story_branch 0.6.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +24 -7
- data/.github/weekly-digest.yml +7 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +42 -0
- data/.ruby-version +1 -1
- data/Gemfile.lock +65 -37
- data/README.md +14 -8
- data/docs/index.md +168 -0
- data/lib/story_branch/cli.rb +20 -20
- data/lib/story_branch/commands/configure.rb +84 -0
- data/lib/story_branch/commands/open_issue.rb +21 -0
- data/lib/story_branch/config_manager.rb +157 -8
- data/lib/story_branch/git_utils.rb +2 -19
- data/lib/story_branch/git_wrapper.rb +2 -2
- data/lib/story_branch/github/issue.rb +3 -4
- data/lib/story_branch/github/label.rb +1 -0
- data/lib/story_branch/github/tracker.rb +6 -10
- data/lib/story_branch/jira/issue.rb +8 -1
- data/lib/story_branch/jira/project.rb +15 -7
- data/lib/story_branch/jira/tracker.rb +11 -11
- data/lib/story_branch/main.rb +35 -105
- data/lib/story_branch/pivotal/tracker.rb +5 -9
- data/lib/story_branch/string_utils.rb +1 -1
- data/lib/story_branch/templates/open_issue/.gitkeep +1 -0
- data/lib/story_branch/tracker_base.rb +56 -0
- data/lib/story_branch/url_opener.rb +17 -0
- data/lib/story_branch/version.rb +1 -1
- data/story_branch.gemspec +9 -6
- data/tools/prep_changelog.rb +48 -0
- metadata +70 -16
- data/lib/story_branch/commands/add.rb +0 -94
- data/lib/story_branch/commands/migrate.rb +0 -103
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module StoryBranch
|
4
|
+
# Class used to open a URL
|
5
|
+
class UrlOpener
|
6
|
+
def self.open_url(url)
|
7
|
+
url = "https://#{url}" unless url.start_with?('http')
|
8
|
+
if RbConfig::CONFIG['host_os'].match?(/mswin|mingw|cygwin/)
|
9
|
+
system "start #{url}"
|
10
|
+
elsif RbConfig::CONFIG['host_os'].match?(/darwin/)
|
11
|
+
system "open #{url}"
|
12
|
+
elsif RbConfig::CONFIG['host_os'].match?(/linux|bsd/)
|
13
|
+
system "xdg-open #{url}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/story_branch/version.rb
CHANGED
data/story_branch.gemspec
CHANGED
@@ -39,7 +39,7 @@ Gem::Specification.new do |spec|
|
|
39
39
|
'documentation_uri' => 'https://github.com/story-branch/story_branch/blob/master/README.md',
|
40
40
|
'source_code_uri' => 'https://github.com/story-branch/story_branch'
|
41
41
|
}
|
42
|
-
spec.required_ruby_version = ['>= 2.4', '<
|
42
|
+
spec.required_ruby_version = ['>= 2.4', '< 3']
|
43
43
|
|
44
44
|
# Specify which files should be added to the gem when it is released.
|
45
45
|
# The `git ls-files -z` loads the files in the RubyGem that have been
|
@@ -56,19 +56,22 @@ Gem::Specification.new do |spec|
|
|
56
56
|
spec.add_runtime_dependency 'blanket_wrapper', '~> 3.0'
|
57
57
|
spec.add_runtime_dependency 'damerau-levenshtein', '~> 1.3'
|
58
58
|
spec.add_runtime_dependency 'jira-ruby', '~> 1.7'
|
59
|
-
spec.add_runtime_dependency 'thor', '~> 0.20
|
60
|
-
spec.add_runtime_dependency 'tty-command', '~> 0.8
|
61
|
-
spec.add_runtime_dependency 'tty-config', '~> 0.2
|
59
|
+
spec.add_runtime_dependency 'thor', '~> 0.20'
|
60
|
+
spec.add_runtime_dependency 'tty-command', '~> 0.8'
|
61
|
+
spec.add_runtime_dependency 'tty-config', '~> 0.2'
|
62
62
|
spec.add_runtime_dependency 'tty-pager', '~> 0.12'
|
63
63
|
spec.add_runtime_dependency 'tty-prompt', '~> 0.18'
|
64
|
+
spec.add_runtime_dependency 'xdg', '~> 3.0'
|
64
65
|
|
65
|
-
spec.add_development_dependency 'bundler', '~> 1
|
66
|
+
spec.add_development_dependency 'bundler', '~> 2.1'
|
67
|
+
spec.add_development_dependency 'simplecov', '~> 0.16'
|
66
68
|
spec.add_development_dependency 'fakefs', '~> 0.14'
|
67
69
|
spec.add_development_dependency 'git', '~> 1.5'
|
68
70
|
spec.add_development_dependency 'ostruct', '~> 0.1'
|
69
71
|
spec.add_development_dependency 'pry', '~> 0.11'
|
70
|
-
spec.add_development_dependency 'rake', '~>
|
72
|
+
spec.add_development_dependency 'rake', '~> 12.3', '>= 12.3.3'
|
71
73
|
spec.add_development_dependency 'rspec', '~> 3'
|
74
|
+
spec.add_development_dependency 'rubocop', '~> 0.86'
|
72
75
|
spec.add_development_dependency 'rspec_junit_formatter', '~> 0.4'
|
73
76
|
end
|
74
77
|
# rubocop:enable Metrics/BlockLength
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../lib/story_branch/git_wrapper'
|
4
|
+
|
5
|
+
def grab_and_print_log(from, to)
|
6
|
+
all_log = StoryBranch::GitWrapper.command("log #{from}..#{to}")
|
7
|
+
|
8
|
+
matches = all_log.scan(/CHANGELOG\n(.*?)--- 8< ---/m).flatten
|
9
|
+
matches.map!(&:strip)
|
10
|
+
|
11
|
+
File.open("release-#{from}-#{to}.md", 'w') do |output|
|
12
|
+
output << "# RELEASE NOTES\n\n"
|
13
|
+
matches.each do |m|
|
14
|
+
output << "#{m}\n"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# rubocop:disable Metrics/MethodLength
|
20
|
+
def print_all_logs
|
21
|
+
all_tags = StoryBranch::GitWrapper.command_lines('tag --list')
|
22
|
+
cleanup_tags = all_tags.map do |t|
|
23
|
+
{ cleanup_tag: t.delete('v'), tag: t }
|
24
|
+
end
|
25
|
+
cleanup_tags.sort_by! { |ctags| ctags[:cleanup_tag] }
|
26
|
+
puts cleanup_tags
|
27
|
+
|
28
|
+
cleanup_tags.each_with_index do |tag, idx|
|
29
|
+
from = tag[:tag]
|
30
|
+
if idx + 1 == cleanup_tags.length
|
31
|
+
to = 'HEAD'
|
32
|
+
else
|
33
|
+
from = tag[:tag]
|
34
|
+
to = cleanup_tags[idx + 1][:tag]
|
35
|
+
end
|
36
|
+
grab_and_print_log(from, to)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
# rubocop:enable Metrics/MethodLength
|
40
|
+
|
41
|
+
all_logs = ARGV[0] == 'all'
|
42
|
+
if all_logs
|
43
|
+
print_all_logs
|
44
|
+
else
|
45
|
+
from = ARGV[0] || 'v0.7.0'
|
46
|
+
to = ARGV[1] || 'HEAD'
|
47
|
+
grab_and_print_log(from, to)
|
48
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: story_branch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rui Baltazar
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: exe
|
14
14
|
cert_chain: []
|
15
|
-
date:
|
15
|
+
date: 2020-07-12 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: blanket_wrapper
|
@@ -62,42 +62,42 @@ dependencies:
|
|
62
62
|
requirements:
|
63
63
|
- - "~>"
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version: 0.20
|
65
|
+
version: '0.20'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
68
|
version_requirements: !ruby/object:Gem::Requirement
|
69
69
|
requirements:
|
70
70
|
- - "~>"
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: 0.20
|
72
|
+
version: '0.20'
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: tty-command
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
76
76
|
requirements:
|
77
77
|
- - "~>"
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: 0.8
|
79
|
+
version: '0.8'
|
80
80
|
type: :runtime
|
81
81
|
prerelease: false
|
82
82
|
version_requirements: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
84
84
|
- - "~>"
|
85
85
|
- !ruby/object:Gem::Version
|
86
|
-
version: 0.8
|
86
|
+
version: '0.8'
|
87
87
|
- !ruby/object:Gem::Dependency
|
88
88
|
name: tty-config
|
89
89
|
requirement: !ruby/object:Gem::Requirement
|
90
90
|
requirements:
|
91
91
|
- - "~>"
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 0.2
|
93
|
+
version: '0.2'
|
94
94
|
type: :runtime
|
95
95
|
prerelease: false
|
96
96
|
version_requirements: !ruby/object:Gem::Requirement
|
97
97
|
requirements:
|
98
98
|
- - "~>"
|
99
99
|
- !ruby/object:Gem::Version
|
100
|
-
version: 0.2
|
100
|
+
version: '0.2'
|
101
101
|
- !ruby/object:Gem::Dependency
|
102
102
|
name: tty-pager
|
103
103
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,20 +126,48 @@ dependencies:
|
|
126
126
|
- - "~>"
|
127
127
|
- !ruby/object:Gem::Version
|
128
128
|
version: '0.18'
|
129
|
+
- !ruby/object:Gem::Dependency
|
130
|
+
name: xdg
|
131
|
+
requirement: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - "~>"
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '3.0'
|
136
|
+
type: :runtime
|
137
|
+
prerelease: false
|
138
|
+
version_requirements: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - "~>"
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '3.0'
|
129
143
|
- !ruby/object:Gem::Dependency
|
130
144
|
name: bundler
|
131
145
|
requirement: !ruby/object:Gem::Requirement
|
132
146
|
requirements:
|
133
147
|
- - "~>"
|
134
148
|
- !ruby/object:Gem::Version
|
135
|
-
version: '1
|
149
|
+
version: '2.1'
|
136
150
|
type: :development
|
137
151
|
prerelease: false
|
138
152
|
version_requirements: !ruby/object:Gem::Requirement
|
139
153
|
requirements:
|
140
154
|
- - "~>"
|
141
155
|
- !ruby/object:Gem::Version
|
142
|
-
version: '1
|
156
|
+
version: '2.1'
|
157
|
+
- !ruby/object:Gem::Dependency
|
158
|
+
name: simplecov
|
159
|
+
requirement: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - "~>"
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0.16'
|
164
|
+
type: :development
|
165
|
+
prerelease: false
|
166
|
+
version_requirements: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - "~>"
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '0.16'
|
143
171
|
- !ruby/object:Gem::Dependency
|
144
172
|
name: fakefs
|
145
173
|
requirement: !ruby/object:Gem::Requirement
|
@@ -202,14 +230,20 @@ dependencies:
|
|
202
230
|
requirements:
|
203
231
|
- - "~>"
|
204
232
|
- !ruby/object:Gem::Version
|
205
|
-
version: '
|
233
|
+
version: '12.3'
|
234
|
+
- - ">="
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: 12.3.3
|
206
237
|
type: :development
|
207
238
|
prerelease: false
|
208
239
|
version_requirements: !ruby/object:Gem::Requirement
|
209
240
|
requirements:
|
210
241
|
- - "~>"
|
211
242
|
- !ruby/object:Gem::Version
|
212
|
-
version: '
|
243
|
+
version: '12.3'
|
244
|
+
- - ">="
|
245
|
+
- !ruby/object:Gem::Version
|
246
|
+
version: 12.3.3
|
213
247
|
- !ruby/object:Gem::Dependency
|
214
248
|
name: rspec
|
215
249
|
requirement: !ruby/object:Gem::Requirement
|
@@ -224,6 +258,20 @@ dependencies:
|
|
224
258
|
- - "~>"
|
225
259
|
- !ruby/object:Gem::Version
|
226
260
|
version: '3'
|
261
|
+
- !ruby/object:Gem::Dependency
|
262
|
+
name: rubocop
|
263
|
+
requirement: !ruby/object:Gem::Requirement
|
264
|
+
requirements:
|
265
|
+
- - "~>"
|
266
|
+
- !ruby/object:Gem::Version
|
267
|
+
version: '0.86'
|
268
|
+
type: :development
|
269
|
+
prerelease: false
|
270
|
+
version_requirements: !ruby/object:Gem::Requirement
|
271
|
+
requirements:
|
272
|
+
- - "~>"
|
273
|
+
- !ruby/object:Gem::Version
|
274
|
+
version: '0.86'
|
227
275
|
- !ruby/object:Gem::Dependency
|
228
276
|
name: rspec_junit_formatter
|
229
277
|
requirement: !ruby/object:Gem::Requirement
|
@@ -261,6 +309,7 @@ files:
|
|
261
309
|
- ".circleci/setup-rubygems.sh"
|
262
310
|
- ".github/ISSUE_TEMPLATE.md"
|
263
311
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
312
|
+
- ".github/weekly-digest.yml"
|
264
313
|
- ".github/workflows/rubocop.yml"
|
265
314
|
- ".gitignore"
|
266
315
|
- ".rspec"
|
@@ -274,6 +323,7 @@ files:
|
|
274
323
|
- README.md
|
275
324
|
- Rakefile
|
276
325
|
- Roadmap.md
|
326
|
+
- docs/index.md
|
277
327
|
- exe/git-finish
|
278
328
|
- exe/git-start
|
279
329
|
- exe/git-story
|
@@ -283,10 +333,10 @@ files:
|
|
283
333
|
- lib/story_branch/cli.rb
|
284
334
|
- lib/story_branch/command.rb
|
285
335
|
- lib/story_branch/commands/.gitkeep
|
286
|
-
- lib/story_branch/commands/
|
336
|
+
- lib/story_branch/commands/configure.rb
|
287
337
|
- lib/story_branch/commands/create.rb
|
288
338
|
- lib/story_branch/commands/finish.rb
|
289
|
-
- lib/story_branch/commands/
|
339
|
+
- lib/story_branch/commands/open_issue.rb
|
290
340
|
- lib/story_branch/commands/start.rb
|
291
341
|
- lib/story_branch/commands/unstart.rb
|
292
342
|
- lib/story_branch/config_manager.rb
|
@@ -311,10 +361,14 @@ files:
|
|
311
361
|
- lib/story_branch/templates/create/.gitkeep
|
312
362
|
- lib/story_branch/templates/finish/.gitkeep
|
313
363
|
- lib/story_branch/templates/migrate/.gitkeep
|
364
|
+
- lib/story_branch/templates/open_issue/.gitkeep
|
314
365
|
- lib/story_branch/templates/start/.gitkeep
|
315
366
|
- lib/story_branch/templates/unstart/.gitkeep
|
367
|
+
- lib/story_branch/tracker_base.rb
|
368
|
+
- lib/story_branch/url_opener.rb
|
316
369
|
- lib/story_branch/version.rb
|
317
370
|
- story_branch.gemspec
|
371
|
+
- tools/prep_changelog.rb
|
318
372
|
homepage: https://github.com/story-branch/story_branch
|
319
373
|
licenses:
|
320
374
|
- MIT
|
@@ -334,14 +388,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
334
388
|
version: '2.4'
|
335
389
|
- - "<"
|
336
390
|
- !ruby/object:Gem::Version
|
337
|
-
version: '
|
391
|
+
version: '3'
|
338
392
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
339
393
|
requirements:
|
340
394
|
- - ">="
|
341
395
|
- !ruby/object:Gem::Version
|
342
396
|
version: '0'
|
343
397
|
requirements: []
|
344
|
-
rubygems_version: 3.0.
|
398
|
+
rubygems_version: 3.0.3
|
345
399
|
signing_key:
|
346
400
|
specification_version: 4
|
347
401
|
summary: Create git branches based on your preferred tracker tickets
|
@@ -1,94 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../config_manager'
|
4
|
-
require_relative '../command'
|
5
|
-
require 'tty-config'
|
6
|
-
require 'tty-prompt'
|
7
|
-
|
8
|
-
module StoryBranch
|
9
|
-
module Commands
|
10
|
-
# Command responsible for adding a new configuration to
|
11
|
-
# the available configurations
|
12
|
-
#
|
13
|
-
# It will try to load the existing global story branch config
|
14
|
-
# and then add the project id specified by the user.
|
15
|
-
class Add < StoryBranch::Command
|
16
|
-
def initialize(options)
|
17
|
-
@options = options
|
18
|
-
@config = ConfigManager.init_config(Dir.home)
|
19
|
-
@local_config = ConfigManager.init_config('.')
|
20
|
-
end
|
21
|
-
|
22
|
-
def execute(_input: $stdin, output: $stdout)
|
23
|
-
create_local_config
|
24
|
-
create_global_config
|
25
|
-
output.puts 'Configuration added successfully'
|
26
|
-
end
|
27
|
-
|
28
|
-
private
|
29
|
-
|
30
|
-
def create_local_config
|
31
|
-
return if local_config_has_value?
|
32
|
-
|
33
|
-
puts "Setting #{tracker}"
|
34
|
-
@local_config.set(:tracker, value: tracker)
|
35
|
-
|
36
|
-
puts "Appending #{project_id}"
|
37
|
-
@local_config.append(project_id, to: :project_id)
|
38
|
-
|
39
|
-
@local_config.write(force: true)
|
40
|
-
end
|
41
|
-
|
42
|
-
def create_global_config
|
43
|
-
api_key = prompt.ask('Please provide the api key:', required: true)
|
44
|
-
@config.set(project_id, :api_key, value: api_key)
|
45
|
-
@config.write(force: true)
|
46
|
-
|
47
|
-
return unless tracker == 'jira'
|
48
|
-
|
49
|
-
# rubocop:disable Layout/LineLength
|
50
|
-
username = prompt.ask('Please provide username (email most of the times) for this key:',
|
51
|
-
required: true)
|
52
|
-
# rubocop:enable Layout/LineLength
|
53
|
-
@config.set(project_id, :username, value: username)
|
54
|
-
@config.write(force: true)
|
55
|
-
end
|
56
|
-
|
57
|
-
def project_id
|
58
|
-
return @project_id if @project_id
|
59
|
-
|
60
|
-
if tracker == 'jira'
|
61
|
-
# rubocop:disable Layout/LineLength
|
62
|
-
project_domain = prompt.ask("What is your JIRA's subdomain?", required: true)
|
63
|
-
project_key = prompt.ask("What is your JIRA's project key?", required: true)
|
64
|
-
# rubocop:enable Layout/LineLength
|
65
|
-
@project_id = "#{project_domain}|#{project_key}"
|
66
|
-
else
|
67
|
-
# rubocop:disable Layout/LineLength
|
68
|
-
@project_id = prompt.ask("Please provide this project's id:", required: true)
|
69
|
-
# rubocop:enable Layout/LineLength
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
def tracker
|
74
|
-
return @tracker if @tracker
|
75
|
-
|
76
|
-
trackers = {
|
77
|
-
'Pivotal Tracker' => 'pivotal-tracker',
|
78
|
-
'Github' => 'github',
|
79
|
-
'JIRA' => 'jira'
|
80
|
-
}
|
81
|
-
@tracker = prompt.select('Which tracker are you using?', trackers)
|
82
|
-
end
|
83
|
-
|
84
|
-
def local_config_has_value?
|
85
|
-
config_value = @local_config.fetch(:project_id)
|
86
|
-
if config_value.is_a? Array
|
87
|
-
config_value.include?(project_id)
|
88
|
-
else
|
89
|
-
config_value == project_id
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
@@ -1,103 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../config_manager'
|
4
|
-
require_relative '../command'
|
5
|
-
require 'yaml'
|
6
|
-
require 'fileutils'
|
7
|
-
|
8
|
-
module StoryBranch
|
9
|
-
module Commands
|
10
|
-
# Migrate command is intended to make the migration from old version
|
11
|
-
# of story branch to the latest one easier.
|
12
|
-
class Migrate < StoryBranch::Command
|
13
|
-
GLOBAL_CONFIG_FILE = "#{Dir.home}/.story_branch"
|
14
|
-
LOCAL_CONFIG_FILE = '.story_branch'
|
15
|
-
OLD_CONFIG_FILES = [LOCAL_CONFIG_FILE, GLOBAL_CONFIG_FILE].freeze
|
16
|
-
|
17
|
-
def initialize(options)
|
18
|
-
@options = options
|
19
|
-
@config = ConfigManager.init_config(Dir.home)
|
20
|
-
end
|
21
|
-
|
22
|
-
def execute(_input: $stdin, output: $stdout)
|
23
|
-
if missing_old_config?
|
24
|
-
error_migrating(output, old_config_file_not_found)
|
25
|
-
return
|
26
|
-
end
|
27
|
-
@config.set(project_id, :api_key, value: api_key)
|
28
|
-
@config.write(force: true)
|
29
|
-
create_local_config
|
30
|
-
clean_old_config_files
|
31
|
-
output.puts 'Migration complete'
|
32
|
-
end
|
33
|
-
|
34
|
-
private
|
35
|
-
|
36
|
-
def project_id
|
37
|
-
return @project_id if @project_id
|
38
|
-
|
39
|
-
@project_id = old_config_value('project', 'PIVOTAL_PROJECT_ID')
|
40
|
-
@project_id
|
41
|
-
end
|
42
|
-
|
43
|
-
def api_key
|
44
|
-
return @api_key if @api_key
|
45
|
-
|
46
|
-
@api_key = old_config_value('api', 'PIVOTAL_API_KEY')
|
47
|
-
@api_key
|
48
|
-
end
|
49
|
-
|
50
|
-
def error_migrating(output, error_message)
|
51
|
-
output.puts error_message
|
52
|
-
end
|
53
|
-
|
54
|
-
def missing_old_config?
|
55
|
-
OLD_CONFIG_FILES.each { |file| return false if File.exist?(file) }
|
56
|
-
return false if env_set?
|
57
|
-
|
58
|
-
true
|
59
|
-
end
|
60
|
-
|
61
|
-
def env_set?
|
62
|
-
ENV['PIVOTAL_API_KEY'].length.positive? ||
|
63
|
-
ENV['PIVOTAL_PROJECT_ID'].length.positive?
|
64
|
-
end
|
65
|
-
|
66
|
-
def old_config_value(key, env)
|
67
|
-
OLD_CONFIG_FILES.each do |config_file|
|
68
|
-
if File.exist? config_file
|
69
|
-
old_config = YAML.load_file config_file
|
70
|
-
return old_config[key].to_s if old_config && old_config[key]
|
71
|
-
end
|
72
|
-
end
|
73
|
-
ENV[env]
|
74
|
-
end
|
75
|
-
|
76
|
-
def create_local_config
|
77
|
-
local_config = ConfigManager.init_config('.')
|
78
|
-
local_config.set(:project_id, value: project_id)
|
79
|
-
local_config.write
|
80
|
-
end
|
81
|
-
|
82
|
-
def clean_old_config_files
|
83
|
-
[GLOBAL_CONFIG_FILE, LOCAL_CONFIG_FILE].each do |file|
|
84
|
-
FileUtils.rm file if File.exist? file
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
def old_config_file_not_found
|
89
|
-
<<~MESSAGE
|
90
|
-
Old configuration not found.
|
91
|
-
Trying to start from scratch? Use story_branch add
|
92
|
-
MESSAGE
|
93
|
-
end
|
94
|
-
|
95
|
-
def cant_migrate_missing_value
|
96
|
-
<<~MESSAGE
|
97
|
-
Old configuration not found. Nothing has been migrated
|
98
|
-
Trying to start from scratch? Use story_branch add
|
99
|
-
MESSAGE
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|