diff --git a/.travis.yml b/.travis.yml index 3b03796..20c13a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,8 @@ rvm: - - 1.9.3 - - 2.0.0 + - 2.2.2 - jruby-19mode - - ruby-head - -matrix: - allow_failures: - - rvm: ruby-head - - gemfile: gemfiles/rails_head.gemfile gemfile: - gemfiles/rails_3.gemfile - - gemfiles/rails_4.gemfile - - gemfiles/rails_head.gemfile + - gemfiles/rails_4.0.gemfile + - gemfiles/rails_4.1.gemfile diff --git a/CHANGELOG.md b/CHANGELOG.md index b65a9d4..d640559 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ### Future +### 0.3.0 + +- specify mime-types < 3 due to requirement for ruby 2.0 [pitr] +- fix bug where html files outside of inside_paths were still being processed [sugarskull, #137] +- remove support for Rails 4.2+ in branch 0.x [pitr] + ### 0.2.0 - Add config.angular_templates.inside_paths [sars, #90] diff --git a/Gemfile b/Gemfile index 8dedc1b..9ce1691 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source "https://rubygems.org" gem "rails", "~> 4.1.0" -gem "slim" +gem "slim-rails" gem "haml" gem "kramdown" diff --git a/README.md b/README.md index 9fd3af0..84c0f54 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Adds your HTML templates into Angular's `$templateCache` using Rails asset pipeline. +**IMPORTANT**: for Rails 4.2+ use version 1.0+ of this gem. For Rails 3 - 4.1 use version 0.x + It removes the need for AJAX calls to retrieve the templates (or for you to manually set them into the DOM). ## Usage @@ -215,7 +217,7 @@ config.angular_templates.htmlcompressor = { ## License -MIT License. Copyright 2014 Pitr +MIT License. Copyright 2017 pitr ## Authors & contributors diff --git a/angular-rails-templates.gemspec b/angular-rails-templates.gemspec index 03b7017..6498df8 100644 --- a/angular-rails-templates.gemspec +++ b/angular-rails-templates.gemspec @@ -17,10 +17,11 @@ Gem::Specification.new do |s| s.require_paths = ["lib"] s.add_dependency "railties", ">= 3.1" - s.add_dependency "sprockets", "~> 2" + s.add_dependency "sprockets", "~> 2.0" s.add_dependency "tilt" s.add_development_dependency "minitest" s.add_development_dependency "capybara" + s.add_development_dependency "mime-types", "< 3" s.add_development_dependency "uglifier" end diff --git a/gemfiles/rails_4.gemfile b/gemfiles/rails_4.0.gemfile similarity index 80% rename from gemfiles/rails_4.gemfile rename to gemfiles/rails_4.0.gemfile index 28f88b7..a5762af 100644 --- a/gemfiles/rails_4.gemfile +++ b/gemfiles/rails_4.0.gemfile @@ -1,9 +1,8 @@ source "https://rubygems.org" -gem "rails", "~> 4.0.1" +gem "rails", "~> 4.0.0" gem "slim-rails" gem "haml" gem "kramdown" - gemspec :path => ".././" diff --git a/gemfiles/rails_4.1.gemfile b/gemfiles/rails_4.1.gemfile new file mode 100644 index 0000000..334b99b --- /dev/null +++ b/gemfiles/rails_4.1.gemfile @@ -0,0 +1,8 @@ +source "https://rubygems.org" + +gem "rails", "~> 4.1.0" +gem "slim-rails" +gem "haml" +gem "kramdown" + +gemspec :path => ".././" diff --git a/lib/angular-rails-templates/template.rb b/lib/angular-rails-templates/template.rb index d54b309..6dc6570 100644 --- a/lib/angular-rails-templates/template.rb +++ b/lib/angular-rails-templates/template.rb @@ -14,18 +14,22 @@ def prepare # we only want to process html assets inside those specified in configuration.inside_paths @asset_should_be_processed = configuration.inside_paths.any? { |folder| file.match(folder.to_s) } + unless @asset_should_be_processed + @data = nil + return + end + if configuration.htmlcompressor and @asset_should_be_processed @data = compress data end end def evaluate(scope, locals, &block) - locals[:html] = escape_javascript data.chomp - locals[:angular_template_name] = logical_template_path(scope) - locals[:source_file] = "#{scope.pathname}".sub(/^#{Rails.root}\//,'') - locals[:angular_module] = configuration.module_name - if @asset_should_be_processed + locals[:html] = escape_javascript data.chomp + locals[:angular_template_name] = logical_template_path(scope) + locals[:source_file] = "#{scope.pathname}".sub(/^#{Rails.root}\//,'') + locals[:angular_module] = configuration.module_name AngularJsTemplateWrapper.render(scope, locals) else data diff --git a/lib/angular-rails-templates/version.rb b/lib/angular-rails-templates/version.rb index ab4e85d..3537262 100644 --- a/lib/angular-rails-templates/version.rb +++ b/lib/angular-rails-templates/version.rb @@ -1,3 +1,3 @@ module AngularRailsTemplates - VERSION = '0.2.0' + VERSION = '0.3.0' end