tkh_authentication 0.0.3 → 0.0.4

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
@@ -2,6 +2,12 @@
2
2
 
3
3
 
4
4
 
5
+ ## 0.0.4
6
+
7
+ * Added an install rake task to run the migration and locale generators
8
+ * Refactored generators to give them more flexibility
9
+
10
+
5
11
  ## 0.0.3
6
12
 
7
13
  * Added an authenticate_as_admin controller method and its translations
data/README.md CHANGED
@@ -18,7 +18,7 @@ And then execute:
18
18
 
19
19
  Import migration and locale files
20
20
 
21
- $ rails g tkh_authentication:install
21
+ $ rake tkh_authentication:install
22
22
 
23
23
  Run the migration
24
24
 
@@ -32,7 +32,7 @@ And then of course restart your server!
32
32
 
33
33
  Upon upgrading to a new version of the gem you might have to update the translation files
34
34
 
35
- $ rails g tkh_authentication:update_locales -f
35
+ $ rails g tkh_authentication:create_or_update_locales -f
36
36
 
37
37
 
38
38
  ## Usage
@@ -2,7 +2,7 @@ require 'rails/generators/migration'
2
2
 
3
3
  module TkhAuthentication
4
4
  module Generators
5
- class InstallGenerator < ::Rails::Generators::Base
5
+ class CreateMigrationGenerator < ::Rails::Generators::Base
6
6
  include Rails::Generators::Migration
7
7
  source_root File.expand_path('../templates', __FILE__)
8
8
  desc "add the migrations and locale files"
@@ -17,14 +17,7 @@ module TkhAuthentication
17
17
 
18
18
  def copy_migrations
19
19
  puts 'creating user migration'
20
- migration_template "create_users.rb", "db/migrate/create_users.rb"
21
- end
22
-
23
- def copy_locales
24
- puts 'creating locale files'
25
- I18n.available_locales.each do |l|
26
- copy_file "locales/#{l.to_s}.yml", "config/locales/tkh_authentication.#{l.to_s}.yml"
27
- end
20
+ migration_template "create_users.rb", "db/migrate/create_users2.rb"
28
21
  end
29
22
 
30
23
  end
@@ -2,17 +2,15 @@ require 'rails/generators/migration'
2
2
 
3
3
  module TkhAuthentication
4
4
  module Generators
5
- class UpdateLocalesGenerator < ::Rails::Generators::Base
6
- # WARNING - sharing translations and using the ones from the install generator
5
+ class CreateOrUpdateLocalesGenerator < ::Rails::Generators::Base
7
6
  source_root File.expand_path('../templates', __FILE__)
8
-
7
+ desc "copying latest version of locale files"
9
8
  def copy_locales
10
9
  puts 'creating locale files'
11
10
  I18n.available_locales.each do |l|
12
- copy_file "locales/#{l.to_s}.yml", "config/locales/tkh_authentication.#{l.to_s}.yml"
11
+ copy_file "#{l.to_s}.yml", "config/locales/tkh_authentication.#{l.to_s}.yml"
13
12
  end
14
13
  end
15
-
16
14
  end
17
15
  end
18
16
  end
@@ -1,4 +1,10 @@
1
- # desc "Explaining what the task does"
2
- # task :tkh_authentication do
3
- # # Task goes here
4
- # end
1
+ namespace :tkh_authentication do
2
+ desc "Create migrations and locale files"
3
+ task :install do
4
+ system 'rails g tkh_authentication:create_migration'
5
+ system 'rails g tkh_authentication:create_or_update_locales'
6
+ end
7
+ end
8
+
9
+
10
+
@@ -1,3 +1,3 @@
1
1
  module TkhAuthentication
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tkh_authentication
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -112,12 +112,12 @@ files:
112
112
  - app/views/users/index.html.erb
113
113
  - app/views/users/new.html.erb
114
114
  - config/routes.rb
115
- - lib/generators/tkh_authentication/install/install_generator.rb
116
- - lib/generators/tkh_authentication/install/templates/create_users.rb
117
- - lib/generators/tkh_authentication/install/templates/locales/en.yml
118
- - lib/generators/tkh_authentication/install/templates/locales/es.yml
119
- - lib/generators/tkh_authentication/install/templates/locales/fr.yml
120
- - lib/generators/tkh_authentication/update_locales/update_locales_generator.rb
115
+ - lib/generators/tkh_authentication/create_migration/create_migration_generator.rb
116
+ - lib/generators/tkh_authentication/create_migration/templates/create_users.rb
117
+ - lib/generators/tkh_authentication/create_or_update_locales/create_or_update_locales_generator.rb
118
+ - lib/generators/tkh_authentication/create_or_update_locales/templates/en.yml
119
+ - lib/generators/tkh_authentication/create_or_update_locales/templates/es.yml
120
+ - lib/generators/tkh_authentication/create_or_update_locales/templates/fr.yml
121
121
  - lib/tasks/tkh_authentication_tasks.rake
122
122
  - lib/tkh_authentication/tkh_authentication_action_controller_extension.rb
123
123
  - lib/tkh_authentication/tkh_authentication_helper.rb
@@ -171,7 +171,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
171
171
  version: '0'
172
172
  segments:
173
173
  - 0
174
- hash: 1167145318761715890
174
+ hash: -4440211809923125949
175
175
  required_rubygems_version: !ruby/object:Gem::Requirement
176
176
  none: false
177
177
  requirements:
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  version: '0'
181
181
  segments:
182
182
  - 0
183
- hash: 1167145318761715890
183
+ hash: -4440211809923125949
184
184
  requirements: []
185
185
  rubyforge_project:
186
186
  rubygems_version: 1.8.23