README.md in nightcrawler_swift-0.3.0 vs README.md in nightcrawler_swift-0.4.0
- old
+ new
@@ -1,9 +1,6 @@
-[](https://codeclimate.com/github/tulios/nightcrawler_swift)
-[](https://travis-ci.org/tulios/nightcrawler_swift)
-[](http://badge.fury.io/rb/nightcrawler_swift)
-# Nightcrawler Swift
+# Nightcrawler Swift [](https://codeclimate.com/github/tulios/nightcrawler_swift) [](https://travis-ci.org/tulios/nightcrawler_swift) [](http://badge.fury.io/rb/nightcrawler_swift)
Like the X-Men nightcrawler this gem teleports your assets to a OpenStack Swift bucket/container. It was designed to sync your assets with OpenStack Swift and allow some operations with your buckets/containers.
## Installation
@@ -30,14 +27,22 @@
config.nightcrawler_swift.bucket = "rogue"
config.nightcrawler_swift.tenant_name = "nightcrawler"
config.nightcrawler_swift.username = "my_username1"
config.nightcrawler_swift.password = "my_password1"
config.nightcrawler_swift.auth_url = "https://auth.url.com:123/v2.0/tokens"
-config.nightcrawler_swift.max_age = 3600 #optional
```
-**max_age** will be used to define *Cache-Control:max-age=<value>* header. It's not required.
+__Optional configurations:__
+
+```ruby
+config.nightcrawler_swift.max_age = 3600 # default: nil
+config.nightcrawler_swift.verify_ssl = true # default: false
+config.nightcrawler_swift.timeout = 10 # in seconds, default: nil
+```
+
+_max_age_ will be used to define *Cache-Control:max-age=<value>* header.
+
By default it will use ```Rails.logger``` as logger, to change that use a different logger in configurations, like:
```ruby
config.nightcrawler_swift.logger = Logger.new(STDOUT)
```
@@ -46,27 +51,34 @@
```sh
rake nightcrawler_swift:rails:asset_sync
```
-It will invoke ```rake assets:precompile``` and will copy your public directory to swift bucket/container.
+It will invoke ```rake assets:precompile``` and will copy your public directory to swift bucket/container. To sync the public directory without the asset precompilation use the task: ```nightcrawler_swift:rails:sync```
### Programatically
#### 1) Configure your swift credentials and options
```ruby
NightcrawlerSwift.configure({
bucket: "rogue",
- tenant_name: "nightcrawler"
+ tenant_name: "nightcrawler",
username: "my_username1",
password: "my_password1",
- auth_url: "https://auth.url.com:123/v2.0/tokens",
- max_age: 3600 #optional
+ auth_url: "https://auth.url.com:123/v2.0/tokens"
})
```
+__Optional configurations:__
+
+```ruby
+max_age: 3600,
+verify_ssl: true,
+timeout: 10
+```
+
By default it will use ```Logger.new(STDOUT)``` as logger, to change that use:
```ruby
NightcrawlerSwift.logger = Logger.new(StringIO.new)
```
@@ -77,26 +89,12 @@
NightcrawlerSwift.sync File.expand_path("./my-dir")
```
## Commands
-NightcrawlerSwift has some useful built-in commands. All commands require the configuration and a established connection.
+NightcrawlerSwift has some useful built-in commands. All commands require the configuration and will __automatically__ connect/reconnect to keystone when necessary.
-To Establish the connection, use:
-
-```ruby
-NightcrawlerSwift.connection.connect!
-```
-
-To check if the connection is still valid, use:
-
-```ruby
-NightcrawlerSwift.connection.connected?
-```
-
-To reconnect just use ```NightcrawlerSwift.connection.connect!``` again.
-
### Upload
```ruby
upload = NightcrawlerSwift::Upload.new
upload.execute "my_file_path.txt", File.open("../my_file_fullpath.txt", "r")
@@ -128,9 +126,26 @@
```ruby
delete = NightcrawlerSwift::Delete.new
delete.execute "my_file_path.txt"
# true / false
```
+
+## Connection
+
+To manually establish the connection with keystone, use:
+
+```ruby
+NightcrawlerSwift.connection.connect!
+```
+
+To check if the connection is still valid, use:
+
+```ruby
+NightcrawlerSwift.connection.connected?
+```
+
+To reconnect just use ```NightcrawlerSwift.connection.connect!``` again.
+
## Contributing
1. Fork it ( https://github.com/tulios/nightcrawler_swift/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)