sinatra-scopes 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ task :default => :examples
2
+
1
3
  begin
2
4
  require 'jeweler'
3
5
  Jeweler::Tasks.new do |s|
@@ -16,10 +18,10 @@ rescue LoadError
16
18
  puts "Install jeweler to build gem"
17
19
  end
18
20
 
19
- task :default => [:test]
20
-
21
- task :examples do
22
- ruby "examples.rb"
23
- end
21
+ task(:examples) { ruby "examples.rb" }
22
+ task :test => :examples
24
23
 
25
- task :test => :examples
24
+ task :tag_version do
25
+ version = File.read('VERSION')
26
+ system "git tag -a v#{version} -m v#{version}"
27
+ end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 1.0.0
@@ -1,5 +1,5 @@
1
1
  require 'sinatra'
2
- require 'sinatra/scopes'
2
+ require 'lib/sinatra/scopes'
3
3
 
4
4
  Project = {'a' => 'Project A', 'b' => 'Project B'}
5
5
  User = {'1' => 'User 1', '2' => 'User 2'}
@@ -32,15 +32,15 @@ module Sinatra
32
32
 
33
33
  module ScopeBuilder
34
34
 
35
- def scope(name, pattern = nil, &blk)
35
+ def scopes
36
36
  @scopes ||= {}
37
- @scopes[name] = Scope.new Sinatra::Application, pattern, &blk
38
37
  end
39
38
 
40
- # hacky? I can't figure out which object to #define_method on
41
- def method_missing(name)
42
- return super unless @scopes.has_key? name
43
- @scopes[name]
39
+ def scope(name, pattern = nil, &blk)
40
+ scopes[name] = Scope.new self, pattern, &blk
41
+ mod = Module.new
42
+ mod.module_eval %{def #{name}; scopes[:#{name}] end}
43
+ register mod
44
44
  end
45
45
 
46
46
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sinatra-scopes}
8
- s.version = "0.1.0"
8
+ s.version = "1.0.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Myles Byrne"]
12
- s.date = %q{2009-11-04}
12
+ s.date = %q{2009-12-08}
13
13
  s.email = %q{myles@myles.id.au}
14
14
  s.extra_rdoc_files = [
15
15
  "README.md"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-scopes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Myles Byrne
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-04 00:00:00 +11:00
12
+ date: 2009-12-08 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency