dpl 1.9.0 → 1.9.1.travis.2589.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5559ec0b1676e226cc48c665aa2f2f67340b823a
4
- data.tar.gz: 4a50e86c2e043afbe4456f8fa000217471bba279
2
+ SHA256:
3
+ metadata.gz: 9963fc0cc331944d4404b6ff5b3e8108e3cfc771a74e11415bffd84c9831c660
4
+ data.tar.gz: ae28c51d143484d4043fa7fde66a64a3eb05b49fb412943e5ae92e5a353c283f
5
5
  SHA512:
6
- metadata.gz: 0e90a5fe54aa6d568c758d4f02a7ed51bed0ba540933c3f3b97b351cafb21aaedea047c797d566f6d70dc2a128d5323d71657cc4d20f91b69d11165dfd136e55
7
- data.tar.gz: ea4fdc47ed409b854e02f26e02ec9d931a61131f8a84246f9da2dbaaa53732f60cf605201b2e554fd32a5c72a1b1b2655a8eec14f745b79291ae2b77f30f826f
6
+ metadata.gz: 2e8d554bb41072da1da36cdd671e5dfc458ea1fe5836310d7cd45c646a105a90fe71f1a24da247894f5f6b1eb51a20396dc2a15c30e99a123f27dc4b2c252340
7
+ data.tar.gz: 987bce9e42a9a95bca543d9b891e8692c0acd691e66d041a08d69995b254ba8a3df2f1d74fd4a6acd1d99c6f6b32383905553a35eb4845f6c2459e1f7eada4e3
data/.travis.yml CHANGED
@@ -8,25 +8,22 @@ rvm:
8
8
  jobs:
9
9
  include:
10
10
  - stage: deploy
11
- cache: false
12
- before_deploy:
13
- - sed -i.bak "s/VERSION = '.*'/VERSION = '${DPL_VERSION}'/g" lib/dpl/version.rb
14
- - git config user.name "travisbot"
15
- - git config user.email "deploy@travis-ci.org"
16
- - git add lib/dpl/version.rb
17
- - git commit -m "Update DPL::Version"
11
+ rvm: "2.3.6"
12
+ install: true
13
+ script: true
14
+ cache:
18
15
  deploy:
19
- - provider: rubygems
20
- script: skip
21
- edge:
22
- branch: master
23
- api_key:
24
- secure: ZmZoDL1tilWvQrqRWDm2K4xQ5Grt9eRJzYVZPLANR0P1TM5BJBLk+UhWCWCPkkDVIBWMa5ANsiFYBxtH65Lw+uqMztSpVusk0l0LQXZGv9jMpT9445A8008U3vvfS0ke7IG8Q4bMAC7Sd6VGaiHDyZC7zmNvnqMpmVX7ShcgBME=
25
- gem: dpl
26
- gemspec_glob: 'dpl*.gemspec'
27
- on:
28
- repo: travis-ci/dpl
29
- if: branch = master AND NOT type IN (pull_request)
16
+ provider: rubygems
17
+ api_key:
18
+ secure: ZmZoDL1tilWvQrqRWDm2K4xQ5Grt9eRJzYVZPLANR0P1TM5BJBLk+UhWCWCPkkDVIBWMa5ANsiFYBxtH65Lw+uqMztSpVusk0l0LQXZGv9jMpT9445A8008U3vvfS0ke7IG8Q4bMAC7Sd6VGaiHDyZC7zmNvnqMpmVX7ShcgBME=
19
+ gem: dpl
20
+ edge:
21
+ branch: v1.9
22
+ gemspec_glob: 'dpl*.gemspec'
23
+ on:
24
+ repo: travis-ci/dpl
25
+ rvm: 2.3.6
26
+ branch: v1.9
30
27
 
31
28
  env:
32
29
  global:
@@ -34,24 +31,40 @@ env:
34
31
 
35
32
  sudo: false
36
33
 
37
- before_cache:
38
- - rm -rf $GEM_HOME/cache/dpl-*.travis.*.gem $GEM_HOME/gems/dpl-*.travis.* $GEM_HOME/specifications/dpl-*.travis.*
39
- - git checkout bin/dpl
40
-
41
34
  cache:
42
35
  directories:
43
36
  - vendor/cache
44
- - $GEM_HOME
45
- - node_modules
37
+ - install
46
38
 
47
39
  before_install:
48
40
  - gem update bundler
49
41
 
50
- before_script:
51
- - rm -f $(ruby -r rubygems -e "puts Gem.bindir")/dpl
52
-
53
42
  script:
