mineral 0.3.0 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
1
  pkg/
2
2
  .loadpath
3
3
  .project
4
+ Gemfile.lock
@@ -0,0 +1,4 @@
1
+ mineral
2
+ ============
3
+
4
+ ![mineral](http://upload.wikimedia.org/wikipedia/commons/d/d9/Biotite-Orthoclase-229808.jpg "Biotite Orthoclase")
data/Rakefile CHANGED
@@ -1,24 +1,23 @@
1
1
  require 'rubygems'
2
+ require 'bundler/setup'
2
3
  require 'rake'
4
+ require 'rake/testtask'
3
5
 
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "mineral"
8
- gem.summary = %Q{Rack metal with a better interface}
9
- gem.description = %Q{Rack metal with a better interface}
10
- gem.email = "jonbell@spamcop.net"
11
- gem.homepage = "http://github.com/jonbell/mineral"
12
- gem.authors = ["jonbell"]
13
- gem.add_dependency "rack", ">= 1.0.0"
14
- gem.add_development_dependency "shoulda", ">= 2.10.0"
15
- gem.add_development_dependency "mocha", ">= 0.9.0"
16
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
- end
18
- Jeweler::GemcutterTasks.new
19
- rescue LoadError
20
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |gem|
8
+ gem.name = 'mineral'
9
+ gem.summary = %Q{Rack metal with a better interface}
10
+ gem.description = %Q{Rack metal with a better interface}
11
+ gem.email = "jonbell@spamcop.net"
12
+ gem.homepage = "http://github.com/jonbell/mineral"
13
+ gem.authors = ["jonbell"]
14
+ gem.files.include 'lib/**/*.rb'
15
+ gem.files.exclude '.bundle/*'
16
+ gem.files.exclude '.rvmrc'
21
17
  end
18
+ Jeweler::RubygemsDotOrgTasks.new
19
+
20
+ task :default => :test
22
21
 
23
22
  require 'rake/testtask'
24
23
  Rake::TestTask.new(:test) do |test|
@@ -27,29 +26,3 @@ Rake::TestTask.new(:test) do |test|
27
26
  test.verbose = true
28
27
  end
29
28
 
30
- begin
31
- require 'rcov/rcovtask'
32
- Rcov::RcovTask.new do |test|
33
- test.libs << 'test'
34
- test.pattern = 'test/**/test_*.rb'
35
- test.verbose = true
36
- end
37
- rescue LoadError
38
- task :rcov do
39
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
40
- end
41
- end
42
-
43
- task :test => :check_dependencies
44
-
45
- task :default => :test
46
-
47
- require 'rake/rdoctask'
48
- Rake::RDocTask.new do |rdoc|
49
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
50
-
51
- rdoc.rdoc_dir = 'rdoc'
52
- rdoc.title = "mineral #{version}"
53
- rdoc.rdoc_files.include('README*')
54
- rdoc.rdoc_files.include('lib/**/*.rb')
55
- end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.2
@@ -1,6 +1,8 @@
1
1
  require 'active_support/ordered_hash'
2
+ require 'active_support/notifications'
2
3
  require 'mineral/railtie'
3
4
  require 'mineral/response'
5
+ require 'rails'
4
6
 
5
7
  module Mineral
6
8
  module Rack
@@ -28,7 +30,7 @@ module Mineral
28
30
 
29
31
  load_list.map do |requested_mineral|
30
32
  if mineral = all_minerals[requested_mineral]
31
- require_dependency "#{Rails.root}/app/mineral/" + mineral
33
+ require "#{Rails.root}/app/mineral/" + mineral
32
34
  requested_mineral.constantize
33
35
  end
34
36
  end.compact
@@ -41,13 +43,17 @@ module Mineral
41
43
  end
42
44
 
43
45
  def call(env)
46
+ call_start = Time.now
44
47
  request = ::Rack::Request.new(env)
45
48
  @minerals.each do |app|
46
49
  if app.methods.include?(request.request_method) && matcher = app.regex.match(request.path_info)
47
50
  args = []
48
51
  1.step(matcher.size - 1){|group| args << matcher[group]}
52
+ method = request.request_method.downcase
49
53
 
50
- return call_mineral_endpoint(app, request.request_method.downcase, request, *args)
54
+ ActiveSupport::Notifications.instrument('call.mineral', {mineral: app, method: method, call_start: call_start}) do
55
+ return call_mineral_endpoint(app, method, request, *args)
56
+ end
51
57
  end
52
58
  end
53
59
  @app.call(env)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mineral}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["jonbell"]
12
- s.date = %q{2012-03-30}
12
+ s.date = %q{2010-11-04}
13
13
  s.description = %q{Rack metal with a better interface}
14
14
  s.email = %q{jonbell@spamcop.net}
15
15
  s.extra_rdoc_files = [
@@ -22,7 +22,6 @@ Gem::Specification.new do |s|
22
22
  "Rakefile",
23
23
  "VERSION",
24
24
  "lib/mineral.rb",
25
- "lib/mineral/railtie.rb",
26
25
  "lib/mineral/response.rb",
27
26
  "mineral.gemspec",
28
27
  "test/app/mineral/handler.rb",
@@ -32,7 +31,7 @@ Gem::Specification.new do |s|
32
31
  s.homepage = %q{http://github.com/jonbell/mineral}
33
32
  s.rdoc_options = ["--charset=UTF-8"]
34
33
  s.require_paths = ["lib"]
35
- s.rubygems_version = %q{1.3.6}
34
+ s.rubygems_version = %q{1.3.7}
36
35
  s.summary = %q{Rack metal with a better interface}
37
36
  s.test_files = [
38
37
  "test/app/mineral/handler.rb",
@@ -44,7 +43,7 @@ Gem::Specification.new do |s|
44
43
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
45
44
  s.specification_version = 3
46
45
 
47
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
46
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
47
  s.add_runtime_dependency(%q<rack>, [">= 1.0.0"])
49
48
  s.add_development_dependency(%q<shoulda>, [">= 2.10.0"])
50
49
  s.add_development_dependency(%q<mocha>, [">= 0.9.0"])
@@ -1,18 +1,19 @@
1
1
  require 'rubygems'
2
- require 'active_support'
3
- require 'rack'
4
- require 'active_support/test_case'
2
+ require 'bundler'
3
+ Bundler.setup(:default, :development)
4
+ require 'test/unit'
5
5
  require 'shoulda'
6
- require 'mocha'
6
+ require 'active_support/test_case'
7
7
 
8
8
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
9
9
  $LOAD_PATH.unshift(File.dirname(__FILE__))
10
10
 
11
+
12
+ require 'mineral'
13
+
11
14
  module Rails
12
15
  def self.root
13
16
  File.dirname(__FILE__)
14
17
  end
15
18
  end
16
19
 
17
-
18
- require 'mineral'
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class TestMineral < ActiveSupport::TestCase
3
+ class TestMineral < Test::Unit::TestCase
4
4
  context "on GET to /handler/123" do
5
5
  setup do
6
6
  @response = Mineral::Rack::Mineral.new(stub).call({"REQUEST_METHOD" => "GET", "PATH_INFO" => "/handler/123"})
metadata CHANGED
@@ -1,116 +1,93 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: mineral
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 3
8
- - 0
9
- version: 0.3.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.2
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - jonbell
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2012-03-30 00:00:00 -05:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2010-11-04 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rack
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 1
29
- - 0
30
- - 0
16
+ requirement: &70343346770120 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
31
21
  version: 1.0.0
32
22
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: shoulda
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 2
43
- - 10
44
- - 0
24
+ version_requirements: *70343346770120
25
+ - !ruby/object:Gem::Dependency
26
+ name: shoulda
27
+ requirement: &70343346769320 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
45
32
  version: 2.10.0
46
33
  type: :development
47
- version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
49
- name: mocha
50
34
  prerelease: false
51
- requirement: &id003 !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- segments:
56
- - 0
57
- - 9
58
- - 0
35
+ version_requirements: *70343346769320
36
+ - !ruby/object:Gem::Dependency
37
+ name: mocha
38
+ requirement: &70343346768840 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
59
43
  version: 0.9.0
60
44
  type: :development
61
- version_requirements: *id003
45
+ prerelease: false
46
+ version_requirements: *70343346768840
62
47
  description: Rack metal with a better interface
63
48
  email: jonbell@spamcop.net
64
49
  executables: []
65
-
66
50
  extensions: []
67
-
68
- extra_rdoc_files:
51
+ extra_rdoc_files:
69
52
  - README.markdown
70
- files:
53
+ files:
71
54
  - .gitignore
72
55
  - MIT-LICENSE
73
56
  - README.markdown
74
57
  - Rakefile
75
58
  - VERSION
76
59
  - lib/mineral.rb
77
- - lib/mineral/railtie.rb
78
60
  - lib/mineral/response.rb
79
61
  - mineral.gemspec
80
62
  - test/app/mineral/handler.rb
81
63
  - test/helper.rb
82
64
  - test/test_mineral.rb
83
- has_rdoc: true
84
65
  homepage: http://github.com/jonbell/mineral
85
66
  licenses: []
86
-
87
67
  post_install_message:
88
- rdoc_options:
68
+ rdoc_options:
89
69
  - --charset=UTF-8
90
- require_paths:
70
+ require_paths:
91
71
  - lib
92
- required_ruby_version: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- segments:
97
- - 0
98
- version: "0"
99
- required_rubygems_version: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- segments:
104
- - 0
105
- version: "0"
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
106
84
  requirements: []
107
-
108
85
  rubyforge_project:
109
- rubygems_version: 1.3.6
86
+ rubygems_version: 1.8.15
110
87
  signing_key:
111
88
  specification_version: 3
112
89
  summary: Rack metal with a better interface
113
- test_files:
90
+ test_files:
114
91
  - test/app/mineral/handler.rb
115
92
  - test/helper.rb
116
93
  - test/test_mineral.rb
@@ -1,9 +0,0 @@
1
- require 'mineral'
2
-
3
- module Mineral
4
- class Railtie < Rails::Railtie
5
- initializer 'mineral.register_middleware' do |app|
6
- app.config.middleware.insert_before ::ActionDispatch::Flash, Mineral::Rack::Mineral
7
- end
8
- end
9
- end