geordi 1.10.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/Gemfile.lock +6 -2
- data/README.md +14 -8
- data/features/console.feature +1 -0
- data/features/dump.feature +2 -1
- data/features/shell.feature +36 -0
- data/lib/geordi/capistrano_config.rb +12 -9
- data/lib/geordi/commands/commit.rb +12 -0
- data/lib/geordi/commands/cucumber.rb +22 -15
- data/lib/geordi/commands/delete_dumps.rb +2 -4
- data/lib/geordi/commands/deploy.rb +1 -0
- data/lib/geordi/commands/{db_clean.rb → drop_databases.rb} +4 -4
- data/lib/geordi/commands/migrate.rb +1 -0
- data/lib/geordi/commands/rspec.rb +8 -2
- data/lib/geordi/commands/server.rb +1 -0
- data/lib/geordi/commands/unit.rb +1 -0
- data/lib/geordi/commands/with_rake.rb +1 -0
- data/lib/geordi/commands/yarn.rb +7 -0
- data/lib/geordi/gitpt.rb +63 -99
- data/lib/geordi/remote.rb +1 -1
- data/lib/geordi/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f371a80f7bc536a88daf8b8d97bda49c835833433cb91b3765ba6d9e17da68f
|
4
|
+
data.tar.gz: 4032f7043edffcd155188d030a96df7122e8507208687c28ad050d7bde4d9da1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7db4044309628ecc8f965eb2f0e4b865e29421cf19c07dd5b74ddedd83f61a1f6f538f9643f6d0f5c8282f5250e3166e093e67dff2b9bf68c591da81ab3bbe25
|
7
|
+
data.tar.gz: 4976e69ed1eaa0d32b177b578610aa10608f17d4a1bf363fecb93317426e784147824704adc314e4fe94da5a8228e3daa52d4c686b60781bba7c68d045237b77
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,23 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
|
|
6
6
|
|
7
7
|
## Unreleased
|
8
8
|
|
9
|
+
### Breaking changes
|
10
|
+
- Pivotal Tracker discontinued API V3 and V4. We now use API V5, which has a client library that does not support Ruby
|
11
|
+
version < 2.1 anymore (all other geordi commands will still work for older Ruby versions).
|
12
|
+
Run `gem uninstall pivotal-tracker` and `gem install tracker_api` to migrate `geordi` installed in a Ruby version >= 2.1.
|
13
|
+
|
14
|
+
### Compatible changes
|
15
|
+
- Fixes [#54]: @solo features run first and are not skipped by accident on failures before
|
16
|
+
- Fixes [#3]: Add spring support for RSpec
|
17
|
+
- Fixes [#53]: Integrate yarn integrity
|
18
|
+
- Fixes [#52]: Remote dumps are transmitted compressed
|
19
|
+
|
20
|
+
## 1.11.0 2018-11-07
|
21
|
+
|
22
|
+
### Compatible changes
|
23
|
+
- Fixes [#36](https://github.com/makandra/geordi/issues/36): Capistrano Config: Settings in deploy/$stage.rb should take precedence over deploy.rb
|
24
|
+
- Fixes [#38](https://github.com/makandra/geordi/issues/31): Capistrano Config: Ignore whitespaces in the capistrano config files
|
25
|
+
|
9
26
|
## 1.10.0 2018-10-17
|
10
27
|
|
11
28
|
### Compatible changes
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
geordi (
|
4
|
+
geordi (2.0.0)
|
5
5
|
thor (>= 0.18.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -37,6 +37,9 @@ GEM
|
|
37
37
|
method_source (0.8.2)
|
38
38
|
multi_json (1.11.2)
|
39
39
|
multi_test (0.1.2)
|
40
|
+
parallel (1.12.1)
|
41
|
+
parallel_tests (2.23.0)
|
42
|
+
parallel
|
40
43
|
pry (0.10.3)
|
41
44
|
coderay (~> 1.1.0)
|
42
45
|
method_source (~> 0.8.1)
|
@@ -58,8 +61,9 @@ DEPENDENCIES
|
|
58
61
|
aruba
|
59
62
|
geordi!
|
60
63
|
highline
|
64
|
+
parallel_tests
|
61
65
|
pry
|
62
66
|
rspec-mocks
|
63
67
|
|
64
68
|
BUNDLED WITH
|
65
|
-
1.
|
69
|
+
1.17.1
|
data/README.md
CHANGED
@@ -43,6 +43,11 @@ Remove unneeded files from the current directory.
|
|
43
43
|
|
44
44
|
Commit using a story title from Pivotal Tracker.
|
45
45
|
|
46
|
+
Example: `geordi commit`
|
47
|
+
|
48
|
+
On the first execution we ask for your Pivotal Tracker API token. It will be
|
49
|
+
stored in `~/.gitpt`.
|
50
|
+
|
46
51
|
|
47
52
|
### `geordi console [TARGET]`
|
48
53
|
|
@@ -70,16 +75,15 @@ with @solo are excluded and will be run sequentially, _after_ the parallel run.
|
|
70
75
|
errors. In case a feature fails without a message, try running it with `--debug`
|
71
76
|
or `-d`.
|
72
77
|
|
73
|
-
- *Options:* Any unknown option will be passed through to Cucumber,
|
74
|
-
|
75
|
-
e.g. `--format=pretty`.
|
78
|
+
- *Options:* Any unknown option will be passed through to Cucumber,
|
79
|
+
e.g. `--format pretty`.
|
76
80
|
|
77
81
|
|
78
|
-
### geordi delete_dumps [DIRECTORY]
|
82
|
+
### `geordi delete_dumps [DIRECTORY]`
|
79
83
|
|
80
|
-
Delete database dump files (
|
84
|
+
Delete database dump files (*.dump).
|
81
85
|
|
82
|
-
Example: `geordi delete_dumps` or `
|
86
|
+
Example: `geordi delete_dumps` or `geordi delete_dumps ~/tmp/dumps`
|
83
87
|
|
84
88
|
Recursively search for files ending in `*.dump` and offer to delete those. When
|
85
89
|
no argument is given, two default directories are searched for dump files: the
|
@@ -87,6 +91,7 @@ current working directory and `~/dumps` (for dumps created with geordi).
|
|
87
91
|
|
88
92
|
Geordi will ask for confirmation before actually deleting files.
|
89
93
|
|
94
|
+
|
90
95
|
### `geordi deploy [STAGE]`
|
91
96
|
|
92
97
|
Guided deployment across branches.
|
@@ -117,9 +122,9 @@ instead of `cap deploy:migrations`. You can force using `deploy` by passing the
|
|
117
122
|
-M option: `geordi deploy -M staging`.
|
118
123
|
|
119
124
|
|
120
|
-
### `geordi
|
125
|
+
### `geordi drop-databases`
|
121
126
|
|
122
|
-
|
127
|
+
Interactively delete local databases.
|
123
128
|
|
124
129
|
Example: `geordi drop_databases`
|
125
130
|
|
@@ -137,6 +142,7 @@ instead of the defaults. This is useful when running multiple installations.
|
|
137
142
|
Geordi will ask for confirmation before actually dropping databases and will
|
138
143
|
offer to edit the whitelist instead.
|
139
144
|
|
145
|
+
|
140
146
|
### `geordi dump [TARGET]`
|
141
147
|
|
142
148
|
Handle dumps (see `geordi help dump` for details).
|
data/features/console.feature
CHANGED
data/features/dump.feature
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
Feature: The dump command
|
2
|
+
Most aspects of connection to a server are tested in shell feature.
|
2
3
|
|
3
4
|
Scenario: Creating a dump of the development database
|
4
5
|
When I run `geordi dump`
|
@@ -26,6 +27,6 @@ Feature: The dump command
|
|
26
27
|
And the output should contain "Util.system! ssh, user@www.example.com, -t, cd /var/www/example.com/current && bash --login -c 'dumple staging --for_download'"
|
27
28
|
And the output should contain "> Downloading remote dump to tmp/staging.dump"
|
28
29
|
# Omitting the absolute path in this regex (.*)
|
29
|
-
And the output should match %r<Util.system! scp user@www.example.com:~/dumps/dump_for_download.dump .*/tmp/aruba/tmp/staging.dump>
|
30
|
+
And the output should match %r<Util.system! scp -C user@www.example.com:~/dumps/dump_for_download.dump .*/tmp/aruba/tmp/staging.dump>
|
30
31
|
And the output should contain "> Dumped the staging database to tmp/staging.dump"
|
31
32
|
|
data/features/shell.feature
CHANGED
@@ -40,3 +40,39 @@ Feature: The shell command
|
|
40
40
|
|
41
41
|
When I run `geordi shell geordi`
|
42
42
|
Then the output should contain "Util.system! ssh, deploy@first.example.com, -t, cd /var/www/example.com/current && bash --login"
|
43
|
+
|
44
|
+
|
45
|
+
Scenario: It prefers stage settings over general config
|
46
|
+
Given a file named "config/deploy.rb" with:
|
47
|
+
"""
|
48
|
+
set :deploy_to, '/var/www/unknown.example.com'
|
49
|
+
set :user, 'user'
|
50
|
+
|
51
|
+
server 'www.unknown.example.com'
|
52
|
+
"""
|
53
|
+
And a file named "config/deploy/staging.rb" with:
|
54
|
+
"""
|
55
|
+
set :deploy_to, '/var/www/example.com'
|
56
|
+
|
57
|
+
server 'www.example.com'
|
58
|
+
"""
|
59
|
+
|
60
|
+
When I run `geordi shell staging`
|
61
|
+
Then the output should contain "Util.system! ssh, user@www.example.com, -t, cd /var/www/example.com/current"
|
62
|
+
|
63
|
+
|
64
|
+
Scenario: It allows whitespaces in the config
|
65
|
+
We also add the unset command to check we are still matching the right
|
66
|
+
commands and not allow any char at the beginning.
|
67
|
+
|
68
|
+
Given a file named "config/deploy.rb" with "deploy.rb exists"
|
69
|
+
And a file named "config/deploy/staging.rb" with:
|
70
|
+
"""
|
71
|
+
unset :user, 'wrong'
|
72
|
+
set :deploy_to, '/var/www/example.com'
|
73
|
+
set :user, 'user'
|
74
|
+
server 'www.example.com'
|
75
|
+
"""
|
76
|
+
|
77
|
+
When I run `geordi shell staging`
|
78
|
+
Then the output should contain "Util.system! ssh, user@www.example.com, -t, cd /var/www/example.com/current"
|
@@ -10,12 +10,12 @@ module Geordi
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def user(server)
|
13
|
-
cap2user = deploy_info[
|
14
|
-
cap2user || deploy_info[
|
13
|
+
cap2user = deploy_info[ /^\s*set\s*:user,\s*['"](.*?)['"]/, 1 ]
|
14
|
+
cap2user || deploy_info[ /^\s*server\s*['"]#{ server }['"],.*user.{1,4}['"](.*?)['"]/m, 1 ]
|
15
15
|
end
|
16
16
|
|
17
17
|
def servers
|
18
|
-
deploy_info.scan(
|
18
|
+
deploy_info.scan(/^\s*server\s*['"](.*?)['"]/).flatten
|
19
19
|
end
|
20
20
|
|
21
21
|
def primary_server
|
@@ -26,11 +26,11 @@ module Geordi
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def remote_root
|
29
|
-
File.join deploy_info[
|
29
|
+
File.join deploy_info[ /^\s*set\s*:deploy_to,\s*['"](.*?)['"]/, 1 ], 'current'
|
30
30
|
end
|
31
31
|
|
32
32
|
def env
|
33
|
-
deploy_info[
|
33
|
+
deploy_info[ /^\s*set\s*:rails_env,\s*['"](.*?)['"]/, 1 ]
|
34
34
|
end
|
35
35
|
|
36
36
|
def shell
|
@@ -42,11 +42,14 @@ module Geordi
|
|
42
42
|
attr_accessor :deploy_info, :stage
|
43
43
|
|
44
44
|
def load_deploy_info
|
45
|
-
self.deploy_info =
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
self.deploy_info = ''
|
46
|
+
|
47
|
+
if stage
|
48
|
+
deploy_info << File.read(File.join root, "config/deploy/#{ stage }.rb")
|
49
|
+
deploy_info << "\n"
|
49
50
|
end
|
51
|
+
|
52
|
+
deploy_info << File.read(File.join root, 'config/deploy.rb')
|
50
53
|
end
|
51
54
|
|
52
55
|
def find_project_root!
|
@@ -1,5 +1,17 @@
|
|
1
1
|
desc 'commit', 'Commit using a story title from Pivotal Tracker'
|
2
|
+
|
3
|
+
long_desc <<-LONGDESC
|
4
|
+
Example: `geordi commit`
|
5
|
+
|
6
|
+
On the first execution we ask for your Pivotal Tracker API token. It will be
|
7
|
+
stored in `~/.gitpt`.
|
8
|
+
LONGDESC
|
9
|
+
|
2
10
|
def commit
|
11
|
+
raise <<-TEXT if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.1')
|
12
|
+
Unsupported Ruby Version #{RUBY_VERSION}. `geordi commit` does not work with a Ruby version < 2.1.
|
13
|
+
TEXT
|
14
|
+
|
3
15
|
require 'geordi/gitpt'
|
4
16
|
|
5
17
|
Gitpt.new.run
|
@@ -49,12 +49,34 @@ def cucumber(*args)
|
|
49
49
|
require 'geordi/cucumber'
|
50
50
|
|
51
51
|
invoke_cmd 'bundle_install'
|
52
|
+
invoke_cmd 'yarn'
|
52
53
|
|
53
54
|
cmd_opts, files = args.partition { |f| f.start_with? '-' }
|
54
55
|
cmd_opts << '--format' << 'pretty' << '--backtrace' if options.debug
|
55
56
|
|
56
57
|
announce 'Running features'
|
57
58
|
|
59
|
+
# Serial run of @solo scenarios
|
60
|
+
if files.any? { |f| f.include? ':' }
|
61
|
+
note '@solo run skipped when called with line numbers' if options.verbose
|
62
|
+
else
|
63
|
+
solo_files = if files.empty?
|
64
|
+
'features' # Proper grepping
|
65
|
+
else
|
66
|
+
files.join(' ')
|
67
|
+
end
|
68
|
+
|
69
|
+
solo_tag_usages = `grep -r '@solo' #{ solo_files }`.split("\n")
|
70
|
+
|
71
|
+
if solo_tag_usages.any?
|
72
|
+
solo_cmd_opts = cmd_opts.dup
|
73
|
+
solo_cmd_opts << '--tags' << '@solo'
|
74
|
+
|
75
|
+
announce 'Running @solo features'
|
76
|
+
Geordi::Cucumber.new.run files, solo_cmd_opts, :verbose => options.verbose, :parallel => false
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
58
80
|
# Normal run
|
59
81
|
unless Geordi::Cucumber.new.run(files, cmd_opts, :verbose => options.verbose)
|
60
82
|
cmd_opts << '--profile' << 'rerun'
|
@@ -68,21 +90,6 @@ def cucumber(*args)
|
|
68
90
|
end
|
69
91
|
end
|
70
92
|
|
71
|
-
# Serial run of @solo scenarios
|
72
|
-
if files.any? { |f| f.include? ':' }
|
73
|
-
note '@solo run skipped when called with line numbers' if options.verbose
|
74
|
-
else
|
75
|
-
files << 'features' if files.empty? # Proper grepping
|
76
|
-
solo_tag_usages = `grep -r '@solo' #{ files.join(' ') }`.split("\n")
|
77
|
-
|
78
|
-
if solo_tag_usages.any?
|
79
|
-
cmd_opts << '--tags' << '@solo'
|
80
|
-
|
81
|
-
announce 'Running @solo features'
|
82
|
-
Geordi::Cucumber.new.run files, cmd_opts, :verbose => options.verbose, :parallel => false
|
83
|
-
end
|
84
|
-
|
85
|
-
end
|
86
93
|
else
|
87
94
|
note 'Cucumber not employed.'
|
88
95
|
end
|
@@ -1,8 +1,6 @@
|
|
1
|
-
desc 'delete_dumps [DIRECTORY]', '
|
1
|
+
desc 'delete_dumps [DIRECTORY]', 'Delete database dump files (*.dump)'
|
2
2
|
long_desc <<-LONGDESC
|
3
|
-
|
4
|
-
|
5
|
-
Example: `geordi delete_dumps` or `geordy delete_dumps ~/tmp/dumps`
|
3
|
+
Example: `geordi delete_dumps` or `geordi delete_dumps ~/tmp/dumps`
|
6
4
|
|
7
5
|
Recursively search for files ending in `*.dump` and offer to delete those. When
|
8
6
|
no argument is given, two default directories are searched for dump files: the
|
@@ -1,8 +1,5 @@
|
|
1
|
-
desc 'drop-databases', '
|
1
|
+
desc 'drop-databases', 'Interactively delete local databases'
|
2
2
|
long_desc <<-LONGDESC
|
3
|
-
|
4
|
-
Delete local MySQL/MariaDB and Postgres databases that are not whitelisted.
|
5
|
-
|
6
3
|
Example: `geordi drop_databases`
|
7
4
|
|
8
5
|
Check both MySQL/MariaDB and Postgres on the machine running geordi for databases
|
@@ -15,6 +12,9 @@ When called with `-P` or `-M` options, only handles Postgres resp. MySQL/MariaDB
|
|
15
12
|
When called with `--postgres <port or local socket>` or `--mysql <port or local socket>`,
|
16
13
|
will instruct the underlying management commands to use those connection methods
|
17
14
|
instead of the defaults. This is useful when running multiple installations.
|
15
|
+
|
16
|
+
Geordi will ask for confirmation before actually dropping databases and will
|
17
|
+
offer to edit the whitelist instead.
|
18
18
|
LONGDESC
|
19
19
|
|
20
20
|
option :postgres_only, :aliases => '-P', :type => :boolean,
|
@@ -9,6 +9,7 @@ LONGDESC
|
|
9
9
|
def rspec(*files)
|
10
10
|
if File.exists?('spec/spec_helper.rb')
|
11
11
|
invoke_cmd 'bundle_install'
|
12
|
+
invoke_cmd 'yarn'
|
12
13
|
|
13
14
|
announce 'Running specs'
|
14
15
|
|
@@ -26,8 +27,13 @@ def rspec(*files)
|
|
26
27
|
end
|
27
28
|
|
28
29
|
command = ['bundle exec']
|
29
|
-
|
30
|
-
|
30
|
+
command << if File.exists?('script/spec')
|
31
|
+
'spec -c' # RSpec 1
|
32
|
+
elsif File.exists?('bin/rspec')
|
33
|
+
'bin/rspec'
|
34
|
+
else
|
35
|
+
'rspec'
|
36
|
+
end
|
31
37
|
command << '-r rspec_spinner -f RspecSpinner::Bar' if Util.file_containing?('Gemfile', /rspec_spinner/)
|
32
38
|
command << files.join(' ')
|
33
39
|
|
data/lib/geordi/commands/unit.rb
CHANGED
data/lib/geordi/gitpt.rb
CHANGED
@@ -2,143 +2,104 @@ class Gitpt
|
|
2
2
|
include Geordi::Interaction
|
3
3
|
require 'yaml'
|
4
4
|
require 'highline'
|
5
|
-
require '
|
5
|
+
require 'tracker_api'
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
SETTINGS_FILE_NAME = '.gitpt'
|
8
|
+
PROJECT_IDS_FILE_NAME = '.pt_project_id'
|
9
9
|
|
10
10
|
def initialize
|
11
|
-
|
12
|
-
@settings_file = File.join(ENV['HOME'], '.gitpt')
|
13
|
-
@deprecated_token_file = File.join(ENV['HOME'], '.pt_token')
|
14
|
-
load_settings
|
15
|
-
settings_were_invalid = (not settings_valid?)
|
16
|
-
|
17
|
-
hello unless settings_valid?
|
18
|
-
request_settings while not settings_valid?
|
19
|
-
stored if settings_were_invalid
|
20
|
-
|
21
|
-
PivotalTracker::Client.use_ssl = true
|
22
|
-
PivotalTracker::Client.token = token
|
11
|
+
self.highline = HighLine.new
|
23
12
|
end
|
24
13
|
|
25
|
-
def
|
26
|
-
|
27
|
-
|
14
|
+
def run
|
15
|
+
settings = read_settings
|
16
|
+
client = build_client(settings)
|
28
17
|
|
29
|
-
|
30
|
-
HighLine::BOLD + string + HighLine::RESET
|
31
|
-
end
|
18
|
+
puts 'Connecting to Pivotal Tracker...'
|
32
19
|
|
33
|
-
|
34
|
-
|
20
|
+
projects = load_projects(client)
|
21
|
+
applicable_stories = load_applicable_stories(projects)
|
22
|
+
choose_story(client.me, applicable_stories)
|
35
23
|
end
|
36
24
|
|
37
|
-
|
38
|
-
highline.say HighLine::RESET
|
39
|
-
highline.say "Welcome to #{bold 'gitpt'}.\n\n"
|
40
|
-
end
|
25
|
+
private
|
41
26
|
|
42
|
-
|
43
|
-
print message
|
44
|
-
STDOUT.flush
|
45
|
-
yield
|
46
|
-
print "\r" + ' ' * message.size + "\r" # Remove loading message
|
47
|
-
STDOUT.flush
|
48
|
-
end
|
27
|
+
attr_accessor :highline
|
49
28
|
|
50
|
-
def
|
51
|
-
|
52
|
-
Thank you. Your settings have been stored at #{highlight @settings_file}
|
53
|
-
You may remove that file for the wizard to reappear.
|
29
|
+
def read_settings
|
30
|
+
file_path = File.join(ENV['HOME'], SETTINGS_FILE_NAME)
|
54
31
|
|
55
|
-
|
32
|
+
unless File.exists?(file_path)
|
33
|
+
highline.say HighLine::RESET
|
34
|
+
highline.say "Welcome to #{bold 'gitpt'}.\n\n"
|
56
35
|
|
57
|
-
|
58
|
-
|
36
|
+
highline.say highlight('Your settings are missing or invalid.')
|
37
|
+
highline.say "Please configure your Pivotal Tracker access.\n\n"
|
38
|
+
token = highline.ask bold("Your API key:") + " "
|
39
|
+
highline.say "\n"
|
59
40
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
initials = highline.ask bold("Your PT initials") + " (optional, used for highlighting your stories): "
|
65
|
-
highline.say "\n"
|
66
|
-
|
67
|
-
settings = { :token => token, :initials => initials }
|
68
|
-
File.open settings_file, 'w' do |file|
|
69
|
-
file.write settings.to_yaml
|
41
|
+
settings = { :token => token }
|
42
|
+
File.open(file_path, 'w') do |file|
|
43
|
+
file.write settings.to_yaml
|
44
|
+
end
|
70
45
|
end
|
71
|
-
|
46
|
+
|
47
|
+
YAML.load_file(file_path)
|
72
48
|
end
|
73
49
|
|
74
|
-
def
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
#{HighLine::YELLOW}You are still using #{highlight(deprecated_token_file) + HighLine::YELLOW} which will be deprecated in a future version.
|
83
|
-
Please migrate your settings to ~/.gitpt or remove #{deprecated_token_file} for the wizard to cast magic.
|
84
|
-
MESSAGE
|
85
|
-
@token = File.read(deprecated_token_file)
|
86
|
-
end
|
87
|
-
end
|
50
|
+
def build_client(settings)
|
51
|
+
TrackerApi::Client.new(:token => settings.fetch(:token))
|
52
|
+
end
|
53
|
+
|
54
|
+
def load_projects(client)
|
55
|
+
project_ids = read_project_ids
|
56
|
+
|
57
|
+
project_ids.collect { |project_id| client.project(project_id) }
|
88
58
|
end
|
89
59
|
|
90
|
-
def
|
91
|
-
|
92
|
-
|
60
|
+
def read_project_ids
|
61
|
+
file_path = PROJECT_IDS_FILE_NAME
|
62
|
+
|
63
|
+
if File.exists?(file_path)
|
93
64
|
project_ids = File.read('.pt_project_id').split(/[\s]+/).map(&:to_i)
|
94
65
|
end
|
95
66
|
|
96
|
-
|
97
|
-
|
67
|
+
if project_ids and project_ids.size > 0
|
68
|
+
project_ids
|
69
|
+
else
|
70
|
+
warn "Sorry, I could not find a project ID in #{file_path} :("
|
98
71
|
puts
|
99
72
|
|
100
|
-
puts "Please put at least one Pivotal Tracker project id into #{
|
73
|
+
puts "Please put at least one Pivotal Tracker project id into #{file_path} in this directory."
|
101
74
|
puts 'You may add multiple IDs, separated using white space.'
|
102
75
|
exit 1
|
103
76
|
end
|
77
|
+
end
|
104
78
|
|
105
|
-
|
106
|
-
|
107
|
-
PivotalTracker::Project.find(project_id)
|
108
|
-
end
|
109
|
-
|
110
|
-
@memberships = projects.collect(&:memberships).map(&:all).flatten
|
111
|
-
|
112
|
-
@applicable_stories = projects.collect do |project|
|
113
|
-
project.stories.all(:state => 'started,finished,rejected')
|
114
|
-
end.flatten
|
115
|
-
end
|
79
|
+
def load_applicable_stories(projects)
|
80
|
+
projects.collect { |project| project.stories(:filter => 'state:started,finished,rejected') }.flatten
|
116
81
|
end
|
117
82
|
|
118
|
-
def choose_story
|
83
|
+
def choose_story(me, applicable_stories)
|
119
84
|
selected_story = nil
|
120
85
|
|
121
86
|
highline.choose do |menu|
|
122
87
|
menu.header = "Choose a story"
|
123
88
|
applicable_stories.each do |story|
|
124
|
-
owner_name = story.owned_by
|
125
|
-
owner = if owner_name
|
126
|
-
owners = memberships.select{|member| member.name == owner_name}
|
127
|
-
owners.first ? owners.first.initials : '?'
|
128
|
-
else
|
129
|
-
'?'
|
130
|
-
end
|
131
|
-
|
132
89
|
state = story.current_state
|
90
|
+
owners = story.owners
|
91
|
+
owner_is_me = owners.collect(&:id).include?(me.id)
|
92
|
+
|
133
93
|
if state == 'started'
|
134
94
|
state = HighLine::GREEN + state + HighLine::RESET
|
135
95
|
elsif state != 'finished'
|
136
96
|
state = HighLine::RED + state + HighLine::RESET
|
137
97
|
end
|
138
|
-
state += HighLine::BOLD if owner == initials
|
139
98
|
|
140
|
-
|
141
|
-
|
99
|
+
state += HighLine::BOLD if owner_is_me
|
100
|
+
|
101
|
+
label = "(#{owners.collect(&:name).join(', ')}, #{state}) #{story.name}"
|
102
|
+
label = bold(label) if owner_is_me
|
142
103
|
menu.choice(label) { selected_story = story }
|
143
104
|
end
|
144
105
|
menu.hidden ''
|
@@ -157,9 +118,12 @@ class Gitpt
|
|
157
118
|
end
|
158
119
|
end
|
159
120
|
|
160
|
-
def
|
161
|
-
|
162
|
-
|
121
|
+
def bold(string)
|
122
|
+
HighLine::BOLD + string + HighLine::RESET
|
123
|
+
end
|
124
|
+
|
125
|
+
def highlight(string)
|
126
|
+
bold HighLine::BLUE + string
|
163
127
|
end
|
164
128
|
|
165
|
-
end
|
129
|
+
end
|
data/lib/geordi/remote.rb
CHANGED
@@ -45,7 +45,7 @@ module Geordi
|
|
45
45
|
|
46
46
|
note "Downloading remote dump to #{relative_destination} ..."
|
47
47
|
server = @config.primary_server
|
48
|
-
Util.system! "scp #{ @config.user(server) }@#{ server }:#{REMOTE_DUMP_PATH} #{destination_path}"
|
48
|
+
Util.system! "scp -C #{ @config.user(server) }@#{ server }:#{REMOTE_DUMP_PATH} #{destination_path}"
|
49
49
|
|
50
50
|
success "Dumped the #{@stage} database to #{relative_destination}."
|
51
51
|
|
data/lib/geordi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geordi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henning Koch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -99,9 +99,9 @@ files:
|
|
99
99
|
- lib/geordi/commands/create_database_yml.rb
|
100
100
|
- lib/geordi/commands/create_databases.rb
|
101
101
|
- lib/geordi/commands/cucumber.rb
|
102
|
-
- lib/geordi/commands/db_clean.rb
|
103
102
|
- lib/geordi/commands/delete_dumps.rb
|
104
103
|
- lib/geordi/commands/deploy.rb
|
104
|
+
- lib/geordi/commands/drop_databases.rb
|
105
105
|
- lib/geordi/commands/dump.rb
|
106
106
|
- lib/geordi/commands/eurest.rb
|
107
107
|
- lib/geordi/commands/firefox.rb
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- lib/geordi/commands/version.rb
|
121
121
|
- lib/geordi/commands/vnc.rb
|
122
122
|
- lib/geordi/commands/with_rake.rb
|
123
|
+
- lib/geordi/commands/yarn.rb
|
123
124
|
- lib/geordi/cucumber.rb
|
124
125
|
- lib/geordi/db_cleaner.rb
|
125
126
|
- lib/geordi/dump_loader.rb
|