happy 0.1.0.pre11 → 0.1.0.pre12

Sign up to get free protection for your applications and to get access to all the features.
data/.watchr CHANGED
@@ -5,11 +5,11 @@ def run(cmd, msg = nil)
5
5
  puts "\n"
6
6
  end
7
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 }
8
+ watch("spec/.*_spec\.rb") { |m| run("rspec %s" % m[0]) }
9
+ watch("lib/happy/(.*)\.rb") { |m| run("rspec spec/%s_spec.rb" % m[1]) }
10
+ watch('^spec/(spec_helper|factories)\.rb') { |f| run "rake spec", "%s.rb has been modified" % f }
11
11
 
12
12
  # Ctrl-\
13
- Signal.trap('QUIT') { run("bundle exec rake spec") }
13
+ Signal.trap('QUIT') { run("rake spec") }
14
14
  # Ctrl-C
15
15
  Signal.trap('INT') { abort("\nQuitting.") }
data/happy.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
17
17
 
18
18
  gem.add_dependency 'activesupport', '~> 3.1'
19
19
  gem.add_dependency 'rack', '~> 1.4'
20
- gem.add_dependency 'happy-helpers', '~> 0.1.0.pre8'
20
+ gem.add_dependency 'happy-helpers', '~> 0.1.0.pre9'
21
21
  gem.add_dependency 'allowance', '>= 0.1.1'
22
22
 
23
23
  gem.add_dependency 'happy-cli', '>= 0.1.0.pre1'
@@ -32,6 +32,13 @@ module Happy
32
32
  halt!
33
33
  end
34
34
 
35
+ def serve_or_404!(*args)
36
+ serve!(*args)
37
+
38
+ # If we get here, #serve! decided not to serve, so let's raise a 404.
39
+ raise Errors::NotFound
40
+ end
41
+
35
42
  def halt!(message = :done)
36
43
  throw message
37
44
  end
@@ -7,10 +7,7 @@ module Happy
7
7
  @env = env
8
8
 
9
9
  catch :done do
10
- serve! perform
11
-
12
- # If we get here, #serve decided not to serve.
13
- raise Errors::NotFound
10
+ serve_or_404! perform
14
11
  end
15
12
 
16
13
  response
@@ -34,10 +34,7 @@ module Happy
34
34
  previous_path << remaining_path.shift
35
35
  end
36
36
 
37
- serve! instance_exec(&blk)
38
-
39
- # If we get here, #serve decided not to serve.
40
- raise Errors::NotFound
37
+ serve_or_404! instance_exec(&blk)
41
38
  end
42
39
  end
43
40
  end
@@ -35,16 +35,16 @@ module Happy
35
35
 
36
36
  protected
37
37
 
38
- def url(extras = nil)
39
- url_for(previous_path, extras)
40
- end
41
-
42
38
  def root_url(extras = nil)
43
39
  url_for(root_path, extras)
44
40
  end
45
41
 
46
42
  private
47
43
 
44
+ def url(extras = nil)
45
+ url_for(previous_path, extras)
46
+ end
47
+
48
48
  def context
49
49
  @env['happy.context'] ||= self.class.context_class.from_env(@env)
50
50
  end
data/lib/happy/request.rb CHANGED
@@ -1,5 +1,8 @@
1
+ # SMELL: really?
1
2
  require 'happy-helpers/utils/date_parameter_converter'
2
3
 
4
+ # SMELL: do we really need our own request class?
5
+
3
6
  module Happy
4
7
  class Request < Rack::Request
5
8
  protected
@@ -1,5 +1,6 @@
1
1
  module Happy
2
2
  module Utils
3
+ # SMELL: this should be a controller, spawning another controller.
3
4
  class AppSpawner
4
5
  attr_reader :options
5
6
 
data/lib/happy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Happy
2
- VERSION = "0.1.0.pre11"
2
+ VERSION = "0.1.0.pre12"
3
3
  end
data/lib/happy.rb CHANGED
@@ -1,5 +1,3 @@
1
- require 'active_support/all' # SMELL
2
-
3
1
  require 'rack'
4
2
  require 'happy/context'
