rubycom 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDhjYTIwMGM1YWNmMjc3NWI0ZWY2NTM5NDY1NGM3MjliYTA4MTA2MA==
4
+ YmZkNDU1NjY2ZGU2MmM0ZGE4OTEyNTkwYTBkMzVhMjhiYWIzOWVhNA==
5
5
  data.tar.gz: !binary |-
6
- NmU3YjBkMjYwYTg5ZTY5MjQ1NjBiNDE3ZDNkMWNhY2QyMDYyNDJlZA==
6
+ NWI4NWMxNjJiN2RhZTA2MWJiNjZhZjZiNTVhMmMzMTMwMWRkN2FkYQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NmRmOThjZDFjYjRlZTNkMGFjYzViYzQ0M2M2ZGM5Y2U1NDlhNzEzOTFjYTcy
10
- NDk0OTRmZDQ3ZjQ5M2JjY2E0ZGU2MzA4NjIyOWIyODIyMDg3ZGM1MTVhOGUy
11
- ZTk3MzhhYTQzY2FjMDk1NGNlY2NiN2FjOWE4NTY2NDA5OWQ1YTA=
9
+ MjI1NjA5YjZiMDdhNzQ3M2YzNjVmYTYwYWQyMjMxZmIzZDYwZmMyNWMwM2Jm
10
+ MjAwNTQ3NDI0NjMzOWVjMGUzNDAyZjVjZDVjZmZkNzk3MjM5YzJlY2M3NDU3
11
+ NzhlNjI2NzNlNjQ4ZTZkYjljNjQ2ZDVmZGE3YjJlNWUxNmI3NDc=
12
12
  data.tar.gz: !binary |-
13
- NGZmOTU5MDUyMjFmOGI2OTEzODdjY2Q5MTlmYTA1MDE1ZGI0OTE1ZTFmM2Vm
14
- MDU3Mjg3NTYwOWVlOWNkOTk1MmFkZDU1ZTE3N2Q0OTkyNGUwNTg5Mzc0NmVj
15
- NjJiNjc4ZDU4ODZhMjMzNzM3MjMzY2JkZjJkZTk1ZDZiYjIzYjU=
13
+ MjUwMmNmYjVjMDc0ZDI2YzE5MzMyYTY0ZDNmNmJiOTdkZDQ4YTVlMGE0Yjlj
14
+ YTRkOTM5ZTM3NTQyNjcxNGE2ZTY0ODAyYTNmZjFmN2JiNGJkYTFmYjQ3YjVi
15
+ Yzk0YjFkMWIxNGViNDlmNDUzNWM4ODdjNWE0MDE1ZmY0ZjczOTQ=
data/Rakefile CHANGED
@@ -1,4 +1,3 @@
1
- require "#{File.expand_path(File.dirname(__FILE__))}/lib/rubycom/version.rb"
2
1
  require 'yard'
3
2
 
4
3
  task :default => [:package]
@@ -14,7 +13,9 @@ task :test do
14
13
  test_files = Dir.glob("**/test/*/test_*.rb")
15
14
  test_files.each { |test_case|
16
15
  ruby test_case rescue SystemExit
17
- if $?.exitstatus != 0; raise "Error during test phase\n Test: #{test_case}\n Error: #{$!}\n#{$@}" unless $!.nil? end
16
+ if $?.exitstatus != 0;
17
+ raise "Error during test phase\n Test: #{test_case}\n Error: #{$!}\n#{$@}" unless $!.nil?
18
+ end
18
19
  }
19
20
  end
20
21
 
@@ -29,9 +30,36 @@ task :package => [:clean, :test, :yard] do
29
30
  end
30
31
 
31
32
  task :install => :package do
33
+ load "#{File.expand_path(File.dirname(__FILE__))}/lib/rubycom/version.rb"
32
34
  system("gem install #{File.expand_path(File.dirname(__FILE__))}/rubycom-#{Rubycom::VERSION}.gem")
33
35
  end
34
36
 
35
- task :release => :package do
36
- system("gem push #{File.expand_path(File.dirname(__FILE__))}/rubycom-#{Rubycom::VERSION}.gem")
37
+ task :version_set, [:version] do |t, args|
38
+ version_file = <<-END.gsub(/^ {4}/, '')
39
+ module Rubycom
40
+ VERSION = "#{args[:version]}"
41
+ end
42
+ END
43
+ puts "Writing version file:\n #{version_file}"
44
+ File.open("#{File.expand_path(File.dirname(__FILE__))}/lib/rubycom/version.rb", 'w+') { |file|
45
+ file.write(version_file)
46
+ }
47
+ file_text = File.read("#{File.expand_path(File.dirname(__FILE__))}/lib/rubycom/version.rb")
48
+ raise "Could not update version file" if file_text != version_file
49
+ end
50
+
51
+ task :release, [:version] => [:version_set, :package] do |t, args|
52
+ system("git clean -f")
53
+ system("git add .")
54
+ system("git commit -m\"Version to #{args[:version]}\"")
55
+ if $?.exitstatus == 0
56
+ system("git tag -a v#{args[:version]} -m\"Version #{args[:version]} Release\"")
57
+ if $?.exitstatus == 0
58
+ system("git push origin master --tags")
59
+ if $?.exitstatus == 0
60
+ load "#{File.expand_path(File.dirname(__FILE__))}/lib/rubycom/version.rb"
61
+ system("gem push #{File.expand_path(File.dirname(__FILE__))}/rubycom-#{Rubycom::VERSION}.gem")
62
+ end
63
+ end
64
+ end
37
65
  end
@@ -152,9 +152,14 @@ module Rubycom
152
152
  raise CLIError, "No argument available for #{param_sym}" if sorted_args[:rubycom_non_opt_arg].nil? || sorted_args[:rubycom_non_opt_arg].length == 0
153
153
  Hash[param_sym, sorted_args[:rubycom_non_opt_arg].shift]
154
154
  elsif def_hash[:type] == :opt
155
- Hash[param_sym, ((sorted_args[param_sym]) ? sorted_args[param_sym] : ((sorted_args[:rubycom_non_opt_arg].shift || parameters[param_sym][:default]) rescue parameters[param_sym][:default]))]
155
+ if sorted_args[param_sym].nil?
156
+ arg = (sorted_args[:rubycom_non_opt_arg].nil? || sorted_args[:rubycom_non_opt_arg].empty?) ? parameters[param_sym][:default] : sorted_args[:rubycom_non_opt_arg].shift
157
+ else
158
+ arg = sorted_args[param_sym]
159
+ end
160
+ Hash[param_sym, arg]
156
161
  elsif def_hash[:type] == :rest
157
- ret = Hash[param_sym, ((sorted_args[param_sym]) ? sorted_args[param_sym] : sorted_args[:rubycom_non_opt_arg])]
162
+ ret = Hash[param_sym, ((!sorted_args[param_sym].nil?) ? sorted_args[param_sym] : sorted_args[:rubycom_non_opt_arg])]
158
163
  sorted_args[:rubycom_non_opt_arg] = []
159
164
  ret
160
165
  end
@@ -1,3 +1,3 @@
1
- module Rubycom
2
- VERSION = "0.2.4"
3
- end
1
+ module Rubycom
2
+ VERSION = "0.2.5"
3
+ end
@@ -708,8 +708,8 @@ class TestRubycom < Test::Unit::TestCase
708
708
  def test_full_run_mixed_args
709
709
  mod = "util_test_module.rb"
710
710
  command = "test_command_mixed_options"
