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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 684eb09e07b2184d93f7dd1ba8ef28df6d75c29bbaac226e4e513da16e0d22f5
4
- data.tar.gz: 5479f75d9364214c164b022a7fc2fb96802c7258663909b16afbdcb75d45ad8e
3
+ metadata.gz: d90387f0828b0ece5fec61d33b6dd1458da6944816a877f8f222d0c732b3737e
4
+ data.tar.gz: 64d540a0623b059d65789d58118c668640dd9679595eb2b3582aa5708c639480
5
5
  SHA512:
6
- metadata.gz: 58f78f7427f2069f3c69389f23dfec8140c365f0d9817e8ee71cc00db978365344d2f4b109acc9268889150509ce63ae56f6b02f087915815ac6d91e5b91e183
7
- data.tar.gz: 3e70c07f05f01312fd95a33b711ea7bd4289db6e4e447392250a8c22568ed8af236456c80f3846ae530621e1038320b70a5f11d74d269a99f13b0bed32b81879
6
+ metadata.gz: 6aa3bc61db4b538553799902876097e555fcc508ee7c7c8b86d19fca60f8d19e6c7dadf74812fa79bac75b7863ce0e3052b47d70e3e682555e8394f790465f3c
7
+ data.tar.gz: 0a9a86bf0baef2c0c07eb2bf3bc7c6a284eb201139c61b2536d04e00db7c0339f6a7062fdd604a39fa74c660c9cdda4eb323c2747c13825fee562cfcddca416e
@@ -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
- attr_accessor :repository
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
- if @args.first.is_a?(self.class)
115
- options = @args.first.to_h.merge(options)
116
- end
117
- if @args.last.is_a?(self.class)
118
- options = @args.last.to_h.merge(options)
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
@@ -1,4 +1,6 @@
1
1
  require 'open3'
2
+ require 'active_support'
3
+ require 'active_support/core_ext'
2
4
 
3
5
  module Coaster
4
6
  module Git
@@ -1,3 +1,3 @@
1
1
  module Coaster
2
- VERSION = '1.3.33'
2
+ VERSION = '1.3.35'
3
3
  end
@@ -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.33
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-08 00:00:00.000000000 Z
11
+ date: 2023-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj