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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f8285ccf8079adbe2b1eb0395c8ff767df3183f
4
- data.tar.gz: 98a454fb40337e4155a5c8b958e8ab64032a6c79
3
+ metadata.gz: e0ebce73bfea260b7392497254675b169fcb33da
4
+ data.tar.gz: f17af525e05d38c4a919d82da156746197ac80ad
5
5
  SHA512:
6
- metadata.gz: 651f743ff125ef6241c60f1626cf58311341c93678ce55e6a5882b749a86ae629c703b53c40ac9eaa310938a3b6838cf2da95d02cc86fb7d3676e00d4f4282c2
7
- data.tar.gz: 3689605b90a4df412a3f3950256dac6f4fda9771a0b18f7b32774f29a984fbfc45c8eadc876589aa84b2d71e2d29c1d85eba6489db813c330aa9ed06add49138
6
+ metadata.gz: 28d5363acaf5bee2074df36cdef49f92701f494100b4d4c05a557b28a76508a262d0d759df88ee7d833b0aeb79e1a35dfcb67fda34aa06fed8678fbd396553cc
7
+ data.tar.gz: d4a7657d74297efa2a8425168ba3b62e331de6c3a954fbd389e09ef0f32e0d3163d8b768b68f2f8ab297d2bbb63532771672f9b74ece6484a8582b1a139426c9
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.8
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(ssh_public_key),
90
- privatekey: File.expand_path(ssh_private_key)
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
- YAML_FILE = '.flight_plan_cli.yml'.freeze
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 = ENV['FLIGHT_PLAN_API_KEY']
17
- @api_secret = ENV['FLIGHT_PLAN_API_SECRET']
18
- end
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
- unless File.exist?(YAML_FILE)
46
- puts "Could not file #{YAML_FILE} file."
47
- exit 1
48
- end
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.2.8
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-09 00:00:00.000000000 Z
11
+ date: 2018-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler