README.md in carrierwave_ucloud-0.1.0 vs README.md in carrierwave_ucloud-0.1.2
- old
+ new
@@ -1,10 +1,10 @@
# CarrierwaveUcloud
-Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/carrierwave_ucloud`. To experiment with that code, run `bin/console` for an interactive prompt.
+Ucloud Ufile CarrierWave Gem。
-TODO: Delete this and the text above, and describe your gem
+参考了aws/aliyun/ucloud多个已有CarrierWave插件的代码,感谢他们的付出。
## Installation
Add this line to your application's Gemfile:
@@ -20,10 +20,39 @@
$ gem install carrierwave_ucloud
## Usage
-TODO: Write usage instructions here
+配置文件:config/initializers/carrierwave.rb,内容如下:
+
+```ruby
+# public / private 最少配置一套,ucloud_public_read自己要对应好,暂时没有做任何校验逻辑
+CarrierWave.configure do |config|
+ config.storage = :ucloud
+ config.ucloud_public_key = "public_key"
+ config.ucloud_private_key = "private_key"
+ config.ucloud_public_read = true # 默认使用public bucket,可在单个uploader覆写
+ # public bucket配置
+ config.ucloud_public_bucket = "public_bucket_name"
+ config.ucloud_public_bucket_host = "http://public_bucket_name.cn-bj.ufileos.com"
+ config.ucloud_public_cdn_host = "http://public_bucket_name.cn-bj.ufileos.com"
+ config.ucloud_private_bucket = "private_bucket_name"
+ # private bucket配置
+ config.ucloud_private_bucket_host = "http://private_bucket_name.cn-bj.ufileos.com"
+ config.ucloud_private_cdn_host = "http://private_bucket_name.cn-bj.ufileos.com"
+ config.ucloud_private_expire_seconds = 300
+end
+```
+
+全局配置ucloud_public_read,默认使用对应bucket配置,个别uploader如要用另外一种bucket配置,添加如下方法:
+```ruby
+class XxxUploader < CarrierWave::Uploader::Base
+ def ucloud_public_read
+ # true or false,XxxUploader以此配置选择bucket配置及逻辑
+ end
+end
+```
+
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.