releasecop 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/lib/releasecop.rb +2 -0
- data/lib/releasecop/checker.rb +14 -12
- data/lib/releasecop/cli.rb +8 -4
- data/lib/releasecop/comparison.rb +62 -0
- data/lib/releasecop/result.rb +36 -0
- data/lib/releasecop/version.rb +1 -1
- metadata +14 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c52b5d851e1d82c6581b8639b55f0b091abc7053
|
4
|
+
data.tar.gz: 9d5cfdebc66eb5e3465d74fbc33c11ab79b90026
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82cd9904b61996b94b6e2840a8fe5055ac4798554e05cb858da4457d46e84d0e27a52f118f524d07ac71d3a19caef0153c126b58997ea56e7e3d432312f1a05b
|
7
|
+
data.tar.gz: daf19f8bba5a58b9894391267f4a69e63c4d10c9ff9f62bd0826ad7765b282210159f018d0084a0bc67d57ae3f5af8ad1dc4d054d7139f208885329c5004ed75
|
data/README.md
CHANGED
@@ -49,4 +49,9 @@ To check all projects:
|
|
49
49
|
|
50
50
|
releasecop check --all
|
51
51
|
|
52
|
+
### Heroku Pipelines
|
53
|
+
|
54
|
+
At this time releasecop is not compatible with projects using [Heroku Pipelines](https://devcenter.heroku.com/articles/pipelines) to promote apps. For these apps, promoting a staging app to production simply copies the slug to the production app, so no git remote is updated.
|
55
|
+
|
56
|
+
|
52
57
|
Copyright (c) 2015 Joey Aghion, Artsy
|
data/lib/releasecop.rb
CHANGED
data/lib/releasecop/checker.rb
CHANGED
@@ -7,31 +7,33 @@ module Releasecop
|
|
7
7
|
self.envs = envs
|
8
8
|
end
|
9
9
|
|
10
|
-
# Reports status of individual project. Returns count of out-of-date environments.
|
11
10
|
def check
|
12
|
-
puts "#{name}..."
|
13
|
-
unreleased = 0
|
14
11
|
Dir.chdir(CONFIG_DIR) do
|
15
12
|
`git clone #{envs.first['git']} --bare #{name} > /dev/null 2>&1`
|
13
|
+
|
16
14
|
Dir.chdir(name) do
|
17
15
|
envs.each do |env|
|
18
16
|
`git remote add #{env['name']} #{env['git']} > /dev/null 2>&1`
|
19
17
|
`git fetch #{env['name']} > /dev/null 2>&1`
|
20
18
|
end
|
19
|
+
|
20
|
+
comparisons = []
|
21
21
|
envs.each_cons(2) do |ahead, behind|
|
22
|
-
|
23
|
-
if log == ''
|
24
|
-
puts " #{behind['name']} is up-to-date with #{ahead['name']}\n"
|
25
|
-
else
|
26
|
-
puts " #{behind['name']} is behind #{ahead['name']} by:"
|
27
|
-
log.lines.each { |l| puts " #{l}" }
|
28
|
-
unreleased += 1
|
29
|
-
end
|
22
|
+
comparisons << Comparison.new(ahead, behind)
|
30
23
|
end
|
24
|
+
|
25
|
+
comparisons.each &:check
|
26
|
+
@result = Result.new(name, comparisons)
|
31
27
|
end
|
32
28
|
end
|
33
|
-
unreleased
|
34
29
|
end
|
35
30
|
|
31
|
+
def puts_message(verbose_flag)
|
32
|
+
@result.puts_message(verbose_flag)
|
33
|
+
end
|
34
|
+
|
35
|
+
def unreleased
|
36
|
+
@result.unreleased
|
37
|
+
end
|
36
38
|
end
|
37
39
|
end
|
data/lib/releasecop/cli.rb
CHANGED
@@ -14,7 +14,8 @@ module Releasecop
|
|
14
14
|
end
|
15
15
|
|
16
16
|
desc "check [PROJECT]", "Check the release status of one or all projects"
|
17
|
-
option :all
|
17
|
+
option :all, desc: 'Check all projects listed in manifest'
|
18
|
+
option :verbose, desc: 'Output results for up-to-date projects'
|
18
19
|
def check(project = nil)
|
19
20
|
raise Thor::Error, "Must specify a PROJECT or --all" if project.nil? && !options[:all]
|
20
21
|
|
@@ -22,11 +23,14 @@ module Releasecop
|
|
22
23
|
selected = options[:all] ? manifest['projects'] : manifest['projects'].select{|k,v| k == project }
|
23
24
|
raise Thor::Error, "No projects found." if selected.empty?
|
24
25
|
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
checkers = selected.map { |name, envs| Releasecop::Checker.new(name, envs) }
|
27
|
+
|
28
|
+
for checker in checkers
|
29
|
+
checker.check
|
30
|
+
checker.puts_message(options[:verbose])
|
28
31
|
end
|
29
32
|
|
33
|
+
unreleased = checkers.map(&:unreleased).inject(&:+)
|
30
34
|
$stderr.puts "#{selected.size} project(s) checked. #{unreleased} environment(s) out-of-date."
|
31
35
|
exit 1 if unreleased > 0
|
32
36
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
class Comparison
|
2
|
+
attr_accessor :lines
|
3
|
+
|
4
|
+
def initialize(ahead, behind)
|
5
|
+
@ahead = ahead
|
6
|
+
@behind = behind
|
7
|
+
end
|
8
|
+
|
9
|
+
def check
|
10
|
+
@lines = log.lines
|
11
|
+
end
|
12
|
+
|
13
|
+
def message
|
14
|
+
[summary_message, *detail_messages].join
|
15
|
+
end
|
16
|
+
|
17
|
+
def unreleased?
|
18
|
+
!lines.empty?
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def log
|
24
|
+
`git log #{from_rev}..#{to_rev} --pretty=format:"%h %ad %s (%an)" --date=short --no-merges`
|
25
|
+
end
|
26
|
+
|
27
|
+
def from_rev
|
28
|
+
[behind_name, behind_branch].join '/'
|
29
|
+
end
|
30
|
+
|
31
|
+
def to_rev
|
32
|
+
[ahead_name, ahead_branch].join '/'
|
33
|
+
end
|
34
|
+
|
35
|
+
def behind_name
|
36
|
+
@behind['name']
|
37
|
+
end
|
38
|
+
|
39
|
+
def behind_branch
|
40
|
+
@behind['branch'] || 'master'
|
41
|
+
end
|
42
|
+
|
43
|
+
def ahead_name
|
44
|
+
@ahead['name']
|
45
|
+
end
|
46
|
+
|
47
|
+
def ahead_branch
|
48
|
+
@ahead['branch'] || 'master'
|
49
|
+
end
|
50
|
+
|
51
|
+
def summary_message
|
52
|
+
if unreleased?
|
53
|
+
" #{behind_name} is behind #{ahead_name} by:\n"
|
54
|
+
else
|
55
|
+
" #{behind_name} is up-to-date with #{ahead_name}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def detail_messages
|
60
|
+
lines.map { |l| " #{l}" }
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class Result
|
2
|
+
def initialize(name, comparisons)
|
3
|
+
@name = name
|
4
|
+
@comparisons = comparisons
|
5
|
+
end
|
6
|
+
|
7
|
+
def puts_message(verbose_flag)
|
8
|
+
if verbose_flag
|
9
|
+
puts message
|
10
|
+
else
|
11
|
+
puts message if unreleased?
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def unreleased
|
16
|
+
@comparisons.select(&:unreleased?).count
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def message
|
22
|
+
[header, *comparison_messages].join "\n"
|
23
|
+
end
|
24
|
+
|
25
|
+
def header
|
26
|
+
"#{@name}..."
|
27
|
+
end
|
28
|
+
|
29
|
+
def unreleased?
|
30
|
+
unreleased > 0
|
31
|
+
end
|
32
|
+
|
33
|
+
def comparison_messages
|
34
|
+
@comparisons.map &:message
|
35
|
+
end
|
36
|
+
end
|
data/lib/releasecop/version.rb
CHANGED
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: releasecop
|
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
|
- Joey Aghion
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
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: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.7'
|
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: '1.7'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '10.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: '10.0'
|
55
55
|
description:
|
@@ -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
|
@@ -69,6 +69,8 @@ files:
|
|
69
69
|
- lib/releasecop.rb
|
70
70
|
- lib/releasecop/checker.rb
|
71
71
|
- lib/releasecop/cli.rb
|
72
|
+
- lib/releasecop/comparison.rb
|
73
|
+
- lib/releasecop/result.rb
|
72
74
|
- lib/releasecop/version.rb
|
73
75
|
- releasecop.gemspec
|
74
76
|
homepage: https://github.com/joeyAghion/releasecop
|
@@ -81,20 +83,19 @@ require_paths:
|
|
81
83
|
- lib
|
82
84
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
85
|
requirements:
|
84
|
-
- -
|
86
|
+
- - ">="
|
85
87
|
- !ruby/object:Gem::Version
|
86
88
|
version: '0'
|
87
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
90
|
requirements:
|
89
|
-
- -
|
91
|
+
- - ">="
|
90
92
|
- !ruby/object:Gem::Version
|
91
93
|
version: '0'
|
92
94
|
requirements: []
|
93
95
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.
|
96
|
+
rubygems_version: 2.6.8
|
95
97
|
signing_key:
|
96
98
|
specification_version: 4
|
97
99
|
summary: Given a list of projects and environments pipelines, report which environments
|
98
100
|
are "behind" and by which commits.
|
99
101
|
test_files: []
|
100
|
-
has_rdoc:
|