sugar-high 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +1 -0
- data/README.textile +17 -1
- data/VERSION +1 -1
- data/lib/sugar-high/dsl.rb +6 -0
- data/lib/sugar-high/rails/concerns.rb +23 -0
- data/spec/sugar-high/dsl_spec.rb +16 -0
- data/spec/sugar-high/includes_spec.rb +3 -3
- data/spec/sugar-high/module_spec.rb +8 -8
- data/spec/sugar-high/rails/concerns_spec.rb +10 -0
- data/sugar-high.gemspec +9 -2
- metadata +28 -13
data/Gemfile
CHANGED
data/README.textile
CHANGED
|
@@ -22,6 +22,7 @@ h2. Sugar packs
|
|
|
22
22
|
* array
|
|
23
23
|
* blank
|
|
24
24
|
* class_ext
|
|
25
|
+
* dsl
|
|
25
26
|
* enumerable
|
|
26
27
|
* file
|
|
27
28
|
* file_mutate (backwards compatible)
|
|
@@ -79,6 +80,21 @@ Makes it easy to autoload multiple modules by standard folder-to-module mapping
|
|
|
79
80
|
* find_first_class(*class_names)
|
|
80
81
|
* find_first_module(*module_names)
|
|
81
82
|
|
|
83
|
+
Note: This pack has recently been extracted into its own gem called *sweet_loader*
|
|
84
|
+
|
|
85
|
+
h3. DSL
|
|
86
|
+
|
|
87
|
+
* with(instance, &block) (by @stanislaw)
|
|
88
|
+
|
|
89
|
+
Useful as a building block for DSLs!
|
|
90
|
+
|
|
91
|
+
<pre>
|
|
92
|
+
with(Hash.new) do
|
|
93
|
+
merge!(:a => 1)
|
|
94
|
+
merge!(:b => 2)
|
|
95
|
+
end.should == {:a => 1, :b => 2}
|
|
96
|
+
</pre>
|
|
97
|
+
|
|
82
98
|
h3. Enumerable
|
|
83
99
|
|
|
84
100
|
* only_kinds_of?(*modules)
|
|
@@ -92,7 +108,7 @@ h3. Enumerable
|
|
|
92
108
|
* select_uniq_symbols!
|
|
93
109
|
* select_strings
|
|
94
110
|
* select_strings!
|
|
95
|
-
* select_only(type)
|
|
111
|
+
* select_only(type)
|
|
96
112
|
* select_only!(type)
|
|
97
113
|
|
|
98
114
|
h3. File
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.5.
|
|
1
|
+
0.5.4
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
class << Module
|
|
2
|
+
def concerned_with(*concerns)
|
|
3
|
+
concerns.each do |concern|
|
|
4
|
+
require_dependency "#{name.underscore}/#{concern}"
|
|
5
|
+
end
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def shared_concerns(*concerns)
|
|
9
|
+
concerns.each do |concern|
|
|
10
|
+
require_dependency "shared/#{concern}"
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def include_shared_concerns(*concerns)
|
|
15
|
+
concerns.each do |concern|
|
|
16
|
+
require_dependency "shared/#{concern}"
|
|
17
|
+
self.send :include, concern.to_s.camelize.constantize
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
alias_method :shared_concern, :shared_concerns
|
|
22
|
+
alias_method :include_shared_concern, :include_shared_concerns
|
|
23
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'sugar-high/dsl'
|
|
3
|
+
|
|
4
|
+
describe "SugarHigh" do
|
|
5
|
+
describe "DSL pack" do
|
|
6
|
+
describe '#with' do
|
|
7
|
+
it "should allow calls on instance in block" do
|
|
8
|
+
with(Hash.new) do
|
|
9
|
+
merge!(:a => 1)
|
|
10
|
+
merge!(:b => 2)
|
|
11
|
+
end.should == {:a => 1, :b => 2}
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
@@ -13,8 +13,8 @@ module Simple
|
|
|
13
13
|
'y'
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
|
-
|
|
17
|
-
includes :x, :y
|
|
16
|
+
|
|
17
|
+
includes :x, :y
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
class Xman
|
|
@@ -23,7 +23,7 @@ end
|
|
|
23
23
|
|
|
24
24
|
describe "SugarHigh" do
|
|
25
25
|
describe "Includes ext" do
|
|
26
|
-
describe '#includes' do
|
|
26
|
+
describe '#includes' do
|
|
27
27
|
it "should include namespaces X and Y" do
|
|
28
28
|
Xman.new.respond_to?(:x).should be_true
|
|
29
29
|
Xman.new.respond_to?(:y).should be_true
|
|
@@ -2,13 +2,13 @@ require 'spec_helper'
|
|
|
2
2
|
require 'sugar-high/module'
|
|
3
3
|
|
|
4
4
|
module Simple
|
|
5
|
-
modules :x, :y
|
|
5
|
+
modules :x, :y
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
module Nested
|
|
9
9
|
modules :x, :y do
|
|
10
10
|
nested_modules :a, :b
|
|
11
|
-
end
|
|
11
|
+
end
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
module AuthAssistant
|
|
@@ -19,26 +19,26 @@ end
|
|
|
19
19
|
|
|
20
20
|
describe "SugarHigh" do
|
|
21
21
|
describe "Module ext" do
|
|
22
|
-
describe '#modules' do
|
|
22
|
+
describe '#modules' do
|
|
23
23
|
it "should create namespaces under Simple for modules X and Y" do
|
|
24
24
|
Simple::X.should_not be_nil
|
|
25
|
-
Simple::Y.should_not be_nil
|
|
25
|
+
Simple::Y.should_not be_nil
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
it "should create namespaces under AuthAssistant for various modules" do
|
|
29
29
|
AuthAssistant::View.should_not be_nil
|
|
30
|
-
AuthAssistant::Helper.should_not be_nil
|
|
30
|
+
AuthAssistant::Helper.should_not be_nil
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
it "should create namespaces under Nested for modules X and Y, and modules A and B under each of those X and Y modules" do
|
|
34
34
|
Nested::X.should_not be_nil
|
|
35
|
-
Nested::Y.should_not be_nil
|
|
35
|
+
Nested::Y.should_not be_nil
|
|
36
36
|
|
|
37
37
|
Nested::X::A.should_not be_nil
|
|
38
|
-
Nested::Y::A.should_not be_nil
|
|
38
|
+
Nested::Y::A.should_not be_nil
|
|
39
39
|
|
|
40
40
|
Nested::X::B.should_not be_nil
|
|
41
|
-
Nested::Y::B.should_not be_nil
|
|
41
|
+
Nested::Y::B.should_not be_nil
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
end
|
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.4"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = [%q{Kristian Mandrup}]
|
|
12
|
-
s.date = %q{2011-08-
|
|
12
|
+
s.date = %q{2011-08-19}
|
|
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 = [
|
|
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
|
|
|
31
31
|
"lib/sugar-high/blank.rb",
|
|
32
32
|
"lib/sugar-high/boolean.rb",
|
|
33
33
|
"lib/sugar-high/class_ext.rb",
|
|
34
|
+
"lib/sugar-high/dsl.rb",
|
|
34
35
|
"lib/sugar-high/enumerable.rb",
|
|
35
36
|
"lib/sugar-high/file.rb",
|
|
36
37
|
"lib/sugar-high/file_ext.rb",
|
|
@@ -54,6 +55,7 @@ Gem::Specification.new do |s|
|
|
|
54
55
|
"lib/sugar-high/numeric.rb",
|
|
55
56
|
"lib/sugar-high/path.rb",
|
|
56
57
|
"lib/sugar-high/properties.rb",
|
|
58
|
+
"lib/sugar-high/rails/concerns.rb",
|
|
57
59
|
"lib/sugar-high/regexp.rb",
|
|
58
60
|
"lib/sugar-high/rspec/configure.rb",
|
|
59
61
|
"lib/sugar-high/rspec/matchers/have_aliases.rb",
|
|
@@ -89,6 +91,7 @@ Gem::Specification.new do |s|
|
|
|
89
91
|
"spec/sugar-high/array_spec.rb",
|
|
90
92
|
"spec/sugar-high/blank_spec.rb",
|
|
91
93
|
"spec/sugar-high/class_ext_spec.rb",
|
|
94
|
+
"spec/sugar-high/dsl_spec.rb",
|
|
92
95
|
"spec/sugar-high/file/file_dsl_spec.rb",
|
|
93
96
|
"spec/sugar-high/file_mutate/append_content_spec.rb",
|
|
94
97
|
"spec/sugar-high/file_mutate/delete_spec.rb",
|
|
@@ -106,6 +109,7 @@ Gem::Specification.new do |s|
|
|
|
106
109
|
"spec/sugar-high/numeric_spec.rb",
|
|
107
110
|
"spec/sugar-high/path_spec.rb",
|
|
108
111
|
"spec/sugar-high/properties_spec.rb",
|
|
112
|
+
"spec/sugar-high/rails/concerns_spec.rb",
|
|
109
113
|
"spec/sugar-high/regexp_spec.rb",
|
|
110
114
|
"spec/sugar-high/string_spec.rb",
|
|
111
115
|
"sugar-high.gemspec"
|
|
@@ -121,12 +125,14 @@ Gem::Specification.new do |s|
|
|
|
121
125
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
122
126
|
s.add_runtime_dependency(%q<activesupport>, [">= 3.0.1"])
|
|
123
127
|
s.add_development_dependency(%q<rspec>, [">= 2.4.0"])
|
|
128
|
+
s.add_development_dependency(%q<rails>, [">= 3.0.1"])
|
|
124
129
|
s.add_development_dependency(%q<jeweler>, [">= 1.6.4"])
|
|
125
130
|
s.add_development_dependency(%q<bundler>, [">= 1.0.1"])
|
|
126
131
|
s.add_development_dependency(%q<rdoc>, [">= 0"])
|
|
127
132
|
else
|
|
128
133
|
s.add_dependency(%q<activesupport>, [">= 3.0.1"])
|
|
129
134
|
s.add_dependency(%q<rspec>, [">= 2.4.0"])
|
|
135
|
+
s.add_dependency(%q<rails>, [">= 3.0.1"])
|
|
130
136
|
s.add_dependency(%q<jeweler>, [">= 1.6.4"])
|
|
131
137
|
s.add_dependency(%q<bundler>, [">= 1.0.1"])
|
|
132
138
|
s.add_dependency(%q<rdoc>, [">= 0"])
|
|
@@ -134,6 +140,7 @@ Gem::Specification.new do |s|
|
|
|
134
140
|
else
|
|
135
141
|
s.add_dependency(%q<activesupport>, [">= 3.0.1"])
|
|
136
142
|
s.add_dependency(%q<rspec>, [">= 2.4.0"])
|
|
143
|
+
s.add_dependency(%q<rails>, [">= 3.0.1"])
|
|
137
144
|
s.add_dependency(%q<jeweler>, [">= 1.6.4"])
|
|
138
145
|
s.add_dependency(%q<bundler>, [">= 1.0.1"])
|
|
139
146
|
s.add_dependency(%q<rdoc>, [">= 0"])
|
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.4
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,11 +9,11 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2011-08-
|
|
12
|
+
date: 2011-08-19 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: activesupport
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &2155550920 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ! '>='
|
|
@@ -21,10 +21,10 @@ dependencies:
|
|
|
21
21
|
version: 3.0.1
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *2155550920
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
26
26
|
name: rspec
|
|
27
|
-
requirement: &
|
|
27
|
+
requirement: &2155550440 !ruby/object:Gem::Requirement
|
|
28
28
|
none: false
|
|
29
29
|
requirements:
|
|
30
30
|
- - ! '>='
|
|
@@ -32,10 +32,21 @@ dependencies:
|
|
|
32
32
|
version: 2.4.0
|
|
33
33
|
type: :development
|
|
34
34
|
prerelease: false
|
|
35
|
-
version_requirements: *
|
|
35
|
+
version_requirements: *2155550440
|
|
36
|
+
- !ruby/object:Gem::Dependency
|
|
37
|
+
name: rails
|
|
38
|
+
requirement: &2155549960 !ruby/object:Gem::Requirement
|
|
39
|
+
none: false
|
|
40
|
+
requirements:
|
|
41
|
+
- - ! '>='
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: 3.0.1
|
|
44
|
+
type: :development
|
|
45
|
+
prerelease: false
|
|
46
|
+
version_requirements: *2155549960
|
|
36
47
|
- !ruby/object:Gem::Dependency
|
|
37
48
|
name: jeweler
|
|
38
|
-
requirement: &
|
|
49
|
+
requirement: &2155549480 !ruby/object:Gem::Requirement
|
|
39
50
|
none: false
|
|
40
51
|
requirements:
|
|
41
52
|
- - ! '>='
|
|
@@ -43,10 +54,10 @@ dependencies:
|
|
|
43
54
|
version: 1.6.4
|
|
44
55
|
type: :development
|
|
45
56
|
prerelease: false
|
|
46
|
-
version_requirements: *
|
|
57
|
+
version_requirements: *2155549480
|
|
47
58
|
- !ruby/object:Gem::Dependency
|
|
48
59
|
name: bundler
|
|
49
|
-
requirement: &
|
|
60
|
+
requirement: &2155549000 !ruby/object:Gem::Requirement
|
|
50
61
|
none: false
|
|
51
62
|
requirements:
|
|
52
63
|
- - ! '>='
|
|
@@ -54,10 +65,10 @@ dependencies:
|
|
|
54
65
|
version: 1.0.1
|
|
55
66
|
type: :development
|
|
56
67
|
prerelease: false
|
|
57
|
-
version_requirements: *
|
|
68
|
+
version_requirements: *2155549000
|
|
58
69
|
- !ruby/object:Gem::Dependency
|
|
59
70
|
name: rdoc
|
|
60
|
-
requirement: &
|
|
71
|
+
requirement: &2155548520 !ruby/object:Gem::Requirement
|
|
61
72
|
none: false
|
|
62
73
|
requirements:
|
|
63
74
|
- - ! '>='
|
|
@@ -65,7 +76,7 @@ dependencies:
|
|
|
65
76
|
version: '0'
|
|
66
77
|
type: :development
|
|
67
78
|
prerelease: false
|
|
68
|
-
version_requirements: *
|
|
79
|
+
version_requirements: *2155548520
|
|
69
80
|
description: More Ruby sugar - inspired by the 'zuker' project
|
|
70
81
|
email: kmandrup@gmail.com
|
|
71
82
|
executables: []
|
|
@@ -88,6 +99,7 @@ files:
|
|
|
88
99
|
- lib/sugar-high/blank.rb
|
|
89
100
|
- lib/sugar-high/boolean.rb
|
|
90
101
|
- lib/sugar-high/class_ext.rb
|
|
102
|
+
- lib/sugar-high/dsl.rb
|
|
91
103
|
- lib/sugar-high/enumerable.rb
|
|
92
104
|
- lib/sugar-high/file.rb
|
|
93
105
|
- lib/sugar-high/file_ext.rb
|
|
@@ -111,6 +123,7 @@ files:
|
|
|
111
123
|
- lib/sugar-high/numeric.rb
|
|
112
124
|
- lib/sugar-high/path.rb
|
|
113
125
|
- lib/sugar-high/properties.rb
|
|
126
|
+
- lib/sugar-high/rails/concerns.rb
|
|
114
127
|
- lib/sugar-high/regexp.rb
|
|
115
128
|
- lib/sugar-high/rspec/configure.rb
|
|
116
129
|
- lib/sugar-high/rspec/matchers/have_aliases.rb
|
|
@@ -146,6 +159,7 @@ files:
|
|
|
146
159
|
- spec/sugar-high/array_spec.rb
|
|
147
160
|
- spec/sugar-high/blank_spec.rb
|
|
148
161
|
- spec/sugar-high/class_ext_spec.rb
|
|
162
|
+
- spec/sugar-high/dsl_spec.rb
|
|
149
163
|
- spec/sugar-high/file/file_dsl_spec.rb
|
|
150
164
|
- spec/sugar-high/file_mutate/append_content_spec.rb
|
|
151
165
|
- spec/sugar-high/file_mutate/delete_spec.rb
|
|
@@ -163,6 +177,7 @@ files:
|
|
|
163
177
|
- spec/sugar-high/numeric_spec.rb
|
|
164
178
|
- spec/sugar-high/path_spec.rb
|
|
165
179
|
- spec/sugar-high/properties_spec.rb
|
|
180
|
+
- spec/sugar-high/rails/concerns_spec.rb
|
|
166
181
|
- spec/sugar-high/regexp_spec.rb
|
|
167
182
|
- spec/sugar-high/string_spec.rb
|
|
168
183
|
- sugar-high.gemspec
|
|
@@ -180,7 +195,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
180
195
|
version: '0'
|
|
181
196
|
segments:
|
|
182
197
|
- 0
|
|
183
|
-
hash: -
|
|
198
|
+
hash: -2320186655016610164
|
|
184
199
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
200
|
none: false
|
|
186
201
|
requirements:
|