ckuru-tools 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/ckuru-tools.rb +3 -3
  2. data/lib/ckuru-tools.rb~ +11 -26
  3. metadata +31 -49
data/lib/ckuru-tools.rb CHANGED
@@ -9,7 +9,7 @@ unless defined? CkuruTools
9
9
 
10
10
  symbols.each do |symbol|
11
11
  module_eval( "def #{symbol}() @#{symbol}; end" )
12
- module_eval( "def #{symbol}=(val) raise ArgumentError.new('#{symbol} must be a #{klass}') unless val.class.inherits_from? #{klass} ; @#{symbol} = val; end" )
12
+ module_eval( "def #{symbol}=(val) raise ArgumentError.new('#{symbol} must be a #{klass}, not one of ' + val.class.ancestors.to_s) unless val.class.inherits_from? #{klass} ; @#{symbol} = val; self.send(:after_#{symbol}_set) if self.respond_to?(:after_#{symbol}_set); end" )
13
13
  end
14
14
  end
15
15
  def class_accessor( klass, *symbols )
@@ -358,7 +358,7 @@ EOF
358
358
  cmd.gsub!(/\"/,"\\\\\\\\\\\"")
359
359
  system("bash -c \"#{cmd}\"")
360
360
  if $?.exitstatus != 0
361
- print " failed exit code #{$?.exitstatus} "
361
+ print " ** failed ** exit code #{$?.exitstatus} "
362
362
  end
363
363
  end
364
364
  $?
@@ -470,7 +470,7 @@ end
470
470
 
471
471
  class Time
472
472
  def ckuru_time_string
473
- strftime("%m/%d/%Y %H:%M:%S")
473
+ strftime("%m%d%Y-%H%M%S")
474
474
  end
475
475
  end
476
476
 
data/lib/ckuru-tools.rb~ CHANGED
@@ -9,7 +9,7 @@ unless defined? CkuruTools
9
9
 
10
10
  symbols.each do |symbol|
11
11
  module_eval( "def #{symbol}() @#{symbol}; end" )
12
- module_eval( "def #{symbol}=(val) raise ArgumentError.new('#{symbol} must be a #{klass}') unless val.class.inherits_from? #{klass} ; @#{symbol} = val; end" )
12
+ module_eval( "def #{symbol}=(val) raise ArgumentError.new('#{symbol} must be a #{klass}, not one of ' + val.class.ancestors.to_s) unless val.class.inherits_from? #{klass} ; @#{symbol} = val; self.send(:after_#{symbol}_set) if self.respond_to?(:after_#{symbol}_set); end" )
13
13
  end
14
14
  end
15
15
  def class_accessor( klass, *symbols )
@@ -113,7 +113,6 @@ EOF
113
113
  def self.validate_hash_arguments(h,*args)
114
114
  raise ArgumentError.new("argument to #{current_method} must be of class Hash") unless h.is_a? Hash
115
115
  ret = []
116
- _calling_method = calling_method
117
116
  args.each do |a|
118
117
  name,options = a
119
118
  options = options || {}
@@ -135,41 +134,27 @@ EOF
135
134
  if instance_that_inherits_from
136
135
  unless val.class.inherits_from? instance_that_inherits_from
137
136
  raise ArgumentError.new(
138
- "argument :#{name} to #{_calling_method} must be an instance that inherits from #{instance_that_inherits_from}, #{val.class} does not")
137
+ "argument :#{name} to #{calling_method} must be an instance that inherits from #{instance_that_inherits_from}, #{val.class} does not")
139
138
  end
140
139
  elsif instance_of
141
- if instance_of.is_a? Array
142
- good = false
143
- instance_of.each do |_instance_of|
144
- if val.class == _instance_of
145
- good = true
146
- break
147
- end
148
- end
149
- unless good
150
- raise ArgumentError.new(
151
- "argument :#{name} to #{_calling_method} must be an instance of class #{instance_of.join(',')}, not #{val.class}")
152
- end
153
- else
154
- unless val.class == instance_of
155
- raise ArgumentError.new(
156
- "argument :#{name} to #{_calling_method} must be an instance of class #{instance_of}, not #{val.class}")
157
- end
140
+ unless val.class == instance_of
141
+ raise ArgumentError.new(
142
+ "argument :#{name} to #{calling_method} must be an instance of class #{instance_of}, not #{val.class}")
158
143
  end
159
144
  elsif klass_that_inherits_from
160
- unless val.inherits_from? klass
161
- raise ArgumentError.new("argument :#{name} to #{_calling_method} must inherits from class #{klass_that_inherits_from}, #{val} does not")
145
+ unless val.inherits_from? klass_that_inherits_from
146
+ raise ArgumentError.new("argument :#{name} to #{calling_method} must inherits from class #{klass_that_inherits_from}, #{val} does not")
162
147
  end
163
148
  elsif klass_of
164
149
  unless val == klass_of
165
- raise ArgumentError.new("argument :#{name} to #{_calling_method} must be of class #{klass_of}, not #{val}")
150
+ raise ArgumentError.new("argument :#{name} to #{calling_method} must be of class #{klass_of}, not #{val}")
166
151
  end
167
152
  end
168
153
  else
169
154
  if options[:default]
170
155
  val = options[:default]
171
156
  elsif options[:required]
172
- raise ArgumentError.new("argument :#{name} to #{_calling_method} is required")
157
+ raise ArgumentError.new("argument :#{name} to #{calling_method} is required")
173
158
  end
174
159
  end
175
160
  ret.push val
@@ -373,7 +358,7 @@ EOF
373
358
  cmd.gsub!(/\"/,"\\\\\\\\\\\"")
374
359
  system("bash -c \"#{cmd}\"")
375
360
  if $?.exitstatus != 0
376
- print " failed exit code #{$?.exitstatus} "
361
+ print " ** failed ** exit code #{$?.exitstatus} "
377
362
  end
378
363
  end
379
364
  $?
@@ -485,7 +470,7 @@ end
485
470
 
486
471
  class Time
487
472
  def ckuru_time_string
488
- strftime("%m/%d/%Y %H:%M:%S")
473
+ strftime("%m/%d/%Y %H;%M;%S")
489
474
  end
490
475
  end
491
476
 
metadata CHANGED
@@ -1,87 +1,69 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ckuru-tools
3
- version: !ruby/object:Gem::Version
4
- hash: 11
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.11
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 10
10
- version: 0.0.10
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Bret Weinraub
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-06-16 00:00:00 Z
12
+ date: 2012-06-23 00:00:00.000000000Z
19
13
  dependencies: []
20
-
21
- description: The infamous ckuru-tools gem. A miscellaneous grab bag of ruby class extensions, utility classes, etc.
14
+ description: The infamous ckuru-tools gem. A miscellaneous grab bag of ruby class
15
+ extensions, utility classes, etc.
22
16
  email: bret@aura-software.com
23
17
  executables: []
24
-
25
18
  extensions: []
26
-
27
19
  extra_rdoc_files: []
28
-
29
- files:
30
- - ./spec/ckuru-tools_spec.rb
20
+ files:
31
21
  - ./spec/spec_helper.rb
32
- - ./lib/debug.rb
22
+ - ./spec/ckuru-tools_spec.rb
33
23
  - ./lib/args.rb
34
- - ./lib/ckuru-tools.rb
24
+ - ./lib/debug.rb
35
25
  - ./lib/ckuru-tools.rb~
26
+ - ./lib/ckuru-tools.rb
27
+ - ./tasks/gem.rake
36
28
  - ./tasks/notes.rake
37
- - ./tasks/rdoc.rake
38
- - ./tasks/bones.rake
39
29
  - ./tasks/git.rake
40
- - ./tasks/gem.rake
41
- - ./tasks/svn.rake
42
30
  - ./tasks/ann.rake
43
31
  - ./tasks/post_load.rake
44
32
  - ./tasks/rubyforge.rake
45
33
  - ./tasks/setup.rb
46
- - ./tasks/spec.rake
34
+ - ./tasks/bones.rake
35
+ - ./tasks/svn.rake
47
36
  - ./tasks/manifest.rake
37
+ - ./tasks/rdoc.rake
48
38
  - ./tasks/test.rake
39
+ - ./tasks/spec.rake
40
+ - ./bin/ckuru-arg-tester
49
41
  - ./bin/ckuru-tools
50
42
  - ./bin/generate_as_controller
51
- - ./bin/ckuru-arg-tester
52
43
  - ./lib/ckuru-tools/typed_array.rb
53
44
  homepage: http://www.aura-software.com
54
45
  licenses: []
55
-
56
46
  post_install_message:
57
47
  rdoc_options: []
58
-
59
- require_paths:
48
+ require_paths:
60
49
  - lib
61
- required_ruby_version: !ruby/object:Gem::Requirement
50
+ required_ruby_version: !ruby/object:Gem::Requirement
62
51
  none: false
63
- requirements:
64
- - - ">="
65
- - !ruby/object:Gem::Version
66
- hash: 3
67
- segments:
68
- - 0
69
- version: "0"
70
- required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
57
  none: false
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- hash: 3
76
- segments:
77
- - 0
78
- version: "0"
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
79
62
  requirements: []
80
-
81
63
  rubyforge_project:
82
- rubygems_version: 1.7.2
64
+ rubygems_version: 1.8.10
83
65
  signing_key:
84
66
  specification_version: 3
85
- summary: The infamous ckuru-tools gem. A miscellaneous grab bag of ruby class extensions, utility classes, etc.
67
+ summary: The infamous ckuru-tools gem. A miscellaneous grab bag of ruby class extensions,
68
+ utility classes, etc.
86
69
  test_files: []
87
-