cf-deploy 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -139,7 +139,7 @@ the [CloudFoundry CLI][cli] repo on github.
139
139
  You then need to install this gem in your project's `Gemfile`:
140
140
 
141
141
  ``` ruby
142
- gem 'cf-deploy', '0.1.1'
142
+ gem 'cf-deploy', '0.1.4'
143
143
  ```
144
144
 
145
145
  ### Defining CloudFoundry details in your Rakefile
@@ -260,6 +260,7 @@ bundle exec rake cf:deploy:production:stop_idle
260
260
  Developed and maintained by [Made Tech][made]. Key contributions:
261
261
 
262
262
  * [Luke Morton](https://github.com/DrPheltRight)
263
+ * [Chris Blackburn](https://github.com/chrisblackburn)
263
264
 
264
265
  ## License
265
266
 
@@ -39,8 +39,9 @@ module CF
39
39
 
40
40
  def define_stop_idle_task
41
41
  Rake::Task.define_task("#{env[:task_name]}:stop_idle" => 'cf:login') do
42
- idle_app_name = app_name_from_color(idle_color(env))
43
- cf.stop(idle_app_name)
42
+ env.app_names_for_colour(idle_color(env)).each do |app_name|
43
+ cf.stop(app_name)
44
+ end
44
45
  end
45
46
  end
46
47
 
@@ -6,7 +6,7 @@ module CF
6
6
 
7
7
  login_cmd << Config::VALID_CF_KEYS
8
8
  .reject { |key| config[key].nil? }
9
- .map { |key| "-#{key.to_s[0]} #{config[key]}" }
9
+ .map { |key| "-#{key.to_s[0]} '#{config[key]}'" }
10
10
 
11
11
  Kernel.system(login_cmd.flatten.join(' '))
12
12
  end
@@ -57,6 +57,13 @@ module CF
57
57
  end
58
58
  end
59
59
 
60
+ def app_names_for_colour(colour)
61
+ self[:manifests].flat_map do |manifest|
62
+ names = app_names_for_manifest(File.expand_path(manifest.to_s))
63
+ names if names.first.include?(colour)
64
+ end.compact
65
+ end
66
+
60
67
  # Environment config setter methods
61
68
  #
62
69
  def manifest(manifest)
@@ -1,5 +1,5 @@
1
1
  module CF
2
2
  class Deploy
3
- VERSION = '0.1.2'
3
+ VERSION = '0.1.4'
4
4
  end
5
5
  end
@@ -19,7 +19,7 @@ describe CF::Deploy do
19
19
  api 'api.run.pivotal.io'
20
20
  end
21
21
 
22
- expect(Kernel).to receive(:system).with('cf login -a api.run.pivotal.io')
22
+ expect(Kernel).to receive(:system).with("cf login -a 'api.run.pivotal.io'")
23
23
  Rake::Task['cf:login'].invoke
24
24
  end
25
25
 
@@ -32,7 +32,7 @@ describe CF::Deploy do
32
32
  space 'space'
33
33
  end
34
34
 
35
- expect(Kernel).to receive(:system).with('cf login -a api -u test -p pass -o org -s space')
35
+ expect(Kernel).to receive(:system).with("cf login -a 'api' -u 'test' -p 'pass' -o 'org' -s 'space'")
36
36
  Rake::Task['cf:login'].invoke
37
37
  end
38
38
 
@@ -45,7 +45,7 @@ describe CF::Deploy do
45
45
  expect(ENV).to receive(:[]).with(k).and_return(v).at_least(:once)
46
46
  end
47
47
 
48
- expect(Kernel).to receive(:system).with('cf login -a api -u test -p pass -o org -s space')
48
+ expect(Kernel).to receive(:system).with("cf login -a 'api' -u 'test' -p 'pass' -o 'org' -s 'space'")
49
49
  described_class.rake_tasks!
50
50
  Rake::Task['cf:login'].invoke
51
51
  end
@@ -59,7 +59,7 @@ describe CF::Deploy do
59
59
  expect(ENV).to receive(:[]).with(k).and_return(v).at_least(:once)
60
60
  end
61
61
 
62
- expect(Kernel).to receive(:system).with('cf login -a api -u test -p pass -o org')
62
+ expect(Kernel).to receive(:system).with("cf login -a 'api' -u 'test' -p 'pass' -o 'org'")
63
63
 
64
64
  described_class.rake_tasks! do
65
65
  api 'api'
@@ -21,6 +21,7 @@ describe CF::Deploy do
21
21
  rake_tasks!
22
22
  expect(Kernel).to receive(:system).with('cf login').ordered
23
23
  expect(Kernel).to receive(:system).with('cf stop production-blue-app').ordered
24
+ expect(Kernel).to receive(:system).with('cf stop production-blue-background').ordered
24
25
  Rake::Task['cf:deploy:production:stop_idle'].invoke
25
26
  end
26
27
  end
@@ -29,8 +30,9 @@ describe CF::Deploy do
29
30
  Dir.chdir('spec/') do
30
31
  rake_tasks!
31
32
  expect(Kernel).to receive(:system).with('cf login').ordered
32
- expect(IO).to receive(:popen).with("cf routes | grep 'yourwebsite.com'") { double(:read => 'production-blue-app', :close => nil) }
33
+ expect(IO).to receive(:popen).with("cf routes | grep 'yourwebsite.com'") { double(read: 'production-blue-app', close: nil) }
33
34
  expect(Kernel).to receive(:system).with('cf stop production-green-app').ordered
35
+ expect(Kernel).to receive(:system).with('cf stop production-green-background').ordered
34
36
  Rake::Task['cf:deploy:production:stop_idle'].invoke
35
37
  end
36
38
  end
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cf-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Luke Morton
9
+ - Chris Blackburn
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2015-03-24 00:00:00.000000000 Z
13
+ date: 2015-05-05 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: rake
@@ -94,6 +95,7 @@ dependencies:
94
95
  description:
95
96
  email:
96
97
  - luke@madetech.co.uk
98
+ - chris@madetech.co.uk
97
99
  executables: []
98
100
  extensions: []
99
101
  extra_rdoc_files: []
@@ -127,18 +129,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
129
  - - ! '>='
128
130
  - !ruby/object:Gem::Version
129
131
  version: '0'
130
- segments:
131
- - 0
132
- hash: -2725312878394451314
133
132
  required_rubygems_version: !ruby/object:Gem::Requirement
134
133
  none: false
135
134
  requirements:
136
135
  - - ! '>='
137
136
  - !ruby/object:Gem::Version
138
137
  version: '0'
139
- segments:
140
- - 0
141
- hash: -2725312878394451314
142
138
  requirements: []
143
139
  rubyforge_project:
144
140
  rubygems_version: 1.8.23