aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-02-17 18:09:13 +0100
committerJosé Valim <jose.valim@gmail.com>2010-02-17 18:43:40 +0100
commitd0454e57661ceeaebd6f3fce4a608ec624257b19 (patch)
treead40d90ac5ef91a167a4f24822650a05acb73431 /railties
parente195b48f21bac800dbad5acc04ac732930d36c35 (diff)
downloadrails-d0454e57661ceeaebd6f3fce4a608ec624257b19.tar.gz
rails-d0454e57661ceeaebd6f3fce4a608ec624257b19.tar.bz2
rails-d0454e57661ceeaebd6f3fce4a608ec624257b19.zip
Add readme as method in Rails::Generators::Actions (as we had in 2.3)
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/generators/actions.rb10
-rw-r--r--railties/railties.gemspec2
-rw-r--r--railties/test/generators/actions_test.rb6
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)