No commit activity in last 3 years
No release in over 3 years
Rake task to push precompiled assets to Upyun
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.6.7
 Project Readme

rails-assets-for-upyun

把预编译好的静态资源发布到又拍云上(用rake

用法

  1. Gemfile 里引用我: gem 'rails-assets-for-upyun', '>= 0.0.9'
  2. 首先设置好在生产环境中调用 UpYun 上的资源
# .. config/environments/production.rb
..
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
config.action_controller.asset_host = "awesome-bucket.b0.upaiyun.com"
..
  1. Rakefile 里添加一个任务(起一个最酷的名字!)
namespace :assets do
  task :publish_my_holy_shinning_precompiled_miraculous_assets_to_the_almighty_upyun do
    RailsAssetsForUpyun.publish 'awesome-bucket', 'notjustausername', 'thencomesthepassword'
  end
end
  1. 然后你就可以在每次发布前(rake assets:precompile之后)运行一遍这个 rake 任务把他们同步到又拍云上去了。

卖点

  • 调用 UpYun 提供的 API 进行增量发布,通过 HTTP 通讯,比 FTP 更加稳定、快速
  • 使用 UpYun API 提供的签名授权,不明文传送密码,更加安全!

详解

RailsAssetsForUpyun.publish(bucket, username, password, bucket_path="/", localpath='public', upyun_ap="http://v0.api.upyun.com")