conditional_capistrano 0.0.2 → 0.0.4
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
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aabb2fe5dcbbecf5c774f5a6ef08e850f57784f6
|
4
|
+
data.tar.gz: e0d87e56788dca75e723ac37a0f130d9c0b47259
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dab1957528ca0c02897a3df30e32841f83b965d6cba823e993c50ffb3a8945108ebad53faacec30cdb703c67d9d74ed14ed3bdbc8b222b916da6c09b66f19c8d
|
7
|
+
data.tar.gz: cb99706f1529ab688de48b0e3d4bd1ccc5f08372cb2924d5eb6fc902c56b579945a20263913aa2d2ce46b1270aabc4a6d86d97ee570ef813dd19cdf7e415becb
|
@@ -19,14 +19,25 @@ module ConditionalCapistrano
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def trigger?(task)
|
22
|
-
|
22
|
+
return false if task.paths_to_check.empty?
|
23
|
+
|
24
|
+
changed_files_cache = changed_files_in_git
|
25
|
+
task.paths_to_check.any? do |path|
|
26
|
+
changed_files_cache.any? { |file| starts_with_path?(path, file) }
|
27
|
+
end
|
23
28
|
rescue IndexError
|
24
29
|
false
|
30
|
+
rescue NameError
|
31
|
+
true
|
25
32
|
end
|
26
33
|
|
27
34
|
private
|
28
35
|
|
29
|
-
def
|
36
|
+
def starts_with_path?(path, file)
|
37
|
+
file[0, path.length] == path
|
38
|
+
end
|
39
|
+
|
40
|
+
def changed_files_in_git
|
30
41
|
capture(
|
31
42
|
"cd #{repository_cache} && git diff --name-only #{current_git_tag} HEAD | cat"
|
32
43
|
).strip.split
|
@@ -51,28 +51,42 @@ describe Capistrano::Configuration do
|
|
51
51
|
|
52
52
|
it "returns false if no files have changed" do
|
53
53
|
task.stub paths_to_check: %w[path/to/file]
|
54
|
-
subject.stub
|
54
|
+
subject.stub changed_files_in_git: []
|
55
55
|
|
56
56
|
subject.trigger?(task).should_not be
|
57
57
|
end
|
58
58
|
|
59
59
|
it "returns true if we have matching files" do
|
60
60
|
task.stub paths_to_check: %w[path/to/file]
|
61
|
-
subject.stub
|
61
|
+
subject.stub changed_files_in_git: %w[path/to/file]
|
62
62
|
|
63
63
|
subject.trigger?(task).should be
|
64
64
|
end
|
65
65
|
|
66
66
|
it "returns false if we files that don't match" do
|
67
67
|
task.stub paths_to_check: %w[path/to/file1]
|
68
|
-
subject.stub
|
68
|
+
subject.stub changed_files_in_git: %w[path/to/file2]
|
69
69
|
|
70
70
|
subject.trigger?(task).should_not be
|
71
71
|
end
|
72
72
|
|
73
73
|
it "returns true if we have files that match a path" do
|
74
74
|
task.stub paths_to_check: %w[path/to]
|
75
|
-
subject.stub
|
75
|
+
subject.stub changed_files_in_git: %w[path/to/file]
|
76
|
+
|
77
|
+
subject.trigger?(task).should be
|
78
|
+
end
|
79
|
+
|
80
|
+
it "returns false if we have files that match a path with a dot" do
|
81
|
+
task.stub paths_to_check: %w[path/to.test]
|
82
|
+
subject.stub changed_files_in_git: %w[path/to-test/file]
|
83
|
+
|
84
|
+
subject.trigger?(task).should_not be
|
85
|
+
end
|
86
|
+
|
87
|
+
it "returns true if we get a NameError, most likely due to a missing #current_git_tag" do
|
88
|
+
task.stub paths_to_check: %w[path/to]
|
89
|
+
subject.stub(:changed_files_in_git).and_raise NameError
|
76
90
|
|
77
91
|
subject.trigger?(task).should be
|
78
92
|
end
|
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conditional_capistrano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- redbubble
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
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
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: Conditionally schedule and execute capistrano tasks based on changes
|
@@ -60,7 +60,7 @@ executables: []
|
|
60
60
|
extensions: []
|
61
61
|
extra_rdoc_files: []
|
62
62
|
files:
|
63
|
-
- .gitignore
|
63
|
+
- ".gitignore"
|
64
64
|
- Gemfile
|
65
65
|
- LICENSE.txt
|
66
66
|
- README.md
|
@@ -82,17 +82,17 @@ require_paths:
|
|
82
82
|
- lib
|
83
83
|
required_ruby_version: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
|
-
- -
|
85
|
+
- - ">="
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '0'
|
88
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
89
|
requirements:
|
90
|
-
- -
|
90
|
+
- - ">="
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: '0'
|
93
93
|
requirements: []
|
94
94
|
rubyforge_project:
|
95
|
-
rubygems_version: 2.
|
95
|
+
rubygems_version: 2.2.2
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
98
|
summary: Execute capistrano task's only when certain path's have changed since the
|