Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
9641cdd8
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,发现更多精彩内容 >>
提交
9641cdd8
编写于
9月 12, 2012
作者:
R
Rafael Mendonça França
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7614 from frodsan/scm_agnostic
add --skip-ignore and --skip-keeps options to generators.
上级
e55c75d2
ceb05bd1
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
90 addition
and
65 deletion
+90
-65
railties/CHANGELOG.md
railties/CHANGELOG.md
+10
-0
railties/lib/rails/generators/app_base.rb
railties/lib/rails/generators/app_base.rb
+38
-35
railties/lib/rails/generators/rails/app/app_generator.rb
railties/lib/rails/generators/rails/app/app_generator.rb
+16
-16
railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
...rails/generators/rails/plugin_new/plugin_new_generator.rb
+10
-10
railties/test/generators/app_generator_test.rb
railties/test/generators/app_generator_test.rb
+4
-4
railties/test/generators/shared_generator_tests.rb
railties/test/generators/shared_generator_tests.rb
+12
-0
未找到文件。
railties/CHANGELOG.md
浏览文件 @
9641cdd8
## Rails 4.0.0 (unreleased) ##
*
Change
`rails new`
and
`rails plugin new`
generators to name the
`.gitkeep`
files
as
`.keep`
in a more SCM-agnostic way.
Change `--skip-git` option to only skip the `.gitignore` file and still generate
the `.keep` files.
Add `--skip-keeps` option to skip the `.keep` files.
*Derek Prior & Francesco Rodriguez*
*
Fixed support for DATABASE_URL environment variable for rake db tasks.
*Grace Liu*
*
rails dbconsole now can use SSL for MySQL. The database.yml options sslca, sslcert, sslcapath, sslcipher,
...
...
railties/lib/rails/generators/app_base.rb
浏览文件 @
9641cdd8
...
...
@@ -16,53 +16,56 @@ class AppBase < Base
attr_accessor
:rails_template
add_shebang_option!
argument
:app_path
,
:type
=>
:string
argument
:app_path
,
type:
:string
def
self
.
add_shared_options_for
(
name
)
class_option
:builder
,
:type
=>
:string
,
:aliases
=>
"-b"
,
:desc
=>
"Path to a
#{
name
}
builder (can be a filesystem path or URL)"
class_option
:builder
,
type: :string
,
aliases:
'-b'
,
desc:
"Path to a
#{
name
}
builder (can be a filesystem path or URL)"
class_option
:template
,
:type
=>
:string
,
:aliases
=>
"-m"
,
:desc
=>
"Path to an
#{
name
}
template (can be a filesystem path or URL)"
class_option
:template
,
type: :string
,
aliases:
'-m'
,
desc:
"Path to an
#{
name
}
template (can be a filesystem path or URL)"
class_option
:skip_gemfile
,
:type
=>
:boolean
,
:default
=>
false
,
:desc
=>
"Don't create a Gemfile"
class_option
:skip_gemfile
,
type: :boolean
,
default:
false
,
desc:
"Don't create a Gemfile"
class_option
:skip_bundle
,
:type
=>
:boolean
,
:default
=>
false
,
:desc
=>
"Don't run bundle install"
class_option
:skip_bundle
,
type: :boolean
,
default:
false
,
desc:
"Don't run bundle install"
class_option
:skip_git
,
:type
=>
:boolean
,
:aliases
=>
"-G"
,
:default
=>
false
,
:desc
=>
"Skip Git ignores and keeps"
class_option
:skip_git
,
type: :boolean
,
aliases:
'-G'
,
default:
false
,
desc:
'Skip .gitignore file'
class_option
:skip_
active_record
,
:type
=>
:boolean
,
:aliases
=>
"-O"
,
:default
=>
false
,
:desc
=>
"Skip Active Record files"
class_option
:skip_
keeps
,
type: :boolean
,
default:
false
,
desc:
'Skip source control .keep files'
class_option
:skip_
sprockets
,
:type
=>
:boolean
,
:aliases
=>
"-S"
,
:default
=>
false
,
:desc
=>
"Skip Sprockets files"
class_option
:skip_
active_record
,
type: :boolean
,
aliases:
'-O'
,
default:
false
,
desc:
'Skip Active Record files'
class_option
:
database
,
:type
=>
:string
,
:aliases
=>
"-d"
,
:default
=>
"sqlite3"
,
:desc
=>
"Preconfigure for selected database (options:
#{
DATABASES
.
join
(
'/'
)
}
)"
class_option
:
skip_sprockets
,
type: :boolean
,
aliases:
'-S'
,
default:
false
,
desc:
'Skip Sprockets files'
class_option
:
javascript
,
:type
=>
:string
,
:aliases
=>
'-j'
,
:default
=>
'jquery
'
,
:desc
=>
'Preconfigure for selected JavaScript library'
class_option
:
database
,
type: :string
,
aliases:
'-d'
,
default:
'sqlite3
'
,
desc:
"Preconfigure for selected database (options:
#{
DATABASES
.
join
(
'/'
)
}
)"
class_option
:
skip_javascript
,
:type
=>
:boolean
,
:aliases
=>
"-J"
,
:default
=>
false
,
:desc
=>
"Skip JavaScript files"
class_option
:
javascript
,
type: :string
,
aliases:
'-j'
,
default:
'jquery'
,
desc:
'Preconfigure for selected JavaScript library'
class_option
:skip_
index_html
,
:type
=>
:boolean
,
:aliases
=>
"-I"
,
:default
=>
false
,
:desc
=>
"Skip public/index.html and app/assets/images/rails.png files"
class_option
:skip_
javascript
,
type: :boolean
,
aliases:
'-J'
,
default:
false
,
desc:
'Skip JavaScript files'
class_option
:
dev
,
:type
=>
:boolean
,
:default
=>
false
,
:desc
=>
"Setup the
#{
name
}
with Gemfile pointing to your Rails checkout"
class_option
:
skip_index_html
,
type: :boolean
,
aliases:
'-I'
,
default:
false
,
desc:
'Skip public/index.html and app/assets/images/rails.png files'
class_option
:
edge
,
:type
=>
:boolean
,
:default
=>
false
,
:desc
=>
"Setup the
#{
name
}
with Gemfile pointing to Rails repository
"
class_option
:
dev
,
type: :boolean
,
default:
false
,
desc:
"Setup the
#{
name
}
with Gemfile pointing to your Rails checkout
"
class_option
:
skip_test_unit
,
:type
=>
:boolean
,
:aliases
=>
"-T"
,
:default
=>
false
,
:desc
=>
"Skip Test::Unit files
"
class_option
:
edge
,
type: :boolean
,
default:
false
,
desc:
"Setup the
#{
name
}
with Gemfile pointing to Rails repository
"
class_option
:help
,
:type
=>
:boolean
,
:aliases
=>
"-h"
,
:group
=>
:rails
,
:desc
=>
"Show this help message and quit"
class_option
:skip_test_unit
,
type: :boolean
,
aliases:
'-T'
,
default:
false
,
desc:
'Skip Test::Unit files'
class_option
:help
,
type: :boolean
,
aliases:
'-h'
,
group: :rails
,
desc:
'Show this help message and quit'
end
def
initialize
(
*
args
)
...
...
@@ -261,13 +264,13 @@ def run_bundle
bundle_command
(
'install'
)
unless
options
[
:skip_gemfile
]
||
options
[
:skip_bundle
]
||
options
[
:pretend
]
end
def
empty_directory_with_
gitkeep
(
destination
,
config
=
{})
def
empty_directory_with_
keep_file
(
destination
,
config
=
{})
empty_directory
(
destination
,
config
)
git_keep
(
destination
)
keep_file
(
destination
)
end
def
git_keep
(
destination
)
create_file
(
"
#{
destination
}
/.
gitkeep"
)
unless
options
[
:skip_git
]
def
keep_file
(
destination
)
create_file
(
"
#{
destination
}
/.
keep"
)
unless
options
[
:skip_keeps
]
end
end
end
...
...
railties/lib/rails/generators/rails/app/app_generator.rb
浏览文件 @
9641cdd8
...
...
@@ -11,7 +11,7 @@ def initialize(generator)
private
%w(template copy_file directory empty_directory inside
empty_directory_with_
gitkeep
create_file chmod shebang)
.
each
do
|
method
|
empty_directory_with_
keep_file
create_file chmod shebang)
.
each
do
|
method
|
class_eval
<<-
RUBY
,
__FILE__
,
__LINE__
+
1
def
#{
method
}
(*args, &block)
@generator.send(:
#{
method
}
, *args, &block)
...
...
@@ -55,8 +55,8 @@ def gitignore
def
app
directory
'app'
git_keep
'app/mailers'
git_keep
'app/models'
keep_file
'app/mailers'
keep_file
'app/models'
end
def
config
...
...
@@ -86,13 +86,13 @@ def doc
end
def
lib
empty_directory
"lib"
empty_directory_with_
gitkeep
"lib/tasks"
empty_directory_with_
gitkeep
"lib/assets"
empty_directory
'lib'
empty_directory_with_
keep_file
'lib/tasks'
empty_directory_with_
keep_file
'lib/assets'
end
def
log
empty_directory_with_
gitkeep
"log"
empty_directory_with_
keep_file
'log'
end
def
public_directory
...
...
@@ -100,7 +100,7 @@ def public_directory
if
options
[
:skip_index_html
]
remove_file
"public/index.html"
remove_file
'app/assets/images/rails.png'
git_keep
'app/assets/images'
keep_file
'app/assets/images'
end
end
...
...
@@ -112,13 +112,13 @@ def script
end
def
test
empty_directory_with_
gitkeep
"test/fixtures"
empty_directory_with_
gitkeep
"test/functional"
empty_directory_with_
gitkeep
"test/integration"
empty_directory_with_
gitkeep
"test/unit"
empty_directory_with_
keep_file
'test/fixtures'
empty_directory_with_
keep_file
'test/functional'
empty_directory_with_
keep_file
'test/integration'
empty_directory_with_
keep_file
'test/unit'
template
"test/performance/browsing_test.rb"
template
"test/test_helper.rb"
template
'test/performance/browsing_test.rb'
template
'test/test_helper.rb'
end
def
tmp
...
...
@@ -132,11 +132,11 @@ def vendor
end
def
vendor_javascripts
empty_directory_with_
gitkeep
"vendor/assets/javascripts"
empty_directory_with_
keep_file
'vendor/assets/javascripts'
end
def
vendor_stylesheets
empty_directory_with_
gitkeep
"vendor/assets/stylesheets"
empty_directory_with_
keep_file
'vendor/assets/stylesheets'
end
end
...
...
railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
浏览文件 @
9641cdd8
...
...
@@ -10,15 +10,15 @@ def rakefile
def
app
if
mountable?
directory
"app"
empty_directory_with_
gitkeep
"app/assets/images/
#{
name
}
"
directory
'app'
empty_directory_with_
keep_file
"app/assets/images/
#{
name
}
"
elsif
full?
empty_directory_with_
gitkeep
"app/models"
empty_directory_with_
gitkeep
"app/controllers"
empty_directory_with_
gitkeep
"app/views"
empty_directory_with_
gitkeep
"app/helpers"
empty_directory_with_
gitkeep
"app/mailers"
empty_directory_with_
gitkeep
"app/assets/images/
#{
name
}
"
empty_directory_with_
keep_file
'app/models'
empty_directory_with_
keep_file
'app/controllers'
empty_directory_with_
keep_file
'app/views'
empty_directory_with_
keep_file
'app/helpers'
empty_directory_with_
keep_file
'app/mailers'
empty_directory_with_
keep_file
"app/assets/images/
#{
name
}
"
end
end
...
...
@@ -110,7 +110,7 @@ def stylesheets
copy_file
"
#{
app_templates_dir
}
/app/assets/stylesheets/application.css"
,
"app/assets/stylesheets/
#{
name
}
/application.css"
elsif
full?
empty_directory_with_
gitkeep
"app/assets/stylesheets/
#{
name
}
"
empty_directory_with_
keep_file
"app/assets/stylesheets/
#{
name
}
"
end
end
...
...
@@ -121,7 +121,7 @@ def javascripts
template
"
#{
app_templates_dir
}
/app/assets/javascripts/application.js.tt"
,
"app/assets/javascripts/
#{
name
}
/application.js"
elsif
full?
empty_directory_with_
gitkeep
"app/assets/javascripts/
#{
name
}
"
empty_directory_with_
keep_file
"app/assets/javascripts/
#{
name
}
"
end
end
...
...
railties/test/generators/app_generator_test.rb
浏览文件 @
9641cdd8
...
...
@@ -250,10 +250,10 @@ def test_inclusion_of_javascript_runtime
end
def
test_generator_if_skip_index_html_is_given
run_generator
[
destination_root
,
"--skip-index-html"
]
assert_no_file
"public/index.html"
assert_no_file
"app/assets/images/rails.png"
assert_file
"app/assets/images/.gitkeep"
run_generator
[
destination_root
,
'--skip-index-html'
]
assert_no_file
'public/index.html'
assert_no_file
'app/assets/images/rails.png'
assert_file
'app/assets/images/.keep'
end
def
test_creation_of_a_test_directory
...
...
railties/test/generators/shared_generator_tests.rb
浏览文件 @
9641cdd8
...
...
@@ -127,6 +127,18 @@ def test_skip_bundle
# generated.
assert_file
'Gemfile'
end
def
test_skip_git
run_generator
[
destination_root
,
'--skip-git'
,
'--full'
]
assert_no_file
(
'.gitignore'
)
assert_file
(
'app/mailers/.keep'
)
end
def
test_skip_keeps
run_generator
[
destination_root
,
'--skip-keeps'
,
'--full'
]
assert_file
(
'.gitignore'
)
assert_no_file
(
'app/mailers/.keep'
)
end
end
module
SharedCustomGeneratorTests
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录