locomotivecms_mounter 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. data/lib/locomotive/mounter/models/content_asset.rb +2 -2
  2. data/lib/locomotive/mounter/models/theme_asset.rb +1 -1
  3. data/lib/locomotive/mounter/reader/api/base.rb +7 -2
  4. data/lib/locomotive/mounter/reader/api/content_assets_reader.rb +2 -3
  5. data/lib/locomotive/mounter/reader/api/content_entries_reader.rb +2 -0
  6. data/lib/locomotive/mounter/reader/api/content_types_reader.rb +2 -0
  7. data/lib/locomotive/mounter/reader/api/pages_reader.rb +2 -0
  8. data/lib/locomotive/mounter/reader/api/site_reader.rb +2 -0
  9. data/lib/locomotive/mounter/reader/api/snippets_reader.rb +2 -0
  10. data/lib/locomotive/mounter/reader/api/theme_assets_reader.rb +2 -3
  11. data/lib/locomotive/mounter/reader/api/translations_reader.rb +2 -0
  12. data/lib/locomotive/mounter/reader/api.rb +10 -2
  13. data/lib/locomotive/mounter/utils/output.rb +124 -0
  14. data/lib/locomotive/mounter/version.rb +1 -1
  15. data/lib/locomotive/mounter/writer/api/base.rb +107 -105
  16. data/lib/locomotive/mounter/writer/file_system/base.rb +9 -0
  17. data/lib/locomotive/mounter/writer/file_system/content_assets_writer.rb +5 -0
  18. data/lib/locomotive/mounter/writer/file_system/content_entries_writer.rb +5 -0
  19. data/lib/locomotive/mounter/writer/file_system/content_types_writer.rb +5 -0
  20. data/lib/locomotive/mounter/writer/file_system/pages_writer.rb +5 -0
  21. data/lib/locomotive/mounter/writer/file_system/site_writer.rb +5 -0
  22. data/lib/locomotive/mounter/writer/file_system/snippets_writer.rb +5 -0
  23. data/lib/locomotive/mounter/writer/file_system/theme_assets_writer.rb +5 -0
  24. data/lib/locomotive/mounter/writer/file_system/translations_writer.rb +1 -0
  25. data/lib/locomotive/mounter.rb +7 -5
  26. metadata +6 -5
@@ -34,7 +34,7 @@ module Locomotive
34
34
  return @raw if @raw
35
35
 
36
36
  if self.uri
37
- @raw = Net::HTTP.get(self.uri)
37
+ @raw = HTTParty.get(self.uri.to_s).body
38
38
  else
39
39
  @raw = File.read(self.filepath)
40
40
  end
@@ -42,7 +42,7 @@ module Locomotive
42
42
 
43
43
  def size
44
44
  if self.uri
45
- Net::HTTP.get(self.uri).body.size
45
+ self.content.size
46
46
  else
47
47
  File.size(self.filepath)
48
48
  end
@@ -98,7 +98,7 @@ module Locomotive
98
98
  return @raw if @raw
99
99
 
100
100
  if self.uri
101
- @raw = Net::HTTP.get(self.uri)
101
+ @raw = HTTParty.get(self.uri.to_s).body
102
102
  elsif self.precompiled?
103
103
  template = Tilt.new(self.filepath)
104
104
  @raw = template.render
@@ -5,9 +5,11 @@ module Locomotive
5
5
 
6
6
  class Base
7
7
 
8
+ include Locomotive::Mounter::Utils::Output
9
+
8
10
  attr_accessor :runner, :items
9
11
 
10
- delegate :uri, :uri_with_scheme, to: :runner
12
+ delegate :uri, :uri_with_scheme, :base_uri_with_scheme, to: :runner
11
13
  delegate :locales, to: :mounting_point
12
14
 
13
15
  def initialize(runner)
@@ -19,6 +21,10 @@ module Locomotive
19
21
  self.runner.mounting_point
20
22
  end
