有没有人有在 Sinatra 应用程序中向 AWS S3 提供资产的经验。我已经安装了宝石
asset_sync
按照这里的说明https://github.com/ejholmes/asset-sync-sinatra
当我跑步时
rake assets:precompile
我在控制台中收到此错误消息
cannot load such file -- asset_sync
这是我的设置
宝石文件
source :rubygems
gem 'sinatra'
gem 'pony'
gem 'sinatra-flash'
gem 'heroku'
gem 'activesupport', require: 'active_support'
gem 'asset_sync', git: 'git://github.com/ejholmes/asset_sync.git', branch: 'sinatra'
配置文件
module MyConfig
def config
environment = ENV["RACK_ENV"] || "development"
YAML.load_file("./config/config.yml")[environment]
end
end
配置.yml
development:
aws_access_key: = 'myaccesskey'
aws_secret_key: = 'mysecretkey'
fog_directory: = 'applecatering'
耙文件
require 'active_support/core_ext'
require 'asset_sync'
require './config/config.rb'
include MyConfig
AssetSync.configure do |con|
con.fog_provider = 'AWS'
con.fog_region = 'eu-west-1'
con.fog_directory = config['fog_directory']
con.aws_access_key_id = config['aws_access_key']
con.aws_secret_access_key = config['aws_secret_key']
con.prefix = "assets"
con.public_path = Pathname("./public")
end
namespace :assets do
desc "Precompile assets"
task :precompile do
AssetSync.sync
end
end
第一次尝试这个,谁能看到我做错了什么,我错过了什么或不理解这个?