fix an issue when pulling assets + deploy the content of editable elements if the -d option is passed + do not display the deploy spinning wheel until Wagon is done asking for additionnal information
did
committed Dec 03, 2015
commit 75e02986e192d200d061042b633ee78dc7935dd4
Showing 6
changed files with
30 additions
and 17 deletions
Gemfile
+2
-2
| @@ | @@ -8,13 +8,13 @@ gem 'rb-fsevent', '~> 0.9.1' |
| gem 'therubyracer' | |
| # Development | |
| - | gem 'locomotivecms_steam', github: 'locomotivecms/steam', ref: '0aa777b', require: false |
| + | # gem 'locomotivecms_steam', github: 'locomotivecms/steam', ref: '0aa777b', require: false |
| # gem 'locomotivecms_coal', github: 'locomotivecms/coal', ref: '32b2844', require: false | |
| # gem 'locomotivecms_common', github: 'locomotivecms/common', ref: '3046b79893', require: false | |
| # Local development | |
| # gem 'locomotivecms_coal', path: '../gems/coal', require: false | |
| - | # gem 'locomotivecms_steam', path: '../gems/steam', require: false |
| + | gem 'locomotivecms_steam', path: '../gems/steam', require: false |
| # gem 'locomotivecms_common', path: '../in_progress/common', require: false | |
| group :development, :test do | |
locomotive/wagon/commands/pull_sub_commands/concerns/assets_concern.rb b/lib/locomotive/wagon/commands/pull_sub_commands/concerns/assets_concern.rb
+1
-1
| @@ | @@ -42,7 +42,7 @@ module Locomotive::Wagon |
| folder, ext = File.dirname(filepath), File.extname(filepath) | |
| basename = File.basename(filepath, ext) | |
| - | find_unique_filepath(File.join(folder, "#{basename}-#{index}#{ext}"), binary, index + 1) |
| + | find_unique_filepath(File.join(folder, "#{basename}-#{index}#{ext}"), binary_file, index + 1) |
| else | |
| filepath | |
| end | |
locomotive/wagon/commands/push_command.rb b/lib/locomotive/wagon/commands/push_command.rb
+10
-8
| @@ | @@ -31,27 +31,29 @@ module Locomotive::Wagon |
| end | |
| def push | |
| + | require_misc_gems |
| + | |
| + | api_client = build_api_site_client(connection_information) |
| + | |
| if options[:verbose] | |
| PushLogger.new | |
| - | _push |
| + | _push(api_client) |
| else | |
| - | show_wait_spinner('Deploying...') { _push } |
| + | show_wait_spinner('Deploying...') { _push(api_client) } |
| end | |
| end | |
| private | |
| - | def _push |
| - | require_misc_gems |
| - | |
| - | api_client = build_api_site_client(connection_information) |
| - | |
| + | def _push(api_client) |
| validate! | |
| content_assets_pusher = Locomotive::Wagon::PushContentAssetsCommand.new(api_client, steam_services) | |
| each_resource do |klass| | |
| - | klass.push(api_client, steam_services, content_assets_pusher, remote_site) |
| + | klass.push(api_client, steam_services, content_assets_pusher, remote_site) do |pusher| |
| + | pusher.with_data if options[:data] |
| + | end |
| end | |
| print_result_message | |
locomotive/wagon/commands/push_sub_commands/push_base_command.rb b/lib/locomotive/wagon/commands/push_sub_commands/push_base_command.rb
+11
-1
| @@ | @@ -7,7 +7,9 @@ module Locomotive::Wagon |
| def_delegators :steam_services, :current_site, :locale, :repositories | |
| def self.push(api_client, steam_services, content_assets_pusher, remote_site) | |
| - | new(api_client, steam_services, content_assets_pusher, remote_site).push |
| + | instance = new(api_client, steam_services, content_assets_pusher, remote_site) |
| + | yield instance if block_given? |
| + | instance.push |
| end | |
| def push | |
| @@ | @@ -61,6 +63,14 @@ module Locomotive::Wagon |
| File.expand_path(repositories.adapter.options[:path]) | |
| end | |
| + | def with_data |
| + | @with_data = true |
| + | end |
| + | |
| + | def with_data? |
| + | !!@with_data |
| + | end |
| + | |
| class SkipPersistingException < Exception | |
| end | |
locomotive/wagon/commands/push_sub_commands/push_pages_command.rb b/lib/locomotive/wagon/commands/push_sub_commands/push_pages_command.rb
+2
-1
| @@ | @@ -39,7 +39,8 @@ module Locomotive::Wagon |
| private | |
| def _decorate(entity) | |
| - | PageDecorator.new(entity, default_locale, content_assets_pusher, remote_site.edited?) |
| + | persist_content = with_data? || !remote_site.edited? |
| + | PageDecorator.new(entity, default_locale, content_assets_pusher, persist_content) |
| end | |
| def remote_entity_id(fullpath) | |
locomotive/wagon/decorators/page_decorator.rb b/lib/locomotive/wagon/decorators/page_decorator.rb
+4
-4
| @@ | @@ -6,11 +6,11 @@ module Locomotive |
| include ToHashConcern | |
| include PersistAssetsConcern | |
| - | attr_accessor :__content_assets_pusher__, :__site_edited__ |
| + | attr_accessor :__content_assets_pusher__, :__persist_content__ |
| - | def initialize(object, locale = nil, content_assets_pusher, site_edited) |
| + | def initialize(object, locale = nil, content_assets_pusher, persist_content) |
| self.__content_assets_pusher__ = content_assets_pusher | |
| - | self.__site_edited__ = site_edited |
| + | self.__persist_content__ = persist_content |
| super(object, locale, nil) | |
| end | |
| @@ | @@ -26,7 +26,7 @@ module Locomotive |
| template) | |
| # remove the attributes that end-users might have modified in the back-office | |
| - | if persisted? && __site_edited__ |
| + | if persisted? && !__persist_content__ |
| _attributes -= %i(title published listed position seo_title meta_keywords meta_description editable_elements) | |
| end | |