Skip to content

Commit

Permalink
config.generators.api_only = true set rails api option on generators
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Apr 20, 2015
1 parent ba03cd8 commit 2f93977
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions railties/lib/rails/generators.rb
Expand Up @@ -103,6 +103,10 @@ def self.fallbacks

def self.api_only!
hide_namespaces "assets", "helper", "css", "js"

options[:rails].merge!(
api: true
)
end

# Remove the color from output.
Expand Down
3 changes: 2 additions & 1 deletion railties/test/application/generators_test.rb
Expand Up @@ -126,7 +126,7 @@ def with_bare_config
end
end

test "api only generators hide assets, helper, js and css namespaces" do
test "api only generators hide assets, helper, js and css namespaces and set api option" do
add_to_config <<-RUBY
config.generators.api_only = true
RUBY
Expand All @@ -139,6 +139,7 @@ def with_bare_config
assert Rails::Generators.hidden_namespaces.include?("helper")
assert Rails::Generators.hidden_namespaces.include?("js")
assert Rails::Generators.hidden_namespaces.include?("css")
assert Rails::Generators.options[:rails][:api]
end
end
end

0 comments on commit 2f93977

Please sign in to comment.