No commit activity in last 3 years
No release in over 3 years
Aliyun OSS support for Carrierwave
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.5.7
>= 1.6.7
 Project Readme

CarrierWave for Aliyun OSS

This gem forked from carrierwave-aliyun and adds CRUD functionality for Aliyun OSS to CarrierWave

Installation

gem install carrierwave-aliyun-crud

Using Bundler

gem 'rest-client'
gem 'carrierwave-aliyun-crud'

Configuration

创建脚本 config/initializes/carrierwave.rb 填入下面的代码,并修改对应的配置:

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

上传文件

CarrierWave::Storage::Aliyun::Connection.new(options).put relative_store_url, File.read(file_path)

删除文件

CarrierWave::Storage::Aliyun::Connection.new(options).delete relative_store_url
#如果删除的文件不存在,不会有异常