Sha256: a7795c0ac132c48f579a6c90cd843c40b2567988d9421c335168cbb089db01fe
Contents?: true
Size: 1.11 KB
Versions: 3
Compression:
Stored size: 1.11 KB
Contents
# CarrierWave for Aliyun OSS This gem forked from carrierwave-aliyun and adds CRUD functionality for [Aliyun OSS](http://oss.aliyun.com) to [CarrierWave](https://github.com/jnicklas/carrierwave/) ## Installation ```bash gem install carrierwave-aliyun-crud ``` ## Using Bundler ```ruby gem 'rest-client' gem 'carrierwave-aliyun-crud' ``` ## Configuration 创建脚本 `config/initializes/carrierwave.rb` 填入下面的代码,并修改对应的配置: ```ruby CarrierWave.configure do |config| config.storage = :aliyun config.aliyun_access_id = "xxxxxx" config.aliyun_access_key = 'xxxxxx' # 需要在 Aliyum OSS 上面提前创建一个 Bucket config.aliyun_bucket = "simple" # 是否使用内部连接,true - 使用 Aliyun 局域网的方式访问 false - 外部网络访问 config.aliyun_internal = true end ``` ## Usage 上传文件 ```ruby CarrierWave::Storage::Aliyun::Connection.new(options).put relative_store_url, File.read(file_path) ``` 删除文件 ```ruby CarrierWave::Storage::Aliyun::Connection.new(options).delete relative_store_url #如果删除的文件不存在,不会有异常 ```
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
carrierwave-aliyun-crud-0.1.3 | README.md |
carrierwave-aliyun-crud-0.1.2 | README.md |
carrierwave-aliyun-crud-0.1.1 | README.md |