cp8_cli 9.0.3 → 9.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/exe/cp8 +1 -1
- data/lib/cp8_cli/config_store.rb +10 -1
- data/lib/cp8_cli/github/issue.rb +1 -1
- data/lib/cp8_cli/github/pull_request.rb +8 -4
- data/lib/cp8_cli/global_config.rb +26 -2
- data/lib/cp8_cli/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7814c1971d98c081f83039b7532cd09643310307b23563c04a6e4e67dc187861
|
4
|
+
data.tar.gz: fcdc9860f33add2f70ce25de66c3b70961516b21377d77cb538266af2a2d02e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b57fc650a6714b0b27c297eee936a9ae62911586625e6ce340dc0a231170d973ee43d4b8da2895e30c1f1dd47773ee1102bb39cc5e4c401f23e7accb59c894d2
|
7
|
+
data.tar.gz: f8005a679e7740ed961ab48230a294af0ac78ba9c584515d36d0ad8d723c9b725a74ff4243b7f05d63f1f3ae2eaa7f7442c8fd4cd13b065a87355ab2193afba0
|
data/README.md
CHANGED
data/exe/cp8
CHANGED
@@ -27,7 +27,7 @@ module Cp8Cli
|
|
27
27
|
main.ci
|
28
28
|
end
|
29
29
|
|
30
|
-
desc "suggest", "Creates a suggestion branch from new commits, pushes it, opens URL and resets
|
30
|
+
desc "suggest", "Creates a suggestion branch from new commits, pushes it, opens URL, and resets the base branch."
|
31
31
|
def suggest
|
32
32
|
main.suggest
|
33
33
|
end
|
data/lib/cp8_cli/config_store.rb
CHANGED
@@ -10,9 +10,18 @@ module Cp8Cli
|
|
10
10
|
data[key]
|
11
11
|
end
|
12
12
|
|
13
|
+
def exist?
|
14
|
+
File.exist?(path)
|
15
|
+
end
|
16
|
+
|
17
|
+
def move_to(new_path)
|
18
|
+
File.rename(path, new_path)
|
19
|
+
@path = new_path
|
20
|
+
end
|
21
|
+
|
13
22
|
def save(key, value)
|
14
23
|
data[key] = value
|
15
|
-
File.new(path, "w") unless
|
24
|
+
File.new(path, "w") unless exist?
|
16
25
|
File.open(path, "w") { |f| f.write(data.to_yaml) }
|
17
26
|
value
|
18
27
|
end
|
data/lib/cp8_cli/github/issue.rb
CHANGED
@@ -7,18 +7,18 @@ module Cp8Cli
|
|
7
7
|
include Api::Client
|
8
8
|
|
9
9
|
def self.create(attributes = {})
|
10
|
-
new(attributes).save
|
10
|
+
new(**attributes).save
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.find_by(repo:, branch:)
|
14
14
|
client.pull_requests(repo.shorthand, head: "#{repo.user}:#{branch}").map do |data|
|
15
|
-
new(data)
|
15
|
+
new(**data)
|
16
16
|
end.first
|
17
17
|
end
|
18
18
|
|
19
|
-
def initialize(from: nil, to:
|
19
|
+
def initialize(from: nil, to: nil, title: nil, body: nil, expand: 1, html_url: nil, **attributes)
|
20
20
|
@from = from
|
21
|
-
@to = to
|
21
|
+
@to = to || default_branch
|
22
22
|
@title = title
|
23
23
|
@body = body
|
24
24
|
@expand = expand
|
@@ -45,6 +45,10 @@ module Cp8Cli
|
|
45
45
|
|
46
46
|
attr_reader :from, :to, :title, :body, :expand, :html_url
|
47
47
|
|
48
|
+
def default_branch
|
49
|
+
client.repo(repo.shorthand).default_branch
|
50
|
+
end
|
51
|
+
|
48
52
|
def url
|
49
53
|
html_url || new_pr_url
|
50
54
|
end
|
@@ -2,10 +2,11 @@ require "cp8_cli/config_store"
|
|
2
2
|
|
3
3
|
module Cp8Cli
|
4
4
|
class GlobalConfig
|
5
|
-
|
5
|
+
LEGACY_PATH = ENV["HOME"] + "/.trello_flow"
|
6
|
+
PATH = ENV["HOME"] + "/.cp8_cli"
|
6
7
|
|
7
8
|
def initialize(store = nil)
|
8
|
-
@store = store ||
|
9
|
+
@store = store || initialize_store
|
9
10
|
end
|
10
11
|
|
11
12
|
def github_token
|
@@ -16,6 +17,29 @@ module Cp8Cli
|
|
16
17
|
|
17
18
|
attr_reader :store
|
18
19
|
|
20
|
+
def initialize_store
|
21
|
+
migrate_legacy_store if uses_legacy_store?
|
22
|
+
|
23
|
+
default_store
|
24
|
+
end
|
25
|
+
|
26
|
+
def uses_legacy_store?
|
27
|
+
legacy_store.exist?
|
28
|
+
end
|
29
|
+
|
30
|
+
def migrate_legacy_store
|
31
|
+
Command.say("#{LEGACY_PATH} was deprecated, moving to #{PATH}")
|
32
|
+
legacy_store.move_to(PATH)
|
33
|
+
end
|
34
|
+
|
35
|
+
def default_store
|
36
|
+
@_default_store ||= ConfigStore.new(PATH)
|
37
|
+
end
|
38
|
+
|
39
|
+
def legacy_store
|
40
|
+
@_legacy_store ||= ConfigStore.new(LEGACY_PATH)
|
41
|
+
end
|
42
|
+
|
19
43
|
def env_github_token
|
20
44
|
ENV["OCTOKIT_ACCESS_TOKEN"]
|
21
45
|
end
|
data/lib/cp8_cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cp8_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.0
|
4
|
+
version: 9.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Balvig
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -279,7 +279,7 @@ homepage: https://github.com/balvig/cp8_cli
|
|
279
279
|
licenses:
|
280
280
|
- MIT
|
281
281
|
metadata: {}
|
282
|
-
post_install_message:
|
282
|
+
post_install_message:
|
283
283
|
rdoc_options: []
|
284
284
|
require_paths:
|
285
285
|
- lib
|
@@ -295,7 +295,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
295
295
|
version: '0'
|
296
296
|
requirements: []
|
297
297
|
rubygems_version: 3.0.3
|
298
|
-
signing_key:
|
298
|
+
signing_key:
|
299
299
|
specification_version: 4
|
300
300
|
summary: Cookpad Global CLI.
|
301
301
|
test_files: []
|