contentful_bootstrap 1.2.0 → 1.3.0

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: 6c9318c79de37f2e341ff2790568f262ae743c6f
4
- data.tar.gz: 027e2f1d2f813dd7474bb60fc9513f90ad01a9bc
3
+ metadata.gz: abc3293313734c48533d9bfab19a082c56ff2015
4
+ data.tar.gz: 2f32362597921e36bde671c82e6ebc1ed9370b8d
5
5
  SHA512:
6
- metadata.gz: 157d290ee057532caa5a4973d453950fc8396245ee206df3f2469e23debf5bcc9c042e709684670fe8807655db5e2d5ba624267ab06ef4a748566a149ca37829
7
- data.tar.gz: bfaf280b578495afa0d746cc6037dcaf9d6e0f1b9599066177a4a2bed341f54c98b102667a0fc936815e267c0cfabfcb35fe1e882290f10f98679c1920d6702e
6
+ metadata.gz: cd662d667dbfa2ea5fedc5eba59e21c88a26a2178857b491ebf334232bf67e96bd3aefd7819f3d97d3752a52b4f58edb275292476684a185768aa9a7a3efc13f
7
+ data.tar.gz: fecb3ebcc95412f4471f9836ac8767168b2f7f68319da4abad64718917809e62af6a1f21b3f16881100aae39b01aa2fddba68a60b0e9447988468e779561c5a7
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # Change Log
2
2
  ## Unreleased
3
3
 
4
+ ## v1.3.0
5
+ ### Added
6
+ * Spaces now get their own section in `~/.contentfulrc`
7
+
8
+ ### Changed
9
+ * Delivery API Tokens now saved per Space
10
+
4
11
  ## v1.2.0
5
12
  ### Added
6
13
  * JSON Template Parser
data/README.md CHANGED
@@ -111,6 +111,9 @@ The configuration file will be in `ini` format and looks like the following
111
111
  ```ini
112
112
  [global]
113
113
  CONTENTFUL_MANAGEMENT_ACCESS_TOKEN = a_management_access_token
114
+
115
+ [space_name]
116
+ SPACE_ID = some_space_id ; Space configurations are not required by this tool, but can be generated by it
114
117
  CONTENTFUL_DELIVERY_ACCESS_TOKEN = a_delivery_acces_token ; Delivery Access Token is not required for this tool, but can be generated by it
115
118
  ```
116
119
 
@@ -95,7 +95,10 @@ module Contentful
95
95
 
96
96
  puts "Token '#{token_name}' created! - '#{token}'"
97
97
  print "Do you want to write the Delivery Token to your configuration file? (Y/n): "
98
- Token.write_access_token(token) unless gets.chomp.downcase == "n"
98
+ unless gets.chomp.downcase == "n"
99
+ Token.write_access_token(space.name, token)
100
+ Token.write_space_id(space.name, space.id)
101
+ end
99
102
 
100
103
  token
101
104
  end
@@ -6,8 +6,9 @@ module Contentful
6
6
  CONFIG_ENV = "CONTENTFUL_ENV".freeze
7
7
  DEFAULT_SECTION = "global".freeze
8
8
  DEFAULT_PATH = ".contentfulrc".freeze
9
- MANAGEMENT_TOKEN = "CONTENTFUL_MANAGEMENT_ACCESS_TOKEN"
10
- DELIVERY_TOKEN = "CONTENTFUL_DELIVERY_ACCESS_TOKEN"
9
+ MANAGEMENT_TOKEN = "CONTENTFUL_MANAGEMENT_ACCESS_TOKEN".freeze
10
+ DELIVERY_TOKEN = "CONTENTFUL_DELIVERY_ACCESS_TOKEN".freeze
11
+ SPACE_ID = "SPACE_ID".freeze
11
12
 
12
13
  def self.set_path!(config_path = "")
13
14
  @@config_path = config_path
@@ -26,14 +27,18 @@ module Contentful
26
27
  end
27
28
  end
28
29
 
29
- def self.write(token, key = MANAGEMENT_TOKEN)
30
+ def self.write(value, section = nil, key = MANAGEMENT_TOKEN)
30
31
  file = config_file
31
- file[config_section][key] = token
32
+ file[section || config_section][key] = value
32
33
  file.save
33
34
  end
34
35
 
35
- def self.write_access_token(token)
36
- write(token, DELIVERY_TOKEN)
36
+ def self.write_access_token(space_name, token)
37
+ write(token, space_name, DELIVERY_TOKEN)
38
+ end
39
+
40
+ def self.write_space_id(space_name, space_id)
41
+ write(space_id, space_name, SPACE_ID)
37
42
  end
38
43
 
39
44
  def self.filename
@@ -1,5 +1,5 @@
1
1
  module Contentful
2
2
  module Bootstrap
3
- VERSION = "1.2.0"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
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: 1.2.0
4
+ version: 1.3.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: 2015-11-03 00:00:00.000000000 Z
11
+ date: 2015-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler