anupom-anobik 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -1,11 +1,12 @@
1
+ lib/anobik/app.rb
2
+ lib/anobik/consts.rb
3
+ lib/anobik/server.rb
4
+ lib/anobik/utils.rb
5
+ lib/rack/anobik.rb
1
6
  test/spec_rack_anobik.rb
2
- Rakefile
3
7
  CHANGELOG.txt
4
- lib/anobik.rb
5
- lib/anobik_server.rb
6
- lib/anobik_app.rb
7
- lib/rack/anobik.rb
8
- server
9
8
  config.ru
10
9
  Manifest
11
- README.rdoc
10
+ Rakefile
11
+ README.rdoc
12
+ server
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('anobik', '0.0.3') do |p|
5
+ Echoe.new('anobik', '0.0.4') do |p|
6
6
  p.description = "Rack middleware Ruby micro-framework"
7
7
  p.url = "http://github.com/anupom/anobik"
8
8
  p.author = "Anupom Syam"
@@ -12,4 +12,4 @@ Echoe.new('anobik', '0.0.3') do |p|
12
12
  p.runtime_dependencies = ['rack']
13
13
  end
14
14
 
15
- Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each
15
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each
@@ -2,28 +2,25 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{anobik}
5
- s.version = "0.0.3"
5
+ s.version = "0.0.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Anupom Syam"]
9
- s.date = %q{2009-09-10}
9
+ s.date = %q{2009-09-22}
10
10
  s.description = %q{Rack middleware Ruby micro-framework}
11
11
  s.email = %q{anupom.syam@gmail.com}
