sugar-high 0.5.1 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +10 -3
- data/Rakefile +45 -13
- data/VERSION +1 -1
- data/lib/sugar-high/string.rb +6 -4
- data/spec/sugar-high/string_spec.rb +36 -1
- data/sugar-high.gemspec +20 -14
- metadata +39 -16
data/Gemfile
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
source 'http://rubygems.org'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
gem "activesupport", '>= 3.0.1'
|
4
|
+
|
5
|
+
group :test, :development do
|
6
|
+
gem "rspec", ">= 2.4.0"
|
7
|
+
end
|
8
|
+
|
9
|
+
group :development do
|
10
|
+
gem "jeweler", ">= 1.6.4"
|
11
|
+
gem "bundler", ">= 1.0.1"
|
12
|
+
gem "rdoc"
|
6
13
|
end
|
7
14
|
|
data/Rakefile
CHANGED
@@ -1,15 +1,47 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
1
5
|
begin
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
gem.email = "kmandrup@gmail.com"
|
8
|
-
gem.homepage = "http://github.com/kristianmandrup/sugar-high"
|
9
|
-
gem.authors = ["Kristian Mandrup"]
|
10
|
-
gem.add_development_dependency "rspec", ">= 2.5"
|
11
|
-
end
|
12
|
-
Jeweler::GemcutterTasks.new
|
13
|
-
rescue LoadError
|
14
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
15
11
|
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
gem.name = "sugar-high"
|
17
|
+
gem.summary = %Q{Ruby convenience sugar packs!}
|
18
|
+
gem.description = %Q{More Ruby sugar - inspired by the 'zuker' project}
|
19
|
+
gem.email = "kmandrup@gmail.com"
|
20
|
+
gem.homepage = "http://github.com/kristianmandrup/sugar-high"
|
21
|
+
gem.email = "kmandrup@gmail.com"
|
22
|
+
gem.authors = ["Kristian Mandrup"]
|
23
|
+
# dependencies defined in Gemfile
|
24
|
+
end
|
25
|
+
Jeweler::RubygemsDotOrgTasks.new
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
Rake::TestTask.new(:test) do |test|
|
29
|
+
test.libs << 'lib' << 'test'
|
30
|
+
test.pattern = 'test/**/test_*.rb'
|
31
|
+
test.verbose = true
|
32
|
+
end
|
33
|
+
|
34
|
+
task :default => :test
|
35
|
+
|
36
|
+
require 'rake/rdoctask'
|
37
|
+
Rake::RDocTask.new do |rdoc|
|
38
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
39
|
+
|
40
|
+
rdoc.rdoc_dir = 'rdoc'
|
41
|
+
rdoc.title = "sugar-high #{version}"
|
42
|
+
rdoc.rdoc_files.include('README*')
|
43
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.3
|
data/lib/sugar-high/string.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'sugar-high/array'
|
2
|
+
|
1
3
|
class String
|
2
4
|
def self.random_letters count, type = :lower
|
3
5
|
letters(type).pick(count)
|
@@ -8,14 +10,14 @@ class String
|
|
8
10
|
type == :upper ? letters.map!(&:upcase) : letters
|
9
11
|
end
|
10
12
|
|
11
|
-
unless respond_to? :trim
|
13
|
+
unless new.respond_to? :trim
|
12
14
|
def trim
|
13
15
|
self.strip
|
14
16
|
end
|
15
17
|
end
|
16
|
-
|
17
|
-
unless respond_to? :
|
18
|
-
def
|
18
|
+
|
19
|
+
unless new.respond_to? :concats
|
20
|
+
def concats *args
|
19
21
|
args.inject(self) do |res, arg|
|
20
22
|
res << arg.to_s
|
21
23
|
res
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'rails'
|
2
3
|
require 'sugar-high/string'
|
3
4
|
|
4
5
|
describe "SugarHigh" do
|
@@ -19,7 +20,41 @@ describe "SugarHigh" do
|
|
19
20
|
end
|
20
21
|
blip}
|
21
22
|
end
|
22
|
-
|
23
|
+
|
24
|
+
|
25
|
+
describe 'String class methods' do
|
26
|
+
describe 'letters' do
|
27
|
+
it "should return lowercase ASCII letters" do
|
28
|
+
String.letters.should include('a', 'z')
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should return lowercase ASCII letters" do
|
32
|
+
String.letters(:upper).should include('A', 'Z')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe 'random_letters' do
|
37
|
+
it "should return random lowercase ASCII letters" do
|
38
|
+
String.random_letters(2).join.should match /[a-z]+/
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should return lowercase ASCII letters" do
|
42
|
+
String.random_letters(2, :upper).join.should match /[A-Z]+/
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'trim' do
|
48
|
+
it "should work and not conflict with rails" do
|
49
|
+
" ab ".trim.should == "ab"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'concats' do
|
54
|
+
it "should work and not conflict with rails" do
|
55
|
+
"a".concats("x", :y, "z").should == "axyz"
|
56
|
+
end
|
57
|
+
end
|
23
58
|
|
24
59
|
describe '#insert_before_last' do
|
25
60
|
it "should insert '# hello' before last end (default)" do
|
data/sugar-high.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sugar-high}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = [
|
12
|
-
s.date = %q{2011-
|
11
|
+
s.authors = [%q{Kristian Mandrup}]
|
12
|
+
s.date = %q{2011-08-18}
|
13
13
|
s.description = %q{More Ruby sugar - inspired by the 'zuker' project}
|
14
14
|
s.email = %q{kmandrup@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -111,26 +111,32 @@ Gem::Specification.new do |s|
|
|
111
111
|
"sugar-high.gemspec"
|
112
112
|
]
|
113
113
|
s.homepage = %q{http://github.com/kristianmandrup/sugar-high}
|
114
|
-
s.require_paths = [
|
115
|
-
s.rubygems_version = %q{1.
|
114
|
+
s.require_paths = [%q{lib}]
|
115
|
+
s.rubygems_version = %q{1.8.8}
|
116
116
|
s.summary = %q{Ruby convenience sugar packs!}
|
117
117
|
|
118
118
|
if s.respond_to? :specification_version then
|
119
119
|
s.specification_version = 3
|
120
120
|
|
121
121
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
122
|
-
s.
|
123
|
-
s.add_development_dependency(%q<
|
124
|
-
s.add_development_dependency(%q<
|
122
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 3.0.1"])
|
123
|
+
s.add_development_dependency(%q<rspec>, [">= 2.4.0"])
|
124
|
+
s.add_development_dependency(%q<jeweler>, [">= 1.6.4"])
|
125
|
+
s.add_development_dependency(%q<bundler>, [">= 1.0.1"])
|
126
|
+
s.add_development_dependency(%q<rdoc>, [">= 0"])
|
125
127
|
else
|
126
|
-
s.add_dependency(%q<
|
127
|
-
s.add_dependency(%q<
|
128
|
-
s.add_dependency(%q<
|
128
|
+
s.add_dependency(%q<activesupport>, [">= 3.0.1"])
|
129
|
+
s.add_dependency(%q<rspec>, [">= 2.4.0"])
|
130
|
+
s.add_dependency(%q<jeweler>, [">= 1.6.4"])
|
131
|
+
s.add_dependency(%q<bundler>, [">= 1.0.1"])
|
132
|
+
s.add_dependency(%q<rdoc>, [">= 0"])
|
129
133
|
end
|
130
134
|
else
|
131
|
-
s.add_dependency(%q<
|
132
|
-
s.add_dependency(%q<
|
133
|
-
s.add_dependency(%q<
|
135
|
+
s.add_dependency(%q<activesupport>, [">= 3.0.1"])
|
136
|
+
s.add_dependency(%q<rspec>, [">= 2.4.0"])
|
137
|
+
s.add_dependency(%q<jeweler>, [">= 1.6.4"])
|
138
|
+
s.add_dependency(%q<bundler>, [">= 1.0.1"])
|
139
|
+
s.add_dependency(%q<rdoc>, [">= 0"])
|
134
140
|
end
|
135
141
|
end
|
136
142
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sugar-high
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,42 +9,63 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
13
|
-
default_executable:
|
12
|
+
date: 2011-08-18 00:00:00.000000000Z
|
14
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activesupport
|
16
|
+
requirement: &2156081160 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.0.1
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2156081160
|
15
25
|
- !ruby/object:Gem::Dependency
|
16
26
|
name: rspec
|
17
|
-
requirement: &
|
27
|
+
requirement: &2156080280 !ruby/object:Gem::Requirement
|
18
28
|
none: false
|
19
29
|
requirements:
|
20
30
|
- - ! '>='
|
21
31
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
32
|
+
version: 2.4.0
|
23
33
|
type: :development
|
24
34
|
prerelease: false
|
25
|
-
version_requirements: *
|
35
|
+
version_requirements: *2156080280
|
26
36
|
- !ruby/object:Gem::Dependency
|
27
|
-
name:
|
28
|
-
requirement: &
|
37
|
+
name: jeweler
|
38
|
+
requirement: &2156078760 !ruby/object:Gem::Requirement
|
29
39
|
none: false
|
30
40
|
requirements:
|
31
41
|
- - ! '>='
|
32
42
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
43
|
+
version: 1.6.4
|
34
44
|
type: :development
|
35
45
|
prerelease: false
|
36
|
-
version_requirements: *
|
46
|
+
version_requirements: *2156078760
|
37
47
|
- !ruby/object:Gem::Dependency
|
38
|
-
name:
|
39
|
-
requirement: &
|
48
|
+
name: bundler
|
49
|
+
requirement: &2156078140 !ruby/object:Gem::Requirement
|
40
50
|
none: false
|
41
51
|
requirements:
|
42
52
|
- - ! '>='
|
43
53
|
- !ruby/object:Gem::Version
|
44
|
-
version:
|
54
|
+
version: 1.0.1
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2156078140
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rdoc
|
60
|
+
requirement: &2156077240 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
45
66
|
type: :development
|
46
67
|
prerelease: false
|
47
|
-
version_requirements: *
|
68
|
+
version_requirements: *2156077240
|
48
69
|
description: More Ruby sugar - inspired by the 'zuker' project
|
49
70
|
email: kmandrup@gmail.com
|
50
71
|
executables: []
|
@@ -145,7 +166,6 @@ files:
|
|
145
166
|
- spec/sugar-high/regexp_spec.rb
|
146
167
|
- spec/sugar-high/string_spec.rb
|
147
168
|
- sugar-high.gemspec
|
148
|
-
has_rdoc: true
|
149
169
|
homepage: http://github.com/kristianmandrup/sugar-high
|
150
170
|
licenses: []
|
151
171
|
post_install_message:
|
@@ -158,6 +178,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
158
178
|
- - ! '>='
|
159
179
|
- !ruby/object:Gem::Version
|
160
180
|
version: '0'
|
181
|
+
segments:
|
182
|
+
- 0
|
183
|
+
hash: -4226046698427202704
|
161
184
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
185
|
none: false
|
163
186
|
requirements:
|
@@ -166,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
189
|
version: '0'
|
167
190
|
requirements: []
|
168
191
|
rubyforge_project:
|
169
|
-
rubygems_version: 1.
|
192
|
+
rubygems_version: 1.8.8
|
170
193
|
signing_key:
|
171
194
|
specification_version: 3
|
172
195
|
summary: Ruby convenience sugar packs!
|