git-fit 0.5.0 → 0.5.1
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/lib/git-fit.rb +1 -0
- data/lib/git_fit/cli/remote_cli.rb +68 -0
- data/lib/git_fit/cli.rb +3 -0
- data/lib/git_fit/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 634af580a8c63dc636583e0835c76433175460d85acd667900e795076d8fc2f0
|
|
4
|
+
data.tar.gz: a1c3b2a10ac1bf9c9ff9dae7e064adcabe3be881c335297bcce9604decc2b480
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c543617f7fd0e9abe52f1ccf499f185162299029298fe4e2da03a00de5f17fc80a977ddf4166ff2f4406ef6abd141a7336b98b81f4483c679ea8fe2fa0128118
|
|
7
|
+
data.tar.gz: 8c2a12124b055b3f7a510f874bff7e2e76c96b6446e1b9b5638838e7e44c859ce4995db785fee1c2a955ba3e3a72eb864a23e84260dfb793d7bfb89f678a4dc1
|
data/lib/git-fit.rb
CHANGED
|
@@ -64,6 +64,7 @@ require_relative "git_fit/export"
|
|
|
64
64
|
require_relative "git_fit/db/cli"
|
|
65
65
|
require_relative "git_fit/install/actions"
|
|
66
66
|
require_relative "git_fit/cli/install_cli"
|
|
67
|
+
require_relative "git_fit/cli/remote_cli"
|
|
67
68
|
require_relative "git_fit/cli/export"
|
|
68
69
|
require_relative "git_fit/cli/import_cli"
|
|
69
70
|
require_relative "git_fit/cli"
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
require "thor"
|
|
2
|
+
require "open3"
|
|
3
|
+
|
|
4
|
+
module GitFit
|
|
5
|
+
module RemoteHelpers
|
|
6
|
+
def detect_repo(url = nil)
|
|
7
|
+
url ||= `git remote get-url origin`.chomp
|
|
8
|
+
url.sub(%r{.*github\.com[:/]}, "").sub(/\.git$/, "")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def gh(*args)
|
|
12
|
+
repo = options[:repo] || detect_repo
|
|
13
|
+
out, err, st = Open3.capture3("gh", *args.map(&:to_s), "-R", repo)
|
|
14
|
+
raise "gh: #{err.strip}" unless st.success?
|
|
15
|
+
out
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
class RemoteSecretCLI < Thor
|
|
20
|
+
include RemoteHelpers
|
|
21
|
+
|
|
22
|
+
class_option :repo, type: :string, desc: "GitHub repo (owner/repo)"
|
|
23
|
+
|
|
24
|
+
desc "list", "List secrets"
|
|
25
|
+
def list
|
|
26
|
+
puts gh("secret", "list")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
desc "set KEY", "Set a secret (reads value from stdin or prompt)"
|
|
30
|
+
def set(key)
|
|
31
|
+
puts gh("secret", "set", key)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
desc "delete KEY", "Delete a secret"
|
|
35
|
+
def delete(key)
|
|
36
|
+
puts gh("secret", "delete", key)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
class RemoteConfigCLI < Thor
|
|
41
|
+
include RemoteHelpers
|
|
42
|
+
|
|
43
|
+
class_option :repo, type: :string, desc: "GitHub repo (owner/repo)"
|
|
44
|
+
|
|
45
|
+
desc "list", "List variables"
|
|
46
|
+
def list
|
|
47
|
+
puts gh("variable", "list")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
desc "set KEY VALUE", "Set a variable"
|
|
51
|
+
def set(key, value)
|
|
52
|
+
puts gh("variable", "set", key, "--body", value)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
desc "get KEY", "Get a variable value"
|
|
56
|
+
def get(key)
|
|
57
|
+
puts gh("variable", "get", key)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
class RemoteCLI < Thor
|
|
62
|
+
desc "secret SUBCOMMAND", "Manage GitHub Secrets"
|
|
63
|
+
subcommand "secret", RemoteSecretCLI
|
|
64
|
+
|
|
65
|
+
desc "config SUBCOMMAND", "Manage GitHub Variables"
|
|
66
|
+
subcommand "config", RemoteConfigCLI
|
|
67
|
+
end
|
|
68
|
+
end
|
data/lib/git_fit/cli.rb
CHANGED
|
@@ -61,6 +61,9 @@ module GitFit
|
|
|
61
61
|
say_status :error, "Parse failed: #{e.message}", :red
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
+
desc "remote SUBCOMMAND", "Manage GitHub remote secrets and config"
|
|
65
|
+
subcommand "remote", RemoteCLI
|
|
66
|
+
|
|
64
67
|
desc "install SUBCOMMAND", "Install project assets (actions)"
|
|
65
68
|
subcommand "install", InstallCLI
|
|
66
69
|
|
data/lib/git_fit/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: git-fit
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lax
|
|
@@ -136,6 +136,7 @@ files:
|
|
|
136
136
|
- lib/git_fit/cli/export.rb
|
|
137
137
|
- lib/git_fit/cli/import_cli.rb
|
|
138
138
|
- lib/git_fit/cli/install_cli.rb
|
|
139
|
+
- lib/git_fit/cli/remote_cli.rb
|
|
139
140
|
- lib/git_fit/config.rb
|
|
140
141
|
- lib/git_fit/config_template.rb
|
|
141
142
|
- lib/git_fit/db/activity.rb
|