Class: Contentful::Bootstrap::Templates::Base
- Inherits:
-
Object
- Object
- Contentful::Bootstrap::Templates::Base
show all
- Defined in:
- lib/contentful/bootstrap/templates/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(space, environment_id = 'master', quiet = false, skip_content_types = false, no_publish = false) ⇒ Base
Returns a new instance of Base.
11
12
13
14
15
16
|
# File 'lib/contentful/bootstrap/templates/base.rb', line 11
def initialize(space, environment_id = 'master', quiet = false, skip_content_types = false, no_publish = false)
@environment = space.environments.find(environment_id)
@quiet = quiet
@skip_content_types = skip_content_types
@no_publish = no_publish
end
|
Instance Attribute Details
#environment ⇒ Object
Returns the value of attribute environment.
9
10
11
|
# File 'lib/contentful/bootstrap/templates/base.rb', line 9
def environment
@environment
end
|
#skip_content_types ⇒ Object
Returns the value of attribute skip_content_types.
9
10
11
|
# File 'lib/contentful/bootstrap/templates/base.rb', line 9
def skip_content_types
@skip_content_types
end
|
Instance Method Details
#after_run ⇒ Object
45
|
# File 'lib/contentful/bootstrap/templates/base.rb', line 45
def after_run; end
|
#assets ⇒ Object
41
42
43
|
# File 'lib/contentful/bootstrap/templates/base.rb', line 41
def assets
[]
end
|
#content_types ⇒ Object
33
34
35
|
# File 'lib/contentful/bootstrap/templates/base.rb', line 33
def content_types
[]
end
|
#entries ⇒ Object
37
38
39
|
# File 'lib/contentful/bootstrap/templates/base.rb', line 37
def entries
{}
end
|
#run ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/contentful/bootstrap/templates/base.rb', line 18
def run
create_content_types unless skip_content_types
create_assets
create_entries
after_run
rescue Contentful::Management::Error => e
error = e.error
output "Error at: #{error[:url]}"
output "Message: #{error[:message]}"
output "Details: #{error[:details]}"
raise e
end
|