Skip to content

Loading…

Remove additional asset artifacts from generated app #7

Merged
merged 2 commits into from

2 participants

@dpowell
  • Don't include jquery-rails in generated Gemfile.
  • Don't generate empty tmp/cache/assets and vendor/assets directories.
@carlosantoniodasilva
rails-api member

I'm a bit unsure about the undef way of doing this, although I can't think about a better approach right now - other than letting the methods run and remove later. I think it's ok to stick with this for now, thanks.

@carlosantoniodasilva carlosantoniodasilva merged commit 9760231 into rails-api:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
5 lib/rails-api/generators/rails/app/app_generator.rb
@@ -4,3 +4,8 @@
Rails::Generators::AppGenerator.source_paths.unshift(
File.expand_path('../../../../templates/rails/app', __FILE__)
)
+
+class Rails::AppBuilder
+ undef tmp
+ undef vendor
+end
View
2 lib/rails-api/templates/rails/app/Gemfile
@@ -9,8 +9,6 @@ gem 'rails-api'
<%= "gem 'jruby-openssl'\n" if defined?(JRUBY_VERSION) -%>
<%= "gem 'json'\n" if RUBY_VERSION < "1.9.2" -%>
-<%= javascript_gemfile_entry %>
-
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
View
11 test/generators/app_generator_test.rb
@@ -10,6 +10,7 @@ def test_skeleton_is_created
run_generator
default_files.each { |path| assert_file path }
+ skipped_files.each { |path| assert_no_file path }
end
def test_api_modified_files
@@ -18,6 +19,7 @@ def test_api_modified_files
assert_file "Gemfile" do |content|
assert_match(/gem 'rails-api'/, content)
assert_no_match(/gem 'coffee-rails'/, content)
+ assert_no_match(/gem 'jquery-rails'/, content)
assert_no_match(/gem 'sass-rails'/, content)
end
assert_file "app/controllers/application_controller.rb", /ActionController::API/
@@ -47,10 +49,11 @@ def default_files
test/functional
test/integration
test/performance
- test/unit
- vendor
- vendor/assets
- tmp/cache
+ test/unit)
+ end
+
+ def skipped_files
+ %w(vendor/assets
tmp/cache/assets)
end
end
Something went wrong with that request. Please try again.