dry_haml_handlebars 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -88,6 +88,21 @@ module DryHamlHandlebars
88
88
 
89
89
  partial_name = [relative_view_path.gsub('/', '_'), view_name[1..-1]].join('_')
90
90
  rabl_path, template_path, compiled_template_path = generate_file_names(relative_view_path, view_name)
91
+
92
+ Rails.logger.info <<-INFO_STRING
93
+ template_path = #{template_path}
94
+ options[:force_handlebars_compile] = #{options[:force_handlebars_compile]}
95
+ File.exist?(compiled_template_path) = #{File.exist?(compiled_template_path)}
96
+ env = #{env}
97
+ INFO_STRING
98
+
99
+ if [:development, :test].include?(env)
100
+ Rails.logger.info <<-INFO_STRING
101
+ File.mtime(compiled_template_path) = #{File.mtime(compiled_template_path)}
102
+ File.mtime(template.identifier) = #{File.mtime(template.identifier)}
103
+ INFO_STRING
104
+ end
105
+
91
106
  if options[:force_handlebars_compile] or !File.exist?(compiled_template_path) or ( [:development, :test].include?(env) and ( File.mtime(compiled_template_path) < File.mtime(template.identifier) ) )
92
107
  source = template.source
93
108
  source = DryHamlHandlebars.dedent_hbs(source)
@@ -299,6 +314,7 @@ module DryHamlHandlebars
299
314
 
300
315
  def write_asset_files
301
316
  <<-RUBY
317
+ Rails.logger.info "WRITING TEMPLATES TO FILE SYSTEM (#{@template_path})"
302
318
  File.open('#{@template_path}', 'w+') {|f| f.write(rendered_haml) }
303
319
  File.open('#{@compiled_template_path}', 'w+') {|f| f.write(hbs_loader) }
304
320
  RUBY
@@ -1,3 +1,3 @@
1
1
  module DryHamlHandlebars
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -16,12 +16,12 @@ module DryHamlHandlebars
16
16
  app.config.autoload_paths += %W(#{app.config.root}/app/views)
17
17
  end
18
18
 
19
- config.to_prepare do
20
- # this is only called once in dev mode and not on every request as it is meant to
21
- # just manually call DryHamlHandlebars.prepare_handlebars if you change/add a helper
22
- # see https://github.com/rails/rails/issues/7152
23
- DryHamlHandlebars.prepare_handlebars
24
- end
19
+ # config.to_prepare do
20
+ # # this is only called once in dev mode and not on every request as it is meant to
21
+ # # just manually call DryHamlHandlebars.prepare_handlebars if you change/add a helper
22
+ # # see https://github.com/rails/rails/issues/7152
23
+ # DryHamlHandlebars.prepare_handlebars
24
+ # end
25
25
 
26
26
  initializer "dry_haml_handlebars.configure" do |app|
27
27
 
@@ -83,7 +83,7 @@ module DryHamlHandlebars
83
83
 
84
84
  additional_javascripts = Array.wrap(additional_javascripts)
85
85
 
86
- compile_all_helper_coffeescripts
86
+ compile_all_helper_coffeescripts unless ["development", "test"].include?(Rails.env.to_s)
87
87
  #load_i18n if defined? SimplesIdeias::I18n
88
88
 
89
89
  hbs_context = HandlebarsAssets::Handlebars.send(:context)
@@ -92,6 +92,8 @@ module DryHamlHandlebars
92
92
  handlebars_helpers = Dir.glob(Rails.root.join('app', 'assets', 'handlebars_helpers', '**', '*.js'))
93
93
 
94
94
  self_loading_assets = templates_and_partials + handlebars_helpers + additional_javascripts
95
+
96
+ Rails.logger.info "self_loading_assets = #{self_loading_assets}"
95
97
 
96
98
  self_loading_assets.each do |fname|
97
99
  basename = File.basename(fname)
@@ -99,6 +101,7 @@ module DryHamlHandlebars
99
101
  source = file.read
100
102
  source.strip!
101
103
  source.chomp!(";")
104
+ Rails.logger.info "about to run:\nhbs_context.eval(#{source[0..50] + '...'}, #{basename})"
102
105
  hbs_context.eval(source, basename)
103
106
  end
104
107
  end
@@ -142,7 +145,7 @@ module DryHamlHandlebars
142
145
  js_path = File.join(js_directory, filename)
143
146
 
144
147
  #see if the js exists and is older than the coffee
145
- unless File.exist?(js_path) and File.mtime(js_path) > File.mtime(coffee_path)
148
+ unless File.exist?(js_path) and File.mtime(js_path) >= File.mtime(coffee_path)
146
149
 
147
150
  #if so, compile coffee and overwrite/create the js
148
151
  coffee = File.read(coffee_path)
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: dry_haml_handlebars
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.8
5
+ version: 0.0.9
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jonathan Chambers
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-12-25 00:00:00 Z
13
+ date: 2012-12-29 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails