contentful_bootstrap 3.3.0 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/bin/contentful_bootstrap +5 -1
- data/contentful_bootstrap.gemspec +3 -2
- data/lib/contentful/bootstrap/commands/create_space.rb +7 -1
- data/lib/contentful/bootstrap/token.rb +9 -0
- data/lib/contentful/bootstrap/version.rb +1 -1
- data/spec/contentful/bootstrap/token_spec.rb +16 -0
- data/spec/fixtures/ini_fixtures/orgid.ini +3 -0
- metadata +26 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4672f655b4d3a32b439e75feec5b7d5fddbcfb5e
|
4
|
+
data.tar.gz: 75bcb4e3054e0a5cbc1abe6a2e7c0083f7a718fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c54a6ad2254d281a207b7764a419313b69b4caf1eff76cd03fb01bc01b757b8f537f73d538122345ccae69ae5b89f782748a22509278881d2122403b19e62140
|
7
|
+
data.tar.gz: 230b8f6a1b6413ce6888bad8a0252435bbc3602a183d31e4aaef66bab51894ceaab68943b4492352bfb3517c4ed984c2d873b8e15056afb844bc2789918e723d
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## v3.4.0
|
6
|
+
### Added
|
7
|
+
* Add `-v` and `--version` flags to output current version
|
8
|
+
* Add possibility to define `CONTENTFUL_ORGANIZATION_ID` in your `.contentfulrc` file [#44](https://github.com/contentful/contentful-bootstrap.rb/issues/44)
|
9
|
+
|
5
10
|
## v3.3.0
|
6
11
|
### Added
|
7
12
|
* Adds possibility to change `contentType` for Assets [#39](https://github.com/contentful/contentful-bootstrap.rb/issues/39)
|
data/bin/contentful_bootstrap
CHANGED
@@ -75,6 +75,10 @@ global = OptionParser.new do |opts|
|
|
75
75
|
Available commands are:
|
76
76
|
\t#{subcommands.keys.sort.join("\n\t")}
|
77
77
|
HELP
|
78
|
+
opts.on_tail("-v", "--version", "Show Version") do
|
79
|
+
puts "Contentful Bootstrap: #{Contentful::Bootstrap::VERSION}"
|
80
|
+
exit(0)
|
81
|
+
end
|
78
82
|
end
|
79
83
|
|
80
84
|
global.order!
|
@@ -85,7 +89,7 @@ space = ARGV.shift unless is_help
|
|
85
89
|
|
86
90
|
options[:access_token] = ARGV.shift if command == "generate_json" && !is_help
|
87
91
|
|
88
|
-
if subcommands.
|
92
|
+
if subcommands.key? command
|
89
93
|
subcommands[command].order!
|
90
94
|
|
91
95
|
unless STDIN.tty? && STDOUT.tty?
|
@@ -18,8 +18,9 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
20
|
spec.add_development_dependency "bundler", "~> 1.6"
|
21
|
-
spec.add_development_dependency
|
22
|
-
spec.add_development_dependency
|
21
|
+
spec.add_development_dependency 'rake', '< 11.0'
|
22
|
+
spec.add_development_dependency 'public_suffix', '< 1.5'
|
23
|
+
spec.add_development_dependency 'rspec', '~> 3'
|
23
24
|
spec.add_development_dependency "vcr", '~> 2.9'
|
24
25
|
spec.add_development_dependency "webmock", '~> 1.24'
|
25
26
|
spec.add_development_dependency "rr"
|
@@ -45,12 +45,18 @@ module Contentful
|
|
45
45
|
def fetch_space
|
46
46
|
new_space = nil
|
47
47
|
begin
|
48
|
-
|
48
|
+
options = {
|
49
|
+
name: @space
|
50
|
+
}
|
51
|
+
options[:organization_id] = @token.read_organization_id unless @token.read_organization_id.nil?
|
52
|
+
new_space = Contentful::Management::Space.create(options)
|
49
53
|
rescue Contentful::Management::NotFound
|
50
54
|
puts 'Your account has multiple organizations:'
|
51
55
|
puts organizations.join("\n")
|
52
56
|
print 'Please insert the Organization ID you\'d want to create the spaces for: '
|
53
57
|
organization_id = gets.chomp
|
58
|
+
@token.write_organization_id(organization_id)
|
59
|
+
puts 'Your Organization ID has been stored as the default organization.'
|
54
60
|
new_space = Contentful::Management::Space.create(
|
55
61
|
name: @space,
|
56
62
|
organization_id: organization_id
|
@@ -8,6 +8,7 @@ module Contentful
|
|
8
8
|
DEFAULT_PATH = '.contentfulrc'.freeze
|
9
9
|
MANAGEMENT_TOKEN = 'CONTENTFUL_MANAGEMENT_ACCESS_TOKEN'.freeze
|
10
10
|
DELIVERY_TOKEN = 'CONTENTFUL_DELIVERY_ACCESS_TOKEN'.freeze
|
11
|
+
ORGANIZATION_ID = 'CONTENTFUL_ORGANIZATION_ID'.freeze
|
11
12
|
SPACE_ID = 'SPACE_ID'.freeze
|
12
13
|
|
13
14
|
attr_reader :config_path
|
@@ -32,12 +33,20 @@ module Contentful
|
|
32
33
|
raise 'Token not found'
|
33
34
|
end
|
34
35
|
|
36
|
+
def read_organization_id
|
37
|
+
config_file[config_section].fetch(ORGANIZATION_ID, nil)
|
38
|
+
end
|
39
|
+
|
35
40
|
def write(value, section = nil, key = MANAGEMENT_TOKEN)
|
36
41
|
file = config_file
|
37
42
|
file[section || config_section][key] = value
|
38
43
|
file.save
|
39
44
|
end
|
40
45
|
|
46
|
+
def write_organization_id(organization_id)
|
47
|
+
write(organization_id, nil, ORGANIZATION_ID)
|
48
|
+
end
|
49
|
+
|
41
50
|
def write_access_token(space_name, token)
|
42
51
|
write(token, space_name, DELIVERY_TOKEN)
|
43
52
|
end
|
@@ -5,6 +5,7 @@ describe Contentful::Bootstrap::Token do
|
|
5
5
|
let(:no_token_path) { File.expand_path(File.join('spec', 'fixtures', 'ini_fixtures', 'no_token.ini')) }
|
6
6
|
let(:sections_path) { File.expand_path(File.join('spec', 'fixtures', 'ini_fixtures', 'sections.ini')) }
|
7
7
|
let(:no_global_path) { File.expand_path(File.join('spec', 'fixtures', 'ini_fixtures', 'no_global.ini')) }
|
8
|
+
let(:with_org_id) { File.expand_path(File.join('spec', 'fixtures', 'ini_fixtures', 'orgid.ini')) }
|
8
9
|
subject { Contentful::Bootstrap::Token.new(path) }
|
9
10
|
|
10
11
|
describe 'attributes' do
|
@@ -76,6 +77,16 @@ describe Contentful::Bootstrap::Token do
|
|
76
77
|
end
|
77
78
|
end
|
78
79
|
|
80
|
+
describe '#read_organization_id' do
|
81
|
+
it 'nil if default org id is not set' do
|
82
|
+
expect(subject.read_organization_id).to be_nil
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'returns value of org id is set' do
|
86
|
+
expect(subject.class.new(with_org_id).read_organization_id).to eq 'my_org'
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
79
90
|
describe 'write methods' do
|
80
91
|
before do
|
81
92
|
@file = subject.config_file
|
@@ -99,6 +110,11 @@ describe Contentful::Bootstrap::Token do
|
|
99
110
|
expect(@file['some_space']['SPACE_ID']).to eq 'asd'
|
100
111
|
end
|
101
112
|
|
113
|
+
it '#write_organization_id' do
|
114
|
+
subject.write_organization_id('foo')
|
115
|
+
expect(@file['global']['CONTENTFUL_ORGANIZATION_ID']).to eq 'foo'
|
116
|
+
end
|
117
|
+
|
102
118
|
describe '#write' do
|
103
119
|
it 'writes management tokens when only value is sent' do
|
104
120
|
expect(@file['global']['CONTENTFUL_MANAGEMENT_ACCESS_TOKEN']).to eq 'foobar'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contentful_bootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Litvak Bruno
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -28,30 +28,44 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '11.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "<"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
40
|
+
version: '11.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: public_suffix
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "<"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.5'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "<"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.5'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rspec
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- - "
|
59
|
+
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
61
|
+
version: '3'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- - "
|
66
|
+
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
68
|
+
version: '3'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: vcr
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -261,6 +275,7 @@ files:
|
|
261
275
|
- spec/fixtures/ini_fixtures/contentfulrc.ini
|
262
276
|
- spec/fixtures/ini_fixtures/no_global.ini
|
263
277
|
- spec/fixtures/ini_fixtures/no_token.ini
|
278
|
+
- spec/fixtures/ini_fixtures/orgid.ini
|
264
279
|
- spec/fixtures/ini_fixtures/sections.ini
|
265
280
|
- spec/fixtures/json_fixtures/asset_no_transform.json
|
266
281
|
- spec/fixtures/json_fixtures/display_field.json
|
@@ -333,6 +348,7 @@ test_files:
|
|
333
348
|
- spec/fixtures/ini_fixtures/contentfulrc.ini
|
334
349
|
- spec/fixtures/ini_fixtures/no_global.ini
|
335
350
|
- spec/fixtures/ini_fixtures/no_token.ini
|
351
|
+
- spec/fixtures/ini_fixtures/orgid.ini
|
336
352
|
- spec/fixtures/ini_fixtures/sections.ini
|
337
353
|
- spec/fixtures/json_fixtures/asset_no_transform.json
|
338
354
|
- spec/fixtures/json_fixtures/display_field.json
|