handlebar_wax 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/handlebar_wax.rb CHANGED
@@ -1,29 +1,19 @@
1
1
  require 'handlebar_wax/template_handler'
2
2
  require 'handlebar_wax/railtie'
3
+ require 'handlebar_wax/engine'
3
4
  require 'yajl'
4
5
 
5
6
  module HandlebarWax
6
7
 
7
8
  autoload :Middleware, "handlebar_wax/middleware"
8
9
 
9
- def self.register_expansion(timestamp=nil)
10
- querystring = "?#{timestamp.to_i}" if timestamp
11
- expansions = {
12
- :handlebar_wax => [
13
- "/javascripts/handlebars.js",
14
- "/javascripts/handlebars_templates.js#{querystring}"
15
- ]
16
- }
17
- ActionView::Helpers::AssetTagHelper.register_javascript_expansion(expansions)
18
- end
19
-
20
10
  def self.template_files
21
11
  Dir[File.join(%w(app views), '**', '*.hbs')]
22
12
  end
23
13
 
24
14
  def self.output_path
25
- base = defined?(Rails.root) ? Rails.root : '.'
26
- "#{base}/public/javascripts/handlebars_templates.js"
15
+ assets = File.join(File.dirname(__FILE__),'..','app','assets')
16
+ "#{assets}/javascripts/handlebars_templates.js"
27
17
  end
28
18
 
29
19
  def self.generate_templates
@@ -0,0 +1,6 @@
1
+ module HandlebarWax
2
+ class Engine < Rails::Engine
3
+
4
+ end
5
+ end
6
+
@@ -12,10 +12,6 @@ module HandlebarWax
12
12
 
13
13
  if mtimes.any? && (newest = mtimes.max) > @newest
14
14
  HandlebarWax.generate_templates
15
- @newest = newest
16
-
17
- # kill caching of old versions.
18
- HandlebarWax.register_expansion(@newest)
19
15
  end
20
16
 
21
17
  @app.call(env)
@@ -2,7 +2,6 @@ module HandlebarWax
2
2
  class Railtie < Rails::Railtie
3
3
  initializer 'handlebar_wax.initialize' do |app|
4
4
  HandlebarWax.generate_templates
5
- HandlebarWax.register_expansion
6
5
  if Rails.env.development?
7
6
  app.config.middleware.use HandlebarWax::Middleware
8
7
  end
@@ -1,3 +1,3 @@
1
1
  module HandlebarWax
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: handlebar_wax
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
8
  - 2
10
- version: 0.1.2
9
+ - 0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Burke Libbey
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-30 00:00:00 -05:00
18
+ date: 2011-05-06 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -123,8 +123,12 @@ files:
123
123
  - LICENSE.txt
124
124
  - README.rdoc
125
125
  - Rakefile
126
+ - app/assets/javascripts/.gitignore
127
+ - app/assets/javascripts/handlebar_wax.js
128
+ - app/assets/javascripts/handlebars.js
126
129
  - handlebar_wax.gemspec
127
130
  - lib/handlebar_wax.rb
131
+ - lib/handlebar_wax/engine.rb
128
132
  - lib/handlebar_wax/middleware.rb
129
133
  - lib/handlebar_wax/railtie.rb
130
134
  - lib/handlebar_wax/template_handler.rb