ro_commands 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/bin/ro_client +1 -0
  4. data/bin/ro_server +1 -1
  5. data/config/rorc.rb +1 -0
  6. data/lib/bash_builder.rb +10 -7
  7. data/lib/bash_builder_helper.rb +25 -23
  8. data/lib/bash_templates/file.sh +1 -0
  9. data/lib/bash_templates/git.sh +1 -0
  10. data/lib/bash_templates/jekyll.sh +3 -0
  11. data/lib/bash_templates/misc.sh +6 -39
  12. data/lib/bash_templates/ruby.sh +1 -0
  13. data/lib/bash_templates/rubymine_idea.sh +41 -0
  14. data/lib/bash_templates/shortcuts.sh +1 -1
  15. data/lib/bash_templates/video.sh +4 -0
  16. data/lib/builder_templates/set_envs.erb +3 -2
  17. data/lib/drb/client.rb +14 -4
  18. data/lib/drb/server.rb +2 -1
  19. data/lib/git_flow_builder_helper.rb +24 -22
  20. data/lib/rails_builder_helper.rb +31 -28
  21. data/lib/ro_commands/base.rb +13 -2
  22. data/lib/ro_commands/core_ext/string.rb +4 -0
  23. data/lib/ro_commands/core_ext/thor.rb +0 -71
  24. data/lib/ro_commands/dsl/{file.rb → ro_file.rb} +3 -4
  25. data/lib/ro_commands/generators/spec_file.rb +24 -17
  26. data/lib/ro_commands/generators/templates/ex.erb +4 -0
  27. data/lib/ro_commands/generators/templates/spec.erb +3 -0
  28. data/lib/ro_commands/helpers/bash.rb +33 -7
  29. data/lib/ro_commands/helpers/out.rb +61 -2
  30. data/lib/ro_commands/info.rb +12 -8
  31. data/lib/ro_commands/navigate.rb +5 -1
  32. data/lib/ro_commands/rails.rb +1 -1
  33. data/lib/ro_commands/shortcuts.rb +82 -3
  34. data/lib/ro_commands/try.rb +8 -1
  35. data/lib/ro_commands/version.rb +1 -1
  36. data/lib/ro_commands/zeus_templates/custom_plan.rb +15 -7
  37. data/lib/ro_commands/zeus_templates/zeus.json +12 -5
  38. data/lib/set_envs_helper.rb +70 -0
  39. data/ro_commands.sh +839 -0
  40. metadata +66 -5
  41. data/lib/shortcuts.rb +0 -43
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8ab04e140f249b37be7aadf29a8c9629f084a70
4
- data.tar.gz: 6983b74563ab46faa825c8548e3653dc0ee72a57
3
+ metadata.gz: 9b3c8d65b42b4dbaff8d2e5d9b6de5cdc2c6bd45
4
+ data.tar.gz: 3c5c665b73f9b3028875c614b9e7797add0551f3
5
5
  SHA512:
6
- metadata.gz: 1991878e840d4a40a3491f6cce19b942869ab8948f83c9f393d9ed1630b228509f90632c73caafb072b48cc28c06bf3402196bd5c0b4d67865e64a89208913b6
7
- data.tar.gz: 522b6130bbc5fe654e338211f128c1809722114cac0b66a3b7a84210ec16090d6272d279a5a9ef3210858f08ae12301f9b982f5540cd44b6de32558616eefca9
6
+ metadata.gz: 7aeb6a23fef8828da338d112fdc10d1987959bd02e8245e8ffb6b5caaf2723b285ab4b20478d52c3a379b4bc6660d15fb1eef3a5c3993d9bb2efa397d2904816
7
+ data.tar.gz: 2d323255f4203f5af461b32c53346d90bfe8e8293c7d17da3ce0fd23d866ebf39bdcb8736c17940f41451779aa1db7cbb66934fbc0844f4812332db2eadac561
data/Rakefile CHANGED
@@ -18,7 +18,7 @@ end
18
18
  namespace :bash do
19
19
  task :install do
20
20
  ro_commands = File.expand_path("../ro_commands.sh", __FILE__)
21
- system "echo 'source #{ro_commands}' >> ~/.bashrc"
21
+ system "echo 'source #{ro_commands}' >> ~/bashrc.erb"
22
22
  end
23
23
 
24
24
  task :check do
data/bin/ro_client CHANGED
@@ -1,3 +1,4 @@
1
+ #! /usr/bin/env ruby
1
2
  $root = File.expand_path("../../", __FILE__)
2
3
  $lib = File.join($root, 'lib')
3
4
  $LOAD_PATH.unshift $root
data/bin/ro_server CHANGED
@@ -1,8 +1,8 @@
1
+ #! /usr/bin/env ruby
1
2
  $root = File.expand_path("../..", __FILE__)
2
3
  $lib = File.join($root, 'lib')
3
4
  $LOAD_PATH.unshift $root
4
5
  $LOAD_PATH.unshift $lib
5
6
 
6
- require "active_support"
7
7
  require "drb/server"
8
8
  DRb.thread.join
data/config/rorc.rb CHANGED
@@ -1,2 +1,3 @@
1
+ ENV['HOME']="/home/zxr"
1
2
  ENV['PROJECTS'] = File.join(ENV['HOME'], "Dropbox", "ruby-projects")
2
3
  ENV['JAVA'] = File.join(ENV['HOME'], "Dropbox", "js-java-projects")
data/lib/bash_builder.rb CHANGED
@@ -7,16 +7,19 @@ require "ro_commands/ro_helper"
7
7
  require_relative "bash_builder_helper"
8
8
  require_relative "rails_builder_helper"
9
9
  require_relative "git_flow_builder_helper"
10
+ require_relative "set_envs_helper"
11
+ require "ro_commands/helpers/out"
10
12
 
11
13
  class BashBuilder
12
- include BashBuilderHelper
13
- include RailsBuilderHelper
14
- include GitFlowBuilderHelper
14
+ include RoHelpers::BashBuilderHelper
15
+ include RoHelpers::RailsBuilderHelper
16
+ include RoHelpers::GitFlowBuilderHelper
17
+ include RoHelpers::SetEnvsHelper
15
18
 
16
19
  class << self
17
20
  def build
18
21
  reset_ivars
19
- set_env
22
+ set_envs
20
23
  build_rails_cmds
21
24
  build_rails_completions
22
25
  build_git_flow_cmds
@@ -51,7 +54,7 @@ class BashBuilder
51
54
  path = File.expand_path("../builder_templates/#{name}.erb", __FILE__)
52
55
 
53
56
  @ctn = ERB.new(File.read(path)).result(binding)
54
- puts "Building templates #{File.basename path}"
57
+ Out.out "Building templates #{File.basename path}"
55
58
  end
56
59
 
57
60
  def _build_completion
@@ -62,7 +65,7 @@ class BashBuilder
62
65
  build_template('rails')
63
66
  end
64
67
 
65
- def _set_env
68
+ def _set_envs
66
69
  build_template('set_envs')
67
70
  end
68
71
 
@@ -73,7 +76,7 @@ class BashBuilder
73
76
  end
74
77
 
75
78
  def file_write(file, ctn)
76
- puts "writing #{file}"
79
+ Out.out "writing #{file}"
77
80
  File.write(file, ctn)
78
81
  end
79
82
 
@@ -1,34 +1,36 @@
1
- module BashBuilderHelper
2
- include RoCommands::RoHelper
1
+ module RoHelpers
2
+ module BashBuilderHelper
3
+ include RoCommands::RoHelper
3
4
 
4
- class << self
5
- def included(base)
6
- base.extend(ClsMeths)
5
+ class << self
6
+ def included(base)
7
+ base.extend(ClsMeths)
8
+ end
7
9
  end
8
- end
9
10
 
10
- module ClsMeths
11
- include RoCommands::RoHelper::ClassMethods
11
+ module ClsMeths
12
+ include RoCommands::RoHelper::ClassMethods
12
13
 
13
- def is_helper?(meth)
14
- ::BashBuilderHelper.meths.include?(meth)
15
- end
14
+ def is_helper?(meth)
15
+ ::BashBuilderHelper.meths.include?(meth)
16
+ end
16
17
 
17
- def ctn
18
- @ctn ||= ""
19
- end
18
+ def ctn
19
+ @ctn ||= ""
20
+ end
20
21
 
21
- def after_each
22
- content << @ctn
23
- end
22
+ def after_each
23
+ content << @ctn
24
+ end
24
25
 
25
- def content
26
- @content.uniq! if @content.respond_to?(:uniq!)
27
- @content ||= []
28
- end
26
+ def content
27
+ @content.uniq! if @content.respond_to?(:uniq!)
28
+ @content ||= []
29
+ end
29
30
 
30
- def target
31
- File.join($root, 'ro_commands.sh')
31
+ def target
32
+ File.join($root, 'ro_commands.sh')
33
+ end
32
34
  end
33
35
  end
34
36
  end
@@ -0,0 +1 @@
1
+ alias list="ro info list ."
@@ -8,3 +8,4 @@ alias gl='git log --oneline --all --color --graph --decorate'
8
8
  alias gm='git merge'
9
9
  alias gp='git push -u origin master'
10
10
  alias gst='git status'
11
+
@@ -0,0 +1,3 @@
1
+ alias jk="jekyll"
2
+ alias jks="jekyll server"
3
+
@@ -1,43 +1,10 @@
1
- alias spec="ro_client generate spec_file"
2
- alias ex="ro_client generate ex"
1
+ alias spec="ro generate spec_file"
2
+ alias ex="ro generate ex"
3
3
  alias dl="cd ~/Downloads"
4
- # cd to dir
5
- goto () {
6
- path=`ro_client navigate get_dir $1`
7
- echo "cd $path"
8
- cd "$path"
9
- }
10
-
11
- opendir () {
12
- goto $1
13
- rubymine .
14
- }
15
-
16
- # cd to project path
17
- cpj () {
18
- path=`ro_client navigate get_project $1`
19
- echo "cd $path"
20
- cd "$path"
21
- }
22
-
23
- pj () {
24
- cpj $1
25
- rubymine "$path"
26
- }
27
-
28
- cjpj () {
29
- path=`ro_client navigate get_project $1 java`
30
- echo "opening $path"
31
- cd "$path"
32
- }
33
-
34
- jpj () {
35
- path=`ro_client navigate get_project $1 java`
36
- echo "opening $path"
37
- cd "$path"
38
- idea "$path"
39
- }
4
+ alias sshproxy="sudo service ssh-proxy"
5
+ alias roserver="sudo service ro_server"
40
6
 
7
+ # cd to dir
41
8
  rp () {
42
9
  cd "$ruby_projects"
43
10
  }
@@ -60,7 +27,7 @@ alias l="cd $learn"
60
27
  #find railscasts
61
28
  alias rc="ro_client file_actions find_railscasts"
62
29
 
63
- # reload ~/.bashrc
30
+ # reload ~/bashrc.erb
64
31
  alias rb="source ~/.bashrc"
65
32
 
66
33
  alias proxy="http_proxy='socks5://127.0.0.1:1080'"
@@ -0,0 +1 @@
1
+ alias guard="bundle exec guard"
@@ -3,3 +3,44 @@ alias i='idea `pwd`'
3
3
 
4
4
  #rubymine
5
5
  alias r='rubymine `pwd`'
6
+ alias libspec="ro shortcuts lib_spec"
7
+
8
+ cdir () {
9
+ path=`ro_client navigate get_dir $1`
10
+ echo "cd $path"
11
+ cd "$path"
12
+ }
13
+
14
+ odir () {
15
+ cdir $1
16
+ rubymine .
17
+ }
18
+
19
+ # cd to project path
20
+ cpj () {
21
+ path=`ro_client navigate get_project $1`
22
+ echo "cd $path"
23
+ cd "$path"
24
+ }
25
+
26
+ pj () {
27
+ cpj $1
28
+ rubymine "$path"
29
+ }
30
+
31
+ cjpj () {
32
+ path=`ro_client navigate get_project $1 java`
33
+ echo "opening $path"
34
+ cd "$path"
35
+ }
36
+
37
+ jpj () {
38
+ path=`ro_client navigate get_project $1 java`
39
+ echo "opening $path"
40
+ cd "$path"
41
+ idea "$path"
42
+ }
43
+
44
+ alias rco="ro shortcuts open_ro_commands"
45
+ alias rsu="ro shortcuts open_ro_support"
46
+
@@ -1 +1 @@
1
- alias work="ro_client shortcuts work"
1
+ alias work="ro shortcuts work"
@@ -0,0 +1,4 @@
1
+ alias sp="smplayer"
2
+ function record() {
3
+ recordmydesktop --no-sound --output=$1
4
+ }
@@ -5,5 +5,6 @@ learn="$HOME/Dropbox/learn"
5
5
  ruby_projects="$HOME/Dropbox/ruby-projects"
