happy 0.1.0.pre.2 → 0.1.0.pre.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/.travis.yml +10 -0
- data/.watchr +15 -0
- data/happy.gemspec +1 -0
- data/lib/happy/context.rb +4 -2
- data/lib/happy/controller.rb +6 -0
- data/lib/happy/version.rb +1 -1
- data/spec/controller_spec.rb +34 -1
- data/spec/spec_helper.rb +4 -0
- metadata +30 -17
data/.rspec
CHANGED
data/.travis.yml
ADDED
data/.watchr
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
def run(cmd, msg = nil)
|
2
|
+
puts "=== %s" % msg if msg
|
3
|
+
puts "=== %s" % cmd
|
4
|
+
system cmd
|
5
|
+
puts "\n"
|
6
|
+
end
|
7
|
+
|
8
|
+
watch("spec/.*_spec\.rb") { |m| run("bundle exec rspec %s" % m[0]) }
|
9
|
+
watch("lib/happy/(.*)\.rb") { |m| run("bundle exec rspec spec/%s_spec.rb" % m[1]) }
|
10
|
+
watch('^spec/(spec_helper|factories)\.rb') { |f| run "bundle exec rake spec", "%s.rb has been modified" % f }
|
11
|
+
|
12
|
+
# Ctrl-\
|
13
|
+
Signal.trap('QUIT') { run("bundle exec rake spec") }
|
14
|
+
# Ctrl-C
|
15
|
+
Signal.trap('INT') { abort("\nQuitting.") }
|
data/happy.gemspec
CHANGED
data/lib/happy/context.rb
CHANGED
@@ -22,8 +22,10 @@ module Happy
|
|
22
22
|
old_controller = self.controller
|
23
23
|
self.controller = new_controller
|
24
24
|
|
25
|
-
# execute permissions block
|
26
|
-
controller.class.
|
25
|
+
# execute permissions block SMELL - better integration
|
26
|
+
if controller.class.respond_to?(:permissions_blk)
|
27
|
+
controller.class.permissions_blk.try(:call, permissions, self)
|
28
|
+
end
|
27
29
|
|
28
30
|
# execute block
|
29
31
|
yield
|
data/lib/happy/controller.rb
CHANGED
data/lib/happy/version.rb
CHANGED
data/spec/controller_spec.rb
CHANGED
@@ -2,6 +2,39 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Happy
|
4
4
|
describe Controller do
|
5
|
-
|
5
|
+
describe ".build" do
|
6
|
+
subject do
|
7
|
+
Controller.build do
|
8
|
+
route { serve! "yay!" }
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def app
|
13
|
+
subject
|
14
|
+
end
|
15
|
+
|
16
|
+
it "creates a new controller class" do
|
17
|
+
subject.ancestors.should include(Controller)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should use the passed block to initialize the new controller class" do
|
21
|
+
get "/"
|
22
|
+
last_response.body.should == 'yay!'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it "is also a Rack app" do
|
27
|
+
def app
|
28
|
+
Controller.build do
|
29
|
+
route do
|
30
|
+
serve! "it works"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
get '/'
|
36
|
+
last_response.body.should == 'it works'
|
37
|
+
end
|
38
|
+
|
6
39
|
end
|
7
40
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: happy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.pre.
|
4
|
+
version: 0.1.0.pre.3
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-05-31 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement: &
|
16
|
+
requirement: &70362048389880 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3.1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70362048389880
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rack
|
27
|
-
requirement: &
|
27
|
+
requirement: &70362048389020 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '1.4'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70362048389020
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: happy-helpers
|
38
|
-
requirement: &
|
38
|
+
requirement: &70362048388280 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70362048388280
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: allowance
|
49
|
-
requirement: &
|
49
|
+
requirement: &70362048386840 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.1.1
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70362048386840
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rake
|
60
|
-
requirement: &
|
60
|
+
requirement: &70362048386200 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70362048386200
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
|
-
requirement: &
|
71
|
+
requirement: &70362048385440 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '2.8'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70362048385440
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rspec-html-matchers
|
82
|
-
requirement: &
|
82
|
+
requirement: &70362048384620 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70362048384620
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rack-test
|
93
|
-
requirement: &
|
93
|
+
requirement: &70362048384120 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,7 +98,18 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70362048384120
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: watchr
|
104
|
+
requirement: &70362048383520 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *70362048383520
|
102
113
|
description: A happy little toolkit for writing web applications.
|
103
114
|
email:
|
104
115
|
- hendrik@mans.de
|
@@ -108,6 +119,8 @@ extra_rdoc_files: []
|
|
108
119
|
files:
|
109
120
|
- .gitignore
|
110
121
|
- .rspec
|
122
|
+
- .travis.yml
|
123
|
+
- .watchr
|
111
124
|
- .yardopt
|
112
125
|
- Gemfile
|
113
126
|
- LICENSE
|