lib/ember-cli/app.rb in ember-cli-rails-0.0.13 vs lib/ember-cli/app.rb in ember-cli-rails-0.0.14
- old
+ new
@@ -2,10 +2,11 @@
module EmberCLI
class App
ADDON_VERSION = "0.0.7"
EMBER_CLI_VERSION = "~> 0.1.3"
+ JQUERY_VERSIONS = ["~> 1.7", "~> 2.1"].freeze
attr_reader :name, :options, :pid
def initialize(name, options={})
@name, @options = name.to_s, options
@@ -68,10 +69,11 @@
end
private
delegate :ember_path, to: :configuration
+ delegate :match_version?, :non_production?, to: Helpers
delegate :tee_path, to: :configuration
delegate :configuration, to: :EmberCLI
def build_timeout
options.fetch(:build_timeout){ configuration.build_timeout }
@@ -90,16 +92,22 @@
add_assets_to_precompile_list
true
end
end
+ def suppress_jquery?
+ return false unless defined?(Jquery::Rails::JQUERY_VERSION)
+
+ JQUERY_VERSIONS.any? do |requirement|
+ match_version?(Jquery::Rails::JQUERY_VERSION, requirement)
+ end
+ end
+
def check_ember_cli_version!
version = dev_dependencies.fetch("ember-cli").split("-").first
- version = Gem::Version.new(version)
- requirement = Gem::Requirement.new(EMBER_CLI_VERSION)
- unless requirement.satisfied_by?(version)
+ unless match_version?(version, EMBER_CLI_VERSION)
fail <<-MSG.strip_heredoc
EmberCLI Rails require ember-cli NPM package version to be
#{requirement} to work properly. From within your EmberCLI directory
please update your package.json accordingly and run:
@@ -171,11 +179,11 @@
def assets_path
@assets_path ||= EmberCLI.root.join("assets").tap(&:mkpath)
end
def environment
- Helpers.non_production?? "development" : "production"
+ non_production?? "development" : "production"
end
def package_json
@package_json ||= JSON.parse(app_path.join("package.json").read).with_indifferent_access
end
@@ -190,9 +198,10 @@
end
def env_hash
ENV.clone.tap do |vars|
vars.store "DISABLE_FINGERPRINTING", "true"
+ vars.store "SUPPRESS_JQUERY", "true" if suppress_jquery?
end
end
end
end