class Contentful::Bootstrap::Commands::UpdateSpace
Attributes
json_template[R]
Public Class Methods
new(token, space_id, options = {})
click to toggle source
Calls superclass method
Contentful::Bootstrap::Commands::Base::new
# File lib/contentful/bootstrap/commands/update_space.rb, line 11 def initialize(token, space_id, options = {}) @json_template = options.fetch(:json_template, nil) @mark_processed = options.fetch(:mark_processed, false) @skip_content_types = options.fetch(:skip_content_types, false) @no_publish = options.fetch(:no_publish, false) @quiet = options.fetch(:quiet, false) @environment = options.fetch(:environment, 'master') super(token, space_id, options) end
Public Instance Methods
run()
click to toggle source
# File lib/contentful/bootstrap/commands/update_space.rb, line 22 def run if @json_template.nil? output 'JSON Template not found. Exiting!' exit(1) end output "Updating Space '#{@space}'" update_space = fetch_space update_json_template(update_space) output output "Successfully updated Space #{@space}" update_space end
Protected Instance Methods
fetch_space()
click to toggle source
# File lib/contentful/bootstrap/commands/update_space.rb, line 42 def fetch_space client.spaces.find(@space) rescue Contentful::Management::NotFound output 'Space Not Found. Exiting!' exit(1) end
Private Instance Methods
update_json_template(space)
click to toggle source
# File lib/contentful/bootstrap/commands/update_space.rb, line 51 def update_json_template(space) if ::File.exist?(@json_template) output "Updating from JSON Template '#{@json_template}'" Templates::JsonTemplate.new(space, @json_template, @environment, @mark_processed, true, @quiet, @skip_content_types, @no_publish).run output "JSON Template '#{@json_template}' updated!" else output "JSON Template '#{@json_template}' does not exist. Please check that you specified the correct file name." exit(1) end end