yggdrasil 0.0.11 → 0.0.12

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.
data/lib/yggdrasil/add.rb CHANGED
@@ -2,7 +2,9 @@ class Yggdrasil
2
2
 
3
3
  # @param [Array] args
4
4
  def add(args)
5
- while (arg = args.shift)
5
+ parse_options(args, {})
6
+ while (arg = @arg_paths.shift)
7
+
6
8
  file_path = system3("readlink -f #{arg}").chomp
7
9
  unless File.exist?(file_path)
8
10
  puts "no such file: #{file_path}"
@@ -18,7 +20,9 @@ class Yggdrasil
18
20
  else
19
21
  Dir.mkdir mirror_path
20
22
  end
21
- puts system3("#@svn add #{mirror_path}")
23
+ cmd = "#@svn add #{mirror_path}"
24
+ cmd += ' ' + @arg_options.join(' ') if @arg_options.size != 0
25
+ puts system3(cmd)
22
26
  end
23
27
  end
24
28
  end
@@ -4,54 +4,53 @@ require 'stringio'
4
4
  class Yggdrasil
5
5
 
6
6
  def check(args)
7
- args = parse_options(args,
8
- {'--username'=>:username, '--password'=>:password,
9
- '--non-interactive'=>:non_interactive?})
10
- if args.size != 0
11
- error "invalid arguments: #{args.join(',')}"
7
+ parse_options(args,
8
+ {'--username'=>:username, '--password'=>:password,
9
+ '--non-interactive'=>:non_interactive?})
10
+ @arg_paths << '/' if @arg_paths.size == 0
11
+ get_user_pass_if_need_to_read_repo
12
+
13
+ exec_checker
14
+
15
+ updates = sync_mirror
16
+ matched_updates = select_updates(updates, @arg_paths)
17
+ if matched_updates.size == 0
18
+ puts 'no files.'
19
+ return
12
20
  end
13
21
 
