diff options
-rw-r--r-- | railties/lib/rails/generators/actions.rb | 10 | ||||
-rw-r--r-- | railties/railties.gemspec | 2 | ||||
-rw-r--r-- | railties/test/generators/actions_test.rb | 6 |
3 files changed, 17 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb index d41da773c6..e39fa3ff11 100644 --- a/railties/lib/rails/generators/actions.rb +++ b/railties/lib/rails/generators/actions.rb @@ -280,6 +280,16 @@ module Rails 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, diff --git a/railties/railties.gemspec b/railties/railties.gemspec index 9b07fcc30f..44475b82cf 100644 --- a/railties/railties.gemspec +++ b/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 diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index 5929db6318..3585e6e7c0 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -210,6 +210,12 @@ class ActionsTest < Rails::Generators::TestCase 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) |