21
23
 
24
+ def read
25
+ self.output_title(:pulling)
26
+ end
27
+
22
28
  def get(resource_name, locale = nil, raw = false)
23
29
  params = { query: {} }
24
30
 
@@ -32,7 +38,6 @@ module Locomotive
32
38
  when Hash then response.to_hash.delete_if { |k, _| !self.safe_attributes.include?(k) }
33
39
  when Array
34
40
  response.map do |row|
35
- # puts "#{row.inspect}\n---" # DEBUG
36
41
  row.delete_if { |k, _| !self.safe_attributes.include?(k) }
37
42
  end
38
43
  else
@@ -10,14 +10,13 @@ module Locomotive
10
10
  # @return [ Array ] The cached list of theme assets
11
11
  #
12
12
  def read
13
- base_uri = self.runner.uri.split('/').first
14
- base_uri = "http://#{base_uri}" unless base_uri =~ /^https?:\/\//
13
+ super
15
14
 
16
15
  self.get(:content_assets).each do |attributes|
17
16
  url = attributes.delete('url')
18
17
 
19
18
  attributes['folder'] = 'samples/assets'
20
- attributes['uri'] = URI(url =~ /^https?:\/\// ? url : "#{base_uri}#{url}")
19
+ attributes['uri'] = URI(url =~ /^https?:\/\// ? url : "#{self.base_uri_with_scheme}#{url}")
21
20
 
22
21
  self.items[url] = Locomotive::Mounter::Models::ContentAsset.new(attributes)
23
22
  end
@@ -17,6 +17,8 @@ module Locomotive
17
17
  # @return [ Array ] The un-ordered list of content types
18
18
  #
19
19
  def read
20
+ super
21
+
20
22
  self.fetch
21
23
 
22
24
  self.items
@@ -10,6 +10,8 @@ module Locomotive
10
10
  # @return [ Array ] The un-ordered list of content types
11
11
  #
12
12
  def read
13
+ super
14
+
13
15
  self.fetch
14
16
 
15
17
  self.enable_relationships
@@ -17,6 +17,8 @@ module Locomotive
17
17
  # @return [ Hash ] The pages organized as a Hash (using the fullpath as the key)
18
18
  #
19
19
  def read
20
+ super
21
+
20
22
  self.fetch
21
23
 
22
24
  index = self.pages['index']
@@ -6,6 +6,8 @@ module Locomotive
6
6
  class SiteReader < Base
7
7
 
8
8
  def read
9
+ super
10
+
9
11
  # get the site from the API
10
12
  site = self.get(:current_site)
11
13
 
@@ -10,6 +10,8 @@ module Locomotive
10
10
  # @return [ Array ] The un-ordered list of snippets
11
11
  #
12
12
  def read
13
+ super
14
+
13
15
  self.fetch
14
16
 
15
17
  self.items
@@ -15,13 +15,12 @@ module Locomotive
15
15
  # @return [ Array ] The cached list of theme assets
16
16
  #
17
17
  def read
18
- base_uri = self.runner.uri.split('/').first
19
- base_uri = "http://#{base_uri}" unless base_uri =~ /^https?:\/\//
18
+ super
20
19
 
21
20
  self.items = self.get(:theme_assets).map do |attributes|
22
21
  url = attributes.delete('url')
23
22
 
24
- attributes['uri'] = URI(url =~ /^https?:\/\// ? url : "#{base_uri}#{url}")
23
+ attributes['uri'] = URI(url =~ /^https?:\/\// ? url : "#{self.base_uri_with_scheme}#{url}")
25
24
 
26
25
  Locomotive::Mounter::Models::ThemeAsset.new(attributes)
27
26
  end
@@ -10,6 +10,8 @@ module Locomotive
10
10
  # @return [ Array ] The cached list of theme assets
11
11
  #
12
12
  def read
13
+ super
14
+
13
15
  self.items = get(:translations).each_with_object({}) do |attributes,hash|
14
16
  hash[attributes['key']] = Locomotive::Mounter::Models::Translation.new(attributes)
15
17
  end
@@ -40,14 +40,22 @@ module Locomotive
40
40
  [SiteReader, ContentAssetsReader, SnippetsReader, ContentTypesReader, ContentEntriesReader, PagesReader, ThemeAssetsReader, TranslationsReader]
41
41
  end
42
42
 
43
- # Return the uri with the scheme (http://)
43
+ # Return the uri with the scheme (http:// or https://)
44
44
  #
45
- # @return [ String ] The uri starting by http://
45
+ # @return [ String ] The uri starting by http:// or https://
46
46
  #
47
47
  def uri_with_scheme
48
48
  self.uri =~ /^http/ ? self.uri : "http://#{self.uri}"
49
49
  end
50
50
 
51
+ # Return the base uri with the scheme ((http:// or https://)) and without the path (/locomotive/...)
52
+ #
53
+ # @return [ String ] The uri starting by http:// or https:// and without the path
54
+ #
55
+ def base_uri_with_scheme
56
+ self.uri_with_scheme.to_s[/^https?:\/\/[^\/]+/] || self.uri_with_scheme
57
+ end
58
+
51
59
  end
52
60
 
53
61
  end
@@ -0,0 +1,124 @@
1
+ module Locomotive
2
+ module Mounter
3
+ module Utils
4
+ module Output
5
+
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+
10
+ @@buffer_enabled = false
11
+ @@buffer_log = ''
12
+
13
+ end
14
+
15
+ protected
16
+
17
+ # Print the the title for each kind of resource.
18
+ #
19
+ def output_title(action = :pushing)
20
+ msg = "* #{action.to_s.capitalize} #{self.class.name.gsub(/(Writer|Reader)$/, '').demodulize}"
21
+ self.log msg.colorize(background: :white, color: :black) + "\n"
22
+ end
23
+
24
+ # Print the current locale.
25
+ #
26
+ def output_locale
27
+ locale = Locomotive::Mounter.locale.to_s
28
+ self.log " #{locale.colorize(background: :blue, color: :white)}\n"
29
+ end
30
+
31
+ def truncate(string, length = 50, separator = '[...]')
32
+ if string.length > length
33
+ string[0..(length - separator.length)] + separator
34
+ else
35
+ string
36
+ end
37
+ end
38
+
39
+ # Print the message about the creation / update of a resource.
40
+ #
41
+ # @param [ Object ] resource The resource (Site, Page, ...etc).
42
+ #
43
+ def output_resource_op(resource)
44
+ self.log self.resource_message(resource)
45
+ end
46
+
47
+ # Print the message about the creation / update of a resource.
48
+ #
49
+ # @param [ Object ] resource The resource (Site, Page, ...etc).
50
+ # @param [ Symbol ] status :success, :error, :skipped
51
+ # @param [ String ] errors The error messages
52
+ #
53
+ def output_resource_op_status(resource, status = :success, errors = nil)
54
+ status_label = case status
55
+ when :success then 'done'.colorize(color: :green)
56
+ when :error then 'error'.colorize(color: :red)
57
+ when :skipped then 'skipped'.colorize(color: :magenta)
58
+ when :same then 'same'.colorize(color: :magenta)
59
+ when :not_translated then 'not translated (itself or parent)'.colorize(color: :yellow)
60
+ end
61
+
62
+ spaces = '.' * (80 - self.resource_message(resource).size)
63
+ self.log "#{spaces}[#{status_label}]\n"
64
+
65
+ if errors && status == :error
66
+ self.log "#{errors.colorize(color: :red)}\n"
67
+ end
68
+ end
69
+
70
+ # Return the message about the creation / update of a resource.
71
+ #
72
+ # @param [ Object ] resource The resource (Site, Page, ...etc).
73
+ #
74
+ # @return [ String ] The message
75
+ #
76
+ def resource_message(resource)
77
+ op_label = resource.persisted? ? 'updating': 'creating'
78
+ " #{op_label} #{truncate(resource.to_s)}"
79
+ end
80
+
81
+ # Log a message to the console or the logger depending on the options
82
+ # of the runner. Info is the log level if case the logger has been chosen.
83
+ #
84
+ # @param [ String ] message The message to log.
85
+ #
86
+ def log(message)
87
+ # puts "buffer ? #{@@buffer_enabled.inspect}"
88
+ if @@buffer_enabled
89
+ @@buffer_log << message
90
+ else
91
+ if self.runner.parameters[:console]
92
+ print message
93
+ else
94
+ Mounter.logger.info message #.gsub(/\n$/, '')
95
+ end
96
+ end
97
+ end
98
+
99
+ # Put in a buffer the logs generated when executing the block.
100
+ # It means that they will not output unless the flush_log_buffer
101
+ # method is called.
102
+ #
103
+ # @return [ Object ] Thee value returned by the call of the block
104
+ #
105
+ def buffer_log(&block)
106
+ @@buffer_log = ''
107
+ @@buffer_enabled = true
108
+ if block_given?
109
+ block.call.tap { @@buffer_enabled = false }
110
+ end
111
+ end
112
+
113
+ # Flush the logs put in a buffer.
114
+ #
115
+ def flush_log_buffer
116
+ @@buffer_enabled = false
117
+ self.log(@@buffer_log)
118
+ @@buffer_log = ''
119
+ end
120
+
121
+ end
122
+ end
123
+ end
124
+ end
@@ -2,7 +2,7 @@
2
2
  module Locomotive
3
3
  module Mounter #:nodoc
4
4
 
5
- VERSION = '1.2.0'
5
+ VERSION = '1.2.1'
6
6
 
7
7
  end
8
8
  end
@@ -5,8 +5,10 @@ module Locomotive
5
5
 
6
6
  class Base
7
7
 
8
- @@buffer_enabled = false
9
- @@buffer_log = ''
8
+ # @@buffer_enabled = false
9
+ # @@buffer_log = ''
10
+
11
+ include Locomotive::Mounter::Utils::Output
10
12
 
11
13
  attr_accessor :mounting_point, :runner
12
14
 
@@ -188,14 +190,14 @@ module Locomotive
188
190
  end
189
191
 
190
192
  protected
191
-
192
- def truncate(string, length = 50, separator = '[...]')
193
- if string.length > length
194
- string[0..(length - separator.length)] + separator
195
- else
196
- string
197
- end
198
- end
193
+
194
+ # def truncate(string, length = 50, separator = '[...]')
195
+ # if string.length > length
196
+ # string[0..(length - separator.length)] + separator
197
+ # else
198
+ # string
199
+ # end
200
+ # end
199
201
 
200
202
  def response_to_status(response)
201
203
  response ? :success : :error
@@ -220,101 +222,101 @@ module Locomotive
220
222
  end
221
223
  end
222
224
 
223
- # Print the the title for each kind of resource.
224
- #
225
- def output_title
226
- msg = "* Pushing #{self.class.name.gsub(/Writer$/, '').demodulize}"
227
- self.log msg.colorize(background: :white, color: :black) + "\n"
228
- end
229
-
230
- # Print the current locale.
231
- #
232
- def output_locale
233
- locale = Locomotive::Mounter.locale.to_s
234
- self.log " #{locale.colorize(background: :blue, color: :white)}\n"
235
- end
236
-
237
- # Print the message about the creation / update of a resource.
238
- #
239
- # @param [ Object ] resource The resource (Site, Page, ...etc).
240
- #
241
- def output_resource_op(resource)
242
- self.log self.resource_message(resource)
243
- end
244
-
245
- # Print the message about the creation / update of a resource.
246
- #
247
- # @param [ Object ] resource The resource (Site, Page, ...etc).
248
- # @param [ Symbol ] status :success, :error, :skipped
249
- # @param [ String ] errors The error messages
250
- #
251
- def output_resource_op_status(resource, status = :success, errors = nil)
252
- status_label = case status
253
- when :success then 'done'.colorize(color: :green)
254
- when :error then 'error'.colorize(color: :red)
255
- when :skipped then 'skipped'.colorize(color: :magenta)
256
- when :same then 'same'.colorize(color: :magenta)
257
- when :not_translated then 'not translated (itself or parent)'.colorize(color: :yellow)
258
- end
259
-
260
- spaces = '.' * (80 - self.resource_message(resource).size)
261
- self.log "#{spaces}[#{status_label}]\n"
262
-
263
- if errors && status == :error
264
- self.log "#{errors.colorize(color: :red)}\n"
265
- end
266
- end
267
-
268
- # Return the message about the creation / update of a resource.
269
- #
270
- # @param [ Object ] resource The resource (Site, Page, ...etc).
271
- #
272
- # @return [ String ] The message
273
- #
274
- def resource_message(resource)
275
- op_label = resource.persisted? ? 'updating': 'creating'
276
- " #{op_label} #{truncate(resource.to_s)}"
277
- end
278
-
279
- # Log a message to the console or the logger depending on the options
280
- # of the runner. Info is the log level if case the logger has been chosen.
281
- #
282
- # @param [ String ] message The message to log.
283
- #
284
- def log(message)
285
- # puts "buffer ? #{@@buffer_enabled.inspect}"
286
- if @@buffer_enabled
287
- @@buffer_log << message
288
- else
289
- if self.runner.parameters[:console]
290
- print message
291
- else
292
- Mounter.logger.info message #.gsub(/\n$/, '')
293
- end
294
- end
295
- end
296
-
297
- # Put in a buffer the logs generated when executing the block.
298
- # It means that they will not output unless the flush_log_buffer
299
- # method is called.
300
- #
301
- # @return [ Object ] Thee value returned by the call of the block
302
- #
303
- def buffer_log(&block)
304
- @@buffer_log = ''
305
- @@buffer_enabled = true
306
- if block_given?
307
- block.call.tap { @@buffer_enabled = false }
308
- end
309
- end
310
-
311
- # Flush the logs put in a buffer.
312
- #
313
- def flush_log_buffer
314
- @@buffer_enabled = false
315
- self.log(@@buffer_log)
316
- @@buffer_log = ''
317
- end
225
+ # # Print the the title for each kind of resource.
226
+ # #
227
+ # def output_title
228
+ # msg = "* Pushing #{self.class.name.gsub(/Writer$/, '').demodulize}"
229
+ # self.log msg.colorize(background: :white, color: :black) + "\n"
230
+ # end
231
+
232
+ # # Print the current locale.
233
+ # #
234
+ # def output_locale
235
+ # locale = Locomotive::Mounter.locale.to_s
236
+ # self.log " #{locale.colorize(background: :blue, color: :white)}\n"
237
+ # end
238
+
239
+ # # Print the message about the creation / update of a resource.
240
+ # #
241
+ # # @param [ Object ] resource The resource (Site, Page, ...etc).
242
+ # #
243
+ # def output_resource_op(resource)
244
+ # self.log self.resource_message(resource)
245
+ # end
246
+
247
+ # # Print the message about the creation / update of a resource.
248
+ # #
249
+ # # @param [ Object ] resource The resource (Site, Page, ...etc).
250
+ # # @param [ Symbol ] status :success, :error, :skipped
251
+ # # @param [ String ] errors The error messages
252
+ # #
253
+ # def output_resource_op_status(resource, status = :success, errors = nil)
254
+ # status_label = case status
255
+ # when :success then 'done'.colorize(color: :green)
256
+ # when :error then 'error'.colorize(color: :red)
257
+ # when :skipped then 'skipped'.colorize(color: :magenta)
258
+ # when :same then 'same'.colorize(color: :magenta)
259
+ # when :not_translated then 'not translated (itself or parent)'.colorize(color: :yellow)
260
+ # end
261
+
262
+ # spaces = '.' * (80 - self.resource_message(resource).size)
263
+ # self.log "#{spaces}[#{status_label}]\n"
264
+
265
+ # if errors && status == :error
266
+ # self.log "#{errors.colorize(color: :red)}\n"
267
+ # end
268
+ # end
269
+
270
+ # # Return the message about the creation / update of a resource.
271
+ # #
272
+ # # @param [ Object ] resource The resource (Site, Page, ...etc).
273
+ # #
274
+ # # @return [ String ] The message
275
+ # #
276
+ # def resource_message(resource)
277
+ # op_label = resource.persisted? ? 'updating': 'creating'
278
+ # " #{op_label} #{truncate(resource.to_s)}"
279
+ # end
280
+
281
+ # # Log a message to the console or the logger depending on the options
282
+ # # of the runner. Info is the log level if case the logger has been chosen.
283
+ # #
284
+ # # @param [ String ] message The message to log.
285
+ # #
286
+ # def log(message)
287
+ # # puts "buffer ? #{@@buffer_enabled.inspect}"
288
+ # if @@buffer_enabled
289
+ # @@buffer_log << message
290
+ # else
291
+ # if self.runner.parameters[:console]
292
+ # print message
293
+ # else
294
+ # Mounter.logger.info message #.gsub(/\n$/, '')
295
+ # end
296
+ # end
297
+ # end
298
+
299
+ # # Put in a buffer the logs generated when executing the block.
300
+ # # It means that they will not output unless the flush_log_buffer
301
+ # # method is called.
302
+ # #
303
+ # # @return [ Object ] Thee value returned by the call of the block
304
+ # #
305
+ # def buffer_log(&block)
306
+ # @@buffer_log = ''
307
+ # @@buffer_enabled = true
308
+ # if block_given?
309
+ # block.call.tap { @@buffer_enabled = false }
310
+ # end
311
+ # end
312
+
313
+ # # Flush the logs put in a buffer.
314
+ # #
315
+ # def flush_log_buffer
316
+ # @@buffer_enabled = false
317
+ # self.log(@@buffer_log)
318
+ # @@buffer_log = ''
319
+ # end
318
320
 
319
321
  end
320
322
 
@@ -5,6 +5,8 @@ module Locomotive
5
5
 
6
6
  class Base
7
7
 
8
+ include Locomotive::Mounter::Utils::Output
9
+
8
10
  attr_accessor :mounting_point, :runner
9
11
 
10
12
  def initialize(mounting_point, runner)
@@ -16,6 +18,7 @@ module Locomotive
16
18
  # Writers inheriting from this class can overide it
17
19
  #
18
20
  def prepare
21
+ self.output_title(:writing)
19
22
  end
20
23
 
21
24
  # Writers inheriting from this class *must* overide it
@@ -53,6 +56,12 @@ module Locomotive
53
56
  self.runner.target_path
54
57
  end
55
58
 
59
+ protected
60
+
61
+ def resource_message(resource)
62
+ " writing #{truncate(resource.to_s)}"
63
+ end
64
+
56
65
  end
57
66
 
58
67
  end
@@ -7,15 +7,20 @@ module Locomotive
7
7
 
8
8
  # It creates the content assets folder
9
9
  def prepare
10
+ super
10
11
  self.create_folder 'public'
11
12
  end
12
13
 
13
14
  # It writes all the content assets into files
14
15
  def write
15
16
  self.mounting_point.content_assets.each do |_, asset|
17
+ self.output_resource_op asset
18
+
16
19
  self.open_file(self.target_asset_path(asset), 'wb') do |file|
17
20
  file.write(asset.content)
18
21
  end
22
+
23
+ self.output_resource_op_status asset
19
24
  end
20
25
  end
21
26
 
@@ -7,17 +7,22 @@ module Locomotive
7
7
 
8
8
  # It creates the data folder
9
9
  def prepare
10
+ super
10
11
  self.create_folder 'data'
11
12
  end
12
13
 
13
14
  # It writes all the content types into files
14
15
  def write
15
16
  self.mounting_point.content_types.each do |filename, content_type|
17
+ self.output_resource_op content_type
18
+
16
19
  entries = (content_type.entries || []).map(&:to_hash)
17
20
 
18
21
  self.open_file("data/#{filename}.yml") do |file|
19
22
  file.write(entries.to_yaml)
20
23
  end
24
+
25
+ self.output_resource_op_status content_type
21
26
  end
22
27
  end
23
28
 
@@ -7,15 +7,20 @@ module Locomotive
7
7
 
8
8
  # It creates the content types folder
9
9
  def prepare
10
+ super
10
11
  self.create_folder 'app/content_types'
11
12
  end
12
13
 
13
14
  # It writes all the content types into files
14
15
  def write
15
16
  self.mounting_point.content_types.each do |filename, content_type|
17
+ self.output_resource_op content_type
18
+
16
19
  self.open_file("app/content_types/#{filename}.yml") do |file|
17
20
  file.write(content_type.to_yaml)
18
21
  end
22
+
23
+ self.output_resource_op_status content_type
19
24
  end
20
25
  end
21
26
 
@@ -7,6 +7,7 @@ module Locomotive
7
7
 
8
8
  # It creates the pages folder
9
9
  def prepare
10
+ super
10
11
  self.create_folder 'app/views/pages'
11
12
  end
12
13
 
@@ -26,6 +27,8 @@ module Locomotive
26
27
  # @param [ String ] path The parent path
27
28
  #
28
29
  def write_page(page, path = '')
30
+ self.output_resource_op page
31
+
29
32
  # Note: we assume the current locale is the default one
30
33
  page.translated_in.each do |locale|
31
34
  default_locale = locale.to_sym == self.mounting_point.default_locale.to_sym
@@ -39,6 +42,8 @@ module Locomotive
39
42
  end
40
43
  end
41
44
 
45
+ self.output_resource_op_status page
46
+
42
47
  # also write the nested pages
43
48
  (page.children || []).each do |child|
44
49
  self.write_page(child, page.depth == 0 ? '' : page.slug)
@@ -7,13 +7,18 @@ module Locomotive
7
7
 
8
8
  # It creates the config folder
9
9
  def prepare
10
+ super
10
11
  self.create_folder 'config'
11
12
  end
12
13
 
13
14
  # It fills the config/site.yml file
14
15
  def write
15
16
  self.open_file('config/site.yml') do |file|
17
+ self.output_resource_op self.mounting_point.site
18
+
16
19
  file.write(self.mounting_point.site.to_yaml)
20
+
21
+ self.output_resource_op_status self.mounting_point.site
17
22
  end
18
23
  end
19
24
 
@@ -7,12 +7,15 @@ module Locomotive
7
7
 
8
8
  # It creates the snippets folder
9
9
  def prepare
10
+ super
10
11
  self.create_folder 'app/views/snippets'
11
12
  end
12
13
 
13
14
  # It writes all the snippets into files
14
15
  def write
15
16
  self.mounting_point.snippets.each do |filepath, snippet|
17
+ self.output_resource_op snippet
18
+
16
19
  # Note: we assume the current locale is the default one
17
20
  snippet.translated_in.each do |locale|
18
21
  default_locale = locale.to_sym == self.mounting_point.default_locale.to_sym
@@ -21,6 +24,8 @@ module Locomotive
21
24
  self.write_snippet_to_fs(snippet, filepath, default_locale ? nil : locale)
22
25
  end
23
26
  end
27
+
28
+ self.output_resource_op_status snippet
24
29
  end
25
30
  end
26
31
 
@@ -8,6 +8,7 @@ module Locomotive
8
8
  # Create the theme assets folders
9
9
  #
10
10
  def prepare
11
+ super
11
12
  self.create_folder 'public'
12
13
  end
13
14
 
@@ -15,6 +16,8 @@ module Locomotive
15
16
  #
16
17
  def write
17
18
  self.theme_assets_by_priority.each do |asset|
19
+ self.output_resource_op asset
20
+
18
21
  self.open_file(self.target_asset_path(asset), 'wb') do |file|
19
22
  content = asset.content
20
23
 
@@ -24,6 +27,8 @@ module Locomotive
24
27
 
25
28
  file.write(content)
26
29
  end
30
+
31
+ self.output_resource_op_status asset
27
32
  end
28
33
  end
29
34
 
@@ -6,6 +6,7 @@ module Locomotive
6
6
  class TranslationsWriter < Base
7
7
 
8
8
  def prepare
9
+ super
9
10
  self.create_folder 'config'
10
11
  end
11
12
 
@@ -19,6 +19,13 @@ require 'compass'
19
19
  require 'httmultiparty'
20
20
  require 'mime/types'
21
21
 
22
+ # Utils
23
+ require 'locomotive/mounter/utils/hash'
24
+ require 'locomotive/mounter/utils/yaml'
25
+ require 'locomotive/mounter/utils/string'
26
+ require 'locomotive/mounter/utils/output'
27
+
28
+ # Main
22
29
  require 'locomotive/mounter/version'
23
30
  require 'locomotive/mounter/exceptions'
24
31
  require 'locomotive/mounter/config'
@@ -34,11 +41,6 @@ require 'locomotive/mounter/extensions/tilt/css'
34
41
  require 'locomotive/mounter/extensions/tilt/haml'
35
42
  require 'locomotive/mounter/extensions/tilt/liquid'
36
43
 
37
- # Utils
38
- require 'locomotive/mounter/utils/hash'
39
- require 'locomotive/mounter/utils/yaml'
40
- require 'locomotive/mounter/utils/string'
41
-
42
44
  # Models
43
45
  require 'locomotive/mounter/models/base'
44
46
  Dir[File.join(File.dirname(__FILE__), 'mounter/models', '*.rb')].each { |lib| require lib }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locomotivecms_mounter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-07 00:00:00.000000000 Z
12
+ date: 2013-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: tilt
@@ -194,7 +194,7 @@ dependencies:
194
194
  requirements:
195
195
  - - '='
196
196
  - !ruby/object:Gem::Version
197
- version: 0.3.8
197
+ version: 0.3.10
198
198
  type: :runtime
199
199
  prerelease: false
200
200
  version_requirements: !ruby/object:Gem::Requirement
@@ -202,7 +202,7 @@ dependencies:
202
202
  requirements:
203
203
  - - '='
204
204
  - !ruby/object:Gem::Version
205
- version: 0.3.8
205
+ version: 0.3.10
206
206
  - !ruby/object:Gem::Dependency
207
207
  name: json
208
208
  requirement: !ruby/object:Gem::Requirement
@@ -464,6 +464,7 @@ files:
464
464
  - lib/locomotive/mounter/reader/file_system.rb
465
465
  - lib/locomotive/mounter/reader/runner.rb
466
466
  - lib/locomotive/mounter/utils/hash.rb
467
+ - lib/locomotive/mounter/utils/output.rb
467
468
  - lib/locomotive/mounter/utils/string.rb
468
469
  - lib/locomotive/mounter/utils/yaml.rb
469
470
  - lib/locomotive/mounter/version.rb
@@ -503,7 +504,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
503
504
  version: '0'
504
505
  segments:
505
506
  - 0
506
- hash: 2524146150368987271
507
+ hash: -2843107645801968148
507
508
  required_rubygems_version: !ruby/object:Gem::Requirement
508
509
  none: false
509
510
  requirements: