Skip to content

[Refactor] Suppress warnings from Ruby #518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions lib/generators/ember/bootstrap_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def inject_ember
else
inject_into_application_file(engine_extension)
end
rescue Exception => e
rescue Exception
inject_into_application_file('js')
end
end
Expand Down Expand Up @@ -69,14 +69,14 @@ def inject_into_application_file(safe_extension)
end

def get_options_from_contents(contents)
if contents =~ regex = /^.*require_tree.*$/
{:before => regex}
elsif contents =~ regex = /^\s*$/
{:before => regex}
else
regex = /\z/
{:after => regex}
end
regex = /^.*require_tree.*$/
return {:before => regex} if contents =~ regex

regex = /^\s*$/
return {:before => regex} if contents =~ regex

regex = /\z/
{:after => regex}
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/generators/ember/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def fetch(from, to, prepend_verbose = true)
raise Thor::Error
end
output.rewind
content = output.read
output.read
end

def resource_exist?(target)
Expand Down
10 changes: 5 additions & 5 deletions test/hjstemplate_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@ class HjsTemplateTest < IntegrationTest
test "asset pipeline should serve template" do
get "/assets/templates/test.js"
assert_response :success
assert_match /Ember\.TEMPLATES\["test"\] = Ember\.(?:Handlebars|HTMLBars)\.template\(/m, @response.body
assert_match %r{Ember\.TEMPLATES\["test"\] = Ember\.(?:Handlebars|HTMLBars)\.template\(}m, @response.body
end

test "asset pipeline should serve bundled application.js" do
get "/assets/application.js"
assert_response :success
assert_match /Ember\.TEMPLATES\["test"\] = Ember\.(?:Handlebars|HTMLBars)\.template\(/m, @response.body
assert_match %r{Ember\.TEMPLATES\["test"\] = Ember\.(?:Handlebars|HTMLBars)\.template\(}m, @response.body
end

test "should unbind mustache templates" do
get "/assets/templates/hairy.js"
assert_response :success
assert_match /Ember\.TEMPLATES\["hairy(\.mustache)?"\] = Ember\.(?:Handlebars|HTMLBars)\.template\(/m, @response.body
assert_match /function .*unbound|"name":"unbound"/m, @response.body
assert_match %r{Ember\.TEMPLATES\["hairy(\.mustache)?"\] = Ember\.(?:Handlebars|HTMLBars)\.template\(}m, @response.body
assert_match %r{function .*unbound|"name":"unbound"}m, @response.body
end

test "ensure new lines inside the anon function are persisted" do
get "/assets/templates/new_lines.js"
assert_response :success
assert @response.body =~ /; data = data || {};\n|"data":data/, @response.body.inspect
assert @response.body =~ %r(; data = data || {};\n|"data":data), @response.body.inspect
end

end
4 changes: 2 additions & 2 deletions test/precompile_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def precompile!(rails_env)

contents = File.read(application_js_path)

assert_match /Ember\.VERSION/, contents, 'application.js should contain Ember.VERSION'
assert_match /Handlebars\.VERSION|COMPILER_REVISION/, contents, 'applciation.js should contain Handlebars.VERSION'
assert_match %r{Ember\.VERSION}, contents, 'application.js should contain Ember.VERSION'
assert_match %r{Handlebars\.VERSION|COMPILER_REVISION}, contents, 'applciation.js should contain Handlebars.VERSION'
end

def app_path
Expand Down