rails_view 1.0.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +15 -0
  2. data/lib/rails_view.rb +51 -34
  3. data/rails_view.gemspec +1 -1
  4. metadata +5 -7
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZjNjMmFjYTUxYjUyNTg0MmJkNWEyMGMwZGUyYzc5NTVmYmFmNTZmMw==
5
+ data.tar.gz: !binary |-
6
+ MDVhNWY4OGQ5NmIyMThkNzJmMGY5MGIxOGY4NmFiNTZlODY2YmRmNw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MDY2NjA3Yjg3YjdjYjIzM2U5ZTM5MjJlMDFjZWE1MDliODg5ZjU4NTc0MTky
10
+ MWM1ZDZjZDk5M2I3NzUyZWQyZTUwYjc3ZmM4ZGE0ZGRkMTM5MjZmMWYwNDk2
11
+ M2NiMWM0ZWMwMTEwYmIxZWU3MTA1YmRkZmY1YmJlMDU0MzY5NzQ=
12
+ data.tar.gz: !binary |-
13
+ MTg2MmMyYWFkNzIwYzQ4NGNlMDJiNzAyMzYzODAzYmY0NjQ2NDlmNGZkZTll
14
+ MDllZmJkMDEyM2UzY2VkNGU5NWExYWVhZTI1Mzk1MWZiOGZiN2QxZWZkOWM5
15
+ ZjFjYTJjMjJhMDJiODkyMTVhNWYwYzgyNWY0NjJmYTE3YTEwMGE=
data/lib/rails_view.rb CHANGED
@@ -2,45 +2,62 @@ require 'rails' unless defined?(::Rails)
2
2
  require 'action_controller' unless defined?(::ActionController)
3
3
 
4
4
  class View
5
- VERSION = '1.0.1'
5
+ VERSION = '1.2.0'
6
6
 
7
7
  def View.version
8
8
  View::VERSION
9
9
  end
10
10
 
11
- class Controller < ::ActionController::Base
12
- layout false
13
- helper :all
14
-
15
- def Controller.context(*args, &block)
16
- require 'rails'
17
- require 'action_controller'
18
- require 'action_dispatch/testing/test_request.rb'
19
- require 'action_dispatch/testing/test_response.rb'
20
-
21
- default_url_options =
22
- begin
23
- require 'rails_default_url_options'
24
- DefaultUrlOptions
25
- rescue LoadError
26
- options[:default_url_options] || {}
27
- end
28
-
29
- store = ActiveSupport::Cache::MemoryStore.new
30
- request = ActionDispatch::TestRequest.new
31
- response = ActionDispatch::TestResponse.new
32
-
33
- controller = new()
34
-
35
- controller.perform_caching = false
36
- controller.cache_store = store
37
- controller.request = request
38
- controller.response = response
39
- #controller.send(:initialize_template_class, response)
40
- #controller.send(:assign_shortcuts, request, response)
41
- controller.send(:default_url_options).merge!(default_url_options)
42
- block ? controller.instance_eval(&block) : controller
43
- end
11
+ if defined?(Rails::Engine)
12
+ class Engine < Rails::Engine
13
+ config.after_initialize do
14
+ ::View.generate_controller!
15
+ end
16
+ end
17
+ else
18
+ ::View.generate_controller!
19
+ end
20
+
21
+ def View.generate_controller!
22
+ #base = (defined?(ApplicationController) ? ApplicationController : ::ActionController::Base)
23
+ base = ::ActionController::Base
24
+
25
+ c = Class.new(base) do
26
+ layout false
27
+ helper :all
28
+
29
+ def self.context(*args, &block)
30
+ require 'rails'
31
+ require 'action_controller'
32
+ require 'action_dispatch/testing/test_request.rb'
33
+ require 'action_dispatch/testing/test_response.rb'
34
+
35
+ default_url_options =
36
+ begin
37
+ require 'rails_default_url_options'
38
+ DefaultUrlOptions
39
+ rescue LoadError
40
+ options[:default_url_options] || {}
41
+ end
42
+
43
+ store = ActiveSupport::Cache::MemoryStore.new
44
+ request = ActionDispatch::TestRequest.new
45
+ response = ActionDispatch::TestResponse.new
46
+
47
+ controller = new()
48
+
49
+ controller.perform_caching = false
50
+ controller.cache_store = store
51
+ controller.request = request
52
+ controller.response = response
53
+ #controller.send(:initialize_template_class, response)
54
+ #controller.send(:assign_shortcuts, request, response)
55
+ controller.send(:default_url_options).merge!(default_url_options)
56
+ block ? controller.instance_eval(&block) : controller
57
+ end
58
+ end
59
+
60
+ const_set(:Controller, c)
44
61
  end
45
62
 
46
63
 
data/rails_view.gemspec CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "rails_view"
6
- spec.version = "1.0.1"
6
+ spec.version = "1.2.0"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "rails_view"
9
9
  spec.description = "View.render(:template => 'shared/view', :locals => {:key => :val})"
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_view
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
5
- prerelease:
4
+ version: 1.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ara T. Howard
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-08 00:00:00.000000000 Z
11
+ date: 2013-11-23 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: View.render(:template => 'shared/view', :locals => {:key => :val})
15
14
  email: ara.t.howard@gmail.com
@@ -25,26 +24,25 @@ files:
25
24
  - test/testing.rb
26
25
  homepage: https://github.com/ahoward/rails_view
27
26
  licenses: []
27
+ metadata: {}
28
28
  post_install_message:
29
29
  rdoc_options: []
30
30
  require_paths:
31
31
  - lib
32
32
  required_ruby_version: !ruby/object:Gem::Requirement
33
- none: false
34
33
  requirements:
35
34
  - - ! '>='
36
35
  - !ruby/object:Gem::Version
37
36
  version: '0'
38
37
  required_rubygems_version: !ruby/object:Gem::Requirement
39
- none: false
40
38
  requirements:
41
39
  - - ! '>='
42
40
  - !ruby/object:Gem::Version
43
41
  version: '0'
44
42
  requirements: []
45
43
  rubyforge_project: codeforpeople
46
- rubygems_version: 1.8.24
44
+ rubygems_version: 2.0.3
47
45
  signing_key:
48
- specification_version: 3
46
+ specification_version: 4
49
47
  summary: rails_view
50
48
  test_files: []