djr 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +5 -5
- data/Rakefile +5 -1
- data/app/controllers/djr_controller.rb +1 -1
- data/lib/djr/version.rb +1 -1
- data/spec/djr_controller_spec.rb +26 -0
- metadata +10 -7
- data/spec/djr_spec.rb +0 -8
data/Gemfile
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
2
|
|
3
|
-
gem "rails", "3.
|
3
|
+
gem "rails", "3.2.8"
|
4
4
|
|
5
5
|
group :development, :test do
|
6
6
|
gem "sqlite3"
|
7
|
-
gem
|
8
|
-
gem 'rspec-rails', "2.8.1"
|
7
|
+
gem 'rspec-rails'#, "2.8.1"
|
9
8
|
gem 'simplecov'
|
10
9
|
gem 'shoulda'
|
11
|
-
gem "rdoc"
|
12
|
-
gem "bundler"
|
10
|
+
gem "rdoc"#, "3.12"
|
11
|
+
gem "bundler" #, "1.0.22"
|
12
|
+
gem "debugger"
|
13
13
|
end
|
data/Rakefile
CHANGED
@@ -31,7 +31,7 @@ class DjrController < ActionController::Base
|
|
31
31
|
if route.defaults[:controller].present?
|
32
32
|
method = route.conditions[:request_method].present? ? route.conditions[:request_method].source[1..-2] : "GET"
|
33
33
|
controller_name = "#{route.defaults[:controller].camelize.gsub(/\:\:/, '.')}Controller"
|
34
|
-
" #{controller_name}.prototype.routes['#{route.defaults[:action]}'] = {url: \"#{route.path}\", method: \"#{method}\" };"
|
34
|
+
" #{controller_name}.prototype.routes['#{route.defaults[:action]}'] = {url: \"#{route.path.ast}\", method: \"#{method}\" };"
|
35
35
|
else
|
36
36
|
nil
|
37
37
|
end
|
data/lib/djr/version.rb
CHANGED
data/spec/djr_controller_spec.rb
CHANGED
@@ -32,6 +32,32 @@ describe DjrController, :type => :controller do
|
|
32
32
|
|
33
33
|
end
|
34
34
|
|
35
|
+
context "When Controller has null" do
|
36
|
+
|
37
|
+
before do
|
38
|
+
|
39
|
+
ActionController::Base.asset_host = "/"
|
40
|
+
|
41
|
+
routes = Rails.application.routes
|
42
|
+
routes.disable_clear_and_finalize = true
|
43
|
+
routes.clear!
|
44
|
+
Rails.application.routes_reloader.paths.each { |path| load(path) }
|
45
|
+
routes.draw do
|
46
|
+
match "/products" => "products#index"
|
47
|
+
end
|
48
|
+
routes.disable_clear_and_finalize = false
|
49
|
+
routes.finalize!
|
50
|
+
|
51
|
+
@generated_javascript = ";DjrController = function(){DJR.call(this);}; DjrController.prototype.routes = {};ProductsController = function(){DJR.call(this);}; ProductsController.prototype.routes = {}; DjrController.prototype.routes['djr'] = {url: \"/djr(.:format)\", method: \"GET\" }; ProductsController.prototype.routes['index'] = {url: \"/products(.:format)\", method: \"GET\" };"
|
52
|
+
end
|
53
|
+
|
54
|
+
it "Should generate without errors because assets route" do
|
55
|
+
get :djr
|
56
|
+
response.body.should == @generated_javascript
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
35
61
|
|
36
62
|
context "When Controller has module" do
|
37
63
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: djr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
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-
|
12
|
+
date: 2012-10-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,12 @@ dependencies:
|
|
21
21
|
version: 3.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.1.0
|
25
30
|
description: DJR will generate the JavaScript code from Rails Controllers to allow
|
26
31
|
browsers to securely call into Ruby code almost as if it was running locally
|
27
32
|
email:
|
@@ -40,7 +45,6 @@ files:
|
|
40
45
|
- lib/engine.rb
|
41
46
|
- vendor/assets/javascripts/djr.js
|
42
47
|
- spec/djr_controller_spec.rb
|
43
|
-
- spec/djr_spec.rb
|
44
48
|
- spec/spec_helper.rb
|
45
49
|
homepage: https://github.com/milfont/djr
|
46
50
|
licenses: []
|
@@ -62,11 +66,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
66
|
version: '0'
|
63
67
|
requirements: []
|
64
68
|
rubyforge_project: djr
|
65
|
-
rubygems_version: 1.8.
|
69
|
+
rubygems_version: 1.8.24
|
66
70
|
signing_key:
|
67
71
|
specification_version: 3
|
68
72
|
summary: Direct Jquery Remoting
|
69
73
|
test_files:
|
70
74
|
- spec/djr_controller_spec.rb
|
71
|
-
- spec/djr_spec.rb
|
72
75
|
- spec/spec_helper.rb
|