14
- # execute checker
15
- `rm -rf #@checker_result_dir`
16
- Dir.mkdir @checker_result_dir, 0755
17
- if File.exist?(@checker_dir)
18
- Find.find(@checker_dir) do |file|
19
- if File.file?(file) && File.executable?(file)
20
- if file =~ %r{^#@checker_dir(.*)$}
21
- file_body = $1
22
- system3("#{file} > #@checker_result_dir#{file_body}")
23
- end
24
- end
22
+ confirmed_updates = confirm_updates(matched_updates) do |relative_path|
23
+ FileUtils.cd @mirror_dir do
24
+ cmd = "#@svn diff --no-auth-cache --non-interactive #{relative_path}"
25
+ cmd += username_password_options_to_read_repo
26
+ puts system3(cmd)
25
27
  end
26
28
  end
29
+ return unless confirmed_updates
30
+ return if confirmed_updates.size == 0
27
31
 
28
- # add checker result
29
- result_files = Array.new
30
- Find.find(@checker_result_dir) {|f| result_files << f}
31
- stdout = $stdout
32
- $stdout = StringIO.new
33
- add result_files
34
- $stdout = stdout
35
-
36
- get_user_pass_if_need_to_read_repo
37
- sync_mirror
38
-
39
- cmd_arg = "#@svn status -qu --no-auth-cache --non-interactive"
40
- cmd_arg += username_password_options_to_read_repo
41
32
  check_result = String.new
42
33
  FileUtils.cd @mirror_dir do
43
- check_result = system3(cmd_arg)
34
+ cmd = "#@svn status -quN --no-auth-cache --non-interactive"
35
+ cmd += username_password_options_to_read_repo
36
+ cmd += " #{confirmed_updates.join(' ')}"
37
+ check_result = system3(cmd)
44
38
  end
45
39
  check_result.gsub!(/^Status against revision:.*\n/, '')
46
40
  check_result.chomp!
41
+ result_array = check_result.split("\n")
42
+ result_array.sort!.uniq!
43
+ check_result = result_array.join("\n")
44
+
47
45
  if check_result == ''
48
46
  puts 'yggdrasil check: OK!'
49
47
  else
50
48
  check_result << "\n\n"
51
- cmd_arg = "#@svn diff --no-auth-cache --non-interactive -r HEAD"
52
- cmd_arg += username_password_options_to_read_repo
49
+ cmd = "#@svn diff --no-auth-cache --non-interactive"
50
+ cmd += username_password_options_to_read_repo
51
+ cmd += " #{confirmed_updates.join(' ')}"
53
52
  FileUtils.cd @mirror_dir do
54
- check_result << system3(cmd_arg)
53
+ check_result << system3(cmd)
55
54
  end
56
55
  puts check_result
57
56
  end
@@ -2,9 +2,9 @@ class Yggdrasil
2
2
 
3
3
  # @param [Array] args
4
4
  def cleanup(args)
5
- args = parse_options(args, {'--username'=>:username, '--password'=>:password})
6
- if args.size != 0
7
- error "invalid arguments: #{args.join(',')}"
5
+ parse_options(args, {'--username'=>:username, '--password'=>:password})
6
+ if @arg_options.size+@arg_paths.size != 0
7
+ error "invalid arguments: #{(@arg_options+@arg_paths).join(', ')}"
8
8
  end
9
9
 
10
10
  get_user_pass_if_need_to_read_repo
@@ -2,15 +2,18 @@ class Yggdrasil
2
2
 
3
3
  # @param [Array] args
4
4
  def commit(args)
5
- target_paths = parse_options(args,
5
+ parse_options(args,
6
6
  {'--username'=>:username, '--password'=>:password,
7
7
  '-m'=>:message, '--message'=>:message, '--non-interactive'=>:non_interactive?})
8
+ @arg_paths << '/' if @arg_paths.size == 0
8
9
  get_user_pass_if_need_to_read_repo
9
10
 
11
+ exec_checker
12
+
10
13
  updates = sync_mirror
11
- matched_updates = select_updates(updates, target_paths)
14
+ matched_updates = select_updates(updates, @arg_paths)
12
15
  if matched_updates.size == 0
13
- puts "\nno files."
16
+ puts 'no files.'
14
17
  return
15
18
  end
16
19
 
@@ -43,10 +46,11 @@ class Yggdrasil
43
46
 
44
47
  input_user_pass
45
48
  FileUtils.cd @mirror_dir do
46
- puts system3 "#@svn commit -m '#{@options[:message]}'"\
47
- ' --no-auth-cache --non-interactive'\
48
- " --username '#{@options[:username]}' --password '#{@options[:password]}'"\
49
- " #{confirmed_updates.join(' ')}"
49
+ cmd = "#@svn commit -N -m '#{@options[:message]}'"\
50
+ ' --no-auth-cache --non-interactive'\
51
+ " --username '#{@options[:username]}' --password '#{@options[:password]}'"\
52
+ " #{confirmed_updates.join(' ')}"
53
+ puts system3(cmd)
50
54
  end
51
55
  end
52
56
  end
@@ -2,26 +2,39 @@ class Yggdrasil
2
2
 
3
3
  # @param [Array] args
4
4
  def diff(args)
5
- args = parse_options(args,
6
- {'--username'=>:username, '--password'=>:password, '-r'=>:revision, '--revision'=>:revision})
5
+ parse_options(args,
6
+ {'--username'=>:username, '--password'=>:password,
7
+ '-r'=>:revision, '--revision'=>:revision})
8
+ @arg_paths << '/' if @arg_paths.size == 0
7
9
 
8
10
  get_user_pass_if_need_to_read_repo
11
+ exec_checker
9
12
  sync_mirror
10
13
 
11
14
  paths = Array.new
12
- if args.size == 0
13
- paths << @current_dir.sub(%r{^/*}, '')
14
- else
15
- args.each do |path|
16
- path = "#@current_dir/#{path}" unless %r{^/} =~ path
17
- paths << path.sub(%r{^/*}, '')
15
+ err_paths = Array.new
16
+ @arg_paths.each do |path|
17
+ if %r{^/(.*)$} =~ path
18
+ mirror_file = $1
19
+ mirror_file = '.' if mirror_file == ''
20
+ else
21
+ mirror_file = @current_dir.sub(/^\//,'') + '/' + path
18
22
  end
23
+ if File.exist?(@mirror_dir+'/'+mirror_file)
24
+ paths << mirror_file
25
+ else
26
+ err_paths << mirror_file
27
+ end
28
+ end
29
+ if err_paths.size != 0
30
+ error "following files are not managed.\n"+err_paths.join("\n")
19
31
  end
20
32
 
21
33
  cmd_arg = "#@svn diff --no-auth-cache --non-interactive"
22
34
  cmd_arg += username_password_options_to_read_repo
35
+ cmd_arg += ' ' + @arg_options.join(' ') if @arg_options.size != 0
23
36
  cmd_arg += " -r #{@options[:revision]}" if @options.has_key?(:revision)
24
- cmd_arg += ' '+paths.join(' ')
37
+ cmd_arg += ' ' + paths.join(' ')
25
38
  FileUtils.cd @mirror_dir do
26
39
  puts system3(cmd_arg)
27
40
  end
@@ -10,7 +10,7 @@ Type '#@base_cmd help <subcommand>' for help on a specific subcommand.
10
10
 
11
11
  Available subcommands:
12
12
  add
13
- check (c)
13
+ check (c, status, stat, st)
14
14
  cleanup
15
15
  commit (ci)
16
16
  diff (di)
@@ -18,9 +18,7 @@ Available subcommands:
18
18
  init
19
19
  list (ls)
20
20
  log
21
- revert
22
- status (stat, st)
23
- update
21
+ update (up, revert)
24
22
  version
25
23
 
26
24
  Yggdrasil is a subversion wrapper to manage server configurations and conditions.
@@ -38,9 +36,9 @@ usage #@base_cmd add [FILES...]
38
36
 
39
37
  EOS
40
38
 
41
- when 'check', 'c' ########################################### check (c)
39
+ when 'check', 'c', 'status', 'stat', 'st' # check (c, status, stat, st)
42
40
  puts <<"EOS"
43
- check (c): check updating of managed files and the execution output of a commands.
41
+ check (c, status, stat, st): check updating of managed files and the execution output of a commands.
44
42
  usage: #@base_cmd check [OPTIONS...]
45
43
 
46
44
  This subcommand execute the executable files in ~/.yggdrasil/checker/, and
@@ -158,49 +156,22 @@ Valid options:
158
156
  'BASE' base rev of item's working copy
159
157
  'COMMITTED' last commit at or before BASE
160
158
  'PREV' revision just before COMMITTED
159
+ -q [--quiet] : print nothing, or only summary information
160
+ -v [--verbose] : print extra information
161
161
 
162
162
  EOS
163
- when 'revert' ################################################## revert
163
+ when 'update', 'up', 'revert' ##################### update (up, revert)
164
164
  puts <<"EOS"
165
- revert: Restore pristine working copy file (undo most local edits).
166
- usage: #@base_cmd revert [OPTIONS...] [PATH...]
167
-
168
- Valid options:
169
- --username ARG : specify a username ARG
170
- --password ARG : specify a password ARG
171
- --non-interactive : do no interactive prompting
172
-
173
- EOS
174
-
175
- when 'status', 'stat', 'st' ######################### status (stat, st)
176
- puts <<"EOS"
177
- status (stat, st): Print the status of managed files and directories.
178
- usage: #@base_cmd status [OPTIONS...] [PATH...]
179
-
180
- Valid options:
181
- --username ARG : specify a username ARG
182
- --password ARG : specify a password ARG
183
-
184
- EOS
185
- when 'update' ################################################## update
186
- puts <<"EOS"
187
- update (up): Bring changes from the repository into the local files.
165
+ update (up, revert): Set the files to the contents of the newest repository.
188
166
  usage: #@base_cmd update [OPTIONS...] [PATH...]
189
167
 
190
168
  Valid options:
191
169
  --username ARG : specify a username ARG
192
170
  --password ARG : specify a password ARG
193
- -r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range)
194
- A revision argument can be one of:
195
- NUMBER revision number
196
- '{' DATE '}' revision at start of the date
197
- 'HEAD' latest in repository
198
- 'BASE' base rev of item's working copy
199
- 'COMMITTED' last commit at or before BASE
200
- 'PREV' revision just before COMMITTED
201
171
  --non-interactive : do no interactive prompting
202
172
 
203
173
  EOS
174
+
204
175
  when 'version', '--version', '-v' ######################## version (-v)
205
176
  puts <<"EOS"
206
177
  version: See the program version
@@ -5,7 +5,7 @@ class Yggdrasil
5
5
  # @param [Array] args
6
6
  def init(args)
7
7
 
8
- args = parse_options(args,
8
+ parse_options(args,
9
9
  {'--username'=>:username, '--password'=>:password,
10
10
  '--repo'=>:repo, '--parents'=>:parents?,
11
11
  '--non-interactive'=>:non_interactive?,
@@ -13,8 +13,8 @@ class Yggdrasil
13
13
  @options[:ro_username] = @options[:username] if @options.has_key?(:username)
14
14
  @options[:ro_password] = @options[:password] if @options.has_key?(:password)
15
15
 
16
- if args.size != 0
17
- error "invalid arguments: #{args.join(',')}"
16
+ if @arg_options.size+@arg_paths.size != 0
17
+ error "invalid arguments: #{(@arg_options+@arg_paths).join(', ')}"
18
18
  end
19
19
 
20
20
  out = system3 'which svn'
@@ -2,21 +2,20 @@ class Yggdrasil
2
2
 
3
3
  # @param [Array] args
4
4
  def list(args)
5
- args = parse_options(args,
5
+ parse_options(args,
6
6
  {'--username'=>:username, '--password'=>:password,
7
7
  '-r'=>:revision, '--revision'=>:revision,
8
8
  '-R'=>:recursive?, '--recursive'=>:recursive?})
9
-
9
+ if @arg_paths.size == 0
10
+ @arg_paths << '/'
11
+ @options[:recursive?] = true
12
+ end
10
13
  get_user_pass_if_need_to_read_repo
11
14
 
12
15
  repos = Array.new
13
- if args.size == 0
14
- repos << @repo + @current_dir
15
- else
16
- args.each do |path|
17
- path = "#@current_dir/#{path}" unless %r{^/} =~ path
18
- repos << @repo+path
19
- end
16
+ @arg_paths.each do |path|
17
+ path = "#@current_dir/#{path}" unless %r{^/} =~ path
18
+ repos << @repo+path
20
19
  end
21
20
 
22
21
  cmd_arg = "#@svn list --no-auth-cache --non-interactive"
data/lib/yggdrasil/log.rb CHANGED
@@ -2,44 +2,43 @@ class Yggdrasil
2
2
 
3
3
  # @param [Array] args
4
4
  def log(args)
5
- args = parse_options(args,
5
+ parse_options(args,
6
6
  {'--username'=>:username, '--password'=>:password,
7
7
  '-r'=>:revision, '--revision'=>:revision})
8
+ @arg_paths << '/' if @arg_paths.size == 0
9
+
8
10
  get_user_pass_if_need_to_read_repo
9
11
 
10
- ext_options = Array.new
11
12
  paths = Array.new
12
- args.each do |arg|
13
- if /^-/ =~ arg
14
- ext_options << arg
13
+ err_paths = Array.new
14
+ @arg_paths.each do |path|
15
+ if %r{^/(.*)$} =~ path
16
+ mirror_file = $1
17
+ mirror_file = '.' if mirror_file == ''
15
18
  else
16
- paths << arg
19
+ mirror_file = @current_dir.sub(/^\//,'') + '/' + path
17
20
  end
18
- end
19
-
20
- if paths.size == 0
21
- dir = @mirror_dir + @current_dir
22
- error 'current directory is not managed.' unless File.exist?(dir)
23
- paths << dir
24
- else
25
- paths.collect! do |path|
26
- if %r{^/} =~ path
27
- @mirror_dir + path
28
- else
29
- @mirror_dir + @current_dir + '/' + path
30
- end
21
+ if File.exist?(@mirror_dir+'/'+mirror_file)
22
+ paths << mirror_file
23
+ else
24
+ err_paths << mirror_file
31
25
  end
32
26
  end
27
+ if err_paths.size != 0
28
+ error "following files are not managed.\n"+err_paths.join("\n")
29
+ end
33
30
 
34
31
  cmd_arg = "#@svn log --no-auth-cache --non-interactive"
35
32
  cmd_arg += username_password_options_to_read_repo
36
- cmd_arg += ' ' + ext_options.join(' ') if ext_options.size != 0
33
+ cmd_arg += ' ' + @arg_options.join(' ') if @arg_options.size != 0
37
34
  if @options.has_key?(:revision)
38
35
  cmd_arg += " -r #{@options[:revision]}"
39
36
  else
40
37
  cmd_arg += ' -r HEAD:1'
41
38
  end
42
39
  cmd_arg += ' ' + paths.join(' ')
43
- puts system3(cmd_arg)
40
+ FileUtils.cd @mirror_dir do
41
+ puts system3(cmd_arg)
42
+ end
44
43
  end
45
44
  end
@@ -2,66 +2,50 @@ class Yggdrasil
2
2
 
3
3
  # @param [Array] args
4
4
  def update(args)
5
- target_paths = parse_options(args,
6
- {'--username'=>:username, '--password'=>:password,
7
- '-r'=>:revision, '--revision'=>:revision,
8
- '--non-interactive'=>:non_interactive?})
5
+ parse_options(args,
6
+ {'--username'=>:username, '--password'=>:password,
7
+ '--non-interactive'=>:non_interactive?})
8
+ @arg_paths << '/' if @arg_paths.size == 0
9
9
  get_user_pass_if_need_to_read_repo
10
- sync_mirror
11
10
 
12
- updates = Array.new
13
- FileUtils.cd @mirror_dir do
14
- cmd = "#@svn status -qu --no-auth-cache --non-interactive"
15
- cmd += username_password_options_to_read_repo
16
- out = system3(cmd)
17
- out.split(/\n/).each do |line|
18
- if /^.*\*.*\s(\S+)\s*$/ =~ line
19
- updates << ['', $1]
20
- end
21
- end
22
- end
23
-
24
- matched_updates = select_updates(updates, target_paths)
11
+ updates = sync_mirror
12
+ matched_updates = select_updates(updates, @arg_paths)
25
13
  if matched_updates.size == 0
26
- puts "\nno files."
14
+ puts 'no files.'
27
15
  return
28
16
  end
29
17
 
30
18
  confirmed_updates = confirm_updates(matched_updates) do |relative_path|
31
19
  FileUtils.cd @mirror_dir do
32
- cmd = "#@svn diff"
33
- cmd += ' --no-auth-cache --non-interactive'
20
+ cmd = "#@svn diff --no-auth-cache --non-interactive #{relative_path}"
34
21
  cmd += username_password_options_to_read_repo
35
- if @options.has_key?(:revision)
36
- cmd += " --old=#{relative_path} --new=#{relative_path}@#{@options[:revision]}"
37
- else
38
- cmd += " --old=#{relative_path} --new=#{relative_path}@HEAD"
39
- end
40
22
  puts system3(cmd)
41
23
  end
42
24
  end
43
- # res == 'Y' or --non-interactive
44
-
45
25
  return unless confirmed_updates
46
- return if confirmed_updates == 0 # no files to update
26
+ return if confirmed_updates.size == 0
47
27
 
48
- cmd_arg = "#@svn update --no-auth-cache --non-interactive"
49
- cmd_arg += username_password_options_to_read_repo
50
- if @options.has_key?(:revision)
51
- cmd_arg += " -r #{@options[:revision]}"
52
- else
53
- cmd_arg += ' -r HEAD'
54
- end
55
- cmd_arg += ' ' + confirmed_updates.join(' ')
56
28
  FileUtils.cd @mirror_dir do
57
- puts system3(cmd_arg)
29
+ cmd = "#@svn revert #{confirmed_updates.reverse.join(' ')}"
30
+ cmd += username_password_options_to_read_repo
31
+ system3 cmd
32
+
33
+ # make ls hash
34
+ cmd = "#@svn ls -R #@repo --no-auth-cache --non-interactive"
35
+ cmd += username_password_options_to_read_repo
36
+ out = system3(cmd)
37
+
38
+ ls_hash = Hash.new
39
+ out.split(/\n/).each {|relative| ls_hash[relative]=true}
58
40
 
59
41
  # reflect mirror to real file
60
- confirmed_updates.each do |update_file|
61
- if File.exist?(update_file)
62
- FileUtils.copy_file "#@mirror_dir/#{update_file}", "/#{update_file}"
42
+ confirmed_updates.each do |file|
43
+ if ls_hash.has_key?(file)
44
+ if File.file?("#@mirror_dir/#{file}")
45
+ FileUtils.copy_file "#@mirror_dir/#{file}", "/#{file}"
46
+ end
63
47
  else
64
- system3 "rm -rf /#{update_file}"
48
+ system3 "rm -rf #{@mirror_dir + '/' + file}"
65
49
  end
66
50
  end
67
51
  end
@@ -1,5 +1,5 @@
1
1
  class Yggdrasil
2
- VERSION = '0.0.11'
2
+ VERSION = '0.0.12'
3
3
 
4
4
  def version
5
5
  puts <<"EOS"
data/lib/yggdrasil.rb CHANGED
@@ -11,9 +11,7 @@ require 'yggdrasil/cleanup'
11
11
  require 'yggdrasil/diff'
12
12
  require 'yggdrasil/list'
13
13
  require 'yggdrasil/log'
14
- require 'yggdrasil/status'
15
14
  require 'yggdrasil/update'
16
- require 'yggdrasil/revert'
17
15
  require 'yggdrasil/check'
18
16
 
19
17
  class Yggdrasil
@@ -29,7 +27,7 @@ class Yggdrasil
29
27
  case args[0]
30
28
  when 'add'
31
29
  new.add(args[1..-1])
32
- when 'check', 'c'
30
+ when 'check', 'c', 'status', 'stat', 'st'
33
31
  new.check(args[1..-1])
34
32
  when 'cleanup'
35
33
  new.cleanup(args[1..-1])
@@ -45,11 +43,7 @@ class Yggdrasil
45
43
  new.list(args[1..-1])
46
44
  when 'log'
47
45
  new.log(args[1..-1])
48
- when 'revert'
49
- new.revert(args[1..-1])
50
- when 'status', 'stat', 'st'
51
- new.status(args[1..-1])
52
- when 'update'
46
+ when 'update', 'up', 'revert'
53
47
  new.update(args[1..-1])
54
48
  when 'version', '--version', '-v'
55
49
  new(false).version
@@ -84,6 +78,9 @@ class Yggdrasil
84
78
  def sync_mirror
85
79
  updates = Array.new
86
80
  FileUtils.cd @mirror_dir do
81
+ cmd = "#@svn update --no-auth-cache --non-interactive"
82
+ cmd += username_password_options_to_read_repo
83
+ system3(cmd)
87
84
  cmd = "#@svn ls #@repo -R --no-auth-cache --non-interactive"
88
85
  cmd += username_password_options_to_read_repo
89
86
  out = system3(cmd)
@@ -164,6 +161,7 @@ class Yggdrasil
164
161
  end
165
162
  print 'OK? [Y|n|<num to diff>]:'
166
163
  res = $stdin.gets
164
+ puts
167
165
  return nil unless res
168
166
  res.chomp!
169
167
  return nil if res == 'n'
@@ -230,4 +228,28 @@ class Yggdrasil
230
228
  error "invalid host:port '#{@options[:server]}'"
231
229
  end
232
230
  end
231
+
232
+ def exec_checker
233
+ # execute checker
234
+ `rm -rf #@checker_result_dir`
235
+ Dir.mkdir @checker_result_dir, 0755
236
+ if File.exist?(@checker_dir)
237
+ Find.find(@checker_dir) do |file|
238
+ if File.file?(file) && File.executable?(file)
239
+ if file =~ %r{^#@checker_dir(.*)$}
240
+ file_body = $1
241
+ system3("#{file} > #@checker_result_dir#{file_body}")
242
+ end
243
+ end
244
+ end
245
+ end
246
+
247
+ # add checker result
248
+ result_files = Array.new
249
+ Find.find(@checker_result_dir) {|f| result_files << f}
250
+ stdout = $stdout
251
+ $stdout = StringIO.new
252
+ self.class.new.add result_files
253
+ $stdout = stdout
254
+ end
233
255
  end
@@ -51,7 +51,16 @@ module YggdrasilCommon
51
51
  end
52
52
  pos += 1
53
53
  end
54
- args
54
+ @arg_options = Array.new
55
+ @arg_paths = Array.new
56
+ args.each do |arg|
57
+ if /^-/ =~ arg
58
+ @arg_options << arg
59
+ else
60
+ @arg_paths << arg
61
+ end
62
+ end
63
+ nil
55
64
  end
56
65
 
57
66
  def input_user_pass
@@ -86,11 +95,11 @@ module YggdrasilCommon
86
95
  unless stat.success?
87
96
  return nil unless err_exit
88
97
  if @options[:debug?]
89
- cmd_disp = cmd
98
+ cmd_display = cmd
90
99
  else
91
- cmd_disp = (cmd.split)[0]+' ...'
100
+ cmd_display = (cmd.split)[0]+' ...'
92
101
  end
93
- $stderr.puts "#@base_cmd error: command failure: #{cmd_disp}"
102
+ $stderr.puts "#@base_cmd error: command failure: #{cmd_display}"
94
103
  $stderr.puts 'command output:'
95
104
  $stderr.puts out
96
105
  exit stat.exitstatus
@@ -3,11 +3,11 @@ class YggdrasilServer
3
3
  # @param [Array] args
4
4
  def init_server(args)
5
5
 
6
- args = parse_options(args,
7
- {'--port'=>:port, '--repo'=>:repo,
8
- '--ro-username'=>:ro_username, '--ro-password'=>:ro_password})
9
- if args.size != 0
10
- error "invalid arguments: #{args.join(',')}"
6
+ parse_options(args,
7
+ {'--port'=>:port, '--repo'=>:repo,
8
+ '--ro-username'=>:ro_username, '--ro-password'=>:ro_password})
9
+ if @arg_options.size+@arg_paths.size != 0
10
+ error "invalid arguments: #{(@arg_options+@arg_paths).join(', ')}"
11
11
  end
12
12
 
13
13
  if !@options.has_key?(:ro_username) && @options.has_key?(:ro_password)
@@ -2,10 +2,10 @@ class YggdrasilServer
2
2
 
3
3
  # @param [Array] args
4
4
  def results(args)
5
- args = parse_options(args, {'--expire'=>:expire})
5
+ parse_options(args, {'--expire'=>:expire})
6
6
 
7
- if args.size != 0
8
- error "invalid arguments: #{args.join(',')}"
7
+ if @arg_options.size+@arg_paths.size != 0
8
+ error "invalid arguments: #{(@arg_options+@arg_paths).join(', ')}"
9
9
  end
10
10
 
11
11
  return unless File.exist?(@results_dir)