nightcrawler_swift 0.8.0 → 0.8.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 +4 -4
- data/Changelog.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +10 -0
- data/lib/nightcrawler_swift/cli/runner.rb +1 -0
- data/lib/nightcrawler_swift/connection.rb +21 -4
- data/lib/nightcrawler_swift/version.rb +1 -1
- data/spec/lib/nightcrawler_swift/cli/runner_spec.rb +2 -1
- data/spec/lib/nightcrawler_swift/connection_spec.rb +7 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49eb3149824e6bb82f13aad83cbb2d39f9257c3c
|
4
|
+
data.tar.gz: 9350bc6a957b2d75ec215f4f2bbf8fee4a9e4b8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83f910d9116f65d0fb9f8f81fd39f3a4f3a35e867f2106f6d4a4994a7d8be4e715064ac10789e1567e9dc56e03133cbacc51870a032d477e4377a49bf8ea0d81
|
7
|
+
data.tar.gz: f203032ebc81bc80aaeb77ac147fbdc16f08b0d57bbf48aac878ae45be24209e18056b5e0d6b0af39a95f4c03de5b6a459e3c9a2f2f4a499cb467466d74cb971
|
data/Changelog.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -370,6 +370,16 @@ NightcrawlerSwift.configure tenant_name: "rogue"
|
|
370
370
|
NightcrawlerSwift.options.tenant_name # "rogue"
|
371
371
|
```
|
372
372
|
|
373
|
+
## Contributors
|
374
|
+
|
375
|
+
Check it out!
|
376
|
+
|
377
|
+
https://github.com/tulios/nightcrawler_swift/graphs/contributors
|
378
|
+
|
379
|
+
## License
|
380
|
+
|
381
|
+
See [LICENSE](https://github.com/tulios/nightcrawler_swift/blob/master/LICENSE.txt) for more details.
|
382
|
+
|
373
383
|
## Contributing
|
374
384
|
|
375
385
|
1. Fork it ( https://github.com/tulios/nightcrawler_swift/fork )
|
@@ -1,7 +1,24 @@
|
|
1
1
|
module NightcrawlerSwift
|
2
2
|
class Connection
|
3
|
-
|
4
|
-
|
3
|
+
def self.connected_attr_reader(*args)
|
4
|
+
args.each do |arg|
|
5
|
+
define_method(arg.to_sym) do
|
6
|
+
connect! unless connected?
|
7
|
+
instance_variable_get("@#{arg}")
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
private_class_method :connected_attr_reader
|
13
|
+
|
14
|
+
attr_writer :auth_response
|
15
|
+
attr_reader :token_id, :expires_at
|
16
|
+
connected_attr_reader :catalog, :admin_url, :upload_url, :public_url, :internal_url
|
17
|
+
|
18
|
+
def auth_response
|
19
|
+
authenticate! if @auth_response.nil?
|
20
|
+
@auth_response
|
21
|
+
end
|
5
22
|
|
6
23
|
def connect!
|
7
24
|
authenticate!
|
@@ -58,8 +75,8 @@ module NightcrawlerSwift
|
|
58
75
|
end
|
59
76
|
|
60
77
|
def select_endpoints
|
61
|
-
raise Exceptions::ConfigurationError.new "No catalog of type 'object-store' found" if catalog.nil?
|
62
|
-
@endpoints = catalog["endpoints"].first
|
78
|
+
raise Exceptions::ConfigurationError.new "No catalog of type 'object-store' found" if @catalog.nil?
|
79
|
+
@endpoints = @catalog["endpoints"].first
|
63
80
|
end
|
64
81
|
|
65
82
|
def configure_urls
|
@@ -100,13 +100,14 @@ describe NightcrawlerSwift::CLI::Runner do
|
|
100
100
|
end
|
101
101
|
|
102
102
|
before do
|
103
|
+
allow(connection).to receive(:authenticate!)
|
103
104
|
allow(formatter).to receive(command_method)
|
104
105
|
allow(NightcrawlerSwift).to receive(:connection).and_return(connection)
|
105
106
|
File.open(config_file, "w") {|f| f.write(opts.to_json)}
|
106
107
|
end
|
107
108
|
|
108
109
|
it "configures NightcrawlerSwift" do
|
109
|
-
expect(NightcrawlerSwift).to receive(:configure).with
|
110
|
+
expect(NightcrawlerSwift).to receive(:configure).with(opts.symbolize_keys).and_call_original
|
110
111
|
subject.run
|
111
112
|
end
|
112
113
|
|
@@ -80,27 +80,28 @@ describe NightcrawlerSwift::Connection do
|
|
80
80
|
end
|
81
81
|
|
82
82
|
it "stores the catalog" do
|
83
|
-
subject.connect!
|
83
|
+
expect(subject).to receive(:connect!).and_call_original
|
84
84
|
expect(subject.catalog).to eql(auth_success_json["access"]["serviceCatalog"][0])
|
85
85
|
end
|
86
86
|
|
87
87
|
it "stores the admin_url" do
|
88
|
-
subject.connect!
|
88
|
+
expect(subject).to receive(:connect!).and_call_original
|
89
89
|
expect(subject.admin_url).to eql(auth_success_json["access"]["serviceCatalog"].first["endpoints"].first["adminURL"])
|
90
90
|
end
|
91
91
|
|
92
92
|
it "stores the upload_url" do
|
93
|
-
subject.
|
94
|
-
expect(subject
|
93
|
+
admin_url = subject.admin_url
|
94
|
+
expect(subject).to receive(:connect!).and_call_original
|
95
|
+
expect(subject.upload_url).to eql("#{admin_url}/#{opts[:bucket]}")
|
95
96
|
end
|
96
97
|
|
97
98
|
it "stores the public_url" do
|
98
|
-
subject.connect!
|
99
|
+
expect(subject).to receive(:connect!).and_call_original
|
99
100
|
expect(subject.public_url).to eql(auth_success_json["access"]["serviceCatalog"].first["endpoints"].first["publicURL"])
|
100
101
|
end
|
101
102
|
|
102
103
|
it "stores the internal_url" do
|
103
|
-
subject.connect!
|
104
|
+
expect(subject).to receive(:connect!).and_call_original
|
104
105
|
expect(subject.internal_url).to eql(auth_success_json["access"]["serviceCatalog"].first["endpoints"].first["internalURL"])
|
105
106
|
end
|
106
107
|
|
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.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tulios
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-09-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|