Skip to content

Commit

Permalink
Merge branch 'release/20130912-release'
Browse files Browse the repository at this point in the history
* release/20130912-release:
  bump version to 3.1.1
  no message
  bugfix: image obj class creation failed on newly created projects
  • Loading branch information
Falk Köppe committed Sep 12, 2013
2 parents 515b6c9 + 108ed31 commit 5a34a35
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# v3.1.1
* Bugfix: Initial migration failed on newly created projects, because the `Image` obj class
already existed.
# v3.1.0
* Updated to Infopark SDK (infopark_rails_connector and infopark_cloud_connector) version 6.9.4.
* We changed the general way to create examples for certain generators. Before you could pass in
Expand Down
7 changes: 1 addition & 6 deletions lib/generators/cms/kickstart/kickstart_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,7 @@ def extend_gitignore
end

def create_structure_migration_file
Model::ApiGenerator.new(behavior: behavior) do |model|
model.name = 'Image'
model.type = :generic
model.title = 'Resource: Image'
model.thumbnail = false
end
migration_template('create_image.rb', 'cms/migrate/create_image.rb')

Model::ApiGenerator.new(behavior: behavior) do |model|
model.name = 'Video'
Expand Down
7 changes: 7 additions & 0 deletions lib/generators/cms/kickstart/templates/app/models/image.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class Image < Obj

# Most CMS objects are either a page or a box. In order for them to
# have common behavior, uncomment one of the following lines.
# include Page
# include Widget
end
23 changes: 23 additions & 0 deletions lib/generators/cms/kickstart/templates/create_image.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class CreateImage < ::RailsConnector::Migration
def up
unless obj_class_exists?('Image')
create_obj_class(
name: 'Image',
type: 'generic',
title: 'Resource: Image',
attributes: [
],
preset_attributes: {},
mandatory_attributes: []
)
end
end

private

def obj_class_exists?(name)
get_obj_class(name).present?
rescue ::RailsConnector::ClientError
false
end
end
2 changes: 1 addition & 1 deletion lib/infopark_kickstarter/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module InfoparkKickstarter
VERSION = '3.1.0'
VERSION = '3.1.1'
end
2 changes: 1 addition & 1 deletion tmp/test_app/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ../../../
specs:
infopark_kickstarter (3.1.0)
infopark_kickstarter (3.1.1)
bundler
infopark_cloud_connector (>= 6.9.4)
infopark_rails_connector (>= 6.9.4)
Expand Down
2 changes: 1 addition & 1 deletion tmp/test_app/app/models/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ class Image < Obj
# have common behavior, uncomment one of the following lines.
# include Page
# include Widget
end
end
3 changes: 0 additions & 3 deletions tmp/test_app/config/locales/en.obj_classes.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
en:
obj_classes:
image:
title: 'Resource: Image'
description: 'Resource: Image'
video:
title: 'Resource: Video'
description: 'Resource: Video'
Expand Down

0 comments on commit 5a34a35

Please sign in to comment.