burke 0.2.2 → 0.3.5
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/README.rdoc +15 -14
- data/Rakefile +9 -11
- data/VERSION +1 -1
- data/lib/burke/holder.rb +188 -0
- data/lib/burke/tasks/clean.rb +15 -0
- data/lib/burke/tasks/docs.rb +46 -0
- data/lib/burke/tasks/gems.rb +117 -0
- data/lib/burke/tasks/rdoc.rb +12 -0
- data/lib/burke/tasks/release.rb +81 -0
- data/lib/burke/tasks/rspec.rb +76 -0
- data/lib/burke/tasks/test.rb +20 -0
- data/lib/burke/tasks/yard.rb +20 -0
- data/lib/burke.rb +184 -408
- data/spec/{conventional_project_spec.rb → burke_spec.rb} +9 -6
- data/spec/holder_spec.rb +77 -0
- data/spec/{conventional_project → simple_project}/COPYING +0 -0
- data/spec/{conventional_project → simple_project}/README.md +0 -0
- data/spec/simple_project/Rakefile +8 -0
- data/spec/{conventional_project → simple_project}/VERSION +0 -0
- data/spec/{conventional_project → simple_project}/lib/main.rb +0 -0
- data/spec/spec_helper.rb +5 -6
- metadata +24 -28
- data/spec/conventional_project/Rakefile +0 -10
data/spec/holder_spec.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
($LOAD_PATH << File.dirname(File.expand_path(__FILE__))).uniq!
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Burke::Holder do
|
5
|
+
before do
|
6
|
+
class Person < Burke::Holder
|
7
|
+
fields :name, :male
|
8
|
+
field(:age) { 18 }
|
9
|
+
field(:partner) { Person[:male => !self.male?] }
|
10
|
+
end
|
11
|
+
|
12
|
+
@holder = Person[:name => "David"]
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should to retrieve property with []" do
|
16
|
+
@holder[:name].should == "David"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should retrieve property with method call" do
|
20
|
+
@holder.name.should == "David"
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should yield property to block with with method call" do
|
24
|
+
@holder.name {|v| v.should == "David" }
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should set property with []=" do
|
28
|
+
@holder[:name] = "Frodo"
|
29
|
+
@holder[:name].should == "Frodo"
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should set property with plain method call" do
|
33
|
+
@holder[:name] = "Frodo"
|
34
|
+
@holder[:name].should == "Frodo"
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should set property with method call ending in '='" do
|
38
|
+
@holder[:name] = "Frodo"
|
39
|
+
@holder[:name].should == "Frodo"
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should return false on '?' method when property is unset" do
|
43
|
+
@holder.male?.should be_false
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should return false on '?' method when property is set to false" do
|
47
|
+
@holder[:male] = false
|
48
|
+
@holder.male?.should be_false
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should return true on '?' method when property is set to non-nil and non-false value" do
|
52
|
+
@holder[:male] = "Yes"
|
53
|
+
@holder.male?.should be_true
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should return default value when property is unset" do
|
57
|
+
@holder[:age].should == 18
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should override default value when property is set" do
|
61
|
+
@holder[:age] = 21
|
62
|
+
@holder[:age].should == 21
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should instance_exec block passed to method call for property with Holder value" do
|
66
|
+
s = self
|
67
|
+
@holder.partner { self.should s.be_a Person }
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should be able to access other properties from default value block" do
|
71
|
+
@holder[:male] = true
|
72
|
+
@holder.partner[:male].should be_false
|
73
|
+
@holder[:male] = false
|
74
|
+
@holder.partner[:male].should be_true
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/spec/spec_helper.rb
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
$LOAD_PATH << File.join(File.dirname(File.expand_path(__FILE__)), 'lib')
|
2
2
|
require 'burke'
|
3
|
+
require 'rspec/core'
|
3
4
|
|
4
5
|
def mock_burke_setup
|
5
6
|
Burke.module_eval do
|
6
7
|
class << self
|
7
|
-
|
8
|
-
alias :old_setup :setup
|
8
|
+
alias :old_settings :settings
|
9
9
|
|
10
|
-
def
|
11
|
-
@
|
12
|
-
yield @test_settings
|
10
|
+
def settings
|
11
|
+
@settings ||= Burke::Settings.new
|
13
12
|
end
|
14
13
|
end
|
15
14
|
end
|
@@ -18,7 +17,7 @@ end
|
|
18
17
|
def unmock_burke_setup
|
19
18
|
Burke.module_eval do
|
20
19
|
class << self
|
21
|
-
alias :
|
20
|
+
alias :settings :old_settings
|
22
21
|
end
|
23
22
|
end
|
24
23
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 3
|
8
|
+
- 5
|
9
|
+
version: 0.3.5
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Aiden Nibali
|
@@ -14,13 +14,13 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-10-24 00:00:00 +11:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
22
22
|
requirements:
|
23
|
-
- -
|
23
|
+
- - "="
|
24
24
|
- !ruby/object:Gem::Version
|
25
25
|
segments:
|
26
26
|
- 0
|
@@ -29,22 +29,8 @@ dependencies:
|
|
29
29
|
version: 0.8.7
|
30
30
|
requirement: *id001
|
31
31
|
prerelease: false
|
32
|
-
type: :
|
32
|
+
type: :development
|
33
33
|
name: rake
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
37
|
-
- - ~>
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
segments:
|
40
|
-
- 0
|
41
|
-
- 4
|
42
|
-
- 0
|
43
|
-
version: 0.4.0
|
44
|
-
requirement: *id002
|
45
|
-
prerelease: false
|
46
|
-
type: :runtime
|
47
|
-
name: hashie
|
48
34
|
description:
|
49
35
|
email: dismal.denizen@gmail.com
|
50
36
|
executables: []
|
@@ -54,14 +40,24 @@ extensions: []
|
|
54
40
|
extra_rdoc_files: []
|
55
41
|
|
56
42
|
files:
|
43
|
+
- lib/burke/tasks/rdoc.rb
|
44
|
+
- lib/burke/tasks/yard.rb
|
45
|
+
- lib/burke/tasks/gems.rb
|
46
|
+
- lib/burke/tasks/release.rb
|
47
|
+
- lib/burke/tasks/test.rb
|
48
|
+
- lib/burke/tasks/rspec.rb
|
49
|
+
- lib/burke/tasks/docs.rb
|
50
|
+
- lib/burke/tasks/clean.rb
|
51
|
+
- lib/burke/holder.rb
|
57
52
|
- lib/burke.rb
|
58
|
-
- spec/
|
59
|
-
- spec/conventional_project/lib/main.rb
|
60
|
-
- spec/conventional_project/Rakefile
|
61
|
-
- spec/conventional_project/README.md
|
62
|
-
- spec/conventional_project/COPYING
|
63
|
-
- spec/conventional_project/VERSION
|
53
|
+
- spec/holder_spec.rb
|
64
54
|
- spec/spec_helper.rb
|
55
|
+
- spec/simple_project/lib/main.rb
|
56
|
+
- spec/simple_project/Rakefile
|
57
|
+
- spec/simple_project/README.md
|
58
|
+
- spec/simple_project/COPYING
|
59
|
+
- spec/simple_project/VERSION
|
60
|
+
- spec/burke_spec.rb
|
65
61
|
- README.rdoc
|
66
62
|
- VERSION
|
67
63
|
- Rakefile
|
@@ -72,7 +68,7 @@ licenses: []
|
|
72
68
|
post_install_message:
|
73
69
|
rdoc_options:
|
74
70
|
- --title
|
75
|
-
- burke 0.
|
71
|
+
- burke 0.3.5
|
76
72
|
- --main
|
77
73
|
- README.rdoc
|
78
74
|
require_paths:
|
@@ -97,6 +93,6 @@ rubyforge_project:
|
|
97
93
|
rubygems_version: 1.3.6
|
98
94
|
signing_key:
|
99
95
|
specification_version: 3
|
100
|
-
summary: Helper for creating nice
|
96
|
+
summary: Helper for creating nice, clean Rake files
|
101
97
|
test_files: []
|
102
98
|
|