12
- s.extra_rdoc_files = ["CHANGELOG.txt", "lib/anobik/server.rb", "lib/anobik/app.rb", "lib/rack/anobik.rb", "README.rdoc"]
13
- s.files = ["test/spec_rack_anobik.rb", "Rakefile", "CHANGELOG.txt", "lib/anobik/server.rb", "lib/anobik/app.rb",
14
- "lib/anobik/consts.rb", "lib/anobik/utils.rb", "lib/rack/anobik.rb", "server",
15
- "config.ru", "Manifest", "README.rdoc", "anobik.gemspec"]
16
- s.has_rdoc = true
12
+ s.extra_rdoc_files = ["lib/anobik/app.rb", "lib/anobik/consts.rb", "lib/anobik/server.rb", "lib/anobik/utils.rb", "lib/rack/anobik.rb", "CHANGELOG.txt", "README.rdoc"]
13
+ s.files = ["lib/anobik/app.rb", "lib/anobik/consts.rb", "lib/anobik/server.rb", "lib/anobik/utils.rb", "lib/rack/anobik.rb", "test/spec_rack_anobik.rb", "CHANGELOG.txt", "config.ru", "Manifest", "Rakefile", "README.rdoc", "server", "anobik.gemspec"]
17
14
  s.homepage = %q{http://github.com/anupom/anobik}
18
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Anobik", "--main", "README.rdoc"]
19
16
  s.require_paths = ["lib"]
20
17
  s.rubyforge_project = %q{anobik}
21
- s.rubygems_version = %q{1.3.1}
18
+ s.rubygems_version = %q{1.3.5}
22
19
  s.summary = %q{Rack middleware Ruby micro-framework}
23
20
 
24
21
  if s.respond_to? :specification_version then
25
22
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
26
- s.specification_version = 2
23
+ s.specification_version = 3
27
24
 
28
25
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
29
26
  s.add_runtime_dependency(%q<rack>, [">= 0"])
@@ -33,4 +30,4 @@ Gem::Specification.new do |s|
33
30
  else
34
31
  s.add_dependency(%q<rack>, [">= 0"])
35
32
  end
36
- end
33
+ end
data/config.ru CHANGED
@@ -7,4 +7,7 @@ DEBUGGER = true
7
7
 
8
8
  app = Anobik::App::create DEBUGGER, PRODUCTION
9
9
 
10
+ puts "=> Application starting on http://#{options[:Host]}:#{options[:Port]}#{options[:path]}"
11
+ puts "=> Ctrl-C to shutdown server"
12
+
10
13
  run app
@@ -89,9 +89,8 @@ module Rack
89
89
 
90
90
  begin
91
91
  anobik_load_config ::Anobik::ROUTES_FILE
92
- rescue Exception
93
- return anobik_error(:missing_routes_file, [::Anobik::ROUTES_FILE,
94
- ANOBIK_ROOT + ::Anobik::CONFIG_DIR])
92
+ rescue LoadError => msg
93
+ return system_error msg
95
94
  end
96
95
 
97
96
  routes_classname = to_class_name ::Anobik::ROUTES_FILE
@@ -125,9 +124,8 @@ module Rack
125
124
 
126
125
  begin
127
126
  anobik_load_resource resource_filename
128
- rescue Exception
129
- return anobik_error(:missing_file, [resource_filename, ANOBIK_ROOT +
130
- ::Anobik::RESOURCE_DIR])
127
+ rescue LoadError => msg
128
+ return system_error msg
131
129
  end
132
130
 
133
131
  resource_classname = to_class_name resource_filename
@@ -155,10 +153,17 @@ module Rack
155
153
  end
156
154
 
157
155
  def anobik_error(err, array = [])
158
- #will be handled by RACK::ShowExceptions
159
156
  raise ERR_MESSAGES[err] % array unless @production
160
- #will be handled by RACK::ShowStatus
161
- return [STATUSES[:bad_request], @headers, '']
157
+ return bad_request
158
+ end
159
+
160
+ def system_error msg
161
+ raise msg unless @production
162
+ return bad_request
163
+ end
164
+
165
+ def bad_request
166
+ [STATUSES[:bad_request], @headers, '']
162
167
  end
163
168
 
164
169
  def anobik_load_config filename
@@ -58,7 +58,7 @@ describe "Rack::Anobik" do
58
58
  it "should return 500 when routes.rb is not present with dev" do
59
59
  remove_routes_file
60
60
  response = anobik_app_dev.get('/')
61
- response.should equal_response({:status => 500, :body => 'routes.rb ' << 'is not present in directory'})
61
+ response.should equal_response({:status => 500, :body => 'no such file to ' << 'load'})
62
62
  end
63
63
 
64
64
  it "should return 404 when Routes class is not defined with production" do
@@ -101,7 +101,7 @@ describe "Rack::Anobik" do
101
101
  remove_resource_file 'index'
102
102
  create_routes_file "class Routes\nend"
103
103
  response = anobik_app_dev.get('/')
104
- response.should equal_response({:status => 500, :body => 'missing ' << 'in directory'})
104
+ response.should equal_response({:status => 500, :body => 'no such file to ' << 'load'})
105
105
  remove_routes_file
106
106
  end
107
107
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anupom-anobik
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anupom Syam
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-10 00:00:00 -07:00
12
+ date: 2009-09-22 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -29,27 +29,30 @@ executables: []
29
29
  extensions: []
30
30
 
31
31
  extra_rdoc_files:
32
- - CHANGELOG.txt
33
- - lib/anobik/server.rb
34
32
  - lib/anobik/app.rb
33
+ - lib/anobik/consts.rb
34
+ - lib/anobik/server.rb
35
+ - lib/anobik/utils.rb
35
36
  - lib/rack/anobik.rb
37
+ - CHANGELOG.txt
36
38
  - README.rdoc
37
39
  files:
38
- - test/spec_rack_anobik.rb
39
- - Rakefile
40
- - CHANGELOG.txt
41
- - lib/anobik/server.rb
42
40
  - lib/anobik/app.rb
43
41
  - lib/anobik/consts.rb
42
+ - lib/anobik/server.rb
44
43
  - lib/anobik/utils.rb
45
44
  - lib/rack/anobik.rb
46
- - server
45
+ - test/spec_rack_anobik.rb
46
+ - CHANGELOG.txt
47
47
  - config.ru
48
48
  - Manifest
49
+ - Rakefile
49
50
  - README.rdoc
51
+ - server
50
52
  - anobik.gemspec
51
- has_rdoc: true
53
+ has_rdoc: false
52
54
  homepage: http://github.com/anupom/anobik
55
+ licenses:
53
56
  post_install_message:
54
57
  rdoc_options:
55
58
  - --line-numbers
@@ -75,9 +78,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
78
  requirements: []
76
79
 
77
80
  rubyforge_project: anobik
78
- rubygems_version: 1.2.0
81
+ rubygems_version: 1.3.5
79
82
  signing_key:
80
- specification_version: 2
83
+ specification_version: 3
81
84
  summary: Rack middleware Ruby micro-framework
82
85
  test_files: []
83
86