711
- args = "testing_arg \"[test1, test2]\" -test_opt='testing_option' \"{a: 'test_hsh_arg'}\" some other args"
712
- expected = 'test_arg=testing_arg test_arr=["test1", "test2"] test_opt=testing_option test_hsh={"a"=>"test_hsh_arg"} test_rest=["some", "other", "args"]'+"\n"
711
+ args = "testing_arg \"[test1, test2]\" -test_opt='testing_option' \"{a: 'test_hsh_arg'}\" -test_bool=true some other args"
712
+ expected = 'test_arg=testing_arg test_arr=["test1", "test2"] test_opt=testing_option test_hsh={"a"=>"test_hsh_arg"} test_bool=true test_rest=["some", "other", "args"]'+"\n"
713
713
  result = %x(ruby #{File.expand_path(File.dirname(__FILE__))}/#{mod} #{command} #{args})
714
714
  assert_equal(expected, result)
715
715
  end
@@ -718,7 +718,7 @@ class TestRubycom < Test::Unit::TestCase
718
718
  mod = "util_test_module.rb"
719
719
  command = "test_command_mixed_options"
720
720
  args = "testing_arg [test1,test2] -test_opt='testing_option' \"{a: 'test_hsh_arg'}\" some other args"
721
- expected = 'test_arg=testing_arg test_arr=["test1", "test2"] test_opt=testing_option test_hsh={"a"=>"test_hsh_arg"} test_rest=["some", "other", "args"]'+"\n"
721
+ expected = 'test_arg=testing_arg test_arr=["test1", "test2"] test_opt=testing_option test_hsh={"a"=>"test_hsh_arg"} test_bool=some test_rest=["other", "args"]'+"\n"
722
722
  result = %x(ruby #{File.expand_path(File.dirname(__FILE__))}/#{mod} #{command} #{args})
723
723
  assert_equal(expected, result)
724
724
  end
@@ -726,8 +726,8 @@ class TestRubycom < Test::Unit::TestCase
726
726
  def test_full_run_mixed_args_quoted_solid_arr
727
727
  mod = "util_test_module.rb"
728
728
  command = "test_command_mixed_options"
729
- args = 'testing_arg "[test1,test2]" -test_opt="testing_option" "{a: "test_hsh_arg"}" some other args'
730
- expected = 'test_arg=testing_arg test_arr=["test1", "test2"] test_opt=testing_option test_hsh={"a"=>"test_hsh_arg"} test_rest=["some", "other", "args"]'+"\n"
729
+ args = 'testing_arg "[test1,test2]" -test_opt="testing_option" "{a: "test_hsh_arg"}" -test_bool=false some other args'
730
+ expected = 'test_arg=testing_arg test_arr=["test1", "test2"] test_opt=testing_option test_hsh={"a"=>"test_hsh_arg"} test_bool=false test_rest=["some", "other", "args"]'+"\n"
731
731
  result = %x(ruby #{File.expand_path(File.dirname(__FILE__))}/#{mod} #{command} #{args})
732
732
  assert_equal(expected, result)
733
733
  end
@@ -735,8 +735,8 @@ class TestRubycom < Test::Unit::TestCase
735
735
  def test_full_run_mixed_args_odd_sp
736
736
  mod = "util_test_module.rb"
737
737
  command = "test_command_mixed_options"
738
- args = 'testing_arg "[ test1 , test2 ]" -test_opt="testing_option" "{ a: "test_hsh_arg" }" some other args'
739
- expected = 'test_arg=testing_arg test_arr=["test1", "test2"] test_opt=testing_option test_hsh={"a"=>"test_hsh_arg"} test_rest=["some", "other", "args"]'+"\n"
738
+ args = 'testing_arg "[ test1 , test2 ]" -test_opt="testing_option" "{ a: "test_hsh_arg" }" -test_bool=false some other args'
739
+ expected = 'test_arg=testing_arg test_arr=["test1", "test2"] test_opt=testing_option test_hsh={"a"=>"test_hsh_arg"} test_bool=false test_rest=["some", "other", "args"]'+"\n"
740
740
  result = %x(ruby #{File.expand_path(File.dirname(__FILE__))}/#{mod} #{command} #{args})
741
741
  assert_equal(expected, result)
742
742
  end
@@ -744,8 +744,17 @@ class TestRubycom < Test::Unit::TestCase
744
744
  def test_full_run_mixed_args_hash_rocket
745
745
  mod = "util_test_module.rb"
746
746
  command = "test_command_mixed_options"
747
- args = 'testing_arg "[ test1 , test2 ]" -test_opt="testing_option" "{ :a => "test_hsh_arg" }" some other args'
748
- expected = 'test_arg=testing_arg test_arr=["test1", "test2"] test_opt=testing_option test_hsh={ :a => test_hsh_arg } test_rest=["some", "other", "args"]'+"\n"
747
+ args = 'testing_arg "[ test1 , test2 ]" -test_opt="testing_option" "{ :a => "test_hsh_arg" }" false some other args'
748
+ expected = 'test_arg=testing_arg test_arr=["test1", "test2"] test_opt=testing_option test_hsh={ :a => test_hsh_arg } test_bool=false test_rest=["some", "other", "args"]'+"\n"
749
+ result = %x(ruby #{File.expand_path(File.dirname(__FILE__))}/#{mod} #{command} #{args})
750
+ assert_equal(expected, result)
751
+ end
752
+
753
+ def test_full_run_mixed_args_no_rest
754
+ mod = "util_test_module.rb"
755
+ command = "test_command_mixed_options"
756
+ args = "testing_arg \"[test1, test2]\" -test_opt='testing_option' \"{a: 'test_hsh_arg'}\""
757
+ expected = 'test_arg=testing_arg test_arr=["test1", "test2"] test_opt=testing_option test_hsh={"a"=>"test_hsh_arg"} test_bool=true test_rest=[]'+"\n"
749
758
  result = %x(ruby #{File.expand_path(File.dirname(__FILE__))}/#{mod} #{command} #{args})
750
759
  assert_equal(expected, result)
751
760
  end
@@ -104,8 +104,8 @@ module UtilTestModule
104
104
  end
105
105
 
106
106
  # A test_command with several mixed options
107
- def self.test_command_mixed_options(test_arg, test_arr=[], test_opt='test_opt_arg', test_hsh={}, *test_rest)
108
- "test_arg=#{test_arg} test_arr=#{test_arr} test_opt=#{test_opt} test_hsh=#{test_hsh} test_rest=#{test_rest}"
107
+ def self.test_command_mixed_options(test_arg, test_arr=[], test_opt='test_opt_arg', test_hsh={}, test_bool=true, *test_rest)
108
+ "test_arg=#{test_arg} test_arr=#{test_arr} test_opt=#{test_opt} test_hsh=#{test_hsh} test_bool=#{test_bool} test_rest=#{test_rest}"
109
109
  end
110
110
 
111
111
  include Rubycom
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubycom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Purcell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-19 00:00:00.000000000 Z
11
+ date: 2013-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler