execjs-rails 0.2.2 → 0.2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4fb0466c220cc5c0bef04fcac4e682253cc6416
4
- data.tar.gz: 0d4a84f8a5a1261447498ac767041b7574232507
3
+ metadata.gz: 6d9c59bab43dffaf0f84ebd6dc53d78b234b04a3
4
+ data.tar.gz: 169675de91e58ce45767ad97631ada530e263188
5
5
  SHA512:
6
- metadata.gz: bcd030d36fff24f40570e6b72f839a5fea1f351e14f377687d67b14e5267c4530e701064621595ad74c3f452ee27a849b5d470880e34917b53a6a87caaed95e3
7
- data.tar.gz: c22f72115e27d4f701fa45adc018c9b8646af1f3c0dcaebbf38a426d012c22d84a1eeed9f6883e18c746d5f31ec7bb9996545a6f74b6bb1413e8e084b440098d
6
+ metadata.gz: 44caf1765e6ec3cdc24cc894e8cc83fd8bb3a63049eb69e984e5b788a8b1a18ac92cc8f80b95facc727b4bcc9395c64d57663932f3d9c4550305a94ba0f4e530
7
+ data.tar.gz: 843b4884347f40b2bacaabd58a0f71f30931d93b29e8363b7021adfa52994fc532786513353f424df5a11d00c498e4e945c4717e693a876ee10a6fec103a52cd
data/README.md CHANGED
@@ -34,7 +34,7 @@ function execjs_rails_handler(path, opts) {
34
34
  ```
35
35
  Then you have:
36
36
  * A Rails view helper, `execjs_render`, that will render output from your `execjs_rails_handler` JavaScript function.
37
- * A Rails template handler that will do the same. You can write your controller code the exact same way as if you were using ERB. If no ERB view exists, it will use `execjs_rails_has_view` to determine whether or not ExecJS Rails can handle the view. If so, it will render via `execjs_rails_handler`.
37
+ * A Rails template handler that will do the same. You can write your controller code the exact same way as if you were using ERB. It will use `execjs_rails_has_view` to determine whether or not ExecJS Rails can handle the view. If so, it will render via `execjs_rails_handler`. If not, it will fall back to looking for ERB.
38
38
 
39
39
  That's pretty much it.
40
40
 
@@ -4,13 +4,12 @@ module ExecJS
4
4
  extend ActiveSupport::Concern
5
5
  included do
6
6
 
7
- append_view_path TemplateResolver.new
7
+ prepend_view_path TemplateResolver.new
8
8
  append_before_filter :reset_execjs_renderer
9
9
 
10
10
  def reset_execjs_renderer
11
11
  Renderer.reset!
12
12
  end
13
-
14
13
  end
15
14
  end
16
15
  end
@@ -1,3 +1,5 @@
1
+ require 'rails/all'
2
+
1
3
  module ExecJS
2
4
  module Rails
3
5
  class Engine < ::Rails::Engine
@@ -38,6 +38,17 @@ module ExecJS
38
38
  output.html_safe
39
39
  end
40
40
 
41
+ # Check for template using has_view and render if we have it. Otherwise,
42
+ # fail with a template missing error that leads back here
43
+ def self.find_and_render(path, opts = {})
44
+ if has_view(path)
45
+ render(path, opts)
46
+ else
47
+ # Throw a missing template error if we don't have it
48
+ fail ::ActionView::MissingTemplate.new(["ExecJS::Rails::Renderer"], path, [], true, {})
49
+ end
50
+ end
51
+
41
52
  def self.dump_render_context(path, assigns, options={})
42
53
  source = @@config.debug_dump_prefix + @@config.build_source.call() + "; #{ @@config.handler_function_name }('#{ path }', '#{ options }');"
43
54
  file = File.open(assigns['__execjs_rails_dump_file'], 'w')
@@ -1,5 +1,5 @@
1
1
  module ExecJS
2
2
  module Rails
3
- VERSION = '0.2.2'
3
+ VERSION = '0.2.2.1'
4
4
  end
5
5
  end
@@ -11,7 +11,7 @@ module ExecJS
11
11
  if self.assigns.has_key?('__execjs_rails_dump_file')
12
12
  Renderer.dump_render_context(path, self.assigns, view_opts)
13
13
  end
14
- Renderer.render(path, view_opts)
14
+ Renderer.find_and_render(path, view_opts)
15
15
  end
16
16
  end
17
17
  end
metadata CHANGED
@@ -1,43 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: execjs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Revelry Labs, LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-17 00:00:00.000000000 Z
11
+ date: 2015-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: execjs
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '4.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '4.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
41
69
  description: Use ExecJS to write your views in JavaScript.
42
70
  email:
43
71
  - hello@revelry.co
@@ -45,7 +73,10 @@ executables: []
45
73
  extensions: []
46
74
  extra_rdoc_files: []
47
75
  files:
76
+ - README.md
48
77
  - lib/assets/javascripts/server.js
78
+ - lib/execjs-rails.rb
79
+ - lib/execjs/rails.rb
49
80
  - lib/execjs/rails/concern.rb
50
81
  - lib/execjs/rails/engine.rb
51
82
  - lib/execjs/rails/renderer.rb
@@ -53,9 +84,6 @@ files:
53
84
  - lib/execjs/rails/template_resolver.rb
54
85
  - lib/execjs/rails/version.rb
55
86
  - lib/execjs/rails/view_helper.rb
56
- - lib/execjs/rails.rb
57
- - lib/execjs-rails.rb
58
- - README.md
59
87
  homepage: https://github.com/revelrylabs/execjs-rails
60
88
  licenses:
61
89
  - MIT
@@ -66,17 +94,17 @@ require_paths:
66
94
  - lib
67
95
  required_ruby_version: !ruby/object:Gem::Requirement
68
96
  requirements:
69
- - - '>='
97
+ - - ">="
70
98
  - !ruby/object:Gem::Version
71
99
  version: '0'
72
100
  required_rubygems_version: !ruby/object:Gem::Requirement
73
101
  requirements:
74
- - - '>='
102
+ - - ">="
75
103
  - !ruby/object:Gem::Version
76
104
  version: '0'
77
105
  requirements: []
78
106
  rubyforge_project:
79
- rubygems_version: 2.0.14
107
+ rubygems_version: 2.2.2
80
108
  signing_key:
81
109
  specification_version: 4
82
110
  summary: Simple JavaScript rendering for Ruby on Rails.