nightcrawler_swift 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45a3c84d56e90690626dab9281b98746d80d2d1a
4
- data.tar.gz: 9def0f86a48fb9c2d55d5404dff9f2128b9534e5
3
+ metadata.gz: 39b53e60af55f2b7f29c0891ca82e3d17e74bb6f
4
+ data.tar.gz: 8fe4bcad69946d7680fc258531f78bc0729e6361
5
5
  SHA512:
6
- metadata.gz: 2b05b0540f632e54157710557efb70fb27518b5a88e43e61093ea877b98bf60c4cf662c3cd838398694329eef1f30723f662d2fffb10df03d3edd8d1c701328f
7
- data.tar.gz: e292d222c897f8a2d24ef1cd42a15123deeedc5a100184bc65d193f7ce5eb6b2ef2f3fa0bbb8f7f9c1791069aa815c8e734695d778d2b1102bc3ecfa011fd76f
6
+ metadata.gz: 33155ed2db0f194cb4012aced580b1f92a1862d4dae8763e527632a26f766a11aec2b7e5574837d2731a956cab5564a5bb9efcc639bc2575a12a3f2330f2f912
7
+ data.tar.gz: fd48e8c2d22ec5152fb28ef88b71a67cd6bdb32090480fd9e6188a9ecbf369fca76f36cf05680b994be918a0e151810159721fe2e42e3b069f709a962e5a7056
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nightcrawler_swift (0.2.0)
4
+ nightcrawler_swift (0.2.1)
5
5
  rest-client (>= 1.7.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Code Climate](https://codeclimate.com/github/tulios/nightcrawler_swift/badges/gpa.svg)](https://codeclimate.com/github/tulios/nightcrawler_swift)
2
+
1
3
  # Nightcrawler Swift
2
4
 
3
5
  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.
@@ -34,7 +36,7 @@ config.nightcrawler_swift.auth_url = "https://auth.url.com:123/v2.0/tokens"
34
36
  By default it will use ```Rails.logger``` as logger, to change that use a different logger in configurations, like:
35
37
 
36
38
  ```ruby
37
- config.nightcrawler_swift.logger = Logger.new(STDOU)
39
+ config.nightcrawler_swift.logger = Logger.new(STDOUT)
38
40
  ```
39
41
 
40
42
  #### 2) Profit!
@@ -28,6 +28,7 @@ module NightcrawlerSwift
28
28
  end
29
29
 
30
30
  def sync dir_path
31
+ connection.connect!
31
32
  Sync.new.execute(dir_path)
32
33
  end
33
34
 
@@ -1,3 +1,3 @@
1
1
  module NightcrawlerSwift
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -0,0 +1,71 @@
1
+ require "spec_helper"
2
+
3
+ describe NightcrawlerSwift do
4
+
5
+ subject do
6
+ NightcrawlerSwift
7
+ end
8
+
9
+ describe "::logger" do
10
+ before do
11
+ subject.logger = nil
12
+ end
13
+
14
+ it "returns an instance of Logger when not configured" do
15
+ expect(Logger).to receive(:new).with(STDOUT)
16
+ subject.logger
17
+ end
18
+
19
+ it "returns the configured logger" do
20
+ logger = Logger.new(StringIO.new)
21
+ subject.logger = logger
22
+ expect(subject.logger).to eql(logger)
23
+ end
24
+ end
25
+
26
+ describe "::configure" do
27
+ it "creates a new connection with the given opts" do
28
+ opts = {bucket: "rogue"}
29
+ expect(NightcrawlerSwift::Connection).to receive(:new).with(opts).and_call_original
30
+ subject.configure opts
31
+ expect(subject.connection).to_not be_nil
32
+ end
33
+ end
34
+
35
+ describe "::connection" do
36
+ it "returns the configured connection" do
37
+ connection = NightcrawlerSwift::Connection.new
38
+ expect(NightcrawlerSwift::Connection).to receive(:new).with(anything).and_return(connection)
39
+ NightcrawlerSwift.configure
40
+ expect(NightcrawlerSwift.connection).to eql(connection)
41
+ end
42
+ end
43
+
44
+ describe "::sync" do
45
+ let :dir_path do
46
+ "path"
47
+ end
48
+
49
+ let :sync_instance do
50
+ double("Sync", execute: true)
51
+ end
52
+
53
+ before do
54
+ NightcrawlerSwift.configure
55
+ end
56
+
57
+ it "connects" do
58
+ allow(NightcrawlerSwift::Sync).to receive(:new).and_return(sync_instance)
59
+ expect(NightcrawlerSwift.connection).to receive(:connect!)
60
+ NightcrawlerSwift.sync dir_path
61
+ end
62
+
63
+ it "uses Sync command with the given dir_path" do
64
+ expect(NightcrawlerSwift.connection).to receive(:connect!)
65
+ expect(NightcrawlerSwift::Sync).to receive(:new).and_return(sync_instance)
66
+ expect(sync_instance).to receive(:execute).with(dir_path)
67
+ NightcrawlerSwift.sync dir_path
68
+ end
69
+ end
70
+
71
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nightcrawler_swift
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - tulios