rext 0.3.5 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,10 @@
1
1
 
2
+ 0.4.0 / 2009-11-10
3
+ ==================
4
+
5
+ * Added Hash#to_query
6
+ * Added Process.alive?
7
+
2
8
  === 0.3.5 / 2009-10-14
3
9
 
4
10
  * Refactored Object#try
data/Manifest CHANGED
@@ -26,6 +26,8 @@ lib/rext/object/helpers.rb
26
26
  lib/rext/object/metaclass.rb
27
27
  lib/rext/proc.rb
28
28
  lib/rext/proc/helpers.rb
29
+ lib/rext/process.rb
30
+ lib/rext/process/helpers.rb
29
31
  lib/rext/string.rb
30
32
  lib/rext/string/encode.rb
31
33
  lib/rext/string/helpers.rb
@@ -80,6 +80,7 @@ Below are the methods currently provided by Rext.
80
80
  * Hash
81
81
  - delete_at / extract!
82
82
  - switchify
83
+ - to_query
83
84
 
84
85
  * Time
85
86
  - in_words_since / in_words_since_now
@@ -103,6 +104,10 @@ Below are the methods currently provided by Rext.
103
104
 
104
105
  * Symbol
105
106
  - to_proc
107
+
108
+ * Process
109
+ - alive?
110
+ - pid_from_file
106
111
 
107
112
  == Contrib
108
113
 
@@ -16,3 +16,4 @@ require 'rext/integer'
16
16
  require 'rext/string'
17
17
  require 'rext/date'
18
18
  require 'rext/time'
19
+ require 'rext/process'
@@ -1,6 +1,14 @@
1
1
 
2
2
  class Hash
3
3
 
4
+
5
+ ##
6
+ # Convert self to an HTTP query string.
7
+
8
+ def to_query
9
+ Rack::Utils.build_query self
10
+ end
11
+
4
12
  ##
5
13
  # Delete key-value pairs, returning the values found
6
14
  # using the +keys+ passed. Aliased as extract!
@@ -0,0 +1,6 @@
1
+
2
+ #--
3
+ # Load Process specific rext extensions.
4
+ #++
5
+
6
+ require 'rext/process/helpers'
@@ -0,0 +1,22 @@
1
+
2
+ module Process
3
+
4
+ ##
5
+ # Check if process _pid_ is alive. Where _pid_
6
+ # may be a pidfile path, or an integer.
7
+
8
+ def self.alive? pid
9
+ pid = pid_from_file(pid) if String === pid
10
+ Process.kill 0, pid if Numeric === pid
11
+ rescue Errno::ESRCH
12
+ end
13
+
14
+ ##
15
+ # Get pid integer from pidfile at _path_.
16
+
17
+ def self.pid_from_file path
18
+ if File.exists? path
19
+ File.read(path).to_i
20
+ end
21
+ end
22
+ end
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Rext
3
- VERSION = '0.3.5'
3
+ VERSION = '0.4.0'
4
4
  end
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{rext}
5
- s.version = "0.3.5"
5
+ s.version = "0.4.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["TJ Holowaychuk"]
9
- s.date = %q{2009-10-14}
9
+ s.date = %q{2009-11-10}
10
10
  s.description = %q{Ruby extensions}
11
11
  s.email = %q{tj@vision-media.ca}
12
- s.extra_rdoc_files = ["README.rdoc", "lib/rext.rb", "lib/rext/all.rb", "lib/rext/array.rb", "lib/rext/array/helpers.rb", "lib/rext/date.rb", "lib/rext/date/helpers.rb", "lib/rext/enumerable.rb", "lib/rext/enumerable/helpers.rb", "lib/rext/hash.rb", "lib/rext/hash/helpers.rb", "lib/rext/integer.rb", "lib/rext/integer/helpers.rb", "lib/rext/module.rb", "lib/rext/module/helpers.rb", "lib/rext/numeric.rb", "lib/rext/numeric/bytes.rb", "lib/rext/numeric/time.rb", "lib/rext/object.rb", "lib/rext/object/helpers.rb", "lib/rext/object/metaclass.rb", "lib/rext/proc.rb", "lib/rext/proc/helpers.rb", "lib/rext/string.rb", "lib/rext/string/encode.rb", "lib/rext/string/helpers.rb", "lib/rext/symbol.rb", "lib/rext/symbol/helpers.rb", "lib/rext/time.rb", "lib/rext/time/helpers.rb", "lib/rext/version.rb", "tasks/benchmark.rake", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake"]
13
- s.files = ["History.rdoc", "Manifest", "README.rdoc", "Rakefile", "benchmarks/enumerable.rb", "benchmarks/proc.rb", "lib/rext.rb", "lib/rext/all.rb", "lib/rext/array.rb", "lib/rext/array/helpers.rb", "lib/rext/date.rb", "lib/rext/date/helpers.rb", "lib/rext/enumerable.rb", "lib/rext/enumerable/helpers.rb", "lib/rext/hash.rb", "lib/rext/hash/helpers.rb", "lib/rext/integer.rb", "lib/rext/integer/helpers.rb", "lib/rext/module.rb", "lib/rext/module/helpers.rb", "lib/rext/numeric.rb", "lib/rext/numeric/bytes.rb", "lib/rext/numeric/time.rb", "lib/rext/object.rb", "lib/rext/object/helpers.rb", "lib/rext/object/metaclass.rb", "lib/rext/proc.rb", "lib/rext/proc/helpers.rb", "lib/rext/string.rb", "lib/rext/string/encode.rb", "lib/rext/string/helpers.rb", "lib/rext/symbol.rb", "lib/rext/symbol/helpers.rb", "lib/rext/time.rb", "lib/rext/time/helpers.rb", "lib/rext/version.rb", "rext.gemspec", "spec/array_spec.rb", "spec/date_spec.rb", "spec/enumerable_spec.rb", "spec/hash_spec.rb", "spec/integer_spec.rb", "spec/module_spec.rb", "spec/numeric_spec.rb", "spec/object_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/string_spec.rb", "spec/symbol_spec.rb", "spec/time_spec.rb", "tasks/benchmark.rake", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake"]
12
+ s.extra_rdoc_files = ["README.rdoc", "lib/rext.rb", "lib/rext/all.rb", "lib/rext/array.rb", "lib/rext/array/helpers.rb", "lib/rext/date.rb", "lib/rext/date/helpers.rb", "lib/rext/enumerable.rb", "lib/rext/enumerable/helpers.rb", "lib/rext/hash.rb", "lib/rext/hash/helpers.rb", "lib/rext/integer.rb", "lib/rext/integer/helpers.rb", "lib/rext/module.rb", "lib/rext/module/helpers.rb", "lib/rext/numeric.rb", "lib/rext/numeric/bytes.rb", "lib/rext/numeric/time.rb", "lib/rext/object.rb", "lib/rext/object/helpers.rb", "lib/rext/object/metaclass.rb", "lib/rext/proc.rb", "lib/rext/proc/helpers.rb", "lib/rext/process.rb", "lib/rext/process/helpers.rb", "lib/rext/string.rb", "lib/rext/string/encode.rb", "lib/rext/string/helpers.rb", "lib/rext/symbol.rb", "lib/rext/symbol/helpers.rb", "lib/rext/time.rb", "lib/rext/time/helpers.rb", "lib/rext/version.rb", "tasks/benchmark.rake", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake"]
13
+ s.files = ["History.rdoc", "Manifest", "README.rdoc", "Rakefile", "benchmarks/enumerable.rb", "benchmarks/proc.rb", "lib/rext.rb", "lib/rext/all.rb", "lib/rext/array.rb", "lib/rext/array/helpers.rb", "lib/rext/date.rb", "lib/rext/date/helpers.rb", "lib/rext/enumerable.rb", "lib/rext/enumerable/helpers.rb", "lib/rext/hash.rb", "lib/rext/hash/helpers.rb", "lib/rext/integer.rb", "lib/rext/integer/helpers.rb", "lib/rext/module.rb", "lib/rext/module/helpers.rb", "lib/rext/numeric.rb", "lib/rext/numeric/bytes.rb", "lib/rext/numeric/time.rb", "lib/rext/object.rb", "lib/rext/object/helpers.rb", "lib/rext/object/metaclass.rb", "lib/rext/proc.rb", "lib/rext/proc/helpers.rb", "lib/rext/process.rb", "lib/rext/process/helpers.rb", "lib/rext/string.rb", "lib/rext/string/encode.rb", "lib/rext/string/helpers.rb", "lib/rext/symbol.rb", "lib/rext/symbol/helpers.rb", "lib/rext/time.rb", "lib/rext/time/helpers.rb", "lib/rext/version.rb", "rext.gemspec", "spec/array_spec.rb", "spec/date_spec.rb", "spec/enumerable_spec.rb", "spec/hash_spec.rb", "spec/integer_spec.rb", "spec/module_spec.rb", "spec/numeric_spec.rb", "spec/object_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/string_spec.rb", "spec/symbol_spec.rb", "spec/time_spec.rb", "tasks/benchmark.rake", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake"]
14
14
  s.homepage = %q{http://github.com/visionmedia/rext}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rext", "--main", "README.rdoc"]
16
16
  s.require_paths = ["lib"]
@@ -14,6 +14,13 @@ describe Hash do
14
14
  end
15
15
  end
16
16
 
17
+ describe "#to_query" do
18
+ it "should build a query string" do
19
+ { :foo => 'bar' }.to_query.should == 'foo=bar'
20
+ { :foo => 'bar', :baz => 'yay' }.to_query.should == 'foo=bar&baz=yay'
21
+ end
22
+ end
23
+
17
24
  describe "#switchify" do
18
25
  it "should work with bools" do
19
26
  { :use_foobar => true }.switchify.should == ['--use-foobar']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - TJ Holowaychuk
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-14 00:00:00 -07:00
12
+ date: 2009-11-10 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -43,6 +43,8 @@ extra_rdoc_files:
43
43
  - lib/rext/object/metaclass.rb
44
44
  - lib/rext/proc.rb
45
45
  - lib/rext/proc/helpers.rb
46
+ - lib/rext/process.rb
47
+ - lib/rext/process/helpers.rb
46
48
  - lib/rext/string.rb
47
49
  - lib/rext/string/encode.rb
48
50
  - lib/rext/string/helpers.rb
@@ -84,6 +86,8 @@ files:
84
86
  - lib/rext/object/metaclass.rb
85
87
  - lib/rext/proc.rb
86
88
  - lib/rext/proc/helpers.rb
89
+ - lib/rext/process.rb
90
+ - lib/rext/process/helpers.rb
87
91
  - lib/rext/string.rb
88
92
  - lib/rext/string/encode.rb
89
93
  - lib/rext/string/helpers.rb