Class: DPL::Provider::GAE

Inherits:
DPL::Provider show all
Defined in:
lib/dpl/provider/gae.rb

Constant Summary collapse

GAE_VERSION =
'1.9.17'
GAE_ZIP_FILE =
"google_appengine_#{GAE_VERSION}.zip"
SHA1SUM =
'eec50aaf922d3b21623fda1b90e199c3ffa9e16e'
BASE_DIR =
Dir.pwd
GAE_DIR =
File.join(BASE_DIR, 'google_appengine')
APPCFG_BIN =
File.join(GAE_DIR, 'appcfg.py')

Instance Attribute Summary

Attributes inherited from DPL::Provider

#context, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DPL::Provider

apt_get, #check_app, #cleanup, #commit_msg, context, #create_key, #deploy, #detect_encoding?, #encoding_for, #error, experimental, #initialize, #log, new, npm_g, #option, pip, requires, #run, #setup_git_credentials, #setup_git_ssh, #sha, shell, #uncleanup, #user_agent, #warn

Constructor Details

This class inherits a constructor from DPL::Provider

Class Method Details

.install_sdkObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/dpl/provider/gae.rb', line 17

def self.install_sdk
  requires 'rubyzip', :load => 'zip'
  $stderr.puts "Setting up Google App Engine SDK"

  Dir.chdir(BASE_DIR) do
    unless File.exists? GAE_ZIP_FILE
      $stderr.puts "Downloading Google App Engine SDK"
      File.open(GAE_ZIP_FILE, "wb") do |dest|
        open("https://storage.googleapis.com/appengine-sdks/featured/#{GAE_ZIP_FILE}", "rb") do |src|
          dest.write(src.read)
        end
      end
    end
    sha1sum = Digest::SHA1.hexdigest(File.read(GAE_ZIP_FILE))
    unless sha1sum == SHA1SUM
      raise "Checksum did not match for #{GAE_ZIP_FILE}"
    end

    unless File.directory? 'google_appengine'
      $stderr.puts "Extracting Google App Engine SDK archive"
      Zip::File.open(GAE_ZIP_FILE) do |file|
        file.each do |entry|
          entry.extract entry.name
        end
      end
    end
  end
end

Instance Method Details

#app_dirObject



55
56
57
# File 'lib/dpl/provider/gae.rb', line 55

def app_dir
  options[:app_dir] || context.env['TRAVIS_BUILD_DIR'] || Dir.pwd
end

#check_authObject



52
53
# File 'lib/dpl/provider/gae.rb', line 52

def check_auth
end

#needs_key?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/dpl/provider/gae.rb', line 48

def needs_key?
  false
end

#push_appObject



59
60
61
62
63
64
65
66
# File 'lib/dpl/provider/gae.rb', line 59

def push_app
  puts "About to call push_app in with #{self.class} provider"
  puts "APPCFG_BIN: #{APPCFG_BIN}"
  unless File.exist?(APPCFG_BIN)
    puts "APPCFG_BIN does not exist"
  end
  context.shell "#{APPCFG_BIN} --oauth2_refresh_token=#{options[:oauth_refresh_token]} update #{app_dir}"
end