shelly 0.1.14 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
@@ -44,7 +44,7 @@ module Shelly
|
|
44
44
|
private
|
45
45
|
|
46
46
|
def gems
|
47
|
-
return [] unless gemfile?
|
47
|
+
return [] unless gemfile? && gemfile_lock?
|
48
48
|
definition = Bundler::Definition.build(@gemfile_path,
|
49
49
|
@gemfile_lock_path, nil)
|
50
50
|
@gems ||= definition.specs.map(&:name)
|
@@ -53,7 +53,11 @@ module Shelly
|
|
53
53
|
def repo_paths
|
54
54
|
@repo_paths ||= begin
|
55
55
|
repo = Grit::Repo.new(".")
|
56
|
-
repo
|
56
|
+
# Select files from repo which are unchanged, added or modified
|
57
|
+
# and then return their paths
|
58
|
+
repo.status.files.map(&:last).select { |status|
|
59
|
+
status.type.nil? || status.type == 'A' || status.type == 'M'
|
60
|
+
}.map(&:path)
|
57
61
|
end
|
58
62
|
end
|
59
63
|
end
|
data/lib/shelly/version.rb
CHANGED
@@ -1290,7 +1290,7 @@ We have been notified about it. We will be adding new resources shortly")
|
|
1290
1290
|
Shelly::App.stub(:inside_git_repository?).and_return(true)
|
1291
1291
|
Bundler::Definition.stub_chain(:build, :specs, :map) \
|
1292
1292
|
.and_return(["thin"])
|
1293
|
-
|
1293
|
+
Shelly::StructureValidator.any_instance.stub(:repo_paths) \
|
1294
1294
|
.and_return(["config.ru", "Gemfile", "Gemfile.lock"])
|
1295
1295
|
end
|
1296
1296
|
|
@@ -1307,7 +1307,7 @@ We have been notified about it. We will be adding new resources shortly")
|
|
1307
1307
|
|
1308
1308
|
context "when gemfile doesn't exist" do
|
1309
1309
|
it "should show that Gemfile doesn't exist" do
|
1310
|
-
|
1310
|
+
Shelly::StructureValidator.any_instance.stub(:repo_paths).and_return([])
|
1311
1311
|
$stdout.should_receive(:puts).with(" #{red("✗")} Gemfile is missing in git repository")
|
1312
1312
|
invoke(@main, :check)
|
1313
1313
|
end
|
@@ -1322,7 +1322,7 @@ We have been notified about it. We will be adding new resources shortly")
|
|
1322
1322
|
|
1323
1323
|
context "when gemfile doesn't exist" do
|
1324
1324
|
it "should show that Gemfile doesn't exist" do
|
1325
|
-
|
1325
|
+
Shelly::StructureValidator.any_instance.stub(:repo_paths).and_return([])
|
1326
1326
|
$stdout.should_receive(:puts).with(" #{red("✗")} Gemfile is missing in git repository")
|
1327
1327
|
invoke(@main, :check)
|
1328
1328
|
end
|
@@ -1352,7 +1352,7 @@ We have been notified about it. We will be adding new resources shortly")
|
|
1352
1352
|
|
1353
1353
|
context "when config.ru doesn't exist" do
|
1354
1354
|
it "should show that config.ru is neccessary" do
|
1355
|
-
|
1355
|
+
Shelly::StructureValidator.any_instance.stub(:repo_paths).and_return([])
|
1356
1356
|
$stdout.should_receive(:puts).with(" #{red("✗")} File config.ru is missing")
|
1357
1357
|
invoke(@main, :check)
|
1358
1358
|
end
|
@@ -3,9 +3,10 @@ require "spec_helper"
|
|
3
3
|
describe Shelly::StructureValidator do
|
4
4
|
before do
|
5
5
|
@validator = Shelly::StructureValidator.new
|
6
|
-
|
7
|
-
mock(:
|
8
|
-
|
6
|
+
statuses = [mock(:type => nil, :path => "Gemfile"),
|
7
|
+
mock(:type => nil, :path => "Gemfile.lock"),
|
8
|
+
mock(:type => nil, :path => "config.ru")]
|
9
|
+
Grit::Repo.stub_chain(:new, :status, :files, :map => statuses)
|
9
10
|
end
|
10
11
|
|
11
12
|
describe "#gemfile?" do
|
@@ -17,8 +18,9 @@ describe Shelly::StructureValidator do
|
|
17
18
|
|
18
19
|
context "when Gemfile doesn't exist" do
|
19
20
|
it "should return false" do
|
20
|
-
Grit::Repo.stub_chain(:new, :status
|
21
|
-
|
21
|
+
Grit::Repo.stub_chain(:new, :status, :files,
|
22
|
+
:map => [mock(:type => 'D', :path => "Gemfile"),
|
23
|
+
mock(:type => nil, :path => "Gemfile.lock")])
|
22
24
|
@validator.gemfile?.should == false
|
23
25
|
end
|
24
26
|
end
|
@@ -33,19 +35,15 @@ describe Shelly::StructureValidator do
|
|
33
35
|
|
34
36
|
context "when Gemfile.lock doesn't exist" do
|
35
37
|
it "should return false" do
|
36
|
-
Grit::Repo.stub_chain(:new, :status
|
37
|
-
|
38
|
+
Grit::Repo.stub_chain(:new, :status, :files,
|
39
|
+
:map => [mock(:type => nil, :path => "Gemfile"),
|
40
|
+
mock(:type => 'D' , :path => "Gemfile.lock")])
|
38
41
|
@validator.gemfile_lock?.should == false
|
39
42
|
end
|
40
43
|
end
|
41
44
|
end
|
42
45
|
|
43
46
|
describe "#config_ru?" do
|
44
|
-
before do
|
45
|
-
Grit::Repo.stub_chain(:new, :status) \
|
46
|
-
.and_return([mock(:path => "config.ru")])
|
47
|
-
end
|
48
|
-
|
49
47
|
context "when config.ru exists" do
|
50
48
|
it "should return true" do
|
51
49
|
@validator.config_ru?.should == true
|
@@ -54,7 +52,7 @@ describe Shelly::StructureValidator do
|
|
54
52
|
|
55
53
|
context "when config.ru doesn't exist" do
|
56
54
|
it "should return false" do
|
57
|
-
Grit::Repo.stub_chain(:new, :status
|
55
|
+
Grit::Repo.stub_chain(:new, :status, :files, :map => [])
|
58
56
|
@validator.config_ru?.should == false
|
59
57
|
end
|
60
58
|
end
|
@@ -74,5 +72,19 @@ describe Shelly::StructureValidator do
|
|
74
72
|
it "should return false if gem is missing" do
|
75
73
|
@validator.gem?("rake").should be_false
|
76
74
|
end
|
75
|
+
|
76
|
+
context "when gemfile doesn't exist" do
|
77
|
+
it "should return false" do
|
78
|
+
@validator.stub(:gemfile? => false)
|
79
|
+
@validator.gem?("thin").should be_false
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
context "when gemfile.lock doesn't exist" do
|
84
|
+
it "should return false" do
|
85
|
+
@validator.stub(:gemfile_lock? => false)
|
86
|
+
@validator.gem?("thin").should be_false
|
87
|
+
end
|
88
|
+
end
|
77
89
|
end
|
78
90
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shelly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|