Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
3b2ee3b2
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,发现更多精彩内容 >>
提交
3b2ee3b2
编写于
5月 25, 2011
作者:
J
José Valim
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1288 from guilleiguaran/railties-deprecations
Remove Railties deprecated methods
上级
a5ee94f6
944aee7b
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
1 addition
and
287 deletion
+1
-287
railties/lib/rails/generators/rails/plugin/USAGE
railties/lib/rails/generators/rails/plugin/USAGE
+0
-13
railties/lib/rails/generators/rails/plugin/plugin_generator.rb
...ies/lib/rails/generators/rails/plugin/plugin_generator.rb
+0
-54
railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt
...ib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt
+0
-20
railties/lib/rails/generators/rails/plugin/templates/README.tt
...ies/lib/rails/generators/rails/plugin/templates/README.tt
+0
-13
railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt
...s/lib/rails/generators/rails/plugin/templates/Rakefile.tt
+0
-23
railties/lib/rails/generators/rails/plugin/templates/init.rb
railties/lib/rails/generators/rails/plugin/templates/init.rb
+0
-1
railties/lib/rails/generators/rails/plugin/templates/install.rb
...es/lib/rails/generators/rails/plugin/templates/install.rb
+0
-1
railties/lib/rails/generators/rails/plugin/templates/lib/%file_name%.rb.tt
...s/generators/rails/plugin/templates/lib/%file_name%.rb.tt
+0
-1
railties/lib/rails/generators/rails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt
...ails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt
+0
-4
railties/lib/rails/generators/rails/plugin/templates/uninstall.rb
.../lib/rails/generators/rails/plugin/templates/uninstall.rb
+0
-1
railties/lib/rails/paths.rb
railties/lib/rails/paths.rb
+0
-26
railties/lib/rails/railtie/configuration.rb
railties/lib/rails/railtie/configuration.rb
+0
-5
railties/test/application/paths_test.rb
railties/test/application/paths_test.rb
+1
-1
railties/test/generators/plugin_generator_test.rb
railties/test/generators/plugin_generator_test.rb
+0
-71
railties/test/paths_test.rb
railties/test/paths_test.rb
+0
-53
未找到文件。
railties/lib/rails/generators/rails/plugin/USAGE
已删除
100644 → 0
浏览文件 @
a5ee94f6
Description:
Stubs out a new plugin at vendor/plugins. Pass the plugin name, either
CamelCased or under_scored, as an argument.
Example:
`rails generate plugin BrowserFilters`
creates a standard browser_filters plugin:
vendor/plugins/browser_filters/README
vendor/plugins/browser_filters/init.rb
vendor/plugins/browser_filters/install.rb
vendor/plugins/browser_filters/lib/browser_filters.rb
vendor/plugins/browser_filters/test/browser_filters_test.rb
railties/lib/rails/generators/rails/plugin/plugin_generator.rb
已删除
100644 → 0
浏览文件 @
a5ee94f6
require
'rails/generators/rails/generator/generator_generator'
module
Rails
module
Generators
class
PluginGenerator
<
NamedBase
class_option
:tasks
,
:desc
=>
"When supplied creates tasks base files."
def
show_deprecation
return
unless
behavior
==
:invoke
message
=
"Plugin generator is deprecated, please use 'rails plugin new' command to generate plugin structure."
ActiveSupport
::
Deprecation
.
warn
message
end
check_class_collision
def
create_root_files
directory
'.'
,
plugin_dir
,
:recursive
=>
false
end
def
create_lib_files
directory
'lib'
,
plugin_dir
(
'lib'
),
:recursive
=>
false
end
def
create_tasks_files
return
unless
options
[
:tasks
]
directory
'lib/tasks'
,
plugin_dir
(
'lib/tasks'
)
end
hook_for
:generator
do
|
generator
|
inside
plugin_dir
,
:verbose
=>
true
do
invoke
generator
,
[
name
],
:namespace
=>
false
end
end
hook_for
:test_framework
do
|
test_framework
|
inside
plugin_dir
,
:verbose
=>
true
do
invoke
test_framework
end
end
protected
def
plugin_dir
(
join
=
nil
)
if
join
File
.
join
(
plugin_dir
,
join
)
else
"vendor/plugins/
#{
file_name
}
"
end
end
end
end
end
railties/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt
已删除
100644 → 0
浏览文件 @
a5ee94f6
Copyright (c) <%= Date.today.year %> [name of plugin creator]
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
railties/lib/rails/generators/rails/plugin/templates/README.tt
已删除
100644 → 0
浏览文件 @
a5ee94f6
<%= class_name %>
<%= "=" * class_name.size %>
Introduction goes here.
Example
=======
Example goes here.
Copyright (c) <%= Date.today.year %> [name of plugin creator], released under the MIT license
railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt
已删除
100644 → 0
浏览文件 @
a5ee94f6
#!/usr/bin/env rake
require 'rake/testtask'
require 'rdoc/task'
desc 'Default: run unit tests.'
task :default => :test
desc 'Test the <%= file_name %> plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc 'Generate documentation for the <%= file_name %> plugin.'
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = '<%= class_name %>'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
end
railties/lib/rails/generators/rails/plugin/templates/init.rb
已删除
100644 → 0
浏览文件 @
a5ee94f6
# Include hook code here
railties/lib/rails/generators/rails/plugin/templates/install.rb
已删除
100644 → 0
浏览文件 @
a5ee94f6
# Install hook code here
railties/lib/rails/generators/rails/plugin/templates/lib/%file_name%.rb.tt
已删除
100644 → 0
浏览文件 @
a5ee94f6
# <%= class_name %>
railties/lib/rails/generators/rails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt
已删除
100644 → 0
浏览文件 @
a5ee94f6
# desc "Explaining what the task does"
# task :<%= file_name %> do
# # Task goes here
# end
railties/lib/rails/generators/rails/plugin/templates/uninstall.rb
已删除
100644 → 0
浏览文件 @
a5ee94f6
# Uninstall hook code here
railties/lib/rails/paths.rb
浏览文件 @
3b2ee3b2
...
...
@@ -2,24 +2,6 @@
module
Rails
module
Paths
module
PathParent
#:nodoc:
def
method_missing
(
id
,
*
args
)
match
=
id
.
to_s
.
match
(
/^(.*)=$/
)
full
=
[
@current
,
$1
||
id
].
compact
.
join
(
"/"
)
ActiveSupport
::
Deprecation
.
warn
'config.paths.app.controller API is deprecated in '
<<
'favor of config.paths["app/controller"] API.'
if
match
||
args
.
any?
@root
[
full
]
=
Path
.
new
(
@root
,
full
,
*
args
)
elsif
path
=
@root
[
full
]
path
else
super
end
end
end
# This object is an extended hash that behaves as root of the Rails::Paths system.
# It allows you to collect information about how you want to structure your application
# paths by a Hash like API. It requires you to give a physical path on initialization.
...
...
@@ -63,7 +45,6 @@ def method_missing(id, *args)
#
# Check the Path documentation for more information.
class
Root
<
::
Hash
include
PathParent
attr_accessor
:path
def
initialize
(
path
)
...
...
@@ -121,8 +102,6 @@ def filter_by(constraint)
end
class
Path
<
Array
include
PathParent
attr_reader
:path
attr_accessor
:glob
...
...
@@ -194,11 +173,6 @@ def existent
expanded
.
select
{
|
f
|
File
.
exists?
(
f
)
}
end
def
paths
ActiveSupport
::
Deprecation
.
warn
"paths is deprecated. Please call expand instead."
expanded
end
alias
to_a
expanded
end
end
...
...
railties/lib/rails/railtie/configuration.rb
浏览文件 @
3b2ee3b2
...
...
@@ -26,11 +26,6 @@ def app_generators
@@app_generators
end
def
generators
(
&
block
)
#:nodoc
ActiveSupport
::
Deprecation
.
warn
"config.generators in Rails::Railtie is deprecated. Please use config.app_generators instead."
app_generators
(
&
block
)
end
# First configurable block to run. Called before any initializers are run.
def
before_configuration
(
&
block
)
ActiveSupport
.
on_load
(
:before_configuration
,
:yield
=>
true
,
&
block
)
...
...
railties/test/application/paths_test.rb
浏览文件 @
3b2ee3b2
...
...
@@ -61,7 +61,7 @@ def assert_not_in_load_path(*path)
end
test
"environments has a glob equal to the current environment"
do
assert_equal
"
#{
Rails
.
env
}
.rb"
,
@paths
.
config
.
environments
.
glob
assert_equal
"
#{
Rails
.
env
}
.rb"
,
@paths
[
"config/environments"
]
.
glob
end
test
"load path includes each of the paths in config.paths as long as the directories exist"
do
...
...
railties/test/generators/plugin_generator_test.rb
已删除
100644 → 0
浏览文件 @
a5ee94f6
require
'generators/generators_test_helper'
require
'rails/generators/rails/plugin/plugin_generator'
class
PluginGeneratorTest
<
Rails
::
Generators
::
TestCase
include
GeneratorsTestHelper
arguments
%w(plugin_fu)
def
test_plugin_skeleton_is_created
silence
(
:stderr
)
{
run_generator
}
year
=
Date
.
today
.
year
%w(
vendor/plugins
vendor/plugins/plugin_fu
vendor/plugins/plugin_fu/init.rb
vendor/plugins/plugin_fu/install.rb
vendor/plugins/plugin_fu/uninstall.rb
vendor/plugins/plugin_fu/lib
vendor/plugins/plugin_fu/lib/plugin_fu.rb
vendor/plugins/plugin_fu/Rakefile
)
.
each
{
|
path
|
assert_file
path
}
%w(
vendor/plugins/plugin_fu/README
)
.
each
{
|
path
|
assert_file
path
,
/PluginFu/
}
%w(
vendor/plugins/plugin_fu/README
vendor/plugins/plugin_fu/MIT-LICENSE
)
.
each
{
|
path
|
assert_file
path
,
/
#{
year
}
/
}
end
def
test_check_class_collision
content
=
capture
(
:stderr
){
run_generator
[
"object"
]
}
assert_match
(
/The name 'Object' is either already used in your application or reserved/
,
content
)
end
def
test_invokes_default_test_framework
silence
(
:stderr
)
{
run_generator
}
assert_file
"vendor/plugins/plugin_fu/test/plugin_fu_test.rb"
,
/class PluginFuTest < ActiveSupport::TestCase/
assert_file
"vendor/plugins/plugin_fu/test/test_helper.rb"
end
def
test_logs_if_the_test_framework_cannot_be_found
content
=
nil
silence
(
:stderr
)
{
content
=
run_generator
[
"plugin_fu"
,
"--test-framework=rspec"
]
}
assert_match
(
/rspec \[not found\]/
,
content
)
end
def
test_creates_tasks_if_required
silence
(
:stderr
)
{
run_generator
[
"plugin_fu"
,
"--tasks"
]
}
assert_file
"vendor/plugins/plugin_fu/lib/tasks/plugin_fu_tasks.rake"
end
def
test_creates_generator_if_required
silence
(
:stderr
)
{
run_generator
[
"plugin_fu"
,
"--generator"
]
}
assert_file
"vendor/plugins/plugin_fu/lib/generators/templates"
assert_file
"vendor/plugins/plugin_fu/lib/generators/plugin_fu_generator.rb"
,
/class PluginFuGenerator < Rails::Generators::NamedBase/
end
def
test_plugin_generator_on_revoke
silence
(
:stderr
)
{
run_generator
}
run_generator
[
"plugin_fu"
],
:behavior
=>
:revoke
end
def
test_deprecation
output
=
capture
(
:stderr
)
{
run_generator
}
assert_match
(
/Plugin generator is deprecated, please use 'rails plugin new' command to generate plugin structure./
,
output
)
end
end
railties/test/paths_test.rb
浏览文件 @
3b2ee3b2
...
...
@@ -227,57 +227,4 @@ def setup
assert
@root
[
"app"
].
autoload?
assert_equal
[
"/app"
],
@root
.
autoload_paths
end
# Deprecated API tests
test
"reading a root level path with assignment"
do
@root
.
add
"app"
assert_deprecated
do
assert_equal
[
"/foo/bar/app"
],
@root
.
app
.
to_a
end
end
test
"creating a root level path with assignment"
do
assert_deprecated
do
@root
.
app
=
"/foo/bar"
end
assert_equal
[
"/foo/bar"
],
@root
[
"app"
].
to_a
end
test
"creating a root level path without assignment"
do
assert_deprecated
do
@root
.
app
"/foo/bar"
end
assert_equal
[
"/foo/bar"
],
@root
[
"app"
].
to_a
end
test
"reading a nested level path with assignment"
do
@root
.
add
"app"
@root
.
add
"app/model"
assert_deprecated
do
assert_equal
[
"/foo/bar/app/model"
],
@root
.
app
.
model
.
to_a
end
end
test
"creating a nested level path with assignment"
do
@root
.
add
"app"
assert_deprecated
do
@root
.
app
.
model
=
"/foo/bar"
end
assert_equal
[
"/foo/bar"
],
@root
[
"app/model"
].
to_a
end
test
"creating a nested level path without assignment"
do
@root
.
add
"app"
assert_deprecated
do
@root
.
app
.
model
"/foo/bar"
end
assert_equal
[
"/foo/bar"
],
@root
[
"app/model"
].
to_a
end
test
"trying to access a path that does not exist raises NoMethodError"
do
assert_deprecated
do
assert_raises
(
NoMethodError
)
{
@root
.
app
}
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录