Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
b1350430
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,发现更多精彩内容 >>
提交
b1350430
编写于
2月 03, 2010
作者:
J
José Valim
浏览文件
操作
浏览文件
下载
差异文件
Merge remote branch 'mikel/master'
上级
80e49354
f390eade
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
36 addition
and
78 deletion
+36
-78
activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
.../lib/active_record/connection_adapters/sqlite3_adapter.rb
+11
-0
activerecord/lib/active_record/railties/databases.rake
activerecord/lib/active_record/railties/databases.rake
+8
-1
railties/lib/rails/commands/rails.rb
railties/lib/rails/commands/rails.rb
+9
-8
railties/lib/rails/tasks/annotations.rake
railties/lib/rails/tasks/annotations.rake
+1
-1
railties/lib/rails/tasks/framework.rake
railties/lib/rails/tasks/framework.rake
+7
-68
未找到文件。
activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
浏览文件 @
b1350430
...
...
@@ -24,6 +24,17 @@ def self.sqlite3_connection(config) # :nodoc:
module
ConnectionAdapters
#:nodoc:
class
SQLite3Adapter
<
SQLiteAdapter
# :nodoc:
# Returns the current database encoding format as a string, eg: 'UTF-8'
def
encoding
if
@connection
.
respond_to?
(
:encoding
)
@connection
.
encoding
[
0
][
'encoding'
]
else
encoding
=
@connection
.
send
(
:get_query_pragma
,
'encoding'
)
encoding
[
0
][
'encoding'
]
end
end
end
end
end
activerecord/lib/active_record/railties/databases.rake
浏览文件 @
b1350430
...
...
@@ -26,8 +26,12 @@ namespace :db do
end
end
desc
'Create the database defined in config/database.yml for the current Rails.env'
desc
'Create the database defined in config/database.yml for the current Rails.env
- also makes test database if in development mode
'
task
:create
=>
:load_config
do
# Make the test database at the same time as the development one
if
Rails
.
env
==
'development'
create_database
(
ActiveRecord
::
Base
.
configurations
[
'test'
])
end
create_database
(
ActiveRecord
::
Base
.
configurations
[
Rails
.
env
])
end
...
...
@@ -196,6 +200,9 @@ namespace :db do
when
'postgresql'
ActiveRecord
::
Base
.
establish_connection
(
config
)
puts
ActiveRecord
::
Base
.
connection
.
encoding
when
'sqlite3'
ActiveRecord
::
Base
.
establish_connection
(
config
)
puts
ActiveRecord
::
Base
.
connection
.
encoding
else
puts
'sorry, your database adapter is not supported yet, feel free to submit a patch'
end
...
...
railties/lib/rails/commands/rails.rb
浏览文件 @
b1350430
...
...
@@ -6,13 +6,14 @@
usage: rails COMMAND [ARGS]
The most common rails commands are:
generate Generate new code (short-cut alias: "g")
console Start the Rails console (short-cut alias: "c")
server Start the Rails server (short-cut alias: "s")
generate Generate new code (short-cut alias: "g")
console Start the Rails console (short-cut alias: "c")
server Start the Rails server (short-cut alias: "s")
dbconsole Start a console for the database specified in config/database.yml
(short-cut alias: "db")
In addition to those, there are:
application Generate the Rails application code
dbconsole Start a console for the database specified in config/database.yml
destroy Undo code generated with "generate"
benchmarker See how fast a piece of code runs
profiler Get profile information from a piece of code
...
...
@@ -35,13 +36,13 @@
require
'rails/commands/server'
Dir
.
chdir
(
ROOT_PATH
)
Rails
::
Server
.
start
when
'application'
require
'rails/commands/application'
when
'dbconsole'
when
'db'
,
'dbconsole'
require
'rails/commands/dbconsole'
require
APP_PATH
Rails
::
DBConsole
.
start
(
Rails
::
Application
)
when
'application'
require
'rails/commands/application'
when
'destroy'
require
ENV_PATH
require
'rails/commands/destroy'
...
...
railties/lib/rails/tasks/annotations.rake
浏览文件 @
b1350430
...
...
@@ -13,7 +13,7 @@ namespace :notes do
end
end
desc
"Enumerate a custom annotation, specify with ANNOTATION=
WTFHAX
"
desc
"Enumerate a custom annotation, specify with ANNOTATION=
CUSTOM
"
task
:custom
do
SourceAnnotationExtractor
.
enumerate
ENV
[
'ANNOTATION'
]
end
...
...
railties/lib/rails/tasks/framework.rake
浏览文件 @
b1350430
namespace
:rails
do
namespace
:freeze
do
desc
"
Lock this application to the current gems (by unpacking them into vendor/rails)
"
desc
"
The rails:freeze:gems is deprecated, please use bundle install instead
"
task
:gems
do
deps
=
%w(actionpack activerecord actionmailer activesupport activeresource)
require
'rubygems'
require
'rubygems/gem_runner'
rails
=
(
version
=
ENV
[
'VERSION'
])
?
Gem
.
cache
.
find_name
(
'rails'
,
"=
#{
version
}
"
).
first
:
Gem
.
cache
.
find_name
(
'rails'
).
sort_by
{
|
g
|
g
.
version
}.
last
version
||=
rails
.
version
unless
rails
puts
"No rails gem
#{
version
}
is installed. Do 'gem list rails' to see what you have available."
exit
end
puts
"Freezing to the gems for Rails
#{
rails
.
version
}
"
rm_rf
"vendor/rails"
mkdir_p
"vendor/rails"
begin
chdir
(
"vendor/rails"
)
do
rails
.
dependencies
.
select
{
|
g
|
deps
.
include?
g
.
name
}.
each
do
|
g
|
Gem
::
GemRunner
.
new
.
run
([
"unpack"
,
g
.
name
,
"--version"
,
g
.
version_requirements
.
to_s
])
mv
(
Dir
.
glob
(
"
#{
g
.
name
}
*"
).
first
,
g
.
name
)
end
Gem
::
GemRunner
.
new
.
run
([
"unpack"
,
"rails"
,
"--version"
,
"=
#{
version
}
"
])
FileUtils
.
mv
(
Dir
.
glob
(
"rails*"
).
first
,
"railties"
)
end
rescue
Exception
rm_rf
"vendor/rails"
raise
end
puts
"The rails:freeze:gems is deprecated, please use bundle install instead"
end
desc
'
Lock to latest Edge Rails, for a specific release use RELEASE=1.2.0
'
desc
'
The freeze:edge command has been deprecated, specify the path setting in your app Gemfile instead and bundle install
'
task
:edge
do
require
'open-uri'
version
=
ENV
[
"RELEASE"
]
||
"edge"
target
=
"rails_
#{
version
}
.zip"
commits
=
"http://github.com/api/v1/yaml/rails/rails/commits/master"
url
=
"http://dev.rubyonrails.org/archives/
#{
target
}
"
chdir
'vendor'
do
latest_revision
=
YAML
.
load
(
open
(
commits
))[
"commits"
].
first
[
"id"
]
puts
"Downloading Rails from
#{
url
}
"
File
.
open
(
'rails.zip'
,
'wb'
)
do
|
dst
|
open
url
do
|
src
|
while
chunk
=
src
.
read
(
4096
)
dst
<<
chunk
end
end
end
puts
'Unpacking Rails'
rm_rf
'rails'
`unzip rails.zip`
%w(rails.zip rails/Rakefile rails/cleanlogs.sh rails/pushgems.rb rails/release.rb)
.
each
do
|
goner
|
rm_f
goner
end
touch
"rails/REVISION_
#{
latest_revision
}
"
end
puts
'Updating current scripts, javascripts, and configuration settings'
Rake
::
Task
[
'rails:update'
].
invoke
puts
'The freeze:edge command has been deprecated, specify the path setting in your app Gemfile instead and bundle install'
end
end
desc
"Unlock this application from freeze of gems or edge and return to a fluid use of system gems"
desc
'The unfreeze command has been deprecated, please use bundler commands instead'
task
:unfreeze
do
rm_rf
"vendor/rails"
puts
'The unfreeze command has been deprecated, please use bundler commands instead'
end
desc
"Update both configs, scripts and public/javascripts from Rails"
...
...
@@ -112,7 +51,7 @@ namespace :rails do
invoke_from_app_generator
:create_prototype_files
end
desc
"Add new scripts to the application script/ directory"
desc
"Add
s
new scripts to the application script/ directory"
task
:scripts
do
invoke_from_app_generator
:create_script_files
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录