eastwood 0.1.2 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/.rvmrc +81 -0
- data/Appraisals +3 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +125 -0
- data/MIT-LICENSE +1 -1
- data/Rakefile +25 -34
- data/app/assets/javascripts/eastwood.js.coffee.erb +13 -36
- data/eastwood.gemspec +33 -0
- data/gemfiles/rails-3.2.0.gemfile +7 -0
- data/gemfiles/rails-3.2.0.gemfile.lock +126 -0
- data/lib/eastwood/config.rb +26 -0
- data/lib/eastwood/context.rb +86 -0
- data/lib/eastwood/engine.rb +5 -2
- data/lib/eastwood/version.rb +1 -1
- data/lib/eastwood.rb +6 -4
- data/spec/requests/eastwood_spec.rb +78 -0
- data/spec/spec_helper.rb +38 -0
- data/spec/support/rails_template.rb +24 -0
- data/spec/unit/config_spec.rb +48 -0
- data/spec/unit/context_spec.rb +108 -0
- data/spec/unit/format_spec.rb +71 -0
- metadata +84 -105
- data/lib/eastwood/helpers.rb +0 -27
- data/lib/eastwood/routes.rb +0 -28
- data/lib/tasks/eastwood_tasks.rake +0 -4
- data/test/asset_test.rb +0 -9
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/assets/javascripts/application.js +0 -9
- data/test/dummy/app/assets/stylesheets/application.css +0 -7
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/controllers/resources_controller.rb +0 -2
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/config/application.rb +0 -45
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -30
- data/test/dummy/config/environments/production.rb +0 -60
- data/test/dummy/config/environments/test.rb +0 -42
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -10
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -61
- data/test/dummy/config.ru +0 -4
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +0 -391
- data/test/dummy/log/test.log +0 -409
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -26
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/index.html +0 -16
- data/test/dummy/script/rails +0 -6
- data/test/dummy/tmp/cache/assets/CBD/F90/sprockets%2F6d20c2441898d9799e1cdb5e152b3495 +0 -0
- data/test/dummy/tmp/cache/assets/D3E/B90/sprockets%2F9df707a0cc19082ff3e094ca09180fe4 +0 -0
- data/test/dummy/tmp/cache/assets/D7F/B10/sprockets%2F9ac097fe24e8c8229522feac6fc9337c +0 -0
- data/test/eastwood_test.rb +0 -7
- data/test/helpers_test.rb +0 -31
- data/test/test_helper.rb +0 -10
- /data/{test/dummy/db/development.sqlite3 → spec/rails/.gitkeep} +0 -0
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'eastwood.js' do
|
4
|
+
|
5
|
+
before do
|
6
|
+
get '/assets/eastwood.js'
|
7
|
+
end
|
8
|
+
|
9
|
+
let( :context ){ ExecJS.compile response.body }
|
10
|
+
let( :routes ){ "window.Rails320.routes" }
|
11
|
+
|
12
|
+
describe 'the response' do
|
13
|
+
subject { response }
|
14
|
+
|
15
|
+
its( :status ){ should eq( 200 ) }
|
16
|
+
its( :content_type ){ should eq( 'text/javascript' ) }
|
17
|
+
end
|
18
|
+
|
19
|
+
describe 'eastwood_engine_path' do
|
20
|
+
it 'should be defined' do
|
21
|
+
context.eval( "typeof #{routes}.eastwood_engine_path" ).should eq( 'function' )
|
22
|
+
end
|
23
|
+
it 'should return the correct route' do
|
24
|
+
context.call( "#{routes}.eastwood_engine_path" ).should eq( '/eastwood' )
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe 'match_path' do
|
29
|
+
it 'should be defined' do
|
30
|
+
context.eval( "typeof #{routes}.match_path" ).should eq( 'function' )
|
31
|
+
end
|
32
|
+
it 'should return the correct route' do
|
33
|
+
context.call( "#{routes}.match_path" ).should eq( '/foo.json' )
|
34
|
+
end
|
35
|
+
it 'should accept a format to override' do
|
36
|
+
context.call( "#{routes}.match_path", '.html' ).should eq( '/foo.html' )
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe 'match_with_segment_path' do
|
41
|
+
it 'should be defined' do
|
42
|
+
context.eval( "typeof #{routes}.match_with_segment_path" ).should eq( 'function' )
|
43
|
+
end
|
44
|
+
it 'should return the correct route' do
|
45
|
+
context.call( "#{routes}.match_with_segment_path", 'bar' ).should eq( '/foo/bar.json' )
|
46
|
+
end
|
47
|
+
it 'should accept a format to override' do
|
48
|
+
context.call( "#{routes}.match_with_segment_path", 'bar', '.html' ).should eq( '/foo/bar.html' )
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe 'home_hash' do
|
53
|
+
it 'should be defined' do
|
54
|
+
context.eval( "typeof #{routes}.home_hash" ).should eq( 'function' )
|
55
|
+
end
|
56
|
+
it 'should return the correct hash' do
|
57
|
+
context.call( "#{routes}.home_hash" ).should eq( '#/home' )
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe 'user_hash' do
|
62
|
+
it 'should be defined' do
|
63
|
+
context.eval( "typeof #{routes}.user_hash" ).should eq( 'function' )
|
64
|
+
end
|
65
|
+
it 'should return the correct hash' do
|
66
|
+
context.call( "#{routes}.user_hash", 'foo' ).should eq( '#/users/foo' )
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe 'post_hash' do
|
71
|
+
it 'should be defined' do
|
72
|
+
context.eval( "typeof #{routes}.post_hash" ).should eq( 'function' )
|
73
|
+
end
|
74
|
+
it 'should return the correct hash' do
|
75
|
+
context.call( "#{routes}.post_hash", 'foo', 'bar' ).should eq( '#/users/foo/posts/bar' )
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Set the environment variables for the test app
|
2
|
+
ENV[ 'RAILS_ENV' ] = 'test'
|
3
|
+
# ENV[ 'RAILS_ROOT' ] =
|
4
|
+
|
5
|
+
# Add the test app to the load path
|
6
|
+
$: << ENV[ 'EASTWOOD_RAILS_PATH' ]
|
7
|
+
|
8
|
+
# Require all dependencies
|
9
|
+
Bundler.require
|
10
|
+
|
11
|
+
# Boot the rails app
|
12
|
+
require 'config/environment'
|
13
|
+
|
14
|
+
# Require test dependencies *after* rails
|
15
|
+
require 'rspec/rails'
|
16
|
+
require 'shoulda'
|
17
|
+
require 'execjs'
|
18
|
+
|
19
|
+
# Define some helpers
|
20
|
+
module ResponseBodyHelper
|
21
|
+
def the_response_body
|
22
|
+
JSON.parse response.body, :symbolize_names => true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# Configure RSpec
|
27
|
+
RSpec.configure do |config|
|
28
|
+
# Use color
|
29
|
+
config.color_enabled = true
|
30
|
+
# Change the formatter
|
31
|
+
config.formatter = :documentation
|
32
|
+
# Include those helpers
|
33
|
+
config.include ResponseBodyHelper
|
34
|
+
# Reset Eastwood after each test
|
35
|
+
config.after do
|
36
|
+
Eastwood.reset!
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Clean up the app a bit
|
2
|
+
run 'rm -r test'
|
3
|
+
run 'rm -r doc'
|
4
|
+
run 'rm -r README.rdoc'
|
5
|
+
run 'rm -r vendor'
|
6
|
+
|
7
|
+
# Add our eastwood dependency
|
8
|
+
gem 'eastwood'
|
9
|
+
|
10
|
+
# Mount the eastwood app
|
11
|
+
route "mount Eastwood::Engine => '/eastwood'"
|
12
|
+
|
13
|
+
# Create a couple of test routes
|
14
|
+
route "match '/foo' => 'bar#baz', :as => 'match'"
|
15
|
+
route "match '/foo/:id' => 'bar#baz', :as => 'match_with_segment'"
|
16
|
+
|
17
|
+
# Create the eastwood initializer
|
18
|
+
initializer 'eastwood.rb', <<-CODE
|
19
|
+
Eastwood.configure do |config|
|
20
|
+
config.hash :home, '#/home'
|
21
|
+
config.hash :user, '#/users/:id'
|
22
|
+
config.hash :post, '#/users/:id/posts/:slug'
|
23
|
+
end
|
24
|
+
CODE
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Eastwood do
|
4
|
+
|
5
|
+
describe '#configure' do
|
6
|
+
it { should respond_to( :configure ) }
|
7
|
+
|
8
|
+
it 'should yield itself to the configure block' do
|
9
|
+
Eastwood.configure do |config|
|
10
|
+
config.should eq( Eastwood )
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#reset!' do
|
16
|
+
it { should respond_to( :reset! ) }
|
17
|
+
|
18
|
+
it 'should reset all configurations' do
|
19
|
+
Eastwood.default_route_format.should eq( :json )
|
20
|
+
Eastwood.default_route_format = :xml
|
21
|
+
Eastwood.default_route_format.should eq( :xml )
|
22
|
+
Eastwood.reset!
|
23
|
+
Eastwood.default_route_format.should eq( :json )
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe '#hash' do
|
28
|
+
it { should respond_to( :hash ) }
|
29
|
+
|
30
|
+
describe 'adding a hash' do
|
31
|
+
before do
|
32
|
+
Eastwood.hash :foo, '#/bar'
|
33
|
+
end
|
34
|
+
|
35
|
+
subject { Eastwood.hashes }
|
36
|
+
|
37
|
+
it { should include( :foo => '#/bar' ) }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '#default_route_format' do
|
42
|
+
it { should respond_to( :default_route_format ) }
|
43
|
+
|
44
|
+
it 'should default to :json' do
|
45
|
+
Eastwood.default_route_format.should eq( :json )
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'the Sprockets context class' do
|
4
|
+
subject { Rails.application.assets.context_class.new nil, nil, nil }
|
5
|
+
|
6
|
+
it 'should have Eastwood::Context mixed in' do
|
7
|
+
subject.class.ancestors.should include( Eastwood::Context )
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '#app' do
|
11
|
+
it { should respond_to( :app ) }
|
12
|
+
its( :app ){ should eq( Rails.application.class.name.split( '::' ).first ) }
|
13
|
+
end
|
14
|
+
|
15
|
+
describe '#env' do
|
16
|
+
it { should respond_to( :env ) }
|
17
|
+
its( :env ){ should eq( Rails.env ) }
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#routes' do
|
21
|
+
it { should respond_to( :routes ) }
|
22
|
+
its( :routes ){ should be_a( Hash ) }
|
23
|
+
end
|
24
|
+
|
25
|
+
describe '#hashes' do
|
26
|
+
it { should respond_to( :hashes ) }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'routes' do
|
31
|
+
let( :context ){ Rails.application.assets.context_class.new nil, nil, nil }
|
32
|
+
|
33
|
+
describe 'eastwood_engine' do
|
34
|
+
subject { context.routes[ :eastwood_engine ] }
|
35
|
+
|
36
|
+
its( :name ){ should eq( 'eastwood_engine' ) }
|
37
|
+
its( :path ){ should eq( '/eastwood' ) }
|
38
|
+
its( :parts ){ should eq( [ ] ) }
|
39
|
+
|
40
|
+
its( :coffee_name ){ should eq( 'eastwood_engine_path' ) }
|
41
|
+
its( :coffee_path ){ should eq( '/eastwood' ) }
|
42
|
+
its( :coffee_args ){ should eq( '' ) }
|
43
|
+
end
|
44
|
+
|
45
|
+
describe 'match' do
|
46
|
+
subject { context.routes[ :match ] }
|
47
|
+
|
48
|
+
its( :name ){ should eq( 'match' ) }
|
49
|
+
its( :path ){ should eq( '/foo.:format' ) }
|
50
|
+
its( :parts ){ should eq( [ :format ] ) }
|
51
|
+
|
52
|
+
its( :coffee_name ){ should eq( 'match_path' ) }
|
53
|
+
its( :coffee_path ){ should eq( '/foo#{format}' ) }
|
54
|
+
its( :coffee_args ){ should eq( "format='.json'" ) }
|
55
|
+
end
|
56
|
+
|
57
|
+
describe 'match with segment' do
|
58
|
+
subject { context.routes[ :match_with_segment ] }
|
59
|
+
|
60
|
+
its( :name ){ should eq( 'match_with_segment' ) }
|
61
|
+
its( :path ){ should eq( '/foo/:id.:format' ) }
|
62
|
+
its( :parts ){ should eq( [ :id, :format ] ) }
|
63
|
+
|
64
|
+
its( :coffee_name ){ should eq( 'match_with_segment_path' ) }
|
65
|
+
its( :coffee_path ){ should eq( '/foo/#{id}#{format}' ) }
|
66
|
+
its( :coffee_args ){ should eq( "id, format='.json'" ) }
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe 'hashes' do
|
71
|
+
let( :context ){ Rails.application.assets.context_class.new nil, nil, nil }
|
72
|
+
|
73
|
+
describe 'home' do
|
74
|
+
subject { context.hashes[ :home ] }
|
75
|
+
|
76
|
+
its( :name ){ should eq( 'home' ) }
|
77
|
+
its( :path ){ should eq( '#/home' ) }
|
78
|
+
its( :parts ){ should eq( [ ] ) }
|
79
|
+
|
80
|
+
its( :coffee_name ){ should eq( 'home_hash' ) }
|
81
|
+
its( :coffee_path ){ should eq( '#/home' ) }
|
82
|
+
its( :coffee_args ){ should eq( '' ) }
|
83
|
+
end
|
84
|
+
|
85
|
+
describe 'user' do
|
86
|
+
subject { context.hashes[ :user ] }
|
87
|
+
|
88
|
+
its( :name ){ should eq( 'user' ) }
|
89
|
+
its( :path ){ should eq( '#/users/:id' ) }
|
90
|
+
its( :parts ){ should eq( [ :id ] ) }
|
91
|
+
|
92
|
+
its( :coffee_name ){ should eq( 'user_hash' ) }
|
93
|
+
its( :coffee_path ){ should eq( '#/users/#{id}' ) }
|
94
|
+
its( :coffee_args ){ should eq( "id" ) }
|
95
|
+
end
|
96
|
+
|
97
|
+
describe 'post' do
|
98
|
+
subject { context.hashes[ :post ] }
|
99
|
+
|
100
|
+
its( :name ){ should eq( 'post' ) }
|
101
|
+
its( :path ){ should eq( '#/users/:id/posts/:slug' ) }
|
102
|
+
its( :parts ){ should eq( [ :id, :slug ] ) }
|
103
|
+
|
104
|
+
its( :coffee_name ){ should eq( 'post_hash' ) }
|
105
|
+
its( :coffee_path ){ should eq( '#/users/#{id}/posts/#{slug}' ) }
|
106
|
+
its( :coffee_args ){ should eq( "id, slug" ) }
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'route formatting' do
|
4
|
+
|
5
|
+
describe 'setting the default route format' do
|
6
|
+
subject { Rails.application.assets.context_class.new nil, nil, nil }
|
7
|
+
|
8
|
+
it { should respond_to( :route_format ) }
|
9
|
+
|
10
|
+
context 'default format' do
|
11
|
+
its( :route_format ){ should eq( '.json' ) }
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'as a symbol' do
|
15
|
+
before do
|
16
|
+
Eastwood.default_route_format = :xml
|
17
|
+
end
|
18
|
+
|
19
|
+
its( :route_format ){ should eq( '.xml' ) }
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'as a string' do
|
23
|
+
before do
|
24
|
+
Eastwood.default_route_format = 'html'
|
25
|
+
end
|
26
|
+
|
27
|
+
its( :route_format ){ should eq( '.html' ) }
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'when empty string' do
|
31
|
+
before do
|
32
|
+
Eastwood.default_route_format = ''
|
33
|
+
end
|
34
|
+
|
35
|
+
its( :route_format ){ should eq( '' ) }
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'when false' do
|
39
|
+
before do
|
40
|
+
Eastwood.default_route_format = false
|
41
|
+
end
|
42
|
+
|
43
|
+
its( :route_format ){ should eq( '' ) }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'including the format in routes' do
|
48
|
+
let( :context ){ Rails.application.assets.context_class.new nil, nil, nil }
|
49
|
+
subject { context.routes[ :match ] }
|
50
|
+
|
51
|
+
context 'default format' do
|
52
|
+
its( :coffee_args ){ should eq( "format='.json'" ) }
|
53
|
+
end
|
54
|
+
|
55
|
+
context 'custom format' do
|
56
|
+
before do
|
57
|
+
Eastwood.default_route_format = :xml
|
58
|
+
end
|
59
|
+
|
60
|
+
its( :coffee_args ){ should eq( "format='.xml'" ) }
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'omit format' do
|
64
|
+
before do
|
65
|
+
Eastwood.default_route_format = false
|
66
|
+
end
|
67
|
+
|
68
|
+
its( :coffee_args ){ should eq( "format=''" ) }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eastwood
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,33 +9,66 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &136100 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *136100
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: coffee-rails
|
27
|
+
requirement: &135210 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
22
33
|
type: :runtime
|
23
34
|
prerelease: false
|
24
|
-
version_requirements: *
|
35
|
+
version_requirements: *135210
|
25
36
|
- !ruby/object:Gem::Dependency
|
26
37
|
name: sqlite3
|
27
|
-
requirement: &
|
38
|
+
requirement: &134720 !ruby/object:Gem::Requirement
|
28
39
|
none: false
|
29
40
|
requirements:
|
30
41
|
- - ! '>='
|
31
42
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *134720
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: appraisal
|
49
|
+
requirement: &134220 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - =
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.4.1
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *134220
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rspec-rails
|
60
|
+
requirement: &126450 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - =
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 2.8.1
|
33
66
|
type: :development
|
34
67
|
prerelease: false
|
35
|
-
version_requirements: *
|
68
|
+
version_requirements: *126450
|
36
69
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
38
|
-
requirement: &
|
70
|
+
name: shoulda
|
71
|
+
requirement: &125110 !ruby/object:Gem::Requirement
|
39
72
|
none: false
|
40
73
|
requirements:
|
41
74
|
- - ! '>='
|
@@ -43,7 +76,18 @@ dependencies:
|
|
43
76
|
version: '0'
|
44
77
|
type: :development
|
45
78
|
prerelease: false
|
46
|
-
version_requirements: *
|
79
|
+
version_requirements: *125110
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: execjs
|
82
|
+
requirement: &123910 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - =
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 1.3.0
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *123910
|
47
91
|
description: Start your client side out right
|
48
92
|
email:
|
49
93
|
- jeremy.ruppel@gmail.com
|
@@ -51,56 +95,30 @@ executables: []
|
|
51
95
|
extensions: []
|
52
96
|
extra_rdoc_files: []
|
53
97
|
files:
|
98
|
+
- .gitignore
|
99
|
+
- .rvmrc
|
100
|
+
- Appraisals
|
101
|
+
- Gemfile
|
102
|
+
- Gemfile.lock
|
103
|
+
- MIT-LICENSE
|
104
|
+
- README.md
|
105
|
+
- Rakefile
|
54
106
|
- app/assets/javascripts/eastwood.js.coffee.erb
|
107
|
+
- eastwood.gemspec
|
108
|
+
- gemfiles/rails-3.2.0.gemfile
|
109
|
+
- gemfiles/rails-3.2.0.gemfile.lock
|
110
|
+
- lib/eastwood.rb
|
111
|
+
- lib/eastwood/config.rb
|
112
|
+
- lib/eastwood/context.rb
|
55
113
|
- lib/eastwood/engine.rb
|
56
|
-
- lib/eastwood/helpers.rb
|
57
|
-
- lib/eastwood/routes.rb
|
58
114
|
- lib/eastwood/version.rb
|
59
|
-
-
|
60
|
-
-
|
61
|
-
-
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
65
|
-
-
|
66
|
-
- test/dummy/app/assets/stylesheets/application.css
|
67
|
-
- test/dummy/app/controllers/application_controller.rb
|
68
|
-
- test/dummy/app/controllers/resources_controller.rb
|
69
|
-
- test/dummy/app/helpers/application_helper.rb
|
70
|
-
- test/dummy/app/views/layouts/application.html.erb
|
71
|
-
- test/dummy/config/application.rb
|
72
|
-
- test/dummy/config/boot.rb
|
73
|
-
- test/dummy/config/database.yml
|
74
|
-
- test/dummy/config/environment.rb
|
75
|
-
- test/dummy/config/environments/development.rb
|
76
|
-
- test/dummy/config/environments/production.rb
|
77
|
-
- test/dummy/config/environments/test.rb
|
78
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
79
|
-
- test/dummy/config/initializers/inflections.rb
|
80
|
-
- test/dummy/config/initializers/mime_types.rb
|
81
|
-
- test/dummy/config/initializers/secret_token.rb
|
82
|
-
- test/dummy/config/initializers/session_store.rb
|
83
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
84
|
-
- test/dummy/config/locales/en.yml
|
85
|
-
- test/dummy/config/routes.rb
|
86
|
-
- test/dummy/config.ru
|
87
|
-
- test/dummy/db/development.sqlite3
|
88
|
-
- test/dummy/db/test.sqlite3
|
89
|
-
- test/dummy/log/development.log
|
90
|
-
- test/dummy/log/test.log
|
91
|
-
- test/dummy/public/404.html
|
92
|
-
- test/dummy/public/422.html
|
93
|
-
- test/dummy/public/500.html
|
94
|
-
- test/dummy/public/favicon.ico
|
95
|
-
- test/dummy/public/index.html
|
96
|
-
- test/dummy/Rakefile
|
97
|
-
- test/dummy/script/rails
|
98
|
-
- test/dummy/tmp/cache/assets/CBD/F90/sprockets%2F6d20c2441898d9799e1cdb5e152b3495
|
99
|
-
- test/dummy/tmp/cache/assets/D3E/B90/sprockets%2F9df707a0cc19082ff3e094ca09180fe4
|
100
|
-
- test/dummy/tmp/cache/assets/D7F/B10/sprockets%2F9ac097fe24e8c8229522feac6fc9337c
|
101
|
-
- test/eastwood_test.rb
|
102
|
-
- test/helpers_test.rb
|
103
|
-
- test/test_helper.rb
|
115
|
+
- spec/rails/.gitkeep
|
116
|
+
- spec/requests/eastwood_spec.rb
|
117
|
+
- spec/spec_helper.rb
|
118
|
+
- spec/support/rails_template.rb
|
119
|
+
- spec/unit/config_spec.rb
|
120
|
+
- spec/unit/context_spec.rb
|
121
|
+
- spec/unit/format_spec.rb
|
104
122
|
homepage: https://github.com/jeremyruppel/eastwood
|
105
123
|
licenses: []
|
106
124
|
post_install_message:
|
@@ -113,62 +131,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
131
|
- - ! '>='
|
114
132
|
- !ruby/object:Gem::Version
|
115
133
|
version: '0'
|
116
|
-
segments:
|
117
|
-
- 0
|
118
|
-
hash: -763628753016896846
|
119
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
135
|
none: false
|
121
136
|
requirements:
|
122
137
|
- - ! '>='
|
123
138
|
- !ruby/object:Gem::Version
|
124
139
|
version: '0'
|
125
|
-
segments:
|
126
|
-
- 0
|
127
|
-
hash: -763628753016896846
|
128
140
|
requirements: []
|
129
|
-
rubyforge_project:
|
141
|
+
rubyforge_project: eastwood
|
130
142
|
rubygems_version: 1.8.15
|
131
143
|
signing_key:
|
132
144
|
specification_version: 3
|
133
145
|
summary: Start your client side out right
|
134
146
|
test_files:
|
135
|
-
-
|
136
|
-
-
|
137
|
-
-
|
138
|
-
-
|
139
|
-
-
|
140
|
-
-
|
141
|
-
-
|
142
|
-
- test/dummy/config/application.rb
|
143
|
-
- test/dummy/config/boot.rb
|
144
|
-
- test/dummy/config/database.yml
|
145
|
-
- test/dummy/config/environment.rb
|
146
|
-
- test/dummy/config/environments/development.rb
|
147
|
-
- test/dummy/config/environments/production.rb
|
148
|
-
- test/dummy/config/environments/test.rb
|
149
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
150
|
-
- test/dummy/config/initializers/inflections.rb
|
151
|
-
- test/dummy/config/initializers/mime_types.rb
|
152
|
-
- test/dummy/config/initializers/secret_token.rb
|
153
|
-
- test/dummy/config/initializers/session_store.rb
|
154
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
155
|
-
- test/dummy/config/locales/en.yml
|
156
|
-
- test/dummy/config/routes.rb
|
157
|
-
- test/dummy/config.ru
|
158
|
-
- test/dummy/db/development.sqlite3
|
159
|
-
- test/dummy/db/test.sqlite3
|
160
|
-
- test/dummy/log/development.log
|
161
|
-
- test/dummy/log/test.log
|
162
|
-
- test/dummy/public/404.html
|
163
|
-
- test/dummy/public/422.html
|
164
|
-
- test/dummy/public/500.html
|
165
|
-
- test/dummy/public/favicon.ico
|
166
|
-
- test/dummy/public/index.html
|
167
|
-
- test/dummy/Rakefile
|
168
|
-
- test/dummy/script/rails
|
169
|
-
- test/dummy/tmp/cache/assets/CBD/F90/sprockets%2F6d20c2441898d9799e1cdb5e152b3495
|
170
|
-
- test/dummy/tmp/cache/assets/D3E/B90/sprockets%2F9df707a0cc19082ff3e094ca09180fe4
|
171
|
-
- test/dummy/tmp/cache/assets/D7F/B10/sprockets%2F9ac097fe24e8c8229522feac6fc9337c
|
172
|
-
- test/eastwood_test.rb
|
173
|
-
- test/helpers_test.rb
|
174
|
-
- test/test_helper.rb
|
147
|
+
- spec/rails/.gitkeep
|
148
|
+
- spec/requests/eastwood_spec.rb
|
149
|
+
- spec/spec_helper.rb
|
150
|
+
- spec/support/rails_template.rb
|
151
|
+
- spec/unit/config_spec.rb
|
152
|
+
- spec/unit/context_spec.rb
|
153
|
+
- spec/unit/format_spec.rb
|
data/lib/eastwood/helpers.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
module Eastwood
|
2
|
-
module Helpers
|
3
|
-
extend ActiveSupport::Concern
|
4
|
-
|
5
|
-
def application_name
|
6
|
-
app.engine_name.camelize.sub /Application$/, ''
|
7
|
-
end
|
8
|
-
|
9
|
-
def env
|
10
|
-
Rails.env
|
11
|
-
end
|
12
|
-
|
13
|
-
def named_routes
|
14
|
-
app.routes.routes.select { |r| r.name.present? }
|
15
|
-
end
|
16
|
-
|
17
|
-
def client_routes
|
18
|
-
Eastwood.routes.routes
|
19
|
-
end
|
20
|
-
|
21
|
-
protected
|
22
|
-
|
23
|
-
def app
|
24
|
-
Rails.application
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
data/lib/eastwood/routes.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
module Eastwood
|
2
|
-
class Routes
|
3
|
-
|
4
|
-
def draw( &block )
|
5
|
-
instance_exec &block
|
6
|
-
end
|
7
|
-
|
8
|
-
def get( name, path )
|
9
|
-
routes[ name ] = Route.new( name, path )
|
10
|
-
end
|
11
|
-
|
12
|
-
def routes
|
13
|
-
@routes ||= { }
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
class Route
|
18
|
-
attr_reader :name, :path
|
19
|
-
def initialize( name, path )
|
20
|
-
@name, @path = name, path
|
21
|
-
end
|
22
|
-
|
23
|
-
def segment_keys
|
24
|
-
# I feel like there has to be a cleaner way to do this
|
25
|
-
path.scan( /:(\w+)/ ).flatten
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|