5
3
  require 'happy/controller'
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe Happy do
4
+ describe '#env' do
5
+ it "is a StringInquirer instance describing the RACK environment" do
6
+ Happy.env.should be_kind_of(ActiveSupport::StringInquirer)
7
+ end
8
+
9
+ it "provides #development?, #production? etc." do
10
+ ENV.should_receive(:[]).twice.with('RACK_ENV').and_return('development')
11
+ Happy.env.should be_development
12
+ Happy.env.should_not be_production
13
+
14
+ ENV.should_receive(:[]).twice.with('RACK_ENV').and_return('production')
15
+ Happy.env.should be_production
16
+ Happy.env.should_not be_development
17
+ end
18
+ end
19
+ end
data/spec/spec_helper.rb CHANGED
@@ -3,7 +3,6 @@ lib_path = File.expand_path("#{SPEC_DIR}/../lib")
3
3
  $LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
4
4
 
5
5
  require 'rubygems'
6
- require 'bundler/setup'
7
6
  require 'rack/test'
8
7
 
9
8
  require 'happy'
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.pre11
4
+ version: 0.1.0.pre12
5
5
  prerelease: 6
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: 2012-06-02 00:00:00.000000000 Z
12
+ date: 2012-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &70286029076720 !ruby/object:Gem::Requirement
16
+ requirement: &70295340567400 !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: *70286029076720
24
+ version_requirements: *70295340567400
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rack
27
- requirement: &70286029074940 !ruby/object:Gem::Requirement
27
+ requirement: &70295340555820 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,21 +32,21 @@ dependencies:
32
32
  version: '1.4'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70286029074940
35
+ version_requirements: *70295340555820
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: happy-helpers
38
- requirement: &70286029066200 !ruby/object:Gem::Requirement
38
+ requirement: &70295340539140 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- version: 0.1.0.pre8
43
+ version: 0.1.0.pre9
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70286029066200
46
+ version_requirements: *70295340539140
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: allowance
49
- requirement: &70286029063180 !ruby/object:Gem::Requirement
49
+ requirement: &70295340535640 !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: *70286029063180
57
+ version_requirements: *70295340535640
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: happy-cli
60
- requirement: &70286029062500 !ruby/object:Gem::Requirement
60
+ requirement: &70295340526260 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.1.0.pre1
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70286029062500
68
+ version_requirements: *70295340526260
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
- requirement: &70286029061860 !ruby/object:Gem::Requirement
71
+ requirement: &70295340518680 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70286029061860
79
+ version_requirements: *70295340518680
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rspec
82
- requirement: &70286029061160 !ruby/object:Gem::Requirement
82
+ requirement: &70295340505940 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '2.8'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70286029061160
90
+ version_requirements: *70295340505940
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rspec-html-matchers
93
- requirement: &70286029059920 !ruby/object:Gem::Requirement
93
+ requirement: &70295340498580 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70286029059920
101
+ version_requirements: *70295340498580
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rack-test
104
- requirement: &70286029058420 !ruby/object:Gem::Requirement
104
+ requirement: &70295340485280 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70286029058420
112
+ version_requirements: *70295340485280
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: watchr
115
- requirement: &70286029053960 !ruby/object:Gem::Requirement
115
+ requirement: &70295340465380 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,7 +120,7 @@ dependencies:
120
120
  version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70286029053960
123
+ version_requirements: *70295340465380
124
124
  description: A happy little toolkit for writing web applications.
125
125
  email:
126
126
  - hendrik@mans.de
@@ -151,9 +151,10 @@ files:
151
151
  - lib/happy/request.rb
152
152
  - lib/happy/utils/app_spawner.rb
153
153
  - lib/happy/version.rb
154
- - spec/controller_ext/actions_spec.rb
155
- - spec/controller_ext/routing_spec.rb
154
+ - spec/controller/actions_spec.rb
155
+ - spec/controller/routing_spec.rb
156
156
  - spec/controller_spec.rb
157
+ - spec/happy_spec.rb
157
158
  - spec/spec_helper.rb
158
159
  homepage: https://github.com/hmans/happy
159
160
  licenses: []
@@ -180,8 +181,9 @@ signing_key:
180
181
  specification_version: 3
181
182
  summary: A happy little toolkit for writing web applications.
182
183
  test_files:
183
- - spec/controller_ext/actions_spec.rb
184
- - spec/controller_ext/routing_spec.rb
184
+ - spec/controller/actions_spec.rb
185
+ - spec/controller/routing_spec.rb
185
186
  - spec/controller_spec.rb
187
+ - spec/happy_spec.rb
186
188
  - spec/spec_helper.rb
187
189
  has_rdoc: