tolk 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/stylesheets/tolk/screen.css +20 -26
- data/app/controllers/tolk/locales_controller.rb +1 -1
- data/app/helpers/tolk/application_helper.rb +1 -1
- data/app/models/tolk/locale.rb +23 -50
- data/app/views/layouts/tolk/application.html.erb +3 -4
- data/app/views/tolk/locales/all.html.erb +0 -3
- data/app/views/tolk/locales/index.html.erb +0 -3
- data/app/views/tolk/locales/show.html.erb +0 -4
- data/app/views/tolk/searches/_form.html.erb +1 -1
- data/app/views/tolk/searches/show.html.erb +0 -4
- data/lib/generators/tolk/install_generator.rb +44 -0
- data/lib/generators/tolk/templates/initializer.erb +12 -0
- data/lib/generators/{tolk_migration/templates/migrate/create_tolk_tables.rb → tolk/templates/migration.rb} +0 -0
- data/lib/generators/tolk/utils.rb +35 -0
- data/lib/tasks/tolk_tasks.rake +8 -1
- data/lib/tolk.rb +9 -0
- data/lib/tolk/config.rb +69 -0
- data/lib/tolk/import.rb +8 -2
- data/lib/tolk/version.rb +1 -1
- metadata +11 -5
- data/lib/generators/tolk_migration/tolk_migration_generator.rb +0 -19
@@ -69,23 +69,35 @@ div#head a {
|
|
69
69
|
text-decoration: none;
|
70
70
|
}
|
71
71
|
|
72
|
+
div#head span {
|
73
|
+
padding: 8px 6px;
|
74
|
+
margin-right: 1px;
|
75
|
+
}
|
76
|
+
|
72
77
|
div#head span.home {
|
78
|
+
background: #333;
|
79
|
+
}
|
80
|
+
|
81
|
+
div#head span.locale {
|
82
|
+
background: #444;
|
83
|
+
}
|
84
|
+
|
85
|
+
div#head span.locale a {
|
86
|
+
color: #fff;
|
87
|
+
}
|
88
|
+
|
89
|
+
div#head span:first-child {
|
90
|
+
padding-left: 12px;
|
73
91
|
-webkit-border-top-left-radius: 10px;
|
74
92
|
-webkit-border-bottom-left-radius: 10px;
|
75
93
|
-moz-border-radius-topleft: 10px;
|
76
94
|
-moz-border-radius-bottomleft: 10px;
|
77
95
|
border-top-left-radius: 10px;
|
78
96
|
border-bottom-left-radius: 10px;
|
79
|
-
background: #333;
|
80
|
-
padding: 8px 6px 8px 12px;
|
81
|
-
margin-right: 1px;
|
82
97
|
}
|
83
98
|
|
84
|
-
div#head span
|
85
|
-
|
86
|
-
font-weight: bold;
|
87
|
-
background: #444;
|
88
|
-
padding: 8px 12px 8px 6px;
|
99
|
+
div#head span:last-child {
|
100
|
+
padding-right: 12px;
|
89
101
|
-webkit-border-top-right-radius: 10px;
|
90
102
|
-webkit-border-bottom-right-radius: 10px;
|
91
103
|
-moz-border-radius-topright: 10px;
|
@@ -94,24 +106,6 @@ div#head span.locale {
|
|
94
106
|
border-bottom-right-radius: 10px;
|
95
107
|
}
|
96
108
|
|
97
|
-
div#head span.locale.empty {
|
98
|
-
background: #333;
|
99
|
-
padding-left: 0;
|
100
|
-
margin-left: -6px;
|
101
|
-
}
|
102
|
-
|
103
|
-
div#head span.locale em {
|
104
|
-
font-style: normal;
|
105
|
-
font-weight: normal;
|
106
|
-
}
|
107
|
-
|
108
|
-
div#head span.note {
|
109
|
-
color: #777;
|
110
|
-
font-size: 13px;
|
111
|
-
font-weight: normal;
|
112
|
-
margin-left: 10px;
|
113
|
-
}
|
114
|
-
|
115
109
|
h2,
|
116
110
|
h3 {
|
117
111
|
font-size: 18px;
|
@@ -21,7 +21,7 @@ module Tolk
|
|
21
21
|
def tolk_locale_selection
|
22
22
|
existing_locale_names = Tolk::Locale.all.map(&:name)
|
23
23
|
|
24
|
-
pairs = Tolk
|
24
|
+
pairs = Tolk.config.mapping.to_a.map(&:reverse).sort_by(&:first)
|
25
25
|
pairs.reject {|pair| existing_locale_names.include?(pair.last) }
|
26
26
|
end
|
27
27
|
|
data/app/models/tolk/locale.rb
CHANGED
@@ -1,55 +1,13 @@
|
|
1
|
+
require 'tolk/config'
|
2
|
+
|
1
3
|
module Tolk
|
2
4
|
class Locale < ActiveRecord::Base
|
3
5
|
self.table_name = "tolk_locales"
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
'ca' => 'Catalan',
|
10
|
-
'cz' => 'Czech',
|
11
|
-
'da' => 'Danish',
|
12
|
-
'de' => 'German',
|
13
|
-
'dsb' => 'Lower Sorbian',
|
14
|
-
'el' => 'Greek',
|
15
|
-
'en' => 'English',
|
16
|
-
'es' => 'Spanish',
|
17
|
-
'et' => 'Estonian',
|
18
|
-
'fa' => 'Persian',
|
19
|
-
'fi' => 'Finnish',
|
20
|
-
'fr' => 'French',
|
21
|
-
'he' => 'Hebrew',
|
22
|
-
'hr' => 'Croatian',
|
23
|
-
'hsb' => 'Upper Sorbian',
|
24
|
-
'hu' => 'Hungarian',
|
25
|
-
'id' => 'Indonesian',
|
26
|
-
'is' => 'Icelandic',
|
27
|
-
'it' => 'Italian',
|
28
|
-
'jp' => 'Japanese',
|
29
|
-
'ko' => 'Korean',
|
30
|
-
'lo' => 'Lao',
|
31
|
-
'lt' => 'Lithuanian',
|
32
|
-
'lv' => 'Latvian',
|
33
|
-
'mk' => 'Macedonian',
|
34
|
-
'nl' => 'Dutch',
|
35
|
-
'no' => 'Norwegian',
|
36
|
-
'pl' => 'Polish',
|
37
|
-
'pt-br' => 'Portuguese (Brazilian)',
|
38
|
-
'pt-PT' => 'Portuguese (Portugal)',
|
39
|
-
'ro' => 'Romanian',
|
40
|
-
'ru' => 'Russian',
|
41
|
-
'se' => 'Swedish',
|
42
|
-
'sk' => 'Slovak',
|
43
|
-
'sl' => 'Slovenian',
|
44
|
-
'sr' => 'Serbian',
|
45
|
-
'sw' => 'Swahili',
|
46
|
-
'th' => 'Thai',
|
47
|
-
'tr' => 'Turkish',
|
48
|
-
'uk' => 'Ukrainian',
|
49
|
-
'vi' => 'Vietnamese',
|
50
|
-
'zh-CN' => 'Chinese (Simplified)',
|
51
|
-
'zh-TW' => 'Chinese (Traditional)'
|
52
|
-
}
|
7
|
+
def self._dump_path
|
8
|
+
# Necessary to acces rails.root at runtime !
|
9
|
+
@dump_path ||= Tolk.config.dump_path.is_a?(Proc) ? instance_eval(&Tolk.config.dump_path) : Tolk.config.dump_path
|
10
|
+
end
|
53
11
|
|
54
12
|
has_many :phrases, :through => :translations, :class_name => 'Tolk::Phrase'
|
55
13
|
has_many :translations, :class_name => 'Tolk::Translation', :dependent => :destroy
|
@@ -59,7 +17,7 @@ module Tolk
|
|
59
17
|
|
60
18
|
attr_accessible :name
|
61
19
|
cattr_accessor :locales_config_path
|
62
|
-
self.locales_config_path =
|
20
|
+
self.locales_config_path = self._dump_path
|
63
21
|
|
64
22
|
cattr_accessor :primary_locale_name
|
65
23
|
self.primary_locale_name = I18n.default_locale.to_s
|
@@ -191,7 +149,7 @@ module Tolk
|
|
191
149
|
end
|
192
150
|
|
193
151
|
def language_name
|
194
|
-
|
152
|
+
Tolk.config.mapping[self.name] || self.name
|
195
153
|
end
|
196
154
|
|
197
155
|
def get(key)
|
@@ -208,8 +166,23 @@ module Tolk
|
|
208
166
|
translations
|
209
167
|
end
|
210
168
|
|
169
|
+
def self.rename(old_name, new_name)
|
170
|
+
if old_name.blank? || new_name.blank?
|
171
|
+
"You need to provide both names, aborting."
|
172
|
+
else
|
173
|
+
if locale = find_by_name(old_name)
|
174
|
+
locale.name = new_name
|
175
|
+
locale.save
|
176
|
+
"Locale ' #{old_name}' was renamed '#{new_name}'"
|
177
|
+
else
|
178
|
+
"Locale with name '#{old_name}' not found."
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
211
183
|
private
|
212
184
|
|
185
|
+
|
213
186
|
def remove_invalid_translations_from_target
|
214
187
|
self.translations.target.dup.each do |t|
|
215
188
|
unless t.valid?
|
@@ -1,6 +1,5 @@
|
|
1
|
-
<!DOCTYPE html
|
2
|
-
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<%= Tolk::Locale.primary_locale_name %>" lang="<%= Tolk::Locale.primary_locale_name %>">
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="<%= Tolk::Locale.primary_locale_name %>">
|
4
3
|
|
5
4
|
<head>
|
6
5
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
@@ -14,7 +13,7 @@
|
|
14
13
|
<body>
|
15
14
|
<div id="container">
|
16
15
|
<div id="head">
|
17
|
-
<h1><span class="home"><%= link_to "Tolk",
|
16
|
+
<h1><span class="home"><%= link_to "Tolk", root_path %></span><% if @locale.present? %><span class="locale"><%= link_to @locale.language_name, locale_path(@locale) %></span><% end %></h1>
|
18
17
|
</div>
|
19
18
|
<%= yield %>
|
20
19
|
</div>
|
@@ -1,6 +1,3 @@
|
|
1
|
-
<% content_for :locale do %><span class="locale"><%= @locale.language_name %></span>
|
2
|
-
<% end %>
|
3
|
-
|
4
1
|
<h3 class="switch">Completed translations <span>(<%= link_to 'See phrases missing translation', @locale %>)</span></h3>
|
5
2
|
|
6
3
|
<% if @locale.has_updated_translations? && action_name != 'updated' %>
|
@@ -1,7 +1,3 @@
|
|
1
|
-
<% content_for :locale do %>
|
2
|
-
<span class="locale"><%= @locale.language_name %></span>
|
3
|
-
<% end %>
|
4
|
-
|
5
1
|
<% content_for :head do %>
|
6
2
|
<link rel="alternate" type="application/rss+xml" title="RSS" href="<%= tolk.locale_path(@locale, :format => 'atom') -%>" />
|
7
3
|
<% end %>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require File.expand_path('../utils', __FILE__)
|
3
|
+
|
4
|
+
# http://guides.rubyonrails.org/generators.html
|
5
|
+
# http://rdoc.info/github/wycats/thor/master/Thor/Actions.html
|
6
|
+
# keep generator idempotent, thanks
|
7
|
+
# Thanks to https://github.com/sferik/rails_admin !
|
8
|
+
|
9
|
+
module Tolk
|
10
|
+
class InstallGenerator < Rails::Generators::Base
|
11
|
+
|
12
|
+
source_root File.expand_path("../templates", __FILE__)
|
13
|
+
include Rails::Generators::Migration
|
14
|
+
include Generators::Utils::InstanceMethods
|
15
|
+
extend Generators::Utils::ClassMethods
|
16
|
+
|
17
|
+
argument :_namespace, :type => :string, :required => false, :desc => "Tolk url namespace"
|
18
|
+
desc "Tolk installation generator"
|
19
|
+
def install
|
20
|
+
routes = File.open(Rails.root.join("config/routes.rb")).try :read
|
21
|
+
initializer = (File.open(Rails.root.join("config/initializers/tolk.rb")) rescue nil).try :read
|
22
|
+
|
23
|
+
display "Hello, Tolk installer will help you sets things up!", :black
|
24
|
+
unless initializer
|
25
|
+
install_generator = ask_boolean("Do you wan't to install the optional configuration file (to change mappings, locales dump location etc..) ?")
|
26
|
+
template "initializer.erb", "config/initializers/tolk.rb" if install_generator
|
27
|
+
else
|
28
|
+
display "You already have a config file. You're updating, heh? I'm generating a new 'tolk.rb.example' that you can review."
|
29
|
+
template "initializer.erb", "config/initializers/tolk.rb.example"
|
30
|
+
end
|
31
|
+
|
32
|
+
display "Adding a migration..."
|
33
|
+
migration_template 'migration.rb', 'db/migrate/create_tolk_tables.rb' rescue display $!.message
|
34
|
+
|
35
|
+
namespace = ask_for("Where do you want to mount tolk?", "tolk", _namespace)
|
36
|
+
gsub_file "config/routes.rb", /mount Tolk::Engine => \'\/.+\', :as => \'tolk\'/, ''
|
37
|
+
gsub_file "config/routes.rb", /mount Tolk::Engine => \'\/.+\'/, ''
|
38
|
+
route("mount Tolk::Engine => '/#{namespace}', :as => 'tolk'")
|
39
|
+
|
40
|
+
display "Job's done: migrate, start your server and visit '/#{namespace}'!", :blue
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# Tolk config file. Generated on <%= DateTime.now.to_s(:long) %>
|
4
|
+
# See github.com/tolk/tolk for more informations
|
5
|
+
|
6
|
+
Tolk.config do |config|
|
7
|
+
|
8
|
+
# If you need to add a mapping do it like this :
|
9
|
+
# May we suggest you use http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
10
|
+
# config.mapping["fr-ES"] = 'Frañol !'
|
11
|
+
|
12
|
+
end
|
File without changes
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Tolk
|
2
|
+
module Generators
|
3
|
+
module Utils
|
4
|
+
module InstanceMethods
|
5
|
+
def display(output, color = :green)
|
6
|
+
say(" - #{output}", color)
|
7
|
+
end
|
8
|
+
|
9
|
+
def ask_for(wording, default_value = nil, override_if_present_value = nil)
|
10
|
+
override_if_present_value.present? ?
|
11
|
+
display("Using [#{override_if_present_value}] for question '#{wording}'") && override_if_present_value :
|
12
|
+
ask(" ? #{wording} Press <enter> for [#{default_value}] >", :yellow).presence || default_value
|
13
|
+
end
|
14
|
+
|
15
|
+
def ask_boolean(wording, default_value = nil)
|
16
|
+
value = ask_for(wording, 'Y')
|
17
|
+
value = (value == 'Y')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
module ClassMethods
|
22
|
+
def next_migration_number(dirname)
|
23
|
+
if ActiveRecord::Base.timestamped_migrations
|
24
|
+
migration_number = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
|
25
|
+
migration_number += 1
|
26
|
+
migration_number.to_s
|
27
|
+
else
|
28
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
data/lib/tasks/tolk_tasks.rake
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
namespace :tolk do
|
2
|
+
desc "Update locale"
|
3
|
+
task :update_locale, [:old_name, :new_name] => :environment do |t, args|
|
4
|
+
old_name, new_name = args[:old_name], args[:new_name]
|
5
|
+
puts Tolk::Locale.rename(old_name, new_name)
|
6
|
+
end
|
7
|
+
|
2
8
|
desc "Add database tables, copy over the assets, and import existing translations"
|
3
9
|
task :setup => :environment do
|
4
|
-
system
|
10
|
+
system 'rails g tolk:install'
|
11
|
+
|
5
12
|
Rake::Task['db:migrate'].invoke
|
6
13
|
Rake::Task['tolk:sync'].invoke
|
7
14
|
Rake::Task['tolk:import'].invoke
|
data/lib/tolk.rb
CHANGED
@@ -1,8 +1,17 @@
|
|
1
1
|
require 'will_paginate'
|
2
2
|
require 'ya2yaml'
|
3
|
+
require 'tolk/config'
|
3
4
|
require 'tolk/engine'
|
4
5
|
require 'tolk/sync'
|
5
6
|
require 'tolk/import'
|
6
7
|
|
7
8
|
module Tolk
|
9
|
+
# Setup Tolk
|
10
|
+
def self.config(&block)
|
11
|
+
if block_given?
|
12
|
+
block.call(Tolk::Config)
|
13
|
+
else
|
14
|
+
Tolk::Config
|
15
|
+
end
|
16
|
+
end
|
8
17
|
end
|
data/lib/tolk/config.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'active_support/core_ext/class/attribute_accessors'
|
2
|
+
|
3
|
+
module Tolk
|
4
|
+
module Config
|
5
|
+
|
6
|
+
|
7
|
+
class << self
|
8
|
+
# Mapping : a hash of the type { 'ar' => 'Arabic' }
|
9
|
+
attr_accessor :mapping
|
10
|
+
|
11
|
+
# Dump locale path by default the locales folder (config/locales)
|
12
|
+
attr_accessor :dump_path
|
13
|
+
|
14
|
+
def reset
|
15
|
+
@dump_path = Proc.new { "#{Rails.application.root}/config/locales" }
|
16
|
+
|
17
|
+
@mapping = {
|
18
|
+
'ar' => 'Arabic',
|
19
|
+
'bs' => 'Bosnian',
|
20
|
+
'bg' => 'Bulgarian',
|
21
|
+
'ca' => 'Catalan',
|
22
|
+
'cs' => 'Czech',
|
23
|
+
'da' => 'Danish',
|
24
|
+
'de' => 'German',
|
25
|
+
'el' => 'Greek',
|
26
|
+
'en' => 'English',
|
27
|
+
'es' => 'Spanish',
|
28
|
+
'et' => 'Estonian',
|
29
|
+
'fa' => 'Persian',
|
30
|
+
'fi' => 'Finnish',
|
31
|
+
'fr' => 'French',
|
32
|
+
'he' => 'Hebrew',
|
33
|
+
'hr' => 'Croatian',
|
34
|
+
'hu' => 'Hungarian',
|
35
|
+
'id' => 'Indonesian',
|
36
|
+
'is' => 'Icelandic',
|
37
|
+
'it' => 'Italian',
|
38
|
+
'ja' => 'Japanese',
|
39
|
+
'ko' => 'Korean',
|
40
|
+
'lo' => 'Lao',
|
41
|
+
'lt' => 'Lithuanian',
|
42
|
+
'lv' => 'Latvian',
|
43
|
+
'mk' => 'Macedonian',
|
44
|
+
'nl' => 'Dutch',
|
45
|
+
'no' => 'Norwegian',
|
46
|
+
'pl' => 'Polish',
|
47
|
+
'pt-br' => 'Portuguese (Brazilian)',
|
48
|
+
'pt-PT' => 'Portuguese (Portugal)',
|
49
|
+
'ro' => 'Romanian',
|
50
|
+
'ru' => 'Russian',
|
51
|
+
'sv' => 'Swedish',
|
52
|
+
'sk' => 'Slovak',
|
53
|
+
'sl' => 'Slovene',
|
54
|
+
'sr' => 'Serbian',
|
55
|
+
'sw' => 'Swahili',
|
56
|
+
'th' => 'Thai',
|
57
|
+
'tr' => 'Turkish',
|
58
|
+
'uk' => 'Ukrainian',
|
59
|
+
'vi' => 'Vietnamese',
|
60
|
+
'zh-CN' => 'Chinese (Simplified)',
|
61
|
+
'zh-TW' => 'Chinese (Traditional)'
|
62
|
+
}
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Set default values for configuration options on load
|
67
|
+
self.reset
|
68
|
+
end
|
69
|
+
end
|
data/lib/tolk/import.rb
CHANGED
@@ -8,8 +8,14 @@ module Tolk
|
|
8
8
|
|
9
9
|
def import_secondary_locales
|
10
10
|
locales = Dir.entries(self.locales_config_path)
|
11
|
-
|
12
|
-
|
11
|
+
|
12
|
+
locale_block_filter = Proc.new {
|
13
|
+
|l| ['.', '..'].include?(l) ||
|
14
|
+
!l.ends_with?('.yml') ||
|
15
|
+
l.match(/(.*\.){2,}/) # reject files of type xxx.en.yml
|
16
|
+
}
|
17
|
+
locales = locales.reject(&locale_block_filter).map {|x| x.split('.').first }
|
18
|
+
locales = locales - [Tolk::Locale.primary_locale.name]
|
13
19
|
locales.each {|l| import_locale(l) }
|
14
20
|
end
|
15
21
|
|
data/lib/tolk/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tolk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2012-05-
|
15
|
+
date: 2012-05-18 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: will_paginate
|
@@ -56,9 +56,12 @@ files:
|
|
56
56
|
- MIT-LICENSE
|
57
57
|
- config/routes.rb
|
58
58
|
- init.rb
|
59
|
-
- lib/generators/
|
60
|
-
- lib/generators/
|
59
|
+
- lib/generators/tolk/install_generator.rb
|
60
|
+
- lib/generators/tolk/templates/initializer.erb
|
61
|
+
- lib/generators/tolk/templates/migration.rb
|
62
|
+
- lib/generators/tolk/utils.rb
|
61
63
|
- lib/tasks/tolk_tasks.rake
|
64
|
+
- lib/tolk/config.rb
|
62
65
|
- lib/tolk/engine.rb
|
63
66
|
- lib/tolk/import.rb
|
64
67
|
- lib/tolk/sync.rb
|
@@ -88,7 +91,10 @@ files:
|
|
88
91
|
- app/views/tolk/searches/show.html.erb
|
89
92
|
homepage: http://github.com/tolk/tolk
|
90
93
|
licenses: []
|
91
|
-
post_install_message:
|
94
|
+
post_install_message: ! "##################################\n# Tolk, if upgrading
|
95
|
+
from pre-1.3.\n##################################\n - A configuration file is now
|
96
|
+
available, run tolk:setup.\n - Mapping has been updated, use update_locale rake
|
97
|
+
task if necessary."
|
92
98
|
rdoc_options: []
|
93
99
|
require_paths:
|
94
100
|
- lib
|
@@ -1,19 +0,0 @@
|
|
1
|
-
class TolkMigrationGenerator < Rails::Generators::Base
|
2
|
-
include Rails::Generators::Migration
|
3
|
-
|
4
|
-
source_root File.expand_path("../templates", __FILE__)
|
5
|
-
|
6
|
-
def create_migration_file
|
7
|
-
migration_template "migrate/create_tolk_tables.rb", "db/migrate/create_tolk_tables.rb"
|
8
|
-
end
|
9
|
-
|
10
|
-
# Implement the required interface for Rails::Generators::Migration.
|
11
|
-
def self.next_migration_number(dirname) #:nodoc:
|
12
|
-
next_migration_number = current_migration_number(dirname) + 1
|
13
|
-
if ActiveRecord::Base.timestamped_migrations
|
14
|
-
[Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
|
15
|
-
else
|
16
|
-
"%.3d" % next_migration_number
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|