pulsar 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,7 @@ module Pulsar
5
5
  def execute
6
6
  Bundler.with_clean_env do
7
7
  begin
8
+ create_tmp_dir
8
9
  fetch_repo
9
10
 
10
11
  list_apps
@@ -24,6 +24,7 @@ module Pulsar
24
24
  find_apps.each do |app|
25
25
  Bundler.with_clean_env do
26
26
  begin
27
+ create_tmp_dir
27
28
  fetch_repo
28
29
  validate(app, stage)
29
30
  bundle_install
@@ -42,6 +42,10 @@ module Pulsar
42
42
  touch(capfile_path, :verbose => verbose?)
43
43
  end
44
44
 
45
+ def create_tmp_dir
46
+ run_cmd("mkdir -p #{tmp_dir}", :verbose => verbose?)
47
+ end
48
+
45
49
  def each_app
46
50
  Dir["#{config_apps_path}/*"].each do |path|
47
51
  yield(File.basename(path)) if File.directory?(path)
@@ -88,11 +92,7 @@ module Pulsar
88
92
  recipes_dir = config_app_recipes_path(app)
89
93
  stage_recipes_dir = config_app_stage_recipes_path(app, stage)
90
94
 
91
- Dir.glob("#{recipes_dir}/*.rb").each do |recipe|
92
- run_cmd("cat #{recipe} >> #{capfile_path}", :verbose => verbose?)
93
- end
94
-
95
- Dir.glob("#{stage_recipes_dir}/*.rb").each do |recipe|
95
+ Dir["#{recipes_dir}/*.rb", "#{stage_recipes_dir}/*.rb"].each do |recipe|
96
96
  run_cmd("cat #{recipe} >> #{capfile_path}", :verbose => verbose?)
97
97
  end
98
98
  end
@@ -174,8 +174,8 @@ module Pulsar
174
174
  def validate(app, stage)
175
175
  app_path = config_app_path(app)
176
176
  stage_path = config_stage_path(app, stage)
177
-
178
- raise(ArgumentError) unless File.exists?(app_path) && File.exists?(stage_path)
177
+ valid_paths = File.exists?(app_path) && File.exists?(stage_path)
178
+ raise(ArgumentError, "no pulsar config available for app=#{app}, stage=#{stage}") unless valid_paths
179
179
  end
180
180
  end
181
181
  end
@@ -1,3 +1,3 @@
1
1
  module Pulsar
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
@@ -107,6 +107,12 @@ describe Pulsar::ListCommand do
107
107
  it "is supported" do
108
108
  expect { pulsar.parse(base_args + %w(--tmp-dir dummy_tmp)) }.to_not raise_error(Clamp::UsageError)
109
109
  end
110
+
111
+ it "creates the tmp directory if it doesn't exist" do
112
+ run_options = base_args + [ "--tmp-dir", tmp_path("tmp/non_existent") ]
113
+
114
+ expect { pulsar.run(run_options) }.not_to raise_error
115
+ end
110
116
  end
111
117
 
112
118
  context "--keep-capfile option" do
@@ -102,11 +102,11 @@ describe Pulsar::MainCommand do
102
102
  end
103
103
 
104
104
  it "errors out if application does not exist in configuration repository" do
105
- expect { pulsar.run(full_cap_args + %w(non_existant_app production)) }.to raise_error(ArgumentError)
105
+ expect { pulsar.run(full_cap_args + %w(non_existent_app production)) }.to raise_error(ArgumentError)
106
106
  end
107
107
 
108
108
  it "errors out if stage does not exist in configuration repository" do
109
- expect { pulsar.run(full_cap_args + dummy_app(:non_existant_stage)) }.to raise_error(ArgumentError)
109
+ expect { pulsar.run(full_cap_args + dummy_app(:non_existent_stage)) }.to raise_error(ArgumentError)
110
110
  end
111
111
 
112
112
  context "Capfile" do
@@ -225,6 +225,12 @@ describe Pulsar::MainCommand do
225
225
  it "is supported" do
226
226
  expect { pulsar.parse(base_args + %w(--tmp-dir dummy_tmp) + dummy_app) }.to_not raise_error(Clamp::UsageError)
227
227
  end
228
+
229
+ it "creates the tmp directory if it doesn't exist" do
230
+ run_options = base_args + [ "--tmp-dir", tmp_path("tmp/non_existent"), "--skip-cap-run" ] + dummy_app
231
+
232
+ expect { pulsar.run(run_options) }.not_to raise_error
233
+ end
228
234
  end
229
235
 
230
236
  context "--keep-capfile option" do
@@ -23,8 +23,8 @@ module Helpers
23
23
  "tmp"
24
24
  end
25
25
 
26
- def tmp_path
27
- File.join(File.dirname(__FILE__), "..", tmp_dir)
26
+ def tmp_path(dir=tmp_dir)
27
+ File.join(File.dirname(__FILE__), "..", dir)
28
28
  end
29
29
 
30
30
  def dummy_app(stage = :production)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pulsar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-07-30 00:00:00.000000000 Z
13
+ date: 2013-08-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: clamp