Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
2120d7b8
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,体验更适合开发者的 AI 搜索 >>
提交
2120d7b8
编写于
10月 03, 2011
作者:
J
José Valim
提交者:
Santiago Pastorino
10月 03, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #3198.
上级
a7648c21
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
35 addition
and
39 deletion
+35
-39
actionpack/lib/sprockets/assets.rake
actionpack/lib/sprockets/assets.rake
+35
-39
未找到文件。
actionpack/lib/sprockets/assets.rake
浏览文件 @
2120d7b8
namespace
:assets
do
desc
"Compile all the assets named in config.assets.precompile"
task
:precompile
do
# We need to do this dance because RAILS_GROUPS is used
# too early in the boot process and changing here is already too late.
if
ENV
[
"RAILS_GROUPS"
].
to_s
.
empty?
||
ENV
[
"RAILS_ENV"
].
to_s
.
empty?
ENV
[
"RAILS_GROUPS"
]
||=
"assets"
ENV
[
"RAILS_ENV"
]
||=
"production"
ruby
$0
,
*
ARGV
exit
else
require
"fileutils"
Rake
::
Task
[
"tmp:cache:clear"
].
invoke
Rake
::
Task
[
"assets:environment"
].
invoke
require
"fileutils"
unless
Rails
.
application
.
config
.
assets
.
enabled
raise
"Cannot precompile assets if sprockets is disabled. Please set config.assets.enabled to true"
end
namespace
:assets
do
def
invoke_precompile
args
=
[
$0
,
"assets:internal_precompile"
]
args
<<
"--trace"
if
Rake
.
application
.
options
.
trace
ruby
*
args
end
# Ensure that action view is loaded and the appropriate sprockets hooks get executed
_
=
ActionView
::
Base
desc
"Compile all the assets named in config.assets.precompile"
task
:precompile
=>
"assets:clean"
do
ENV
[
"RAILS_GROUPS"
]
||=
"assets"
ENV
[
"RAILS_ENV"
]
||=
"production"
invoke_precompile
end
config
=
Rails
.
application
.
config
config
.
assets
.
compile
=
true
config
.
assets
.
digest
=
false
if
ENV
[
"RAILS_ASSETS_NONDIGEST"
]
task
:internal_precompile
=>
"assets:environment"
do
unless
Rails
.
application
.
config
.
assets
.
enabled
raise
"Cannot precompile assets if sprockets is disabled. Please set config.assets.enabled to true"
end
env
=
Rails
.
application
.
assets
# Ensure that action view is loaded and the appropriate sprockets hooks get executed
_
=
ActionView
::
Base
# Always compile files and avoid use of existing precompiled assets
config
.
assets
.
compile
=
true
config
.
assets
.
digests
=
{}
config
=
Rails
.
application
.
config
config
.
assets
.
compile
=
true
config
.
assets
.
digest
=
false
if
ENV
[
"RAILS_ASSETS_NONDIGEST"
]
config
.
assets
.
digests
=
{}
target
=
File
.
join
(
Rails
.
public_path
,
config
.
assets
.
prefix
)
static_compiler
=
Sprockets
::
StaticCompiler
.
new
(
env
,
target
,
:digest
=>
config
.
assets
.
digest
)
env
=
Rails
.
application
.
assets
target
=
File
.
join
(
Rails
.
public_path
,
config
.
assets
.
prefix
)
static_compiler
=
Sprockets
::
StaticCompiler
.
new
(
env
,
target
,
:digest
=>
config
.
assets
.
digest
)
manifest
=
static_compiler
.
precompile
(
config
.
assets
.
precompile
)
manifest_path
=
config
.
assets
.
manifest
||
target
FileUtils
.
mkdir_p
(
manifest_path
)
manifest
=
static_compiler
.
precompile
(
config
.
assets
.
precompile
)
manifest_path
=
config
.
assets
.
manifest
||
target
FileUtils
.
mkdir_p
(
manifest_path
)
unless
ENV
[
"RAILS_ASSETS_NONDIGEST"
]
File
.
open
(
"
#{
manifest_path
}
/manifest.yml"
,
'wb'
)
do
|
f
|
YAML
.
dump
(
manifest
,
f
)
end
ENV
[
"RAILS_ASSETS_NONDIGEST"
]
=
"true"
ruby
$0
,
*
ARGV
exit
unless
ENV
[
"RAILS_ASSETS_NONDIGEST"
]
File
.
open
(
"
#{
manifest_path
}
/manifest.yml"
,
'wb'
)
do
|
f
|
YAML
.
dump
(
manifest
,
f
)
end
ENV
[
"RAILS_ASSETS_NONDIGEST"
]
=
"true"
invoke_precompile
end
end
desc
"Remove compiled assets"
task
:clean
=>
[
'assets:environment'
,
'tmp:cache:clear'
]
do
task
:clean
=>
"tmp:cache:clear"
do
config
=
Rails
.
application
.
config
public_asset_path
=
File
.
join
(
Rails
.
public_path
,
config
.
assets
.
prefix
)
rm_rf
public_asset_path
,
:secure
=>
true
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录