Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
e38d3752
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e38d3752
编写于
5月 27, 2011
作者:
S
Stefan Sprenger
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Generate script/rails only if --full is given
上级
5f005924
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
7 addition
and
5 deletion
+7
-5
railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
...rails/generators/rails/plugin_new/plugin_new_generator.rb
+2
-0
railties/test/generators/plugin_new_generator_test.rb
railties/test/generators/plugin_new_generator_test.rb
+3
-3
railties/test/generators/shared_generator_tests.rb
railties/test/generators/shared_generator_tests.rb
+2
-2
未找到文件。
railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
浏览文件 @
e38d3752
...
@@ -126,6 +126,8 @@ def javascripts
...
@@ -126,6 +126,8 @@ def javascripts
end
end
def
script
(
force
=
false
)
def
script
(
force
=
false
)
return
unless
full?
directory
"script"
,
:force
=>
force
do
|
content
|
directory
"script"
,
:force
=>
force
do
|
content
|
"
#{
shebang
}
\n
"
+
content
"
#{
shebang
}
\n
"
+
content
end
end
...
...
railties/test/generators/plugin_new_generator_test.rb
浏览文件 @
e38d3752
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +12,6 @@
lib
lib
lib/bukkits.rb
lib/bukkits.rb
lib/tasks/bukkits_tasks.rake
lib/tasks/bukkits_tasks.rake
script/rails
test/bukkits_test.rb
test/bukkits_test.rb
test/test_helper.rb
test/test_helper.rb
test/dummy
test/dummy
...
@@ -150,6 +149,7 @@ def test_creating_engine_in_full_mode
...
@@ -150,6 +149,7 @@ def test_creating_engine_in_full_mode
assert_file
"config/routes.rb"
,
/Rails.application.routes.draw do/
assert_file
"config/routes.rb"
,
/Rails.application.routes.draw do/
assert_file
"lib/bukkits/engine.rb"
,
/module Bukkits\n class Engine < ::Rails::Engine\n end\nend/
assert_file
"lib/bukkits/engine.rb"
,
/module Bukkits\n class Engine < ::Rails::Engine\n end\nend/
assert_file
"lib/bukkits.rb"
,
/require "bukkits\/engine"/
assert_file
"lib/bukkits.rb"
,
/require "bukkits\/engine"/
assert_file
"script/rails"
end
end
def
test_being_quiet_while_creating_dummy_application
def
test_being_quiet_while_creating_dummy_application
...
@@ -178,7 +178,7 @@ def test_creating_gemspec
...
@@ -178,7 +178,7 @@ def test_creating_gemspec
end
end
def
test_usage_of_engine_commands
def
test_usage_of_engine_commands
run_generator
run_generator
[
destination_root
,
"--full"
]
assert_file
"script/rails"
,
/ENGINE_PATH = File.expand_path\('..\/..\/lib\/bukkits\/engine', __FILE__\)/
assert_file
"script/rails"
,
/ENGINE_PATH = File.expand_path\('..\/..\/lib\/bukkits\/engine', __FILE__\)/
assert_file
"script/rails"
,
/ENGINE_ROOT = File.expand_path\('..\/..', __FILE__\)/
assert_file
"script/rails"
,
/ENGINE_ROOT = File.expand_path\('..\/..', __FILE__\)/
assert_file
"script/rails"
,
/require 'rails\/all'/
assert_file
"script/rails"
,
/require 'rails\/all'/
...
@@ -186,7 +186,7 @@ def test_usage_of_engine_commands
...
@@ -186,7 +186,7 @@ def test_usage_of_engine_commands
end
end
def
test_shebang
def
test_shebang
run_generator
run_generator
[
destination_root
,
"--full"
]
assert_file
"script/rails"
,
/#!\/usr\/bin\/env ruby/
assert_file
"script/rails"
,
/#!\/usr\/bin\/env ruby/
end
end
...
...
railties/test/generators/shared_generator_tests.rb
浏览文件 @
e38d3752
...
@@ -67,12 +67,12 @@ def test_name_raises_an_error_if_name_already_used_constant
...
@@ -67,12 +67,12 @@ def test_name_raises_an_error_if_name_already_used_constant
end
end
def
test_shebang_is_added_to_rails_file
def
test_shebang_is_added_to_rails_file
run_generator
[
destination_root
,
"--ruby"
,
"foo/bar/baz"
]
run_generator
[
destination_root
,
"--ruby"
,
"foo/bar/baz"
,
"--full"
]
assert_file
"script/rails"
,
/#!foo\/bar\/baz/
assert_file
"script/rails"
,
/#!foo\/bar\/baz/
end
end
def
test_shebang_when_is_the_same_as_default_use_env
def
test_shebang_when_is_the_same_as_default_use_env
run_generator
[
destination_root
,
"--ruby"
,
Thor
::
Util
.
ruby_command
]
run_generator
[
destination_root
,
"--ruby"
,
Thor
::
Util
.
ruby_command
,
"--full"
]
assert_file
"script/rails"
,
/#!\/usr\/bin\/env/
assert_file
"script/rails"
,
/#!\/usr\/bin\/env/
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录