54
- - rake
43
+ - bundle exec rspec spec/cli_spec.rb spec/provider_spec.rb
44
+ - gem build dpl.gemspec && gem install dpl-*.gem
45
+ - echo -e "\n${ANSI_GREEN}Run specs${ANSI_RESET}"
46
+ - |
47
+ spec_errors=0
48
+ for f in dpl-*.gemspec; do
49
+ base=${f%*.gemspec}; name=${base#dpl-*}
50
+ echo -e "\n${ANSI_GREEN}${base}${ANSI_RESET}\n"
51
+ echo -e "source 'https://rubygems.org'\ngemspec :name => \"dpl-${name}\"" > Gemfile-${name}
52
+ export BUNDLE_GEMFILE=Gemfile-${name}
53
+ bundle install --gemfile Gemfile-${name} --path=vendor/cache/dpl-${name} --binstubs=bin && ./bin/rspec spec/provider/${name}_spec.rb || ( echo -e "${ANSI_RED}${name} specs failed${ANSI_RESET}" && let spec_errors=$spec_errors+1 )
54
+ done
55
+ test $spec_errors -eq 0
56
+ - echo -e "\n${ANSI_GREEN}Install gem and invoke dpl${ANSI_RESET}"
57
+ - |
58
+ no_err=0
59
+ export BUNDLE_GEMFILE=Gemfile
60
+ for f in dpl-*.gemspec; do
61
+ base=${f%*.gemspec}; name=${base#dpl-*}
62
+ echo -e "\n${ANSI_GREEN}${base}${ANSI_RESET}\n"
63
+ gem build --silent $f && gem install --install-dir=install dpl-${name}-*.gem && ( dpl --provider=${name} --no-deploy ) || ( echo -e "${ANSI_RED}${name} invocation failed${ANSI_RESET}" && let no_err=$no_err+1 )
64
+ done
65
+ test $no_err -eq 0
66
+ # - bundle exec rake && gem build dpl.gemspec && gem install dpl-*.gem && dpl --provider=script --script='echo foo'
67
+
55
68
 
56
69
  notifications:
57
70
  webhooks: "http://requestb.in/1guaq7t1"
data/Rakefile CHANGED
@@ -1,160 +1,12 @@
1
1
  require 'bundler'
2
- require 'term/ansicolor'
3
- require 'pathname'
4
- require 'logger'
5
- require './lib/dpl/version'
6
- require 'highline'
7
2
 
8
- include Term::ANSIColor
3
+ task(:default) { ruby '-S rspec' }
9
4
 
10
- def cli
11
- @cli ||= HighLine.new
12
- end
5
+ desc "Test provider"
6
+ task :test_provider, [:provider] do |t, args|
7
+ provider = args.provider
13
8
 
14
- @ready = false
9
+ Bundler.setup(provider.to_sym)
15
10
 
16
- def logger
17
- @logger ||= Logger.new($stdout)
18
- end
19
-
20
- def top
21
- @top ||= Pathname.new File.expand_path(File.dirname(__FILE__))
22
- end
23
-
24
- def gem_version
25
- ENV['DPL_VERSION'] || DPL::VERSION
26
- end
27
-
28
- def confirm(verb = "release")
29
- unless @ready
30
- answer = cli.ask "Ready to #{verb} `dpl` version #{gem_version}? (y/n)"
31
- if answer !~ /^y/i
32
- abort red("Aborting #{verb}")
33
- end
34
-
35
- @ready = true
36
- end
37
- end
38
-
39
- gemspecs = FileList[File.join(top, "dpl-*.gemspec")]
40
-
41
- providers = gemspecs.map { |f| /dpl-(?<provider>.*)\.gemspec/ =~ f && provider }
42
-
43
- task :default => [:spec, :install] do
44
- Rake::Task["spec_providers"].invoke
45
- Rake::Task["check_providers"].invoke
46
- end
47
-
48
- desc "Run spec on all providers"
49
- task :spec_providers do
50
- providers.each do |provider|
51
- Rake::Task["spec-#{provider}"].invoke
52
- end
53
- end
54
-
55
- desc "Check all provider gems install correctly"
56
- task :check_providers do
57
- providers.each do |provider|
58
- Rake::Task["check-#{provider}"].invoke
59
- end
60
- end
61
-
62
- desc "Build all gems"
63
- task :build => "dpl-#{gem_version}.gem" do
64
- providers.each do |provider|
65
- Rake::Task["dpl-#{provider}-#{gem_version}.gem"].invoke
66
- end
67
- end
68
-
69
- desc "Release all gems"
70
- task :release do
71
- confirm
72
- threads = []
73
- providers.each { |provider| threads << Thread.new { Rake::Task["release-#{provider}"].invoke } }
74
- threads.each { |thr| thr.join }
75
- logger.info green("Pushing dpl-#{gem_version}.gem")
76
- sh "gem push dpl-#{gem_version}.gem"
77
- end
78
-
79
- desc "Yank all gems"
80
- task :yank, [:version] do |t, args|
81
- version = args.version
82
- confirm "yank"
83
- logger.info green("Yanking `dpl` version #{version}")
84
- sh "gem yank dpl -v #{version}"
85
- threads = []
86
- providers.each { |provider| threads << Thread.new { Rake::Task["yank-#{provider}"].invoke } }
87
- threads.each { |thr| thr.join }
88
- end
89
-
90
- task :deep_clean do
91
- Rake::Task[:clean].invoke
92
- sh "git clean -dfx"
93
- end
94
-
95
- task :clean do
96
- rm_rf "stubs"
97
- rm_rf "vendor"
98
- end
99
-
100
- desc "Run dpl specs"
101
- task :spec do
102
- ruby '-S rspec spec/cli_spec.rb spec/provider_spec.rb'
103
- end
104
-
105
- desc "Build dpl gem"
106
- file "dpl-#{gem_version}.gem" do
107
- logger.info green("Building dpl gem")
108
- ruby "-S gem build dpl.gemspec"
109
- end
110
-
111
- desc "Install dpl gem"
112
- task :install => "dpl-#{gem_version}.gem" do
113
- logger.info green("Installing dpl gem")
114
- ruby "-S gem install dpl-#{gem_version}.gem"
115
- end
116
-
117
- providers.each do |provider|
118
- desc "Write Gemfile-#{provider}"
119
- file "Gemfile-#{provider}" do |t|
120
- gemfile = top + t.name
121
- logger.info green("Writing #{gemfile}")
122
- gemfile.write %Q(source 'https://rubygems.org'\ngemspec :name => "dpl-#{provider}"\n)
123
- end
124
-
125
- desc %Q(Run dpl-#{provider} specs)
126
- task "spec-#{provider}" => [:install, "Gemfile-#{provider}"] do
127
- sh "rm -f $HOME/.npmrc"
128
- logger.info green("Running `bundle install` for #{provider}")
129
- sh 'bash', '-cl', "bundle install --gemfile=Gemfile-#{provider} --path=vendor/cache/dpl-#{provider} --retry=3 --binstubs=stubs"
130
- logger.info green("Running specs for #{provider}")
131
- sh "env BUNDLE_GEMFILE=Gemfile-#{provider} ./stubs/rspec spec/provider/#{provider}_spec.rb"
132
- end
133
-
134
- desc "Build dpl-#{provider} gem"
135
- file "dpl-#{provider}-#{gem_version}.gem" do
136
- logger.info green("Building dpl-#{provider} gem")
137
- ruby "-S gem build --silent dpl-#{provider}.gemspec"
138
- end
139
-
140
- desc "Test dpl-#{provider} gem"
141
- task "check-#{provider}" => [:install, "dpl-#{provider}-#{gem_version}.gem"] do
142
- logger.info green("Installing dpl-#{provider} gem")
143
- sh "gem install --no-post-install-message dpl-#{provider}-#{gem_version}.gem"
144
- logger.info green("Testing dpl-#{provider} loads correctly")
145
- ruby "-S dpl --provider=#{provider} --skip-cleanup=true --no-deploy"
146
- end
147
-
148
- desc "Release dpl-#{provider} gem"
149
- task "release-#{provider}" => "dpl-#{provider}-#{gem_version}.gem" do
150
- confirm
151
- logger.info green("Pushing dpl-#{provider}-#{gem_version}.gem")
152
- sh "gem push dpl-#{provider}-#{gem_version}.gem"
153
- end
154
-
155
- desc "Yank dpl-#{provider}"
156
- task "yank-#{provider}" do
157
- logger.info green("Yanking dpl-#{provider} version #{gem_version}")
158
- sh "gem yank dpl-#{provider} -v #{gem_version}"
159
- end
160
- end
11
+ `bundle exec rspec spec/provider/#{provider}_spec.rb`
12
+ end
data/gemspec_helper.rb CHANGED
@@ -27,13 +27,12 @@ def gemspec_for(provider_name=nil, runtime_dependencies=[])
27
27
  s.add_runtime_dependency *part
28
28
  end
29
29
 
30
- s.add_development_dependency 'rspec'
30
+ s.add_development_dependency 'rspec', '~> 3.0.0'
31
31
  s.add_development_dependency 'rspec-its'
32
32
  s.add_development_dependency 'rake'
33
33
  s.add_development_dependency 'json_pure'
34
34
  s.add_development_dependency 'tins'
35
35
  s.add_development_dependency 'coveralls'
36
- s.add_development_dependency 'highline'
37
36
 
38
37
  # set up files
39
38
  if provider_name
data/lib/dpl/provider.rb CHANGED
@@ -6,11 +6,7 @@ module DPL
6
6
  class Provider
7
7
  include FileUtils
8
8
 
9
- # map of DPL provider class name constants to their corresponding
10
- # file names. There is no simple rule to map them automatically
11
- # (camel-cases, snake-cases, call-caps, etc.), so we need an explicit
12
- # map.
13
- GEM_NAME_OF = {
9
+ PROVIDERS = {
14
10
  'Anynines' => 'anynines',
15
11
  'Appfog' => 'appfog',
16
12
  'Atlas' => 'atlas',
@@ -24,7 +20,7 @@ module DPL
24
20
  'Cloud66' => 'cloud66',
25
21
  'CloudFiles' => 'cloud_files',
26
22
  'CloudFoundry' => 'cloud_foundry',
27
- 'CodeDeploy' => 'code_deploy',
23
+ 'CodeDeploy' => 'cloud_deploy',
28
24
  'Deis' => 'deis',
29
25
  'Divshot' => 'divshot',
30
26
  'ElasticBeanstalk' => 'elastic_beanstalk',
@@ -58,39 +54,30 @@ module DPL
58
54
  def self.new(context, options)
59
55
  return super if self < Provider
60
56
 
61
- # when requiring the file corresponding to the provider name
62
- # given in the options, the general strategy is to normalize
63
- # the option to lower-case alphanumeric, then
64
- # use that key to find the file name using the GEM_NAME_OF map.
65
-
66
57
  context.fold("Installing deploy dependencies") do
67
58
  begin
68
59
  opt_lower = super.option(:provider).to_s.downcase
69
60
  opt = opt_lower.gsub(/[^a-z0-9]/, '')
70
- class_name = class_of(opt)
71
- raise Error, "could not find provider %p" % opt unless class_name
72
- require "dpl/provider/#{GEM_NAME_OF[class_name]}"
73
- provider = const_get(class_name).new(context, options)
61
+ name = PROVIDERS.keys.detect { |p| p.to_s.downcase == opt }
62
+ raise Error, "could not find provider %p" % opt unless name
63
+
64
+ require "dpl/provider/#{opt_lower}"
65
+ provider = const_get(name).new(context, options)
74
66
  rescue NameError, LoadError => e
75
67
  if /uninitialized constant DPL::Provider::(?<provider_wanted>\S+)/ =~ e.message
76
- provider_gem_name = GEM_NAME_OF[provider_wanted]
77
- elsif %r(cannot load such file -- dpl/provider/(?<provider_file_name>\S+)) =~ e.message
78
- provider_gem_name = GEM_NAME_OF[class_name]
79
- else
80
- # don't know what to do with this error
81
- raise e
68
+ provider_name = PROVIDERS[provider_wanted]
82
69
  end
83
- install_cmd = "gem install dpl-#{provider_gem_name || opt} -v #{ENV['DPL_VERSION'] || DPL::VERSION}"
70
+ install_cmd = "gem install dpl-#{PROVIDERS[provider_name] || opt} -v #{ENV['DPL_VERSION'] || DPL::VERSION}"
84
71
 
85
- if File.exist?(local_gem = File.join(Dir.pwd, "dpl-#{GEM_NAME_OF[provider_gem_name] || opt_lower}-#{ENV['DPL_VERSION'] || DPL::VERSION}.gem"))
72
+ if File.exist?(local_gem = File.join(Dir.pwd, "dpl-#{PROVIDERS[provider_name] || opt_lower}-#{ENV['DPL_VERSION'] || DPL::VERSION}.gem"))
86
73
  install_cmd = "gem install #{local_gem}"
87
74
  end
88
75
 
89
76
  context.shell(install_cmd)
90
77
  Gem.clear_paths
91
78
 
92
- require "dpl/provider/#{GEM_NAME_OF[class_name]}"
93
- provider = const_get(class_name).new(context, options)
79
+ require "dpl/provider/#{opt_lower}"
80
+ provider = const_get(name).new(context, options)
94
81
  rescue DPL::Error
95
82
  if opt_lower
96
83
  provider = const_get(opt.capitalize).new(context, options)
@@ -149,10 +136,6 @@ module DPL
149
136
  context.shell("npm install -g #{name}", retry: true) if `which #{command}`.chop.empty?
150
137
  end
151
138
 
152
- def self.class_of(filename)
153
- GEM_NAME_OF.keys.detect { |p| p.to_s.downcase == filename }
154
- end
155
-
156
139
  attr_reader :context, :options
157
140
 
158
141
  def initialize(context, options)
@@ -3,32 +3,20 @@ require 'dpl/provider'
3
3
 
4
4
  describe DPL::Provider do
5
5
  let(:example_provider) { Class.new(described_class)}
6
- let(:context) { DummyContext.new }
7
- subject(:provider) { example_provider.new(context, :app => 'example', :key_name => 'foo', :run => ["foo", "bar"]) }
6
+ subject(:provider) { example_provider.new(DummyContext.new, :app => 'example', :key_name => 'foo', :run => ["foo", "bar"]) }
8
7
 
9
8
  before { stub_const "DPL::Provider::Example", example_provider }
10
9
 
11
10
  describe "#new" do
12
- example { expect(described_class.new(context, :provider => "example")) .to be_an(example_provider) }
13
- example { expect(described_class.new(context, :provider => "Example")) .to be_an(example_provider) }
14
- example { expect(described_class.new(context, :provider => "exa_mple")).to be_an(example_provider) }
15
- example { expect(described_class.new(context, :provider => "exa-mple")).to be_an(example_provider) }
16
- example { expect(described_class.new(context, :provider => "scri_pt")).to be_an(DPL::Provider::Script) }
17
- example { expect(described_class.new(context, :provider => "scri _pt")).to be_an(DPL::Provider::Script) }
18
- example { expect(described_class.new(context, :provider => "cloudfoundry")).to be_an(DPL::Provider::CloudFoundry) }
11
+ example { expect(described_class.new(DummyContext.new, :provider => "example")) .to be_an(example_provider) }
12
+ example { expect(described_class.new(DummyContext.new, :provider => "Example")) .to be_an(example_provider) }
13
+ example { expect(described_class.new(DummyContext.new, :provider => "exa_mple")).to be_an(example_provider) }
14
+ example { expect(described_class.new(DummyContext.new, :provider => "exa-mple")).to be_an(example_provider) }
19
15
  example "install deployment dependencies" do
20
16
  expect_any_instance_of(described_class).to receive(:respond_to?).with(:install_deploy_dependencies).and_return(true)
21
17
  expect_any_instance_of(described_class).to receive(:install_deploy_dependencies)
22
- described_class.new(context, :provider => "example")
18
+ described_class.new(DummyContext.new, :provider => "example")
23
19
  end
24
-
25
- it "installs correct gem when provider name does not match" do
26
- expect(context).to receive(:shell).with("gem install dpl-cloud_foundry -v #{ENV['DPL_VERSION'] || DPL::VERSION}")
27
- expect(described_class).to receive(:require).with("dpl/provider/cloud_foundry").and_raise LoadError.new("cannot load such file -- dpl/provider/cloud_foundry")
28
- expect(described_class).to receive(:require).with("dpl/provider/cloud_foundry").and_call_original
29
- described_class.new(context, :provider => 'cloudfoundry')
30
- end
31
-
32
20
  end
33
21
 
34
22
  describe "#pip" do
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dpl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.9.1.travis.2589.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-08 00:00:00.000000000 Z
11
+ date: 2018-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 3.0.0
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 3.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec-its
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -94,20 +94,6 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: highline
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
97
  description: deploy tool abstraction for clients
112
98
  email: konstantin.mailinglists@googlemail.com
113
99
  executables:
@@ -191,16 +177,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
191
177
  version: '2.2'
192
178
  required_rubygems_version: !ruby/object:Gem::Requirement
193
179
  requirements:
194
- - - ">="
180
+ - - ">"
195
181
  - !ruby/object:Gem::Version
196
- version: '0'
182
+ version: 1.3.1
197
183
  requirements: []
198
184
  rubyforge_project:
199
- rubygems_version: 2.6.13
185
+ rubygems_version: 2.7.6
200
186
  signing_key:
201
187
  specification_version: 4
202
188
  summary: deploy tool
203
- test_files:
204
- - spec/cli_spec.rb
205
- - spec/provider_spec.rb
206
- - spec/spec_helper.rb
189
+ test_files: []