Skip to content
Browse files

Add readme as method in Rails::Generators::Actions (as we had in 2.3)

  • Loading branch information...
1 parent e195b48 commit d0454e57661ceeaebd6f3fce4a608ec624257b19 @josevalim josevalim committed Feb 17, 2010
View
10 railties/lib/rails/generators/actions.rb
@@ -280,6 +280,16 @@ def route(routing_code)
end
end
+ # Reads the given file at the source root and prints it in the console.
+ #
+ # === Example
+ #
+ # readme "README"
+ #
+ def readme(path)
+ say File.read(find_in_source_paths(path))
+ end
+
protected
# Define log for backwards compatibility. If just one argument is sent,
View
2 railties/railties.gemspec
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
s.has_rdoc = false
s.add_dependency('rake', '>= 0.8.3')
- s.add_dependency('thor', '~> 0.13.0')
+ s.add_dependency('thor', '~> 0.13.3')
s.add_dependency('activesupport', '= 3.0.0.beta1')
s.add_dependency('actionpack', '= 3.0.0.beta1')
end
View
6 railties/test/generators/actions_test.rb
@@ -210,6 +210,12 @@ def test_route_should_add_data_to_the_routes_block_in_config_routes
assert_file 'config/routes.rb', /#{Regexp.escape(route_command)}/
end
+ def test_readme
+ run_generator
+ Rails::Generators::AppGenerator.expects(:source_root).returns(destination_root)
+ assert_match(/Welcome to Rails/, action(:readme, "README"))
+ end
+
protected
def action(*args, &block)

0 comments on commit d0454e5

Please sign in to comment.
Something went wrong with that request. Please try again.