6
6
  js_java_projects="$HOME/Dropbox/js-java-projects"
7
7
  work_project="$ruby_projects/ro_partner"
8
- ro="ro_client"
9
-
8
+ alias ro="bundle exec ro"
9
+ alias ro_client="<%= ro_client %>"
10
+ alias ro_server="<%= ro_server %>"
data/lib/drb/client.rb CHANGED
@@ -1,22 +1,32 @@
1
1
  require "drb"
2
+
2
3
  require "ro_commands/helpers/all_files"
3
4
  require "ro_commands/helpers/out"
4
5
  require "ro_commands/core_ext/string"
5
6
 
6
- item = ARGV.shift
7
- meth = ARGV.shift
8
- args = ARGV
9
7
 
8
+ item = ARGV.shift
10
9
  DRb.start_service
11
10
  file = RoCommands.file_map.keys.grep(%r{#{item}}).first
12
11
 
13
12
  if file
14
13
  port = RoCommands.file_map[file.to_sym]
14
+ end
15
+
16
+ if ARGV.length == 0
17
+ #drb_obj = DRbObject.new_with_uri("druby://localhost:#{port}")
18
+ #drb_obj.start
19
+ else
20
+ #Out.out "ARGV:#{ARGV} file:#{File.basename __FILE__} line:#{__LINE__}", "red"
21
+ meth = ARGV.shift
22
+ args = ARGV
15
23
 
16
24
  #Out.out "starting #{File.basename(file.to_s).gsub(%r{\.rb}, "")}"
17
25
  drb_obj = DRbObject.new_with_uri("druby://localhost:#{port}")
18
- r = drb_obj.start(["drb_#{meth}", *args])
26
+
27
+ r = drb_obj.start(["drb_#{meth}", *args, {pwd: Dir.pwd}])
19
28
  #Out.out "r:#{r} file:#{File.basename __FILE__} line:#{__LINE__}"
20
29
  Out.out(r)
21
30
  end
22
31
 
32
+
data/lib/drb/server.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require "active_support/all"
1
2
  require "drb"
2
3
  require "ro_commands"
3
4
  require "ro_commands/core_ext/thor"
@@ -20,7 +21,7 @@ RoCommands.file_map.each do |file, port|
20
21
  define_method("drb_#{m}".to_sym) do |*args|
21
22
  Out.reset
22
23
  send(m.to_sym, *args)
23
- Out.out "Out.msgs:#{Out.msgs} file:#{File.basename __FILE__} line:#{__LINE__}"
24
+ #Out.out "Out.msgs:#{Out.msgs} file:#{File.basename __FILE__} line:#{__LINE__}"
24
25
  handle_drb_out
25
26
  end
26
27
  end
@@ -1,34 +1,36 @@
1
1
  require_relative "ro_helper"
2
- module GitFlowBuilderHelper
3
- class << self
4
- def included(base)
5
- base.extend(ClsMeths)
2
+ module RoHelpers
3
+ module GitFlowBuilderHelper
4
+ class << self
5
+ def included(base)
6
+ base.extend(ClsMeths)
7
+ end
6
8
  end
7
- end
8
9
 
9
- module ClsMeths
10
+ module ClsMeths
10
11
 
11
- include ::RoHelper
12
+ include ::RoHelper
12
13
 
13
- class GitFlow < Cmd
14
+ class GitFlow < Cmd
14
15
 
15
- end
16
+ end
16
17
 
17
- def git_flows
18
- cmd 'gfi', "git init && git flow init -f"
18
+ def git_flows
19
+ cmd 'gfi', "git init && git flow init -f"
19
20
 
20
- #git flow release
21
- cmd 'fr', "git flow release"
22
- cmd 'frf', "fr finish", "zeus git_flow get_releases"
23
- cmd 'frp', "fr publish", "zeus git_flow get_releases"
21
+ #git flow release
22
+ cmd 'fr', "git flow release"
23
+ cmd 'frf', "fr finish", "zeus git_flow get_releases"
24
+ cmd 'frp', "fr publish", "zeus git_flow get_releases"
24
25
 
25
- #git flow feature
26
- cmd 'ff', "git flow feature"
27
- cmd 'frs', "git flow release start"
28
- cmd 'ffs', "git flow feature start"
29
- cmd 'fff', "ff finish", "zeus git_flow get_features"
30
- cmd 'ffc', 'ff checkout', "zeus git flow get_features"
31
- cmds
26
+ #git flow feature
27
+ cmd 'ff', "git flow feature"
28
+ cmd 'frs', "git flow release start"
29
+ cmd 'ffs', "git flow feature start"
30
+ cmd 'fff', "ff finish", "zeus git_flow get_features"
31
+ cmd 'ffc', 'ff checkout', "zeus git flow get_features"
32
+ cmds
33
+ end
32
34
  end
33
35
  end
34
36
  end
@@ -1,41 +1,44 @@
1
1
  require_relative "ro_helper"
2
- module RailsBuilderHelper
3
- class << self
4
- def included(base)
5
- base.extend(ClsMeths)
2
+ module RoHelpers
3
+ module RailsBuilderHelper
4
+ class << self
5
+ def included(base)
6
+ base.extend(ClsMeths)
7
+ end
6
8
  end
7
- end
8
9
 
9
- module ClsMeths
10
+ module ClsMeths
10
11
 
11
- include ::RoHelper
12
+ include ::RoHelper
12
13
 
13
- def rails_cmds
14
- cmd 'z', 'zeus'
15
- cmd 'zr', 'z rails'
16
- cmd 'g', 'z g'
17
- cmd 'd', 'z d'
14
+ def rails_cmds
15
+ cmd 'z', 'zeus'
16
+ cmd 'zr', 'z rails'
17
+ cmd 'g', 'z g'
18
+ cmd 'd', 'z d'
19
+ cmd 'zs', 'z s'
18
20
 
19
- # generate
20
- cmd 'a', 'z g assets'
21
- cmd 'c', 'zr controller'
22
- cmd 'm', 'zr migration'
23
- cmd 'mo', 'zr model'
24
- cmd 's', 'zr scaffold'
21
+ # generate
22
+ cmd 'a', 'z g assets'
23
+ cmd 'c', 'zr controller'
24
+ cmd 'm', 'zr migration'
25
+ cmd 'mo', 'zr model'
26
+ cmd 's', 'zr scaffold'
25
27
 
26
28
 
27
- # destroy
28
- cmd 'da', 'd assets', 'zeus rails get_assets'
29
- cmd 'dco', 'd controller', 'zeus rails get_controllers'
30
- cmd 'dmo', 'd model', 'zeus rails get_models'
31
- cmd 'dm', 'd migration', 'zeus rails get_migrations'
32
- cmd 'ds', 'd scaffold', 'zeus rails get_scaffold'
29
+ # destroy
30
+ cmd 'da', 'd assets', 'ro_client rails get_assets'
31
+ cmd 'dco', 'd controller', 'ro_client rails get_controllers'
32
+ cmd 'dmo', 'd model', 'ro_client rails get_models'
33
+ cmd 'dm', 'd migration', 'ro_client rails get_migrations'
34
+ cmd 'ds', 'd scaffold', 'ro_client rails get_scaffolds'
33
35
 
34
- # misc
35
- cmd 'mi', 'z rake db:migrate'
36
+ # misc
37
+ cmd 'mi', 'z rake db:migrate'
36
38
 
37
- cmd 'bx', "bundle exec"
38
- cmds
39
+ cmd 'bx', "bundle exec"
40
+ cmds
41
+ end
39
42
  end
40
43
  end
41
44
  end
@@ -5,6 +5,8 @@ require "ro_commands/core_ext/string"
5
5
  require "ro_commands/core_ext/hash"
6
6
  require "ro_commands/helpers/out"
7
7
  require "ro_commands/helpers/bash"
8
+ require "active_support/all"
9
+ require "ro_commands/core_ext/thor"
8
10
 
9
11
  #Thor.class_eval do
10
12
  #
@@ -23,6 +25,16 @@ module RoCommands
23
25
  class Base < Thor
24
26
  protected
25
27
  class << self
28
+ def start(given_args=ARGV, config={})
29
+ given_args.flatten!
30
+ opt = given_args.extract_options!
31
+ if opt and opt[:pwd]
32
+ Out.out("Current working path is #{opt[:pwd]}")
33
+ Dir.chdir opt[:pwd]
34
+ end
35
+ given_args = given_args - [{pwd: opt[:pwd]}]
36
+ super
37
+ end
26
38
 
27
39
  def method_added(method)
28
40
  super
@@ -48,7 +60,6 @@ module RoCommands
48
60
 
49
61
  include ::Bash
50
62
 
51
-
52
63
  def get_options(args)
53
64
  h = {}
54
65
  args.select do |a|
@@ -88,7 +99,7 @@ module RoCommands
88
99
  opts
89
100
  end
90
101
 
91
- def handle_drb_out(result)
102
+ def handle_drb_out
92
103
  Out.msgs
93
104
  end
94
105
  end
@@ -11,4 +11,8 @@ String.class_eval do
11
11
  def uncamelize
12
12
  self.split(/(?=[A-Z])/).join("_").downcase
13
13
  end
14
+
15
+ def implicit
16
+ self.split("").join(".*")
17
+ end
14
18
  end
@@ -1,71 +0,0 @@
1
- require "thor"
2
- Thor::Shell::Basic.class_eval do
3
- def say(message="", color=nil, force_new_line=(message.to_s !~ /( |\t)\Z/))
4
- message = message.to_s
5
-
6
- message = set_color(message, *color) if color && can_display_colors?
7
-
8
- spaces = " " * padding
9
-
10
- if force_new_line
11
- stdout.puts(spaces + message)
12
- else
13
- stdout.print(spaces + message)
14
- end
15
-
16
- #puts "message:#{message} line:#{__LINE__}"
17
- $ro_out << message
18
- end
19
-
20
- def print_table(array, options={})
21
- return if array.empty?
22
-
23
- formats, indent, colwidth = [], options[:indent].to_i, options[:colwidth]
24
- options[:truncate] = terminal_width if options[:truncate] == true
25
-
26
- formats << "%-#{colwidth + 2}s" if colwidth
27
- start = colwidth ? 1 : 0
28
-
29
- colcount = array.max{|a,b| a.size <=> b.size }.size
30
-
31
- maximas = []
32
-
33
- start.upto(colcount - 1) do |index|
34
- maxima = array.map {|row| row[index] ? row[index].to_s.size : 0 }.max
35
- maximas << maxima
36
- if index == colcount - 1
37
- # Don't output 2 trailing spaces when printing the last column
38
- formats << "%-s"
39
- else
40
- formats << "%-#{maxima + 2}s"
41
- end
42
- end
43
-
44
- formats[0] = formats[0].insert(0, " " * indent)
45
- formats << "%s"
46
-
47
- array.each do |row|
48
- sentence = ""
49
-
50
- row.each_with_index do |column, index|
51
- maxima = maximas[index]
52
-
53
- if column.is_a?(Numeric)
54
- if index == row.size - 1
55
- # Don't output 2 trailing spaces when printing the last column
56
- f = "%#{maxima}s"
57
- else
58
- f = "%#{maxima}s "
59
- end
60
- else
61
- f = formats[index]
62
- end
63
- sentence << f % column.to_s
64
- end
65
-
66
- sentence = truncate(sentence, options[:truncate]) if options[:truncate]
67
- $ro_out << sentence
68
- stdout.puts sentence
69
- end
70
- end
71
- end
@@ -2,12 +2,11 @@ require 'find'
2
2
 
3
3
  module RoCommands
4
4
  module DSL
5
- module File
5
+ module RoFile
6
6
  def dir?(path)
7
7
  test(?d, path)
8
8
  end
9
9
 
10
- # file?
11
10
  def file?(path)
12
11
  test(?f, path)
13
12
  end
@@ -16,9 +15,9 @@ module RoCommands
16
15
  Find.find(path).to_a
17
16
  end
18
17
 
19
- # size
20
18
  def size(path)
21
- test(?s, path)
19
+ s = test(?s, path)
20
+ s ||= 0
22
21
  end
23
22
  end
24
23
  end