Class: Contentful::Bootstrap::Commands::UpdateSpace

Inherits:
Base
  • Object
show all
Defined in:
lib/contentful/bootstrap/commands/update_space.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#no_input, #options, #quiet, #space, #token

Instance Method Summary collapse

Methods inherited from Base

#client

Constructor Details

#initialize(token, space_id, options = {}) ⇒ UpdateSpace

Returns a new instance of UpdateSpace.



11
12
13
14
15
16
17
18
19
20
# 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

Instance Attribute Details

#json_templateObject (readonly)

Returns the value of attribute json_template.



10
11
12
# File 'lib/contentful/bootstrap/commands/update_space.rb', line 10

def json_template
  @json_template
end

Instance Method Details

#runObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 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