tkh_illustrations 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # TKH Illustrations
2
2
 
3
3
 
4
+
5
+ ## 0.0.7
6
+
7
+ * Model translation of illustration name attribute with Globalize3
8
+ * Refactored migration generator and added a new update migration
9
+
10
+
4
11
  ## 0.0.6
5
12
 
6
13
  * Refactored migration and locale generators and created an install rake task. Now it's all much more consistent with other tkh gems
data/README.md CHANGED
@@ -42,8 +42,19 @@ And then of course restart your server!
42
42
  $ rails s
43
43
 
44
44
 
45
- ## Usage
45
+ ## Upgrading
46
+
47
+ If you are upgrading and think you might need to upgrade your migrations or your locale files, run again:
48
+
49
+ $ rake tkh_illustrations:install
46
50
 
51
+ and
52
+
53
+ $ rake db:migrate
54
+
55
+
56
+
57
+ ## Usage
47
58
 
48
59
  The section is located at:
49
60
 
@@ -1,9 +1,16 @@
1
+ # this is needed for now to make mass assignment security compatible with the translation of globalize3
2
+ Globalize::ActiveRecord::Translation.class_eval do
3
+ attr_accessible :locale
4
+ end
5
+
1
6
  class Illustration < ActiveRecord::Base
2
7
 
3
8
  attr_accessible :image, :name
4
9
 
5
10
  validates_presence_of :name
6
11
 
12
+ translates :name
13
+
7
14
  mount_uploader :image, ImageUploader
8
15
 
9
16
  def to_param
@@ -2,7 +2,7 @@ require 'rails/generators/migration'
2
2
 
3
3
  module TkhIllustrations
4
4
  module Generators
5
- class CreateMigrationGenerator < ::Rails::Generators::Base
5
+ class CreateOrUpdateMigrationsGenerator < ::Rails::Generators::Base
6
6
  include Rails::Generators::Migration
7
7
  source_root File.expand_path('../templates', __FILE__)
8
8
  desc "add the migration"
@@ -15,9 +15,11 @@ module TkhIllustrations
15
15
  @prev_migration_nr.to_s
16
16
  end
17
17
 
18
- def copy_migrations
19
- puts 'creating illustration migration'
18
+ def create_or_update_migrations
19
+ puts 'Creating the illustrations table'
20
20
  migration_template "create_illustrations.rb", "db/migrate/create_illustrations.rb"
21
+ puts 'Adding translation of name attribute for Globalize3'
22
+ migration_template "add_translation_of_name_to_illustrations.rb", "db/migrate/add_translation_of_name_to_illustrations.rb"
21
23
  end
22
24
 
23
25
  end
@@ -0,0 +1,13 @@
1
+ class AddTranslationOfNameToIllustrations < ActiveRecord::Migration
2
+ def self.up
3
+ Illustration.create_translation_table!({
4
+ name: :string
5
+ }, {
6
+ :migrate_data => true
7
+ })
8
+ end
9
+
10
+ def self.down
11
+ Illustration.drop_translation_table! :migrate_data => true
12
+ end
13
+ end
@@ -1,7 +1,9 @@
1
1
  namespace :tkh_illustrations do
2
+
2
3
  desc "Create migration and locale files"
3
4
  task :install do
4
- system 'rails g tkh_illustrations:create_migration'
5
- system 'rails g tkh_illustrations:create_or_update_locales'
5
+ system 'rails g tkh_illustrations:create_or_update_migrations -s'
6
+ system 'rails g tkh_illustrations:create_or_update_locales -f'
6
7
  end
8
+
7
9
  end
@@ -1,3 +1,3 @@
1
1
  module TkhIllustrations
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -2,6 +2,7 @@ require "tkh_illustrations/version"
2
2
  require 'carrierwave'
3
3
  require 'RMagick'
4
4
  require 'stringex'
5
+ require 'globalize3'
5
6
 
6
7
  module TkhIllustrations
7
8
  class Engine < ::Rails::Engine
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tkh_illustrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-01 00:00:00.000000000 Z
12
+ date: 2012-08-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -44,23 +44,23 @@ dependencies:
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0.6'
46
46
  - !ruby/object:Gem::Dependency
47
- name: tkh_admin_panel
47
+ name: rmagick
48
48
  requirement: !ruby/object:Gem::Requirement
49
49
  none: false
50
50
  requirements:
51
- - - ~>
51
+ - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
- version: '0.0'
53
+ version: '0'
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
59
- - - ~>
59
+ - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
- version: '0.0'
61
+ version: '0'
62
62
  - !ruby/object:Gem::Dependency
63
- name: rmagick
63
+ name: stringex
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
@@ -76,21 +76,21 @@ dependencies:
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  - !ruby/object:Gem::Dependency
79
- name: stringex
79
+ name: globalize3
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
- - - ! '>='
83
+ - - ~>
84
84
  - !ruby/object:Gem::Version
85
- version: '0'
85
+ version: '0.2'
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
89
89
  none: false
90
90
  requirements:
91
- - - ! '>='
91
+ - - ~>
92
92
  - !ruby/object:Gem::Version
93
- version: '0'
93
+ version: '0.2'
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: sqlite3
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -123,12 +123,13 @@ files:
123
123
  - app/views/illustrations/new.html.erb
124
124
  - app/views/illustrations/show.html.erb
125
125
  - config/routes.rb
126
- - lib/generators/tkh_illustrations/create_migration/create_migration_generator.rb
127
- - lib/generators/tkh_illustrations/create_migration/templates/create_illustrations.rb
128
126
  - lib/generators/tkh_illustrations/create_or_update_locales/create_or_update_locales_generator.rb
129
127
  - lib/generators/tkh_illustrations/create_or_update_locales/templates/en.yml
130
128
  - lib/generators/tkh_illustrations/create_or_update_locales/templates/es.yml
131
129
  - lib/generators/tkh_illustrations/create_or_update_locales/templates/fr.yml
130
+ - lib/generators/tkh_illustrations/create_or_update_migrations/create_or_update_migrations_generator.rb
131
+ - lib/generators/tkh_illustrations/create_or_update_migrations/templates/add_translation_of_name_to_illustrations.rb
132
+ - lib/generators/tkh_illustrations/create_or_update_migrations/templates/create_illustrations.rb
132
133
  - lib/tasks/tkh_illustrations_tasks.rake
133
134
  - lib/tkh_illustrations/version.rb
134
135
  - lib/tkh_illustrations.rb
@@ -180,7 +181,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
180
181
  version: '0'
181
182
  segments:
182
183
  - 0
183
- hash: -3432498490499045948
184
+ hash: -1376230274536530257
184
185
  required_rubygems_version: !ruby/object:Gem::Requirement
185
186
  none: false
186
187
  requirements:
@@ -189,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
190
  version: '0'
190
191
  segments:
191
192
  - 0
192
- hash: -3432498490499045948
193
+ hash: -1376230274536530257
193
194
  requirements: []
194
195
  rubyforge_project:
195
196
  rubygems_version: 1.8.23