flight_plan_cli 0.2.8 → 0.3.0
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/lib/flight_plan_cli/commands/checkout.rb +6 -3
- data/lib/flight_plan_cli/config.rb +17 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0ebce73bfea260b7392497254675b169fcb33da
|
4
|
+
data.tar.gz: f17af525e05d38c4a919d82da156746197ac80ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28d5363acaf5bee2074df36cdef49f92701f494100b4d4c05a557b28a76508a262d0d759df88ee7d833b0aeb79e1a35dfcb67fda34aa06fed8678fbd396553cc
|
7
|
+
data.tar.gz: d4a7657d74297efa2a8425168ba3b62e331de6c3a954fbd389e09ef0f32e0d3163d8b768b68f2f8ab297d2bbb63532771672f9b74ece6484a8582b1a139426c9
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
@@ -3,6 +3,10 @@ module FlightPlanCli
|
|
3
3
|
class Checkout
|
4
4
|
include FlightPlanCli::Config
|
5
5
|
|
6
|
+
def initialize
|
7
|
+
read_config
|
8
|
+
end
|
9
|
+
|
6
10
|
def process(issue)
|
7
11
|
puts "Checking out branch for #{issue}"
|
8
12
|
local_branch_for(issue) ||
|
@@ -44,7 +48,6 @@ module FlightPlanCli
|
|
44
48
|
end
|
45
49
|
|
46
50
|
def new_branch_for(issue)
|
47
|
-
read_config
|
48
51
|
branches = client.board_tickets(remote_number: issue)
|
49
52
|
# TODO: update flight_plan to only return one issue when remote_numer is provided
|
50
53
|
branches = branches.select { |b| b['ticket']['remote_number'] == issue }
|
@@ -86,8 +89,8 @@ module FlightPlanCli
|
|
86
89
|
def credentials
|
87
90
|
@ssh_agent ||= Rugged::Credentials::SshKey.new(
|
88
91
|
username: 'git',
|
89
|
-
publickey: File.expand_path(
|
90
|
-
privatekey: File.expand_path(
|
92
|
+
publickey: File.expand_path(git_ssh_public_key),
|
93
|
+
privatekey: File.expand_path(git_ssh_private_key)
|
91
94
|
)
|
92
95
|
end
|
93
96
|
end
|
@@ -2,10 +2,12 @@ module FlightPlanCli
|
|
2
2
|
module Config
|
3
3
|
private
|
4
4
|
|
5
|
-
|
5
|
+
CONFIG_YAML_PATH = '.flight_plan_cli/config.yml'.freeze
|
6
|
+
USER_YAML_PATH = '.flight_plan_cli/user.yml'.freeze
|
6
7
|
|
7
8
|
attr_reader :board_id, :repo_id, :default_swimlane_ids
|
8
9
|
attr_reader :api_url, :api_key, :api_secret
|
10
|
+
attr_reader :git_ssh_public_key, :git_ssh_private_key
|
9
11
|
|
10
12
|
def read_config
|
11
13
|
@board_id = config['board_id']
|
@@ -13,16 +15,10 @@ module FlightPlanCli
|
|
13
15
|
@default_swimlane_ids = config['ls']['default_swimlane_ids']
|
14
16
|
|
15
17
|
@api_url = config['api_url']
|
16
|
-
@api_key =
|
17
|
-
@api_secret =
|
18
|
-
|
19
|
-
|
20
|
-
def ssh_private_key
|
21
|
-
ENV['GIT_SSH_PRIVATE_KEY'] || '~/.ssh/id_rsa'
|
22
|
-
end
|
23
|
-
|
24
|
-
def ssh_public_key
|
25
|
-
ENV['GIT_SSH_PUBLIC_KEY'] || '~/.ssh/id_rsa.pub'
|
18
|
+
@api_key = config['flight_plan_api_key']
|
19
|
+
@api_secret = config['flight_plan_api_secret']
|
20
|
+
@git_ssh_private_key = config['git_ssh_private_key'] || '~/.ssh/id_rsa'
|
21
|
+
@git_ssh_public_key = config['git_ssh_public_key'] || '~/.ssh/id_rsa.pub'
|
26
22
|
end
|
27
23
|
|
28
24
|
def client
|
@@ -42,12 +38,17 @@ module FlightPlanCli
|
|
42
38
|
def config
|
43
39
|
@config ||=
|
44
40
|
begin
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
YAML.load_file(YAML_FILE)
|
41
|
+
check_config_exists
|
42
|
+
YAML.load_file(CONFIG_YAML_PATH).merge(
|
43
|
+
FileTest.exist?(USER_YAML_PATH) ? YAML.load_file(USER_YAML_PATH) : {}
|
44
|
+
)
|
50
45
|
end
|
51
46
|
end
|
47
|
+
|
48
|
+
def check_config_exists
|
49
|
+
return if FileTest.exist?(CONFIG_YAML_PATH)
|
50
|
+
puts "#{CONFIG_YAML_PATH} not found"
|
51
|
+
exit 1
|
52
|
+
end
|
52
53
|
end
|
53
54
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flight_plan_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Cleary
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|