nightcrawler_swift 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 206f894e8de465851f7a45dcea23615de0666dd4
4
- data.tar.gz: 69f0ed04088e491d8d7bf1ea6e6b2c5c3bd03049
3
+ metadata.gz: 49eb3149824e6bb82f13aad83cbb2d39f9257c3c
4
+ data.tar.gz: 9350bc6a957b2d75ec215f4f2bbf8fee4a9e4b8b
5
5
  SHA512:
6
- metadata.gz: 9432b08baae481fc88123911809c78ada1300653af4ecd1cadda04d5b3776bbdfdfb6288fd3284a42aacca7056632c1fd26f9bd1eb833401efdec43504eb9226
7
- data.tar.gz: 1d14060fafd907d4e0185ff5612a84c087ea58234219638fae4f07eabd6d5c3d50a78b264d548d90c50e1731b60e58628a5e59267df9b8bd1ceb23536fb9b982
6
+ metadata.gz: 83f910d9116f65d0fb9f8f81fd39f3a4f3a35e867f2106f6d4a4994a7d8be4e715064ac10789e1567e9dc56e03133cbacc51870a032d477e4377a49bf8ea0d81
7
+ data.tar.gz: f203032ebc81bc80aaeb77ac147fbdc16f08b0d57bbf48aac878ae45be24209e18056b5e0d6b0af39a95f4c03de5b6a459e3c9a2f2f4a499cb467466d74cb971
data/Changelog.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.1
4
+
5
+ - Ensure connected on url getters `catalog, admin_url, upload_url, public_url, internal_url` (pull request #28)
6
+
3
7
  ## 0.8.0
4
8
 
5
9
  - Added support for ssl_version configuration
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nightcrawler_swift (0.8.0)
4
+ nightcrawler_swift (0.8.1)
5
5
  concurrent-ruby (~> 0.8.0)
6
6
  multi_mime (>= 1.0.1)
7
7
  rest-client
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 )
@@ -105,6 +105,7 @@ module NightcrawlerSwift::CLI
105
105
  rescue
106
106
  log "Failed to restore connection, removing cache"
107
107
  File.delete cache_path
108
+ NightcrawlerSwift.connection.auth_response = nil
108
109
  end
109
110
  end
110
111
 
@@ -1,7 +1,24 @@
1
1
  module NightcrawlerSwift
2
2
  class Connection
3
- attr_accessor :auth_response
4
- attr_reader :token_id, :expires_at, :catalog, :admin_url, :upload_url, :public_url, :internal_url
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
@@ -1,3 +1,3 @@
1
1
  module NightcrawlerSwift
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
3
3
  end
@@ -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 opts.symbolize_keys
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.connect!
94
- expect(subject.upload_url).to eql("#{subject.admin_url}/#{opts[:bucket]}")
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.0
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-05-18 00:00:00.000000000 Z
12
+ date: 2015-09-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client