Class: Contentful::Bootstrap::Commands::CreateSpace
- Defined in:
- lib/contentful/bootstrap/commands/create_space.rb
Instance Attribute Summary collapse
-
#json_template ⇒ Object
readonly
Returns the value of attribute json_template.
-
#template_name ⇒ Object
readonly
Returns the value of attribute template_name.
Attributes inherited from Base
#no_input, #options, #quiet, #space, #token
Instance Method Summary collapse
-
#initialize(token, space, options = {}) ⇒ CreateSpace
constructor
A new instance of CreateSpace.
- #run ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(token, space, options = {}) ⇒ CreateSpace
Returns a new instance of CreateSpace.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/contentful/bootstrap/commands/create_space.rb', line 12 def initialize(token, space, = {}) @template_name = .fetch(:template, nil) @json_template = .fetch(:json_template, nil) @mark_processed = .fetch(:mark_processed, false) @locale = .fetch(:locale, 'en-US') @no_publish = .fetch(:no_publish, false) @environment = 'master' # Can only add content to a new space through the master environment by default super(token, space, ) end |
Instance Attribute Details
#json_template ⇒ Object (readonly)
Returns the value of attribute json_template.
11 12 13 |
# File 'lib/contentful/bootstrap/commands/create_space.rb', line 11 def json_template @json_template end |
#template_name ⇒ Object (readonly)
Returns the value of attribute template_name.
11 12 13 |
# File 'lib/contentful/bootstrap/commands/create_space.rb', line 11 def template_name @template_name end |
Instance Method Details
#run ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/contentful/bootstrap/commands/create_space.rb', line 23 def run output "Creating Space '#{@space}'" new_space = fetch_space output "Space '#{@space}' created!" output create_template(new_space) unless @template_name.nil? create_json_template(new_space) unless @json_template.nil? access_token = generate_token(new_space) output output "Space ID: '#{new_space.id}'" output "Access Token: '#{access_token}'" output output 'You can now insert those values into your configuration blocks' output "Manage your content at https://app.contentful.com/spaces/#{new_space.id}" new_space end |