git-story-workflow 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/git-story-workflow.gemspec +2 -2
- data/lib/git/story/app.rb +14 -11
- data/lib/git/story/utils.rb +8 -0
- data/lib/git/story/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bf07f9f4c2ba53aa0f34cfd6bd62b50c35f03cdf
|
|
4
|
+
data.tar.gz: b1e14858e8fb8006ed03f52dce06580132335d90
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7e86b06c49a7154dd16d444788023df00ec7c63af4d517b7da3e5d30584366fdc4ee8d038716e5ee6468fb3d98d48bea1371e65af01d50a4d090071ec671313f
|
|
7
|
+
data.tar.gz: 02fced5abd048bd96743f7c1605d17ed1f3d068ce3e5d6e3eb4b288aea483f8fd2b05f5cd7fe0fa2b0b7f251c5c75813c8f9e19f6ced63fb67ac59428fd04b91
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.2
|
data/git-story-workflow.gemspec
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
# stub: git-story-workflow 0.0.
|
|
2
|
+
# stub: git-story-workflow 0.0.2 ruby lib
|
|
3
3
|
|
|
4
4
|
Gem::Specification.new do |s|
|
|
5
5
|
s.name = "git-story-workflow".freeze
|
|
6
|
-
s.version = "0.0.
|
|
6
|
+
s.version = "0.0.2"
|
|
7
7
|
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
9
9
|
s.require_paths = ["lib".freeze]
|
data/lib/git/story/app.rb
CHANGED
|
@@ -20,9 +20,10 @@ class Git::Story::App
|
|
|
20
20
|
attr_accessor :story_id
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
def initialize(argv = ARGV)
|
|
23
|
+
def initialize(argv = ARGV, debug: ENV['DEBUG'].to_i == 1)
|
|
24
24
|
@argv = argv
|
|
25
25
|
@command = @argv.shift&.to_sym
|
|
26
|
+
@debug = debug
|
|
26
27
|
end
|
|
27
28
|
|
|
28
29
|
def run
|
|
@@ -84,7 +85,9 @@ class Git::Story::App
|
|
|
84
85
|
command doc: 'list all production deploy tags'
|
|
85
86
|
def deploy_tags
|
|
86
87
|
fetch_tags
|
|
87
|
-
|
|
88
|
+
capture(
|
|
89
|
+
"git tag | grep ^#{complex_config.story.deploy_tag_prefix} | sort"
|
|
90
|
+
).lines.map(&:chomp)
|
|
88
91
|
end
|
|
89
92
|
|
|
90
93
|
command doc: 'output the times of all production deploys'
|
|
@@ -107,21 +110,21 @@ class Git::Story::App
|
|
|
107
110
|
def deploy_log
|
|
108
111
|
fetch_tags
|
|
109
112
|
opts = '--pretty=tformat:"%C(yellow)%h%Creset %C(green)%ci%Creset %s (%Cred%an <%ae>%Creset)"'
|
|
110
|
-
|
|
113
|
+
capture("git log #{opts} #{deploy_tags.last}..")
|
|
111
114
|
end
|
|
112
115
|
|
|
113
116
|
command doc: 'output diff since last production deploy tag'
|
|
114
|
-
def deploy_diff
|
|
117
|
+
def deploy_diff(ref = nil)
|
|
115
118
|
fetch_tags
|
|
116
119
|
opts = '-u'
|
|
117
|
-
|
|
120
|
+
capture("git diff --color #{opts} #{ref} #{deploy_tags.last}")
|
|
118
121
|
end
|
|
119
122
|
|
|
120
|
-
command doc: '
|
|
121
|
-
def deploy_migrate_diff
|
|
123
|
+
command doc: 'output migration diff since last production deploy tag'
|
|
124
|
+
def deploy_migrate_diff(ref = nil)
|
|
122
125
|
fetch_tags
|
|
123
126
|
opts = '-u'
|
|
124
|
-
|
|
127
|
+
capture("git diff --color #{opts} #{deploy_tags.last} #{ref} -- db/migrate")
|
|
125
128
|
end
|
|
126
129
|
|
|
127
130
|
command doc: '[STORYID] create a story for story STORYID'
|
|
@@ -196,7 +199,7 @@ class Git::Story::App
|
|
|
196
199
|
def pivotal_get(path)
|
|
197
200
|
path = path.sub(/\A\/*/, '')
|
|
198
201
|
url = "https://www.pivotaltracker.com/services/v5/#{path}"
|
|
199
|
-
|
|
202
|
+
@debug and STDERR.puts "Fetching #{url.inspect}"
|
|
200
203
|
open(url,
|
|
201
204
|
'X-TrackerToken' => pivotal_token,
|
|
202
205
|
'Content-Type' => 'application/xml',
|
|
@@ -215,7 +218,7 @@ class Git::Story::App
|
|
|
215
218
|
|
|
216
219
|
def stories
|
|
217
220
|
sh 'git remote prune origin', error: false
|
|
218
|
-
|
|
221
|
+
capture("git branch -r | grep -e '^ *origin/'").lines.map do |l|
|
|
219
222
|
b = l.strip
|
|
220
223
|
b_base = File.basename(b)
|
|
221
224
|
if b_base =~ BRANCH_NAME_REGEX
|
|
@@ -229,7 +232,7 @@ class Git::Story::App
|
|
|
229
232
|
end
|
|
230
233
|
|
|
231
234
|
def current_branch
|
|
232
|
-
|
|
235
|
+
capture("git rev-parse --abbrev-ref HEAD").strip
|
|
233
236
|
end
|
|
234
237
|
|
|
235
238
|
def check_current
|
data/lib/git/story/utils.rb
CHANGED
|
@@ -4,6 +4,7 @@ module Git::Story::Utils
|
|
|
4
4
|
include FileUtils::Verbose
|
|
5
5
|
|
|
6
6
|
def sh(*a, error: true)
|
|
7
|
+
@debug and STDERR.puts("Executing #{a * ' '}")
|
|
7
8
|
system(*a)
|
|
8
9
|
if error && !$?.success?
|
|
9
10
|
STDERR.puts ("Failed with rc #{$?.exitstatus}: " + a.join(' ')).red
|
|
@@ -11,6 +12,13 @@ module Git::Story::Utils
|
|
|
11
12
|
end
|
|
12
13
|
end
|
|
13
14
|
|
|
15
|
+
def capture(command)
|
|
16
|
+
@debug and STDERR.puts("Executing #{command.inspect}")
|
|
17
|
+
result = `#{command}`
|
|
18
|
+
@debug and STDERR.puts("Result\n#{result}")
|
|
19
|
+
result
|
|
20
|
+
end
|
|
21
|
+
|
|
14
22
|
def ask(prompt: '? ', **options, &block)
|
|
15
23
|
response = options[:preset]
|
|
16
24
|
unless response
|
data/lib/git/story/version.rb
CHANGED