contentful_bootstrap 3.5.0 → 3.5.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: 3069a4e110431c036457ac8839dc3e01d48146e3
4
- data.tar.gz: 9fdeed19e3bdd8c97d77424e029b3f76b65a78e3
3
+ metadata.gz: 6a980f96add79c447bc7c0fefe9a9adf6ca7a0a2
4
+ data.tar.gz: c985777812c51b5ea56cbb72b408dc4084c4fd37
5
5
  SHA512:
6
- metadata.gz: 1a29cc6c70e7e062bc0224b0831a1b3841059ba99e1954690cdf8dfe702bde14cd8090d7c8cad8d52766cef84d81df1e7a9e7bbd3352efced2b7c48a857924ac
7
- data.tar.gz: b8638c2bbc11a3f8cb2f5c4a99e763c2220d8b318eccaea6c8e1a01c7123c7807b90aa2b852ea50b8d40229ba81ae3bf197fae3b1c1119b75eb31aa2da2a11d8
6
+ metadata.gz: 98d0f125902b0f630e68d221cc1d1f46e8e10bc4d8269053b8900a3b8cf6860a0ddc7734203672ae5e38cf95aaa57c07342b128a808ebc4a4dc6a3d778fe09e5
7
+ data.tar.gz: 0efd66ede3afb522c91aeea013097e7a638ac5e68ea9d0b38da2c28b1b722523e1e077848c5e09c5658b4f8841d948547aaafbbe7e9f7dedc83ba6ae81c91467
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## v3.5.1
6
+ ### Fixed
7
+ * Fixed organization fetching when no organization ID is provided on the configuration file [#54](https://github.com/contentful/contentful-bootstrap.rb/issues/54)
8
+
5
9
  ## v3.5.0
6
10
 
7
11
  ### Added
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "vcr", '~> 2.9'
25
25
  spec.add_development_dependency "webmock", '~> 1.24'
26
26
  spec.add_development_dependency "rr"
27
+ spec.add_development_dependency "simplecov"
27
28
  spec.add_development_dependency "guard"
28
29
  spec.add_development_dependency "guard-rspec"
29
30
  spec.add_development_dependency 'listen', '~> 3.0.0'
@@ -48,6 +48,7 @@ module Contentful
48
48
  name: @space
49
49
  }
50
50
  options[:organization_id] = @token.read_organization_id unless @token.read_organization_id.nil?
51
+ management_client_init
51
52
  new_space = client.spaces.create(options)
52
53
  rescue Contentful::Management::NotFound
53
54
  fail "Organization ID is required, provide it in Configuration File" if no_input
@@ -71,9 +72,9 @@ module Contentful
71
72
  private
72
73
 
73
74
  def organizations
74
- client = management_client_init
75
+ management_client_init
75
76
  url = client.base_url.sub('spaces', 'token')
76
- response = client.get_http(url, nil, client.request_headers)
77
+ response = client.class.get_http(url, nil, client.request_headers)
77
78
  organization_ids = JSON.load(response.body.to_s)['includes']['Organization'].map do |org|
78
79
  sprintf('%-20s %s', org['name'], org['sys']['id'])
79
80
  end
@@ -1,6 +1,6 @@
1
1
  module Contentful
2
2
  module Bootstrap
3
- VERSION = '3.5.0'
3
+ VERSION = '3.5.1'
4
4
 
5
5
  def self.major_version
6
6
  VERSION.split('.').first.to_i
@@ -85,6 +85,27 @@ describe Contentful::Bootstrap::Commands::CreateSpace do
85
85
  command.run
86
86
  }
87
87
  end
88
+
89
+ it 'doesnt fail on multiple organizations #54' do
90
+ vcr('multiple_organizations') {
91
+ path = File.expand_path(File.join('spec', 'fixtures', 'ini_fixtures', 'no_org.ini'))
92
+ token = Contentful::Bootstrap::Token.new path
93
+
94
+ allow(Contentful::Bootstrap::Support).to receive(:gets).and_return('y')
95
+ allow(Contentful::Bootstrap::Support).to receive(:gets).and_return('n')
96
+ subject = described_class.new token, 'foo', quiet: true
97
+
98
+ expect(subject).to receive(:generate_token).with(space_double)
99
+ expect(Contentful::Bootstrap::Support).to receive(:gets) { 'foobar' }
100
+ expect(token).to receive(:write_organization_id).with('foobar')
101
+ expect(subject.client).to receive(:spaces).and_call_original
102
+ space_proxy_double = Object.new
103
+ expect(subject.client).to receive(:spaces) { space_proxy_double }
104
+ expect(space_proxy_double).to receive(:create).with(name: 'foo', organization_id: 'foobar') { space_double }
105
+
106
+ subject.run
107
+ }
108
+ end
88
109
  end
89
110
 
90
111
  describe 'integration' do
@@ -0,0 +1,2 @@
1
+ [global]
2
+ CONTENTFUL_MANAGEMENT_ACCESS_TOKEN = foo