vex 0.2 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -37,6 +37,7 @@ lib/vex/active_record/validation_error_ext.rb
37
37
  lib/vex/base.rb
38
38
  lib/vex/base/app.rb
39
39
  lib/vex/base/array/at_random.rb
40
+ lib/vex/base/array/avg.rb
40
41
  lib/vex/base/array/cross.rb
41
42
  lib/vex/base/array/each_batch.rb
42
43
  lib/vex/base/array/parallel_map.rb
@@ -73,6 +74,7 @@ lib/vex/base/range_array.rb
73
74
  lib/vex/base/range_ext.rb
74
75
  lib/vex/base/safe_token.rb
75
76
  lib/vex/base/string/string_ext.rb
77
+ lib/vex/base/system.rb
76
78
  lib/vex/base/thread/deferred.rb
77
79
  lib/vex/base/thread/sleep.rb
78
80
  lib/vex/base/time/date_ext.rb
@@ -81,7 +83,6 @@ lib/vex/boot/array.rb
81
83
  lib/vex/boot/blank.rb
82
84
  lib/vex/boot/string.rb
83
85
  migration/create_request_log.rb
84
- r.rb
85
86
  script/console
86
87
  script/rebuild
87
88
  tasks/echoe.rake
@@ -93,20 +94,4 @@ test/base.rb
93
94
  test/boot.rb
94
95
  test/config/local.defaults.yml
95
96
  test/config/local.yml
96
- test/test.sqlite3
97
- test/test.sqlite3.Class#create.lck
98
- test/test.sqlite3.Class#create.lck.lck
99
- test/test.sqlite3.Class#create.lck.pid
100
- test/test.sqlite3.Class#create.pid
101
- test/test.sqlite3.LiteView.make.holders__view_dummy.lck
102
- test/test.sqlite3.LiteView.make.holders__view_dummy.lck.lck
103
- test/test.sqlite3.LiteView.make.holders__view_dummy.lck.pid
104
- test/test.sqlite3.LiteView.make.holders__view_dummy.pid
105
- test/test.sqlite3.vex.lck
106
97
  test/test_helper.rb
107
- test/tmp/copy.dat
108
- test/tmp/lock.sqlite3
109
- test/tmp/lock.sqlite3.etest.lck
110
- test/tmp/lock.sqlite3.etest.pid
111
- test/tmp/somedata.dat
112
- vex.tmproj
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2
1
+ 0.2.1
@@ -1,7 +1,6 @@
1
1
  #
2
2
  # require all dependent gems
3
3
  require 'nokogiri'
4
- require 'openssl'
5
4
 
6
5
  require 'etest'
7
6
  require 'sanitize'
data/config/gem.yml CHANGED
@@ -4,4 +4,8 @@ author: pboy
4
4
  email: eno-pboy@open-lab.org
5
5
  ignore_pattern:
6
6
  - "tmp/*"
7
+ - "test/tmp/*"
8
+ - "test/*.sqlite3*"
7
9
  - "**/.*"
10
+ - "vex.tmproj"
11
+
@@ -93,5 +93,5 @@ module ActionController::VerifyAction
93
93
  end
94
94
 
95
95
  class ActionController::Base
96
- include VerifyAction
96
+ include ActionController::VerifyAction
97
97
  end
@@ -15,6 +15,46 @@ module ActiveRecord::FindByExtension
15
15
  find_by(args, opts) ||
16
16
  raise(ActiveRecord::RecordNotFound, "Couldn't find #{self} with #{args.inspect}")
17
17
  end
18
+
19
+
20
+ def create_by!(args, opts, &block)
21
+ args = opts.update(args) if opts
22
+ obj = new args
23
+ if block_given?
24
+ yield(obj)
25
+ end
26
+ obj.save!
27
+ obj
28
+ end
29
+
30
+ def find_or_create_by(args, opts = nil, &block)
31
+ find(:first, :conditions => args) || create_by!(args, opts, &block)
32
+ end
33
+
34
+ def find_or_create_all_by(args, opts = nil, &block)
35
+ requested = args.cross
36
+
37
+ models = find_all_by(args)
38
+ return models if requested.length == models.length
39
+
40
+ # TODO: Check locking
41
+ connection.locked("#{self.class.name}#create") do
42
+ models = find_all_by(args)
43
+ return models if requested.length == models.length
44
+
45
+ keys = args.keys
46
+ missing = requested - models.map do |model|
47
+ args.keys.inject({}) do |hash, key| hash.update key => model.send(key) end
48
+ end
49
+
50
+ # TODO: Potential mass insert, when no block given
51
+ missing.each do |data|
52
+ models << create_by!(data, opts, &block)
53
+ end
54
+ end
55
+
56
+ models
57
+ end
18
58
  end
19
59
 
20
60
  class ActiveRecord::Base
@@ -65,4 +65,4 @@ module ActiveRecord::Errors::Unique::Etest
65
65
  obj.errors.add "value", "zzz"
66
66
  assert_equal(%w(xxx yyyy zzz), obj.errors["value"])
67
67
  end
68
- end
68
+ end if VEX_TEST == "active_record"
@@ -0,0 +1,23 @@
1
+ module Array::Average
2
+ def avg
3
+ return 0 if empty?
4
+
5
+ sum = inject(0) { |s, i| s + i }
6
+
7
+ avg = sum / length
8
+ return avg if length * avg == sum
9
+ sum * 1.0 / length
10
+ end
11
+ end
12
+
13
+ class Array
14
+ include Average
15
+ end
16
+
17
+ module Array::Average::Etest
18
+ def test_avg
19
+ assert_equal(1, [ 1 ].avg)
20
+ assert_equal(2, [ 1, 3 ].avg)
21
+ assert_equal(0, [ ].avg)
22
+ end
23
+ end
@@ -1 +1 @@
1
- 7394.106710
1
+ 21526.106710
@@ -4,6 +4,14 @@ module StringExt
4
4
  rescue LoadError, NameError
5
5
  STDERR.puts $!.to_s
6
6
  end
7
+
8
+ def upcase?
9
+ self == upcase
10
+ end
11
+
12
+ def downcase?
13
+ self == downcase
14
+ end
7
15
 
8
16
  def uri?
9
17
  !!(self =~ /^[a-z][a-z]+:/)
@@ -133,4 +141,18 @@ module StringExt::Etest
133
141
  assert_equal String, "String".constantize?
134
142
  assert_equal nil, "I::Dont::Know::This".constantize?
135
143
  end
144
+
145
+ def test_downcase
146
+ assert_equal true, "expected".downcase?
147
+ assert_equal false, "Expected".downcase?
148
+ assert_equal false, "EXPECTED".downcase?
149
+
150
+ assert_equal false, "expected".upcase?
151
+ assert_equal false, "Expected".upcase?
152
+ assert_equal true, "EXPECTED".upcase?
153
+
154
+ assert_equal true, "".upcase?
155
+ assert_equal true, "".downcase?
156
+ end
157
+
136
158
  end if VEX_TEST == "base"
@@ -0,0 +1,81 @@
1
+ module System
2
+ class ProcessFailed < RuntimeError;
3
+ attr_reader :cmd, :exitstatus
4
+
5
+ def initialize(cmd)
6
+ @cmd, @exitstatus = cmd, $?.exitstatus
7
+ end
8
+
9
+ def to_s
10
+ "exit code: #{exitstatus}"
11
+ end
12
+
13
+ end
14
+
15
+ def self.sys!(*args)
16
+ cmd = args.join(" ")
17
+
18
+ benchmark "**** Running #{cmd}" do
19
+ next true if system(cmd)
20
+ raise ProcessFailed, cmd
21
+ end
22
+ end
23
+
24
+ def self.sys(*args)
25
+ sys!(*args)
26
+ rescue ProcessFailed
27
+ App.logger.warn "#{args.join(" ")}: #{$!}"
28
+ false
29
+ end
30
+
31
+ def self.uname
32
+ @uname ||= `uname`.chomp
33
+ end
34
+
35
+ def self.name
36
+ case uname
37
+ when "Darwin" then :osx
38
+ when "Linux" then :linux
39
+ else raise "Unsupported OS uname #{uname}"
40
+ end
41
+ end
42
+
43
+ def self.linux?
44
+ uname == "Linux"
45
+ end
46
+
47
+ def self.which(binary)
48
+ r = `which #{binary}`.chomp
49
+ r.blank? ? nil : r
50
+ end
51
+
52
+ def self.which!(binary)
53
+ which(binary) || abort("Missing binary #{binary}")
54
+ end
55
+ end
56
+
57
+ module Hash::Etest
58
+ def test_system
59
+ assert_equal true, System.sys("true")
60
+ assert_equal false, System.sys("false")
61
+ assert_equal false, System.sys("command_not_existing")
62
+ end
63
+
64
+ def test_system!
65
+ assert_nothing_raised { System.sys!("true") }
66
+ assert_raise(System::ProcessFailed) { System.sys!("false") }
67
+ assert_raise(System::ProcessFailed) { System.sys!("command_not_existing") }
68
+ end
69
+
70
+ def test_which
71
+ assert_equal "/bin/ls", System.which("ls")
72
+ assert_equal nil, System.which("lslslslslslslslslslslslslslsls")
73
+ end
74
+
75
+ def test_which!
76
+ assert_equal "/bin/ls", System.which!("ls")
77
+ assert_raise(SystemExit) {
78
+ System.which!("lslslslslslslslslslslslslslsls")
79
+ }
80
+ end
81
+ end
data/lib/vex/base.rb CHANGED
@@ -1,2 +1,3 @@
1
1
  require "#{File.dirname(__FILE__)}/boot"
2
2
  Vex.load_directory "base"
3
+ Vex.load_directory "nokogiri"
data/lib/vex.rb CHANGED
@@ -1,3 +1,7 @@
1
+ if !defined?(VEX_TEST)
2
+ VEX_TEST=""
3
+ end
4
+
1
5
  require "#{File.dirname(__FILE__)}/vex/boot"
2
6
  Vex.load_directory "base"
3
7
 
data/vex.gemspec CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{vex}
5
- s.version = "0.2"
5
+ s.version = "0.2.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["pboy"]
9
- s.date = %q{2010-03-05}
9
+ s.date = %q{2010-03-09}
10
10
  s.description = %q{Vex: some ruby extensions}
11
11
  s.email = %q{eno-pboy@open-lab.org}
12
- s.extra_rdoc_files = ["lib/nokogiri/nokogiri_ext.rb", "lib/vex.rb", "lib/vex/action_controller.rb", "lib/vex/action_controller/verify_action.rb", "lib/vex/action_controller/whitelisted_actions.rb", "lib/vex/active_record.rb", "lib/vex/active_record/__init__.rb", "lib/vex/active_record/advisory_lock.rb", "lib/vex/active_record/advisory_lock/mysql_adapter.rb", "lib/vex/active_record/advisory_lock/sqlite_adapter.rb", "lib/vex/active_record/belongs_to_many.rb", "lib/vex/active_record/find_by_extension.rb", "lib/vex/active_record/gem.rb", "lib/vex/active_record/lite_table.rb", "lib/vex/active_record/lite_view.rb", "lib/vex/active_record/mass_load.rb", "lib/vex/active_record/mysql_backup.rb", "lib/vex/active_record/plugins/default_value_for/LICENSE.TXT", "lib/vex/active_record/plugins/default_value_for/README.rdoc", "lib/vex/active_record/plugins/default_value_for/Rakefile", "lib/vex/active_record/plugins/default_value_for/init.rb", "lib/vex/active_record/plugins/default_value_for/test.rb", "lib/vex/active_record/plugins/default_value_for/test.sqlite3", "lib/vex/active_record/random_id.rb", "lib/vex/active_record/resolver.rb", "lib/vex/active_record/serialize_hash.rb", "lib/vex/active_record/to_html.rb", "lib/vex/active_record/validate.rb", "lib/vex/active_record/validation_error_ext.rb", "lib/vex/base.rb", "lib/vex/base/app.rb", "lib/vex/base/array/at_random.rb", "lib/vex/base/array/cross.rb", "lib/vex/base/array/each_batch.rb", "lib/vex/base/array/parallel_map.rb", "lib/vex/base/deprecation.rb", "lib/vex/base/enumerable/deep.rb", "lib/vex/base/enumerable/enumerable_ext.rb", "lib/vex/base/enumerable/progress.rb", "lib/vex/base/filesystem/fast_copy.rb", "lib/vex/base/filesystem/grep.rb", "lib/vex/base/filesystem/lock.rb", "lib/vex/base/filesystem/lock.rb.test.lck", "lib/vex/base/filesystem/lock.rb.test.pid", "lib/vex/base/filesystem/make_dirs.rb", "lib/vex/base/filesystem/parse_filename.rb", "lib/vex/base/filesystem/tmp_file.rb", "lib/vex/base/filesystem/write.rb", "lib/vex/base/hash/compact.rb", "lib/vex/base/hash/cross.rb", "lib/vex/base/hash/easy_access.rb", "lib/vex/base/hash/ensure_keys.rb", "lib/vex/base/hash/extract.rb", "lib/vex/base/hash/extras.rb", "lib/vex/base/hash/inspect.rb", "lib/vex/base/hash/simple_access_methods.rb", "lib/vex/base/invalid_argument/invalid_argument.rb", "lib/vex/base/local_conf.rb", "lib/vex/base/net/http_ext.rb", "lib/vex/base/net/socket_ext.rb", "lib/vex/base/object/insp.rb", "lib/vex/base/object/multiple_attributes.rb", "lib/vex/base/object/singleton_methods.rb", "lib/vex/base/object/with_benchmark.rb", "lib/vex/base/range_array.rb", "lib/vex/base/range_ext.rb", "lib/vex/base/safe_token.rb", "lib/vex/base/string/string_ext.rb", "lib/vex/base/thread/deferred.rb", "lib/vex/base/thread/sleep.rb", "lib/vex/base/time/date_ext.rb", "lib/vex/boot.rb", "lib/vex/boot/array.rb", "lib/vex/boot/blank.rb", "lib/vex/boot/string.rb", "tasks/echoe.rake", "tasks/validate_db.rake"]
13
- s.files = ["Manifest", "Rakefile", "VERSION", "config/README", "config/dependencies.rb", "config/gem.yml", "init.rb", "lib/nokogiri/nokogiri_ext.rb", "lib/vex.rb", "lib/vex/action_controller.rb", "lib/vex/action_controller/verify_action.rb", "lib/vex/action_controller/whitelisted_actions.rb", "lib/vex/active_record.rb", "lib/vex/active_record/__init__.rb", "lib/vex/active_record/advisory_lock.rb", "lib/vex/active_record/advisory_lock/mysql_adapter.rb", "lib/vex/active_record/advisory_lock/sqlite_adapter.rb", "lib/vex/active_record/belongs_to_many.rb", "lib/vex/active_record/find_by_extension.rb", "lib/vex/active_record/gem.rb", "lib/vex/active_record/lite_table.rb", "lib/vex/active_record/lite_view.rb", "lib/vex/active_record/mass_load.rb", "lib/vex/active_record/mysql_backup.rb", "lib/vex/active_record/plugins/default_value_for/LICENSE.TXT", "lib/vex/active_record/plugins/default_value_for/README.rdoc", "lib/vex/active_record/plugins/default_value_for/Rakefile", "lib/vex/active_record/plugins/default_value_for/init.rb", "lib/vex/active_record/plugins/default_value_for/test.rb", "lib/vex/active_record/plugins/default_value_for/test.sqlite3", "lib/vex/active_record/random_id.rb", "lib/vex/active_record/resolver.rb", "lib/vex/active_record/serialize_hash.rb", "lib/vex/active_record/to_html.rb", "lib/vex/active_record/validate.rb", "lib/vex/active_record/validation_error_ext.rb", "lib/vex/base.rb", "lib/vex/base/app.rb", "lib/vex/base/array/at_random.rb", "lib/vex/base/array/cross.rb", "lib/vex/base/array/each_batch.rb", "lib/vex/base/array/parallel_map.rb", "lib/vex/base/deprecation.rb", "lib/vex/base/enumerable/deep.rb", "lib/vex/base/enumerable/enumerable_ext.rb", "lib/vex/base/enumerable/progress.rb", "lib/vex/base/filesystem/fast_copy.rb", "lib/vex/base/filesystem/grep.rb", "lib/vex/base/filesystem/lock.rb", "lib/vex/base/filesystem/lock.rb.test.lck", "lib/vex/base/filesystem/lock.rb.test.pid", "lib/vex/base/filesystem/make_dirs.rb", "lib/vex/base/filesystem/parse_filename.rb", "lib/vex/base/filesystem/tmp_file.rb", "lib/vex/base/filesystem/write.rb", "lib/vex/base/hash/compact.rb", "lib/vex/base/hash/cross.rb", "lib/vex/base/hash/easy_access.rb", "lib/vex/base/hash/ensure_keys.rb", "lib/vex/base/hash/extract.rb", "lib/vex/base/hash/extras.rb", "lib/vex/base/hash/inspect.rb", "lib/vex/base/hash/simple_access_methods.rb", "lib/vex/base/invalid_argument/invalid_argument.rb", "lib/vex/base/local_conf.rb", "lib/vex/base/net/http_ext.rb", "lib/vex/base/net/socket_ext.rb", "lib/vex/base/object/insp.rb", "lib/vex/base/object/multiple_attributes.rb", "lib/vex/base/object/singleton_methods.rb", "lib/vex/base/object/with_benchmark.rb", "lib/vex/base/range_array.rb", "lib/vex/base/range_ext.rb", "lib/vex/base/safe_token.rb", "lib/vex/base/string/string_ext.rb", "lib/vex/base/thread/deferred.rb", "lib/vex/base/thread/sleep.rb", "lib/vex/base/time/date_ext.rb", "lib/vex/boot.rb", "lib/vex/boot/array.rb", "lib/vex/boot/blank.rb", "lib/vex/boot/string.rb", "migration/create_request_log.rb", "r.rb", "script/console", "script/rebuild", "tasks/echoe.rake", "tasks/validate_db.rake", "test/ar.rb", "test/auto.rb", "test/base-tests/local_conf.rb", "test/base.rb", "test/boot.rb", "test/config/local.defaults.yml", "test/config/local.yml", "test/test.sqlite3", "test/test.sqlite3.Class#create.lck", "test/test.sqlite3.Class#create.lck.lck", "test/test.sqlite3.Class#create.lck.pid", "test/test.sqlite3.Class#create.pid", "test/test.sqlite3.LiteView.make.holders__view_dummy.lck", "test/test.sqlite3.LiteView.make.holders__view_dummy.lck.lck", "test/test.sqlite3.LiteView.make.holders__view_dummy.lck.pid", "test/test.sqlite3.LiteView.make.holders__view_dummy.pid", "test/test.sqlite3.vex.lck", "test/test_helper.rb", "test/tmp/copy.dat", "test/tmp/lock.sqlite3", "test/tmp/lock.sqlite3.etest.lck", "test/tmp/lock.sqlite3.etest.pid", "test/tmp/somedata.dat", "vex.tmproj", "vex.gemspec"]
12
+ s.extra_rdoc_files = ["lib/nokogiri/nokogiri_ext.rb", "lib/vex.rb", "lib/vex/action_controller.rb", "lib/vex/action_controller/verify_action.rb", "lib/vex/action_controller/whitelisted_actions.rb", "lib/vex/active_record.rb", "lib/vex/active_record/__init__.rb", "lib/vex/active_record/advisory_lock.rb", "lib/vex/active_record/advisory_lock/mysql_adapter.rb", "lib/vex/active_record/advisory_lock/sqlite_adapter.rb", "lib/vex/active_record/belongs_to_many.rb", "lib/vex/active_record/find_by_extension.rb", "lib/vex/active_record/gem.rb", "lib/vex/active_record/lite_table.rb", "lib/vex/active_record/lite_view.rb", "lib/vex/active_record/mass_load.rb", "lib/vex/active_record/mysql_backup.rb", "lib/vex/active_record/plugins/default_value_for/LICENSE.TXT", "lib/vex/active_record/plugins/default_value_for/README.rdoc", "lib/vex/active_record/plugins/default_value_for/Rakefile", "lib/vex/active_record/plugins/default_value_for/init.rb", "lib/vex/active_record/plugins/default_value_for/test.rb", "lib/vex/active_record/plugins/default_value_for/test.sqlite3", "lib/vex/active_record/random_id.rb", "lib/vex/active_record/resolver.rb", "lib/vex/active_record/serialize_hash.rb", "lib/vex/active_record/to_html.rb", "lib/vex/active_record/validate.rb", "lib/vex/active_record/validation_error_ext.rb", "lib/vex/base.rb", "lib/vex/base/app.rb", "lib/vex/base/array/at_random.rb", "lib/vex/base/array/avg.rb", "lib/vex/base/array/cross.rb", "lib/vex/base/array/each_batch.rb", "lib/vex/base/array/parallel_map.rb", "lib/vex/base/deprecation.rb", "lib/vex/base/enumerable/deep.rb", "lib/vex/base/enumerable/enumerable_ext.rb", "lib/vex/base/enumerable/progress.rb", "lib/vex/base/filesystem/fast_copy.rb", "lib/vex/base/filesystem/grep.rb", "lib/vex/base/filesystem/lock.rb", "lib/vex/base/filesystem/lock.rb.test.lck", "lib/vex/base/filesystem/lock.rb.test.pid", "lib/vex/base/filesystem/make_dirs.rb", "lib/vex/base/filesystem/parse_filename.rb", "lib/vex/base/filesystem/tmp_file.rb", "lib/vex/base/filesystem/write.rb", "lib/vex/base/hash/compact.rb", "lib/vex/base/hash/cross.rb", "lib/vex/base/hash/easy_access.rb", "lib/vex/base/hash/ensure_keys.rb", "lib/vex/base/hash/extract.rb", "lib/vex/base/hash/extras.rb", "lib/vex/base/hash/inspect.rb", "lib/vex/base/hash/simple_access_methods.rb", "lib/vex/base/invalid_argument/invalid_argument.rb", "lib/vex/base/local_conf.rb", "lib/vex/base/net/http_ext.rb", "lib/vex/base/net/socket_ext.rb", "lib/vex/base/object/insp.rb", "lib/vex/base/object/multiple_attributes.rb", "lib/vex/base/object/singleton_methods.rb", "lib/vex/base/object/with_benchmark.rb", "lib/vex/base/range_array.rb", "lib/vex/base/range_ext.rb", "lib/vex/base/safe_token.rb", "lib/vex/base/string/string_ext.rb", "lib/vex/base/system.rb", "lib/vex/base/thread/deferred.rb", "lib/vex/base/thread/sleep.rb", "lib/vex/base/time/date_ext.rb", "lib/vex/boot.rb", "lib/vex/boot/array.rb", "lib/vex/boot/blank.rb", "lib/vex/boot/string.rb", "tasks/echoe.rake", "tasks/validate_db.rake"]
13
+ s.files = ["Manifest", "Rakefile", "VERSION", "config/README", "config/dependencies.rb", "config/gem.yml", "init.rb", "lib/nokogiri/nokogiri_ext.rb", "lib/vex.rb", "lib/vex/action_controller.rb", "lib/vex/action_controller/verify_action.rb", "lib/vex/action_controller/whitelisted_actions.rb", "lib/vex/active_record.rb", "lib/vex/active_record/__init__.rb", "lib/vex/active_record/advisory_lock.rb", "lib/vex/active_record/advisory_lock/mysql_adapter.rb", "lib/vex/active_record/advisory_lock/sqlite_adapter.rb", "lib/vex/active_record/belongs_to_many.rb", "lib/vex/active_record/find_by_extension.rb", "lib/vex/active_record/gem.rb", "lib/vex/active_record/lite_table.rb", "lib/vex/active_record/lite_view.rb", "lib/vex/active_record/mass_load.rb", "lib/vex/active_record/mysql_backup.rb", "lib/vex/active_record/plugins/default_value_for/LICENSE.TXT", "lib/vex/active_record/plugins/default_value_for/README.rdoc", "lib/vex/active_record/plugins/default_value_for/Rakefile", "lib/vex/active_record/plugins/default_value_for/init.rb", "lib/vex/active_record/plugins/default_value_for/test.rb", "lib/vex/active_record/plugins/default_value_for/test.sqlite3", "lib/vex/active_record/random_id.rb", "lib/vex/active_record/resolver.rb", "lib/vex/active_record/serialize_hash.rb", "lib/vex/active_record/to_html.rb", "lib/vex/active_record/validate.rb", "lib/vex/active_record/validation_error_ext.rb", "lib/vex/base.rb", "lib/vex/base/app.rb", "lib/vex/base/array/at_random.rb", "lib/vex/base/array/avg.rb", "lib/vex/base/array/cross.rb", "lib/vex/base/array/each_batch.rb", "lib/vex/base/array/parallel_map.rb", "lib/vex/base/deprecation.rb", "lib/vex/base/enumerable/deep.rb", "lib/vex/base/enumerable/enumerable_ext.rb", "lib/vex/base/enumerable/progress.rb", "lib/vex/base/filesystem/fast_copy.rb", "lib/vex/base/filesystem/grep.rb", "lib/vex/base/filesystem/lock.rb", "lib/vex/base/filesystem/lock.rb.test.lck", "lib/vex/base/filesystem/lock.rb.test.pid", "lib/vex/base/filesystem/make_dirs.rb", "lib/vex/base/filesystem/parse_filename.rb", "lib/vex/base/filesystem/tmp_file.rb", "lib/vex/base/filesystem/write.rb", "lib/vex/base/hash/compact.rb", "lib/vex/base/hash/cross.rb", "lib/vex/base/hash/easy_access.rb", "lib/vex/base/hash/ensure_keys.rb", "lib/vex/base/hash/extract.rb", "lib/vex/base/hash/extras.rb", "lib/vex/base/hash/inspect.rb", "lib/vex/base/hash/simple_access_methods.rb", "lib/vex/base/invalid_argument/invalid_argument.rb", "lib/vex/base/local_conf.rb", "lib/vex/base/net/http_ext.rb", "lib/vex/base/net/socket_ext.rb", "lib/vex/base/object/insp.rb", "lib/vex/base/object/multiple_attributes.rb", "lib/vex/base/object/singleton_methods.rb", "lib/vex/base/object/with_benchmark.rb", "lib/vex/base/range_array.rb", "lib/vex/base/range_ext.rb", "lib/vex/base/safe_token.rb", "lib/vex/base/string/string_ext.rb", "lib/vex/base/system.rb", "lib/vex/base/thread/deferred.rb", "lib/vex/base/thread/sleep.rb", "lib/vex/base/time/date_ext.rb", "lib/vex/boot.rb", "lib/vex/boot/array.rb", "lib/vex/boot/blank.rb", "lib/vex/boot/string.rb", "migration/create_request_log.rb", "script/console", "script/rebuild", "tasks/echoe.rake", "tasks/validate_db.rake", "test/ar.rb", "test/auto.rb", "test/base-tests/local_conf.rb", "test/base.rb", "test/boot.rb", "test/config/local.defaults.yml", "test/config/local.yml", "test/test_helper.rb", "vex.gemspec"]
14
14
  s.homepage = %q{http://github.com/pboy/vex}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Vex"]
16
16
  s.require_paths = ["lib"]
@@ -25,14 +25,12 @@ Gem::Specification.new do |s|
25
25
 
26
26
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
27
27
  s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
28
- s.add_runtime_dependency(%q<openssl>, [">= 0"])
29
28
  s.add_runtime_dependency(%q<etest>, [">= 0"])
30
29
  s.add_runtime_dependency(%q<sanitize>, [">= 0"])
31
30
  s.add_runtime_dependency(%q<htmlentities>, [">= 0"])
32
31
  s.add_runtime_dependency(%q<json>, [">= 0"])
33
32
  else
34
33
  s.add_dependency(%q<nokogiri>, [">= 0"])
35
- s.add_dependency(%q<openssl>, [">= 0"])
36
34
  s.add_dependency(%q<etest>, [">= 0"])
37
35
  s.add_dependency(%q<sanitize>, [">= 0"])
38
36
  s.add_dependency(%q<htmlentities>, [">= 0"])
@@ -40,7 +38,6 @@ Gem::Specification.new do |s|
40
38
  end
41
39
  else
42
40
  s.add_dependency(%q<nokogiri>, [">= 0"])
43
- s.add_dependency(%q<openssl>, [">= 0"])
44
41
  s.add_dependency(%q<etest>, [">= 0"])
45
42
  s.add_dependency(%q<sanitize>, [">= 0"])
46
43
  s.add_dependency(%q<htmlentities>, [">= 0"])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vex
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.2"
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - pboy
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-05 00:00:00 +01:00
12
+ date: 2010-03-09 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,16 +22,6 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: "0"
24
24
  version:
25
- - !ruby/object:Gem::Dependency
26
- name: openssl
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: "0"
34
- version:
35
25
  - !ruby/object:Gem::Dependency
36
26
  name: etest
37
27
  type: :runtime
@@ -111,6 +101,7 @@ extra_rdoc_files:
111
101
  - lib/vex/base.rb
112
102
  - lib/vex/base/app.rb
113
103
  - lib/vex/base/array/at_random.rb
104
+ - lib/vex/base/array/avg.rb
114
105
  - lib/vex/base/array/cross.rb
115
106
  - lib/vex/base/array/each_batch.rb
116
107
  - lib/vex/base/array/parallel_map.rb
@@ -147,6 +138,7 @@ extra_rdoc_files:
147
138
  - lib/vex/base/range_ext.rb
148
139
  - lib/vex/base/safe_token.rb
149
140
  - lib/vex/base/string/string_ext.rb
141
+ - lib/vex/base/system.rb
150
142
  - lib/vex/base/thread/deferred.rb
151
143
  - lib/vex/base/thread/sleep.rb
152
144
  - lib/vex/base/time/date_ext.rb
@@ -196,6 +188,7 @@ files:
196
188
  - lib/vex/base.rb
197
189
  - lib/vex/base/app.rb
198
190
  - lib/vex/base/array/at_random.rb
191
+ - lib/vex/base/array/avg.rb
199
192
  - lib/vex/base/array/cross.rb
200
193
  - lib/vex/base/array/each_batch.rb
201
194
  - lib/vex/base/array/parallel_map.rb
@@ -232,6 +225,7 @@ files:
232
225
  - lib/vex/base/range_ext.rb
233
226
  - lib/vex/base/safe_token.rb
234
227
  - lib/vex/base/string/string_ext.rb
228
+ - lib/vex/base/system.rb
235
229
  - lib/vex/base/thread/deferred.rb
236
230
  - lib/vex/base/thread/sleep.rb
237
231
  - lib/vex/base/time/date_ext.rb
@@ -240,7 +234,6 @@ files:
240
234
  - lib/vex/boot/blank.rb
241
235
  - lib/vex/boot/string.rb
242
236
  - migration/create_request_log.rb
243
- - r.rb
244
237
  - script/console
245
238
  - script/rebuild
246
239
  - tasks/echoe.rake
@@ -252,23 +245,7 @@ files:
252
245
  - test/boot.rb
253
246
  - test/config/local.defaults.yml
254
247
  - test/config/local.yml
255
- - test/test.sqlite3
256
- - test/test.sqlite3.Class#create.lck
257
- - test/test.sqlite3.Class#create.lck.lck
258
- - test/test.sqlite3.Class#create.lck.pid
259
- - test/test.sqlite3.Class#create.pid
260
- - test/test.sqlite3.LiteView.make.holders__view_dummy.lck
261
- - test/test.sqlite3.LiteView.make.holders__view_dummy.lck.lck
262
- - test/test.sqlite3.LiteView.make.holders__view_dummy.lck.pid
263
- - test/test.sqlite3.LiteView.make.holders__view_dummy.pid
264
- - test/test.sqlite3.vex.lck
265
248
  - test/test_helper.rb
266
- - test/tmp/copy.dat
267
- - test/tmp/lock.sqlite3
268
- - test/tmp/lock.sqlite3.etest.lck
269
- - test/tmp/lock.sqlite3.etest.pid
270
- - test/tmp/somedata.dat
271
- - vex.tmproj
272
249
  - vex.gemspec
273
250
  has_rdoc: true
274
251
  homepage: http://github.com/pboy/vex
data/r.rb DELETED
@@ -1,35 +0,0 @@
1
- def a
2
- puts "a"
3
- end
4
-
5
- def b
6
- puts "b"
7
- end
8
-
9
- def f
10
- a
11
- yield
12
- ensure
13
- b
14
- end
15
-
16
-
17
-
18
-
19
-
20
-
21
- f do
22
- puts "inner"
23
- end
24
-
25
-
26
- cc = nil
27
-
28
- f do
29
- callcc { |s| cc = s }
30
- end
31
-
32
- cc.call
33
-
34
- #
35
- #a
data/test/test.sqlite3 DELETED
Binary file
File without changes
File without changes
@@ -1 +0,0 @@
1
- 1929.106710
@@ -1 +0,0 @@
1
- 51615.106710
@@ -1 +0,0 @@
1
- 51615.106710
File without changes
data/test/tmp/copy.dat DELETED
@@ -1 +0,0 @@
1
- hey
Binary file
File without changes
@@ -1 +0,0 @@
1
- 2784.20009720
@@ -1,61 +0,0 @@
1
- module FileUtils::FastCopy
2
- # fast_copy a file: This hardlinks the source file to the destfile,
3
- # if possible. src must refer to a file; dest must refer to a file
4
- # or not exist at all.
5
- def fast_copy(src, dest)
6
- src_stat = File.stat(src)
7
- invalid_argument!(src) unless src_stat.file?
8
-
9
- dest_stat = begin
10
- File.stat(dest)
11
- rescue Errno::ENOENT
12
- end
13
-
14
- invalid_argument!(dest) unless !dest_stat || dest_stat.file?
15
-
16
- dest_dev = dest_stat ? dest_stat.dev : begin
17
- dest_dir = File.dirname(File.expand_path(dest))
18
- File.stat(dest_dir).dev
19
- end
20
-
21
- if src_stat.dev == dest_dev
22
- File.unlink(dest) if File.exists?(dest)
23
- File.link src, dest
24
- else
25
- FileUtils.copy src, dest
26
- end
27
- end
28
- end
29
-
30
- FileUtils.extend FileUtils::FastCopy
31
-
32
- module FileUtils::FastCopy::Etest
33
- def test_fast_copy
34
- assert File.exist?(__FILE__)
35
- File.unlink("tmp/somedata.dat") if File.exist?("tmp/somedata.dat")
36
-
37
- assert !File.exist?("tmp/somedata.dat")
38
- FileUtils.fast_copy __FILE__, "tmp/somedata.dat"
39
- assert_equal File.read("tmp/somedata.dat"), File.read(__FILE__)
40
-
41
- File.unlink("tmp/somedata.dat")
42
- File.touch("tmp/somedata.dat")
43
- assert_not_equal File.size("tmp/somedata.dat"), File.size(__FILE__)
44
- FileUtils.fast_copy __FILE__, "tmp/somedata.dat"
45
- assert_equal File.size("tmp/somedata.dat"), File.size(__FILE__)
46
- end
47
-
48
- def test_fast_copy_failures
49
- assert_raise(Errno::ENOENT) {
50
- FileUtils.fast_copy "fixtures/somedata.dat.nonexisting", "tmp/somedata.dat"
51
- }
52
-
53
- assert_raise(Errno::ENOENT) {
54
- FileUtils.fast_copy "fixtures/somedata.dat.nonexisting", "tmp"
55
- }
56
-
57
- assert_raise(Errno::ENOENT) {
58
- FileUtils.fast_copy __FILE__, "tmp/nonexisting/dir"
59
- }
60
- end
61
- end if VEX_TEST == "base"
data/vex.tmproj DELETED
@@ -1,186 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>currentDocument</key>
6
- <string>test/test_helper.rb</string>
7
- <key>documents</key>
8
- <array>
9
- <dict>
10
- <key>expanded</key>
11
- <true/>
12
- <key>name</key>
13
- <string>vex</string>
14
- <key>regexFolderFilter</key>
15
- <string>!.*/(\.[^/]*|CVS|coverage|pkg|_darcs|_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
16
- <key>sourceDirectory</key>
17
- <string></string>
18
- </dict>
19
- </array>
20
- <key>fileHierarchyDrawerWidth</key>
21
- <integer>339</integer>
22
- <key>metaData</key>
23
- <dict>
24
- <key>lib/vex.rb</key>
25
- <dict>
26
- <key>caret</key>
27
- <dict>
28
- <key>column</key>
29
- <integer>0</integer>
30
- <key>line</key>
31
- <integer>5</integer>
32
- </dict>
33
- <key>firstVisibleColumn</key>
34
- <integer>0</integer>
35
- <key>firstVisibleLine</key>
36
- <integer>0</integer>
37
- </dict>
38
- <key>lib/vex/action_controller.rb</key>
39
- <dict>
40
- <key>caret</key>
41
- <dict>
42
- <key>column</key>
43
- <integer>0</integer>
44
- <key>line</key>
45
- <integer>3</integer>
46
- </dict>
47
- <key>firstVisibleColumn</key>
48
- <integer>0</integer>
49
- <key>firstVisibleLine</key>
50
- <integer>0</integer>
51
- </dict>
52
- <key>lib/vex/action_controller/verify_action.rb</key>
53
- <dict>
54
- <key>caret</key>
55
- <dict>
56
- <key>column</key>
57
- <integer>0</integer>
58
- <key>line</key>
59
- <integer>96</integer>
60
- </dict>
61
- <key>firstVisibleColumn</key>
62
- <integer>0</integer>
63
- <key>firstVisibleLine</key>
64
- <integer>50</integer>
65
- </dict>
66
- <key>lib/vex/action_controller/whitelisted_actions.rb</key>
67
- <dict>
68
- <key>caret</key>
69
- <dict>
70
- <key>column</key>
71
- <integer>0</integer>
72
- <key>line</key>
73
- <integer>9</integer>
74
- </dict>
75
- <key>firstVisibleColumn</key>
76
- <integer>0</integer>
77
- <key>firstVisibleLine</key>
78
- <integer>0</integer>
79
- </dict>
80
- <key>lib/vex/active_record.rb</key>
81
- <dict>
82
- <key>caret</key>
83
- <dict>
84
- <key>column</key>
85
- <integer>0</integer>
86
- <key>line</key>
87
- <integer>3</integer>
88
- </dict>
89
- <key>columnSelection</key>
90
- <false/>
91
- <key>firstVisibleColumn</key>
92
- <integer>0</integer>
93
- <key>firstVisibleLine</key>
94
- <integer>0</integer>
95
- <key>selectFrom</key>
96
- <dict>
97
- <key>column</key>
98
- <integer>0</integer>
99
- <key>line</key>
100
- <integer>0</integer>
101
- </dict>
102
- <key>selectTo</key>
103
- <dict>
104
- <key>column</key>
105
- <integer>0</integer>
106
- <key>line</key>
107
- <integer>3</integer>
108
- </dict>
109
- </dict>
110
- <key>lib/vex/active_record/lite_table.rb</key>
111
- <dict>
112
- <key>caret</key>
113
- <dict>
114
- <key>column</key>
115
- <integer>19</integer>
116
- <key>line</key>
117
- <integer>77</integer>
118
- </dict>
119
- <key>columnSelection</key>
120
- <false/>
121
- <key>firstVisibleColumn</key>
122
- <integer>0</integer>
123
- <key>firstVisibleLine</key>
124
- <integer>53</integer>
125
- <key>selectFrom</key>
126
- <dict>
127
- <key>column</key>
128
- <integer>10</integer>
129
- <key>line</key>
130
- <integer>77</integer>
131
- </dict>
132
- <key>selectTo</key>
133
- <dict>
134
- <key>column</key>
135
- <integer>19</integer>
136
- <key>line</key>
137
- <integer>77</integer>
138
- </dict>
139
- </dict>
140
- <key>test/test_helper.rb</key>
141
- <dict>
142
- <key>caret</key>
143
- <dict>
144
- <key>column</key>
145
- <integer>25</integer>
146
- <key>line</key>
147
- <integer>17</integer>
148
- </dict>
149
- <key>columnSelection</key>
150
- <false/>
151
- <key>firstVisibleColumn</key>
152
- <integer>0</integer>
153
- <key>firstVisibleLine</key>
154
- <integer>0</integer>
155
- <key>selectFrom</key>
156
- <dict>
157
- <key>column</key>
158
- <integer>12</integer>
159
- <key>line</key>
160
- <integer>17</integer>
161
- </dict>
162
- <key>selectTo</key>
163
- <dict>
164
- <key>column</key>
165
- <integer>25</integer>
166
- <key>line</key>
167
- <integer>17</integer>
168
- </dict>
169
- </dict>
170
- </dict>
171
- <key>openDocuments</key>
172
- <array>
173
- <string>lib/vex/active_record/lite_table.rb</string>
174
- <string>lib/vex.rb</string>
175
- <string>lib/vex/active_record.rb</string>
176
- <string>lib/vex/action_controller.rb</string>
177
- <string>lib/vex/action_controller/whitelisted_actions.rb</string>
178
- <string>lib/vex/action_controller/verify_action.rb</string>
179
- <string>test/test_helper.rb</string>
180
- </array>
181
- <key>showFileHierarchyDrawer</key>
182
- <true/>
183
- <key>windowFrame</key>
184
- <string>{{10, 0}, {927, 1002}}</string>
185
- </dict>
186
- </plist>