brightbox-rujitsu 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG ADDED
@@ -0,0 +1,36 @@
1
+ = Version 0.1.8 (2009-01-24)
2
+
3
+ Added String#truncate + matching specs
4
+
5
+ = Version 0.1.7 (2008-12-08)
6
+
7
+ Added the limiter to Range#random_numbers
8
+
9
+ = Version 0.1.6 (2008-12-08)
10
+
11
+ Added a limiter to Fixnum#random_numbers
12
+
13
+ = Version 0.1.5 (2008-12-03)
14
+
15
+ Added random_vowels and random_consonants
16
+
17
+ = Version 0.1.4 (2008-11-27)
18
+
19
+ Added the grammar section
20
+
21
+ = Version 0.1.3 (2008-11-24)
22
+
23
+ Cleaned up invalid characters
24
+ Refactored generate_random_string_using method (thanks to zachinglis)
25
+
26
+ = Version 0.1.2 (2008-11-24)
27
+
28
+ Added full test suite
29
+
30
+ = Version 0.1.1 (2008-11-22)
31
+
32
+ Added range based random character generation
33
+
34
+ = Version 0.1.0 (2008-11-22)
35
+
36
+ Initial Release; random character generation, URL-friendly strings.
data/README.rdoc ADDED
@@ -0,0 +1,65 @@
1
+ = rujitsu
2
+
3
+ A ruby gem with various helper methods to smooth out your Ruby development.
4
+
5
+ == Install
6
+
7
+ gem install brightbox-rujitsu --source http://gems.github.com
8
+
9
+ == Including
10
+
11
+ require "rujitsu"
12
+ require "rujitsu/grammar"
13
+
14
+ === Rails
15
+
16
+ To require in rails 2.2, add the following to your +environment.rb+ file.
17
+
18
+ config.gem "brightbox-rujitsu", :lib => "rujitsu", :source => "http://gems.github.com"
19
+ config.gem "brightbox-rujitsu", :lib => "rujitsu/grammar", :source => "http://gems.github.com"
20
+
21
+
22
+ == Usage
23
+
24
+ === Generating random strings
25
+
26
+ The Fixnum class has a couple of extensions allowing you to generate random strings.
27
+
28
+ 5.random_letters
29
+ 5.random_numbers
30
+ 5.random_characters
31
+
32
+ You can also generate a variable length string.
33
+
34
+ (3..5).random_letters
35
+
36
+ This generates a string of random letters whose length is 3, 4 or 5 characters.
37
+
38
+ === URL-friendly strings
39
+
40
+ The String class has an extension that strips out URL-unfriendly characters.
41
+
42
+ ""$%hello!@ 123 there'".to_url # => "hello-123-there"
43
+
44
+ === Truncating strings
45
+
46
+ The String class has an extension that truncates it to a customisable length with a customisable suffix.
47
+
48
+ "this is a string".truncate(:length => 15) # => "this is a st..."
49
+
50
+ === Grammar
51
+
52
+ So far the grammar library just adds the method +should_recieve+ for rspec assertions. Use it to find out what it does!
53
+
54
+
55
+ == Released under the MIT Licence
56
+
57
+ Copyright (c) 2008 Brightbox Systems Ltd
58
+
59
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
60
+
61
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
62
+
63
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
64
+
65
+ See http://www.brightbox.co.uk/ for contact details.
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('rujitsu', '0.1.8') do | config |
6
+ config.description = 'Various helper methods to smooth over Ruby development'
7
+ config.url = 'http://github.com/rahoub/rujitsu'
8
+ config.author = 'Brightbox Systems Ltd'
9
+ config.email = 'hello@brightbox.co.uk'
10
+ config.ignore_pattern = ['tmp/*', 'script/*']
11
+ config.development_dependencies = []
12
+ end
13
+
14
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each do | rake_file |
15
+ load rake_file
16
+ end
@@ -0,0 +1,53 @@
1
+ class Fixnum
2
+ # produce a string of N random vowels
3
+ def random_vowels
4
+ generate_random_string_using VOWELS
5
+ end
6
+ # produce a string of N random consonants
7
+ def random_consonants
8
+ generate_random_string_using CONSONANTS
9
+ end
10
+ # produce a string of N random letters
11
+ # 5.random_letters
12
+ def random_letters
13
+ generate_random_string_using LETTERS
14
+ end
15
+ # produce a string of N random numbers
16
+ # 5.random_numbers
17
+ # optionally specific limits on the numbers
18
+ # 5.random_numbers(:from => 1, :to => 5)
19
+ def random_numbers( opts = {} )
20
+ # Then set some defaults, just in case
21
+ upper = opts[:to] || 9
22
+ lower = opts[:from] || 0
23
+
24
+ # And finally calculate the number
25
+ n = []
26
+ self.times do
27
+ i = (lower..upper).to_a.sort_by { rand }.first
28
+ n << i.to_s
29
+ end
30
+ n.join("")
31
+ end
32
+ # produce a string of N random characters
33
+ # 5.random_characters
34
+ def random_characters
35
+ generate_random_string_using CHARACTERS
36
+ end
37
+
38
+ private
39
+
40
+ VOWELS = ['a', 'e', 'i', 'o', 'u']
41
+ LETTERS = ('a'..'z').to_a
42
+ CONSONANTS = LETTERS - VOWELS
43
+ NUMBERS = ('0'..'9').to_a
44
+ CHARACTERS = LETTERS + NUMBERS
45
+
46
+ def generate_random_string_using(legal_characters)
47
+ upper_limit = legal_characters.size - 1
48
+ (1..self).collect do |num|
49
+ legal_characters[rand(upper_limit)]
50
+ end.join
51
+ end
52
+ end
53
+
@@ -0,0 +1,12 @@
1
+ module Spec
2
+ module Mocks
3
+ module Methods
4
+ class GrammarException < Exception; end
5
+
6
+ def should_recieve(sym, opts={}, &block)
7
+ raise GrammarException, "Oi! i before except after c."
8
+ end
9
+ end
10
+ end
11
+ end
12
+
@@ -0,0 +1,8 @@
1
+ class Numeric
2
+ # convert float values to "cents"
3
+ # my_value = 2.5
4
+ # my_value.to_cents # => 250
5
+ def to_cents
6
+ (self * 100.0).to_i
7
+ end
8
+ end
@@ -0,0 +1,26 @@
1
+ class Range
2
+ # pull a random element out of this range
3
+ def to_random_i
4
+ self.to_a.sort_by { rand }.first
5
+ end
6
+
7
+ # create a string of random letters whose length is one of the values in your range
8
+ # (3..4).random_letters # => returns a string or 3 or 4 random letters
9
+ def random_letters
10
+ self.to_random_i.random_letters
11
+ end
12
+
13
+ # create a string of random numbers whose length is one of the values in your range
14
+ # (3..4).random_numbers # => returns a string or 3 or 4 random numbers
15
+ def random_numbers opts = {}
16
+ self.to_random_i.random_numbers opts
17
+ end
18
+
19
+ # create a string of random characters whose length is one of the values in your range
20
+ # (3..4).random_characters # => returns a string or 3 or 4 random characters
21
+ def random_characters
22
+ self.to_random_i.random_characters
23
+ end
24
+
25
+ end
26
+
@@ -0,0 +1,26 @@
1
+ class String
2
+ # Return a string that can be used as part of a url
3
+ # replaces basic "bad" characters with "-"
4
+ def to_url
5
+ self.downcase.gsub(/[^\-0-9a-z ]/, '').split.join('-')
6
+ end
7
+
8
+ # Truncates a string to the specified length,
9
+ # and appends suffix if required
10
+ #
11
+ # Options:
12
+ # * +length+ length to truncate string to. Includes the suffix in the length. Default is 50.
13
+ # * +suffix+ suffix to append to truncated string. Pass "" or false for no suffix. Default is "...".
14
+ #
15
+ def truncate opts = {}
16
+ opts[:length] ||= 50
17
+ opts[:suffix] = opts.has_key?(:suffix) ? opts[:suffix] : "..."
18
+ opts[:suffix] ||= ""
19
+ opts[:length] -= (opts[:suffix].length+1)
20
+ if opts[:length] > 0
21
+ self.length > opts[:length] ? self[0..opts[:length]] + opts[:suffix] : self
22
+ else
23
+ opts[:suffix][0..(opts[:length] += opts[:suffix].length)]
24
+ end
25
+ end
26
+ end
data/lib/rujitsu.rb ADDED
@@ -0,0 +1,5 @@
1
+ base_dir = File.expand_path(File.dirname(__FILE__))
2
+ require base_dir + '/rujitsu/fixnum'
3
+ require base_dir + '/rujitsu/numeric'
4
+ require base_dir + '/rujitsu/range'
5
+ require base_dir + '/rujitsu/string'
data/rujitsu.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{rujitsu}
5
+ s.version = "0.1.8"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Brightbox Systems Ltd"]
9
+ s.date = %q{2009-01-24}
10
+ s.description = %q{Various helper methods to smooth over Ruby development}
11
+ s.email = %q{hello@brightbox.co.uk}
12
+ s.extra_rdoc_files = ["CHANGELOG", "lib/rujitsu/fixnum.rb", "lib/rujitsu/grammar.rb", "lib/rujitsu/numeric.rb", "lib/rujitsu/range.rb", "lib/rujitsu/string.rb", "lib/rujitsu.rb", "README.rdoc", "tasks/rspec.rake"]
13
+ s.files = ["CHANGELOG", "lib/rujitsu/fixnum.rb", "lib/rujitsu/grammar.rb", "lib/rujitsu/numeric.rb", "lib/rujitsu/range.rb", "lib/rujitsu/string.rb", "lib/rujitsu.rb", "Manifest", "Rakefile", "README.rdoc", "rujitsu.gemspec", "spec/fixnum_spec.rb", "spec/numeric_spec.rb", "spec/range_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/string_spec.rb", "tasks/rspec.rake"]
14
+ s.has_rdoc = true
15
+ s.homepage = %q{http://github.com/brightbox/rujitsu}
16
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rujitsu", "--main", "README.rdoc"]
17
+ s.require_paths = ["lib"]
18
+ s.rubyforge_project = %q{rujitsu}
19
+ s.rubygems_version = %q{1.3.1}
20
+ s.summary = %q{Various helper methods to smooth over Ruby development}
21
+
22
+ if s.respond_to? :specification_version then
23
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
+ s.specification_version = 2
25
+
26
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
27
+ else
28
+ end
29
+ else
30
+ end
31
+ end
@@ -0,0 +1,129 @@
1
+ require File.join(File.dirname(__FILE__) + "/spec_helper")
2
+
3
+ describe Fixnum do
4
+
5
+ describe "random_vowels" do
6
+ it "should be a method" do
7
+ Fixnum.instance_methods.should include("random_vowels")
8
+ 5.should respond_to(:random_vowels)
9
+ end
10
+
11
+ it "should produce a string of random vowels" do
12
+ [ 5, 10, 15, 25, 29 ].each do |i|
13
+ str = i.random_vowels
14
+ str.should be_a_kind_of( String )
15
+ str.length.should == i
16
+ str.should match( /^[aeiou]+$/ )
17
+ end
18
+ end
19
+ end
20
+
21
+ describe "random_consonants" do
22
+ it "should be a method" do
23
+ Fixnum.instance_methods.should include("random_consonants")
24
+ 5.should respond_to(:random_consonants)
25
+ end
26
+
27
+ it "should produce a string of random consonants" do
28
+ [ 5, 10, 15, 25, 29 ].each do |i|
29
+ str = i.random_consonants
30
+ str.should be_a_kind_of( String )
31
+ str.length.should == i
32
+ str.should match( /^[bcdfghjklmnpqrstvwxyz]+$/ )
33
+ end
34
+ end
35
+ end
36
+
37
+ describe "random_letters" do
38
+ it "should be a method" do
39
+ Fixnum.instance_methods.should include("random_letters")
40
+ 5.should respond_to(:random_letters)
41
+ end
42
+
43
+ it "should produce a string of random letters" do
44
+ [ 5, 10, 15, 25, 29 ].each do |i|
45
+ str = i.random_letters
46
+ str.should be_a_kind_of( String )
47
+ str.length.should == i
48
+ str.should match( /^[a-z]+$/ )
49
+ end
50
+ end
51
+ end
52
+
53
+ describe "random_numbers" do
54
+ it "should be a method" do
55
+ Fixnum.instance_methods.should include("random_numbers")
56
+ 5.should respond_to(:random_numbers)
57
+ end
58
+
59
+ it "should produce a string of random numbers" do
60
+ [ 5, 10, 15, 25, 29 ].each do |i|
61
+ num = i.random_numbers
62
+ num.should be_a_kind_of( String )
63
+ num.length.should == i
64
+ num.should match( /^[0-9]+$/ )
65
+ end
66
+ end
67
+
68
+ it "should contain only the number 5 upwards" do
69
+ num = 5.random_numbers(:from => 5)
70
+
71
+ num.should be_a_kind_of(String)
72
+
73
+ # Check each digit is greater than or equal to 5
74
+ string_to_integers(num).each do |i|
75
+ i.should be_a_kind_of(Integer)
76
+ i.should >= 5
77
+ end
78
+ end
79
+
80
+ it "should contain on the number 5 downwards" do
81
+ num = 5.random_numbers(:to => 5)
82
+
83
+ num.should be_a_kind_of(String)
84
+
85
+ # Check each digit is lower than or equal to 5
86
+ string_to_integers(num).each do |i|
87
+ i.should be_a_kind_of(Integer)
88
+ i.should <= 5
89
+ end
90
+ end
91
+
92
+ it "should contain numbers between 4 and 6" do
93
+ num = 5.random_numbers(:from => 4, :to => 6)
94
+
95
+ num.should be_a_kind_of(String)
96
+
97
+ # Check each digit is lower than or equal to 4..
98
+ # ..and greater than or equal to 6
99
+ string_to_integers(num).each do |i|
100
+ i.should be_a_kind_of(Integer)
101
+ i.should >= 4
102
+ i.should <= 6
103
+ end
104
+ end
105
+
106
+ private
107
+
108
+ def string_to_integers(str)
109
+ str.split("").map {|x| x.to_i }
110
+ end
111
+ end
112
+
113
+ describe "random_characters" do
114
+ it "should be a method" do
115
+ Fixnum.instance_methods.should include("random_characters")
116
+ 5.should respond_to(:random_numbers)
117
+ end
118
+
119
+ it "should produce a string of random letters and numbers" do
120
+ [ 5, 10, 15, 25, 29 ].each do |i|
121
+ str = i.random_characters
122
+ str.should be_a_kind_of( String )
123
+ str.length.should == i
124
+ str.should match( /^[a-z0-9]+$/ )
125
+ end
126
+ end
127
+ end
128
+
129
+ end
@@ -0,0 +1,14 @@
1
+ require File.join(File.dirname(__FILE__) + "/spec_helper")
2
+
3
+ describe Numeric, "to_cents" do
4
+ it "should be a method" do
5
+ Numeric.instance_methods.should include("to_cents")
6
+ Numeric.new.should respond_to(:to_cents)
7
+ end
8
+
9
+ it "should convert float values to \"cents\"" do
10
+ [ 5, 10, 15, 25, 29 ].each do |i|
11
+ i.to_cents.should == (i*100).to_i
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,117 @@
1
+ require File.join(File.dirname(__FILE__) + "/spec_helper")
2
+
3
+ describe Range do
4
+
5
+ describe "to_random_i" do
6
+ it "should be a method" do
7
+ Range.instance_methods.should include("to_random_i")
8
+ end
9
+
10
+ it "should return a random number from the range" do
11
+ setup_range
12
+
13
+ # First check with an absolute
14
+ result = @range.to_random_i
15
+ result.should be_a_kind_of(Fixnum)
16
+ result.should == 4
17
+
18
+ # And then one that is random
19
+ res = (3..5).to_random_i
20
+ res.should be_a_kind_of(Fixnum)
21
+ [3,4,5].should include(res)
22
+ end
23
+ end
24
+
25
+ describe "random_letters" do
26
+ it "should be a method" do
27
+ Range.instance_methods.should include("random_letters")
28
+ (0..1).should respond_to(:random_letters)
29
+ end
30
+
31
+ it "should generate a string of random letters" do
32
+ setup_range
33
+
34
+ str = @range.random_letters
35
+ str.length.should == 4
36
+ str.should match( /^[a-z]+$/ )
37
+ end
38
+ end
39
+
40
+ describe "random_numbers" do
41
+ it "should be a method" do
42
+ Range.instance_methods.should include("random_numbers")
43
+ (0..1).should respond_to(:random_numbers)
44
+ end
45
+
46
+ it "should generate a string of random numbers" do
47
+ setup_range
48
+
49
+ str = @range.random_numbers
50
+ str.length.should == 4
51
+ str.should match( /^[0-9]+$/ )
52
+ end
53
+
54
+ it "should contain only the number 5 upwards" do
55
+ setup_range
56
+
57
+ str = @range.random_numbers :from => 5
58
+ str.should be_a_kind_of(String)
59
+
60
+ string_to_integers(str).each do |i|
61
+ i.should be_a_kind_of(Integer)
62
+ i.should >= 5
63
+ end
64
+ end
65
+
66
+ it "should contain only the number 5 downwards" do
67
+ setup_range
68
+
69
+ str = @range.random_numbers :to => 5
70
+ str.should be_a_kind_of(String)
71
+
72
+ string_to_integers(str).each do |i|
73
+ i.should be_a_kind_of(Integer)
74
+ i.should <= 5
75
+ end
76
+ end
77
+
78
+ it "should contain only numbers between 4 and 6" do
79
+ setup_range
80
+
81
+ str = @range.random_numbers :from => 4, :to => 6
82
+ str.should be_a_kind_of(String)
83
+
84
+ string_to_integers(str).each do |i|
85
+ i.should be_a_kind_of(Integer)
86
+ i.should >= 4
87
+ i.should <= 6
88
+ end
89
+ end
90
+
91
+ private
92
+
93
+ def string_to_integers(str)
94
+ str.split("").map {|x| x.to_i }
95
+ end
96
+ end
97
+
98
+ describe "random_letters" do
99
+ it "should be a method" do
100
+ Range.instance_methods.should include("random_characters")
101
+ (0..1).should respond_to(:random_characters)
102
+ end
103
+
104
+ it "should generate a string of random letters" do
105
+ setup_range
106
+
107
+ str = @range.random_characters
108
+ str.length.should == 4
109
+ str.should match( /^[a-z0-9]+$/ )
110
+ end
111
+ end
112
+
113
+ def setup_range
114
+ @range = (3..5)
115
+ @range.should_receive(:to_random_i).and_return(4)
116
+ end
117
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1,4 @@
1
+ --colour
2
+ --format progress
3
+ --loadby mtime
4
+ --reverse
@@ -0,0 +1 @@
1
+ require File.join(File.dirname(__FILE__) + "/../lib/rujitsu")
@@ -0,0 +1,99 @@
1
+ require File.join(File.dirname(__FILE__) + "/spec_helper")
2
+
3
+ describe String, "to_url" do
4
+
5
+ it "should remove non-valid characters" do
6
+ "a!@£$".to_url.should == "a"
7
+ end
8
+
9
+ it "should convert spaces to hyphens" do
10
+ "a string".to_url.should == "a-string"
11
+ end
12
+
13
+ it "should downcase entire string" do
14
+ "THISISASTRING".to_url.should == "thisisastring"
15
+ end
16
+
17
+ it "should not touch [\\-0-9a-z]" do
18
+ "post-number-12345".to_url.should == "post-number-12345"
19
+ end
20
+
21
+ end
22
+
23
+ describe String, "truncate" do
24
+
25
+ it "should return shorter string unmodified with no params" do
26
+ str = 30.random_characters
27
+ # default length is 50
28
+ str.truncate.should == str
29
+ end
30
+
31
+ it "should return shorter string unmodified with length param" do
32
+ str = "0123456789" # length 10
33
+ trunced = str.truncate(:length => 30)
34
+ trunced.length.should == 10
35
+ trunced.should == str
36
+ end
37
+
38
+ it "should return shorter string unmodified with suffix param" do
39
+ str = "0123456789" # length 10
40
+ trunced = str.truncate(:suffix => "abcd")
41
+ trunced.length.should == 10
42
+ trunced.should == str
43
+ end
44
+
45
+ it "should return shorter string unmodified with length and suffix params" do
46
+ str = "0123456789" # length 10
47
+ trunced = str.truncate(:length => 30, :suffix => "abcd")
48
+ trunced.length.should == 10
49
+ trunced.should == str
50
+ end
51
+
52
+ it "should truncate longer string with no params" do
53
+ str = "this is a string with a really long length just to get above 50 characters"
54
+ # default length is 50
55
+ # default suffix is "..."
56
+ trunced = str.truncate
57
+ trunced.length.should == 50
58
+ trunced.should == "this is a string with a really long length just..."
59
+ end
60
+
61
+ it "should truncate longer string with length param" do
62
+ str = "123456789123456789" # length 11
63
+ trunced = str.truncate(:length => 10)
64
+ trunced.length.should == 10
65
+ trunced.should == "1234567..."
66
+ end
67
+
68
+ it "should truncate longer string with suffix param" do
69
+ str = "this is a string with a really long length just to get above 50 characters"
70
+ # default length is 50
71
+ trunced = str.truncate(:suffix => "..abc")
72
+ trunced.length.should == 50
73
+ trunced.should == "this is a string with a really long length ju..abc"
74
+ end
75
+
76
+ it "should truncate longer string with length and suffix param" do
77
+ str = "123456789123456789" # length 11
78
+ trunced = str.truncate(:length => 10, :suffix => "abde")
79
+ trunced.length.should == 10
80
+ trunced.should == "123456abde"
81
+ end
82
+
83
+ it "should return truncated string with no suffix if suffix param is false" do
84
+ str = "this is a string with a really long length just to get above 50 characters"
85
+ # default length is 50
86
+ trunced = str.truncate(:suffix => false)
87
+ trunced.length.should == 50
88
+ trunced.should == "this is a string with a really long length just to"
89
+ end
90
+
91
+ it "should return a string of length specified even when the suffix is longer" do
92
+ str = "this is a string" # => 16
93
+ suff = "this is a longer string" # => 23
94
+ trunced = str.truncate(:suffix => suff, :length => 10)
95
+ trunced.should == "this is a "
96
+ trunced.length.should == 10
97
+ end
98
+
99
+ end
data/tasks/rspec.rake ADDED
@@ -0,0 +1,24 @@
1
+ # Borrowed from http://github.com/rsim/ruby-plsql/tree/master/tasks/rspec.rake
2
+ # Github++
3
+ begin
4
+ require "spec"
5
+ rescue LoadError
6
+ require "rubygems"
7
+ require "spec"
8
+ end
9
+
10
+ begin
11
+ require "spec/rake/spectask"
12
+ rescue LoadError
13
+ puts <<-EOS
14
+ To use rspec for testing you must install rspec gem:
15
+ [sudo] gem install rspec
16
+ EOS
17
+ exit(0)
18
+ end
19
+
20
+ desc "Run the specs under spec/*"
21
+ Spec::Rake::SpecTask.new do |t|
22
+ t.spec_opts = ["--options", "spec/spec.opts"]
23
+ t.spec_files = FileList["spec/*_spec.rb"]
24
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: brightbox-rujitsu
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.8
5
+ platform: ruby
6
+ authors:
7
+ - Brightbox Systems Ltd
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-01-24 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Various helper methods to smooth over Ruby development
17
+ email: hello@brightbox.co.uk
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - CHANGELOG
24
+ - lib/rujitsu/fixnum.rb
25
+ - lib/rujitsu/grammar.rb
26
+ - lib/rujitsu/numeric.rb
27
+ - lib/rujitsu/range.rb
28
+ - lib/rujitsu/string.rb
29
+ - lib/rujitsu.rb
30
+ - README.rdoc
31
+ - tasks/rspec.rake
32
+ files:
33
+ - CHANGELOG
34
+ - lib/rujitsu/fixnum.rb
35
+ - lib/rujitsu/grammar.rb
36
+ - lib/rujitsu/numeric.rb
37
+ - lib/rujitsu/range.rb
38
+ - lib/rujitsu/string.rb
39
+ - lib/rujitsu.rb
40
+ - Manifest
41
+ - Rakefile
42
+ - README.rdoc
43
+ - rujitsu.gemspec
44
+ - spec/fixnum_spec.rb
45
+ - spec/numeric_spec.rb
46
+ - spec/range_spec.rb
47
+ - spec/spec.opts
48
+ - spec/spec_helper.rb
49
+ - spec/string_spec.rb
50
+ - tasks/rspec.rake
51
+ has_rdoc: true
52
+ homepage: http://github.com/brightbox/rujitsu
53
+ post_install_message:
54
+ rdoc_options:
55
+ - --line-numbers
56
+ - --inline-source
57
+ - --title
58
+ - Rujitsu
59
+ - --main
60
+ - README.rdoc
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ version:
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: "1.2"
74
+ version:
75
+ requirements: []
76
+
77
+ rubyforge_project: rujitsu
78
+ rubygems_version: 1.2.0
79
+ signing_key:
80
+ specification_version: 2
81
+ summary: Various helper methods to smooth over Ruby development
82
+ test_files: []
83
+