contentful_bootstrap 1.5.1 → 1.6.0

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: f322cae9e22455a154bb4c242aeae31b7d6e44ba
4
- data.tar.gz: 3889c9c6eea8a7cc05a1af678e205978b737677b
3
+ metadata.gz: 350dcf7465b5d8ccd0efcdbb8351e6504bf653c0
4
+ data.tar.gz: 1c554d4d7ec3606eb026d671660dae89aad58b28
5
5
  SHA512:
6
- metadata.gz: 73886dbe2ccb781efd7cb8b10d84967d1c0149c585cf5b34985c65d058536d6a0c178bdc6139ab4cad3583d2dee9df8702eadc7b9671b605748c727f1b3fd702
7
- data.tar.gz: d4a2055f9ac462e1d00e16d80be7f617afff824561e709cff31b2b38deace5aaab4c4c199ceb6704f8c7793fbafd1dfb5924c95367a631cc15a8eabb50b884bd
6
+ metadata.gz: 623d664fcd58c48df3b1067c18ae757d5e831c827f24acc4f01c59a5b7926af1f5681b4b85f9d764c66700043862af4d940620a4c52520f398c189a0e39d3358
7
+ data.tar.gz: 4fba258364e79b46261f7ef7e5584c6b64090678c5725e9ad0720b5d671cb96704abbfed658d2db94c27ea3a223708248893eb0357c9f960cf89cd0690247fd8
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # Change Log
2
2
  ## Unreleased
3
3
 
4
+ ## v1.6.0
5
+ ### Added
6
+ * Support for Symbols in Array fields
7
+ * Support for Links of other Entries that are not yet saved
8
+
4
9
  ## v1.5.1
5
10
  ### Fixed
6
11
  * Array fields were getting overwritten with `nil`
data/Gemfile CHANGED
@@ -1,6 +1,8 @@
1
1
  # A sample Gemfile
2
2
  source "https://rubygems.org"
3
3
 
4
+ gemspec
5
+
4
6
  gem "launchy"
5
7
  gem "inifile"
6
8
  gem "contentful-management"
@@ -1,4 +1,5 @@
1
1
  require "contentful/management"
2
+ require "contentful/bootstrap/templates/links/base"
2
3
 
3
4
  module Contentful
4
5
  module Bootstrap
@@ -94,8 +95,11 @@ module Contentful
94
95
  end
95
96
 
96
97
  def create_entries
98
+ content_types = []
97
99
  entries.each do |content_type_id, entry_list|
98
100
  content_type = space.content_types.find(content_type_id)
101
+ content_types << content_type
102
+
99
103
  entry_list.each_with_index do |e, index|
100
104
  puts "Creating Entry #{index} for #{content_type_id.capitalize}"
101
105
 
@@ -111,8 +115,12 @@ module Contentful
111
115
  end
112
116
 
113
117
  array_fields.each do |af|
114
- e[af].map! do |f|
115
- space.send(f.kind).find(f.id)
118
+ e[af].map! do |item|
119
+ if item.is_a? Links::Base
120
+ item.to_management_object
121
+ else
122
+ item
123
+ end
116
124
  end
117
125
  e[af.to_sym] = e.delete(af)
118
126
  end
@@ -121,11 +129,14 @@ module Contentful
121
129
  e[rf.to_sym] = e.delete(rf)
122
130
  end
123
131
 
124
- entry = content_type.entries.create(e)
132
+ entry = content_type.entries.create(e.clone)
125
133
  entry.save
126
- entry.publish
127
134
  end
128
135
  end
136
+
137
+ content_types.each do |content_type|
138
+ content_type.entries.all.map(&:publish)
139
+ end
129
140
  end
130
141
  end
131
142
  end
@@ -61,8 +61,12 @@ module Contentful
61
61
  end
62
62
 
63
63
  array_fields.each do |af|
64
- entry[af].map! do |link|
65
- create_link(link)
64
+ entry[af].map! do |item|
65
+ if item.is_a? Hash
66
+ create_link(item)
67
+ else
68
+ item
69
+ end
66
70
  end
67
71
  end
68
72
 
@@ -1,3 +1,4 @@
1
+ require "contentful/management"
1
2
  require "contentful/bootstrap/templates/links/base"
2
3
 
3
4
  module Contentful
@@ -5,8 +6,8 @@ module Contentful
5
6
  module Templates
6
7
  module Links
7
8
  class Asset < Base
8
- def kind
9
- :assets
9
+ def management_class
10
+ Contentful::Management::Asset
10
11
  end
11
12
  end
12
13
  end
@@ -1,3 +1,5 @@
1
+ require "contentful/management"
2
+
1
3
  module Contentful
2
4
  module Bootstrap
3
5
  module Templates
@@ -8,7 +10,21 @@ module Contentful
8
10
  @id = id
9
11
  end
10
12
 
11
- def kind
13
+ def link_type
14
+ self.class.name.split("::").last
15
+ end
16
+
17
+ def type
18
+ Contentful::Management::ContentType::LINK
19
+ end
20
+
21
+ def to_management_object
22
+ object = management_class.new
23
+ object.id = id
24
+ object
25
+ end
26
+
27
+ def management_class
12
28
  raise "must implement"
13
29
  end
14
30
  end
@@ -1,3 +1,4 @@
1
+ require "contentful/management"
1
2
  require "contentful/bootstrap/templates/links/base"
2
3
 
3
4
  module Contentful
@@ -5,8 +6,8 @@ module Contentful
5
6
  module Templates
6
7
  module Links
7
8
  class Entry < Base
8
- def kind
9
- :entries
9
+ def management_class
10
+ Contentful::Management::Entry
10
11
  end
11
12
  end
12
13
  end
@@ -1,5 +1,5 @@
1
1
  module Contentful
2
2
  module Bootstrap
3
- VERSION = "1.5.1"
3
+ VERSION = "1.6.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentful_bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Litvak Bruno