pulsar 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/pulsar/helpers/clamp.rb +8 -4
- data/lib/pulsar/version.rb +1 -1
- data/spec/pulsar/commands/main_spec.rb +13 -0
- data/spec/pulsar/helpers/clamp_spec.rb +47 -0
- metadata +3 -3
data/lib/pulsar/helpers/clamp.rb
CHANGED
@@ -59,10 +59,14 @@ module Pulsar
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def fetch_repo
|
62
|
-
if conf_repo
|
63
|
-
fetch_git_repo("git@github.com:#{conf_repo}.git")
|
64
|
-
else
|
62
|
+
if File.directory?(conf_repo)
|
65
63
|
fetch_directory_repo(conf_repo)
|
64
|
+
else
|
65
|
+
if conf_repo =~ /\A[a-zA-Z-]+\/[a-zA-Z-]+\Z/
|
66
|
+
fetch_git_repo("git@github.com:#{conf_repo}.git")
|
67
|
+
else
|
68
|
+
fetch_git_repo(conf_repo)
|
69
|
+
end
|
66
70
|
end
|
67
71
|
end
|
68
72
|
|
@@ -138,7 +142,7 @@ module Pulsar
|
|
138
142
|
File.readlines(conf_file).each do |line|
|
139
143
|
conf, value = line.split("=")
|
140
144
|
|
141
|
-
ENV[conf] = value.chomp.gsub('"', '')
|
145
|
+
ENV[conf] = value.chomp.gsub('"', '') if !conf.nil? && !value.nil?
|
142
146
|
end
|
143
147
|
end
|
144
148
|
end
|
data/lib/pulsar/version.rb
CHANGED
@@ -73,6 +73,19 @@ describe Pulsar::MainCommand do
|
|
73
73
|
ENV['PULSAR_CONF_REPO'].should == dummy_conf_path
|
74
74
|
end
|
75
75
|
|
76
|
+
it "skips lines which cannot parse when reading .pulsar file" do
|
77
|
+
env_vars = [ "wrong_line", "# comment"]
|
78
|
+
|
79
|
+
File.stub(:file?).and_return(true)
|
80
|
+
File.stub(:readlines).with("#{File.expand_path(dummy_rack_app_path)}/.pulsar").and_return(env_vars)
|
81
|
+
|
82
|
+
FileUtils.cd(dummy_rack_app_path) do
|
83
|
+
reload_main_command
|
84
|
+
|
85
|
+
expect { pulsar.run(full_cap_args + %w(production)) }.not_to raise_error
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
76
89
|
context "Capfile" do
|
77
90
|
it "uses base.rb in staging stage" do
|
78
91
|
pulsar.run(full_cap_args + dummy_app(:staging))
|
@@ -3,6 +3,53 @@ require 'spec_helper'
|
|
3
3
|
describe Pulsar::Helpers::Clamp do
|
4
4
|
include Pulsar::Helpers::Clamp
|
5
5
|
|
6
|
+
context "fetch_repo" do
|
7
|
+
it "supports directories" do
|
8
|
+
File.stub(:directory?).and_return(true)
|
9
|
+
self.stub!(:conf_repo).and_return("conf-repo/path")
|
10
|
+
|
11
|
+
self.should_receive(:fetch_directory_repo).with("conf-repo/path")
|
12
|
+
|
13
|
+
fetch_repo
|
14
|
+
end
|
15
|
+
|
16
|
+
it "supports full git path" do
|
17
|
+
File.stub(:directory?).and_return(false)
|
18
|
+
self.stub!(:conf_repo).and_return("git://github.com/gh_user/pulsar-conf.git")
|
19
|
+
|
20
|
+
self.should_receive(:fetch_git_repo).with("git://github.com/gh_user/pulsar-conf.git")
|
21
|
+
|
22
|
+
fetch_repo
|
23
|
+
end
|
24
|
+
|
25
|
+
it "supports full git path on ssh" do
|
26
|
+
File.stub(:directory?).and_return(false)
|
27
|
+
self.stub!(:conf_repo).and_return("git@github.com:gh_user/pulsar-conf.git")
|
28
|
+
|
29
|
+
self.should_receive(:fetch_git_repo).with("git@github.com:gh_user/pulsar-conf.git")
|
30
|
+
|
31
|
+
fetch_repo
|
32
|
+
end
|
33
|
+
|
34
|
+
it "supports full git path on http" do
|
35
|
+
File.stub(:directory?).and_return(false)
|
36
|
+
self.stub!(:conf_repo).and_return("https://github.com/gh_user/pulsar.git")
|
37
|
+
|
38
|
+
self.should_receive(:fetch_git_repo).with("https://github.com/gh_user/pulsar.git")
|
39
|
+
|
40
|
+
fetch_repo
|
41
|
+
end
|
42
|
+
|
43
|
+
it "supports github path" do
|
44
|
+
File.stub(:directory?).and_return(false)
|
45
|
+
self.stub!(:conf_repo).and_return("gh-user/pulsar-conf")
|
46
|
+
|
47
|
+
self.should_receive(:fetch_git_repo).with("git@github.com:gh-user/pulsar-conf.git")
|
48
|
+
|
49
|
+
fetch_repo
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
6
53
|
context "run_cmd" do
|
7
54
|
it "raises exception if command fails" do
|
8
55
|
expect { run_cmd("return 1", {}) }.to raise_error
|
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.2.
|
4
|
+
version: 0.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -207,7 +207,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
207
207
|
version: '0'
|
208
208
|
segments:
|
209
209
|
- 0
|
210
|
-
hash:
|
210
|
+
hash: 2516214880330231667
|
211
211
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
212
|
none: false
|
213
213
|
requirements:
|
@@ -216,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
216
216
|
version: '0'
|
217
217
|
segments:
|
218
218
|
- 0
|
219
|
-
hash:
|
219
|
+
hash: 2516214880330231667
|
220
220
|
requirements: []
|
221
221
|
rubyforge_project:
|
222
222
|
rubygems_version: 1.8.25
|