Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
6e1dbb87
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,发现更多精彩内容 >>
提交
6e1dbb87
编写于
5月 24, 2011
作者:
G
Guillermo Iguaran
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove deprecated plugin generator
上级
ce350de5
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
0 addition
and
202 deletion
+0
-202
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/test/generators/plugin_generator_test.rb
railties/test/generators/plugin_generator_test.rb
+0
-71
未找到文件。
railties/lib/rails/generators/rails/plugin/USAGE
已删除
100644 → 0
浏览文件 @
ce350de5
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
浏览文件 @
ce350de5
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
浏览文件 @
ce350de5
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
浏览文件 @
ce350de5
<%= 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
浏览文件 @
ce350de5
#!/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
浏览文件 @
ce350de5
# Include hook code here
railties/lib/rails/generators/rails/plugin/templates/install.rb
已删除
100644 → 0
浏览文件 @
ce350de5
# Install hook code here
railties/lib/rails/generators/rails/plugin/templates/lib/%file_name%.rb.tt
已删除
100644 → 0
浏览文件 @
ce350de5
# <%= class_name %>
railties/lib/rails/generators/rails/plugin/templates/lib/tasks/%file_name%_tasks.rake.tt
已删除
100644 → 0
浏览文件 @
ce350de5
# 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
浏览文件 @
ce350de5
# Uninstall hook code here
railties/test/generators/plugin_generator_test.rb
已删除
100644 → 0
浏览文件 @
ce350de5
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
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录