coaster 1.3.33 → 1.3.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/coaster/cmd_options.rb +10 -36
- data/lib/coaster/git/repository.rb +3 -1
- data/lib/coaster/git.rb +2 -0
- data/lib/coaster/version.rb +1 -1
- data/test/test_git_repository.rb +0 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d90387f0828b0ece5fec61d33b6dd1458da6944816a877f8f222d0c732b3737e
|
4
|
+
data.tar.gz: 64d540a0623b059d65789d58118c668640dd9679595eb2b3582aa5708c639480
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6aa3bc61db4b538553799902876097e555fcc508ee7c7c8b86d19fca60f8d19e6c7dadf74812fa79bac75b7863ce0e3052b47d70e3e682555e8394f790465f3c
|
7
|
+
data.tar.gz: 0a9a86bf0baef2c0c07eb2bf3bc7c6a284eb201139c61b2536d04e00db7c0339f6a7062fdd604a39fa74c660c9cdda4eb323c2747c13825fee562cfcddca416e
|
data/lib/coaster/cmd_options.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
1
3
|
module Coaster
|
2
4
|
class CmdOptions
|
3
5
|
class << self
|
@@ -9,36 +11,6 @@ module Coaster
|
|
9
11
|
end
|
10
12
|
end
|
11
13
|
|
12
|
-
def options_s_to_h(options)
|
13
|
-
opts = {}
|
14
|
-
options = " #{options}"
|
15
|
-
options_indexes = options.enum_for(:scan, / -\w| --\w+| -- /).map { Regexp.last_match.begin(0) }
|
16
|
-
options_indexes << 0
|
17
|
-
options_indexes.each_cons(2) do |a, b|
|
18
|
-
option = options[a+1..b-1]
|
19
|
-
h = option_s_to_h(option)
|
20
|
-
options_h_merger(h, base: opts)
|
21
|
-
end
|
22
|
-
opts
|
23
|
-
end
|
24
|
-
|
25
|
-
def option_s_to_h(option)
|
26
|
-
if option.start_with?(/--\w/)
|
27
|
-
opt = option.split('=', 2)
|
28
|
-
opt << '' if opt.length == 1
|
29
|
-
elsif option.start_with?(/-\w/)
|
30
|
-
opt = option.split(' ', 2)
|
31
|
-
opt << '' if opt.length == 1
|
32
|
-
elsif option.start_with?('-- ')
|
33
|
-
opt = ['--', option[3..-1].split(' ')]
|
34
|
-
else
|
35
|
-
return {}
|
36
|
-
end
|
37
|
-
opt[1] = opt[1].split(',') if opt[1].include?(',')
|
38
|
-
opt[1] = opt[1].map{|s| s.include?('=') ? Hash[s.split('=', 2)] : s}.to_h if opt[1].is_a?(Array)
|
39
|
-
[opt].to_h
|
40
|
-
end
|
41
|
-
|
42
14
|
def option_v_to_s(option_v)
|
43
15
|
case option_v
|
44
16
|
when Hash then option_v.map{|vk,vv| Set[vk, vv]}.to_set
|
@@ -97,7 +69,7 @@ module Coaster
|
|
97
69
|
end
|
98
70
|
end
|
99
71
|
|
100
|
-
|
72
|
+
attr_reader :cmd, :sub_cmd, :args, :remain_args, :options, :str
|
101
73
|
|
102
74
|
def initialize(cmd, *args, **options)
|
103
75
|
arg_options = args.extract_options!
|
@@ -111,11 +83,13 @@ module Coaster
|
|
111
83
|
else
|
112
84
|
@args = args
|
113
85
|
end
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
86
|
+
@args.delete_if do |arg|
|
87
|
+
if arg.is_a?(self.class)
|
88
|
+
options = arg.to_h.merge(options)
|
89
|
+
true
|
90
|
+
else
|
91
|
+
false
|
92
|
+
end
|
119
93
|
end
|
120
94
|
options['--'] ||= []
|
121
95
|
options['--'] += @remain_args if @remain_args
|
@@ -31,7 +31,7 @@ module Coaster
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def commit(*args, **options)
|
34
|
-
opts = Options.new('commit', *options)
|
34
|
+
opts = Options.new('commit', *args, **options)
|
35
35
|
opts['--message'] ||= "no message"
|
36
36
|
run_git_cmd("commit", opts)
|
37
37
|
end
|
@@ -109,6 +109,8 @@ module Coaster
|
|
109
109
|
File.open(ga_file, 'w') do |f|
|
110
110
|
f.puts ga_lines.join("\n")
|
111
111
|
end
|
112
|
+
add('.')
|
113
|
+
commit
|
112
114
|
end
|
113
115
|
|
114
116
|
def deep_merge(pointer)
|
data/lib/coaster/git.rb
CHANGED
data/lib/coaster/version.rb
CHANGED
data/test/test_git_repository.rb
CHANGED
@@ -30,11 +30,6 @@ module Coaster
|
|
30
30
|
@alpha.run_git_cmd('commit -m "hello"')
|
31
31
|
end
|
32
32
|
|
33
|
-
def teardown
|
34
|
-
FileUtils.rm_rf(@test_repo_root)
|
35
|
-
super
|
36
|
-
end
|
37
|
-
|
38
33
|
def test_git_deep_merge
|
39
34
|
assert_equal "hello alpha\n", @alpha.run_cmd('cat README.md')
|
40
35
|
assert_equal "hello beta\n", @alpha.run_cmd('cat sb/beta/README.md')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coaster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.35
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- buzz jung
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|