ar-translatable 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +20 -0
- data/.travis.yml +3 -3
- data/Guardfile +37 -0
- data/README.md +1 -1
- data/Rakefile +12 -4
- data/ar-translatable.gemspec +33 -0
- data/{spec/dummy/db → db}/migrate/20140625163354_create_translated_words.rb +4 -4
- data/lib/translatable.rb +3 -3
- data/lib/translatable/acts_as_translatable.rb +3 -3
- data/lib/translatable/engine.rb +1 -1
- data/lib/translatable/railtie.rb +2 -2
- data/lib/translatable/version.rb +1 -1
- data/spec/dummy/config/application.rb +1 -1
- data/spec/dummy/config/initializers/cookies_serializer.rb +1 -1
- data/spec/dummy/db/schema.rb +14 -14
- data/spec/factories/translated_word.rb +2 -2
- data/spec/models/translated_word_spec.rb +1 -1
- data/spec/models/user_spec.rb +14 -14
- data/spec/rails_helper.rb +3 -3
- data/spec/spec_helper.rb +59 -61
- metadata +49 -8
- data/lib/generators/translatable/migration_generator.rb +0 -17
- data/lib/generators/translatable/templates/migration.rb +0 -13
- data/translatable.gemspec +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be0b0dd51089a14927e703832923497a06aa4445
|
4
|
+
data.tar.gz: ff049f573ac9e966204ac487c03c852e792fc7d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e49a83e504c916260916428b6979641c40e99d37423b25fad8f226e456015f3249ae3dad38bcc8b545fde829009eaf5b0e4be1f01d54f052d9a933a0c2e16500
|
7
|
+
data.tar.gz: a352f011c2fdc6c5eb8fbda9e165a17b3961d6052772a4ef56469cfc00e642d86d5169fbd5ea34d7a0a31bf409b46516a928b37dc549a6c52a6d649a2b8a635b
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
+
# on 2014-09-22 04:32:14 +0900 using RuboCop version 0.26.1.
|
3
|
+
# The point is for the user to remove these configuration records
|
4
|
+
# one by one as the offenses are removed from the code base.
|
5
|
+
# Note that changes in the inspected code, or installation of new
|
6
|
+
# versions of RuboCop, may require this file to be generated again.
|
7
|
+
|
8
|
+
AllCops:
|
9
|
+
RunRailsCops: true
|
10
|
+
Excludes:
|
11
|
+
- spec/dummy/db/schema.rb
|
12
|
+
- vendor/bundle/**/*
|
13
|
+
Metrics/LineLength:
|
14
|
+
Enabled: false
|
15
|
+
Style/Documentation:
|
16
|
+
Enabled: false
|
17
|
+
Style/FileName:
|
18
|
+
Enabled: false
|
19
|
+
Style/RegexpLiteral:
|
20
|
+
Enabled: false
|
data/.travis.yml
CHANGED
data/Guardfile
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
5
|
+
# rspec may be run, below are examples of the most common uses.
|
6
|
+
# * bundler: 'bundle exec rspec'
|
7
|
+
# * bundler binstubs: 'bin/rspec'
|
8
|
+
# * spring: 'bin/rsspec' (This will use spring if running and you have
|
9
|
+
# installed the spring binstubs per the docs)
|
10
|
+
# * zeus: 'zeus rspec' (requires the server to be started separetly)
|
11
|
+
# * 'just' rspec: 'rspec'
|
12
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
13
|
+
watch(%r{^spec/.+_spec\.rb$})
|
14
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
15
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
16
|
+
|
17
|
+
# Rails example
|
18
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
19
|
+
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
20
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
21
|
+
watch(%r{^spec/support/(.+)\.rb$}) { 'spec' }
|
22
|
+
watch('config/routes.rb') { 'spec/routing' }
|
23
|
+
watch('app/controllers/application_controller.rb') { 'spec/controllers' }
|
24
|
+
watch('spec/rails_helper.rb') { 'spec' }
|
25
|
+
|
26
|
+
# Capybara features specs
|
27
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
28
|
+
|
29
|
+
# Turnip features and steps
|
30
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
31
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
32
|
+
end
|
33
|
+
|
34
|
+
guard :rubocop, cli: '--auto-correct' do
|
35
|
+
watch(%r{.+\.rb$})
|
36
|
+
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
37
|
+
end
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
-
|
2
|
-
require
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
3
6
|
|
4
|
-
|
7
|
+
require 'bundler/gem_tasks'
|
8
|
+
require 'rspec/core/rake_task'
|
9
|
+
|
10
|
+
APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
|
11
|
+
load 'rails/tasks/engine.rake'
|
5
12
|
|
6
|
-
|
13
|
+
RSpec::Core::RakeTask.new(:spec)
|
7
14
|
|
15
|
+
task default: :spec
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'translatable/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'ar-translatable'
|
8
|
+
spec.version = Translatable::VERSION
|
9
|
+
spec.authors = ['masarakki']
|
10
|
+
spec.email = ['masaki@hisme.net']
|
11
|
+
spec.summary = 'ActiveRecord plugin to translate.'
|
12
|
+
spec.description = 'ActiveRecord plugin to translate.'
|
13
|
+
spec.homepage = 'https://github.com/masarakki/ar-translatable'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
22
|
+
spec.add_dependency 'rails', '>= 4.0.0'
|
23
|
+
spec.add_development_dependency 'sqlite3'
|
24
|
+
spec.add_development_dependency 'rake'
|
25
|
+
spec.add_development_dependency 'rspec'
|
26
|
+
spec.add_development_dependency 'rspec-rails'
|
27
|
+
spec.add_development_dependency 'pry'
|
28
|
+
spec.add_development_dependency 'pry-doc'
|
29
|
+
spec.add_development_dependency 'factory_girl_rails'
|
30
|
+
spec.add_development_dependency 'guard'
|
31
|
+
spec.add_development_dependency 'guard-rspec'
|
32
|
+
spec.add_development_dependency 'guard-rubocop'
|
33
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
class CreateTranslatedWords < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table(:translated_words) do |t|
|
4
|
-
t.string
|
4
|
+
t.string :translatable_type, null: false
|
5
5
|
t.integer :translatable_id, null: false
|
6
|
-
t.string
|
7
|
-
t.string
|
8
|
-
t.string
|
6
|
+
t.string :key, null: false
|
7
|
+
t.string :locale, null: false
|
8
|
+
t.string :value, null: false
|
9
9
|
t.index [:translatable_type, :translatable_id, :key, :locale], name: 'translated_word', unique: true
|
10
10
|
t.timestamps
|
11
11
|
end
|
data/lib/translatable.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'translatable/version'
|
2
|
+
require 'translatable/acts_as_translatable'
|
3
|
+
require 'translatable/engine' if defined? Rails
|
4
4
|
|
5
5
|
module Translatable
|
6
6
|
end
|
@@ -7,12 +7,12 @@ module Translatable
|
|
7
7
|
module ClassMethods
|
8
8
|
def translatable(column)
|
9
9
|
key_name = column.to_s.pluralize.to_sym
|
10
|
-
has_many key_name, -> { where(key: column.to_s) }, :
|
11
|
-
:
|
10
|
+
has_many key_name, -> { where(key: column.to_s) }, as: :translatable, class_name: 'TranslatedWord',
|
11
|
+
inverse_of: :translatable, dependent: :destroy
|
12
12
|
accepts_nested_attributes_for key_name
|
13
13
|
define_method column do |locale = I18n.default_locale|
|
14
14
|
localizes = send(key_name)
|
15
|
-
localizes.
|
15
|
+
localizes.find { |w| w.locale.to_s == locale.to_s }.try(:value) || localizes.first.try(:value)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
data/lib/translatable/engine.rb
CHANGED
data/lib/translatable/railtie.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module Translatable
|
2
2
|
class Railtie < ::Rails::Railtie
|
3
|
-
initializer
|
3
|
+
initializer 'translatable.initialize' do
|
4
4
|
ActiveSupport.on_load :active_record do
|
5
5
|
include Translatable::ActsAsTranslatable
|
6
|
-
require
|
6
|
+
require 'translatable/translated_word'
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
data/lib/translatable/version.rb
CHANGED
data/spec/dummy/db/schema.rb
CHANGED
@@ -11,24 +11,24 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20_140_625_174_008) do
|
15
15
|
|
16
|
-
create_table
|
17
|
-
t.string
|
18
|
-
t.integer
|
19
|
-
t.string
|
20
|
-
t.string
|
21
|
-
t.string
|
22
|
-
t.datetime
|
23
|
-
t.datetime
|
16
|
+
create_table 'translated_words', force: true do |t|
|
17
|
+
t.string 'translatable_type', null: false
|
18
|
+
t.integer 'translatable_id', null: false
|
19
|
+
t.string 'key', null: false
|
20
|
+
t.string 'locale', null: false
|
21
|
+
t.string 'value', null: false
|
22
|
+
t.datetime 'created_at'
|
23
|
+
t.datetime 'updated_at'
|
24
24
|
end
|
25
25
|
|
26
|
-
add_index
|
26
|
+
add_index 'translated_words', %w(translatable_type translatable_id key locale), name: 'translated_word', unique: true
|
27
27
|
|
28
|
-
create_table
|
29
|
-
t.date
|
30
|
-
t.datetime
|
31
|
-
t.datetime
|
28
|
+
create_table 'users', force: true do |t|
|
29
|
+
t.date 'birthday'
|
30
|
+
t.datetime 'created_at'
|
31
|
+
t.datetime 'updated_at'
|
32
32
|
end
|
33
33
|
|
34
34
|
end
|
data/spec/models/user_spec.rb
CHANGED
@@ -2,42 +2,42 @@
|
|
2
2
|
require 'rails_helper'
|
3
3
|
|
4
4
|
describe User do
|
5
|
-
describe
|
5
|
+
describe 'factory' do
|
6
6
|
it { expect(build(:user)).to be_valid }
|
7
7
|
end
|
8
8
|
|
9
|
-
describe
|
10
|
-
let(:user)
|
9
|
+
describe 'nested_attributes_for' do
|
10
|
+
let(:user) do
|
11
11
|
User.create(
|
12
|
-
first_names_attributes: [{locale: 'ja', value: 'ジョン'}, {locale: 'en', value: 'John'}],
|
13
|
-
last_names_attributes: [{locale: 'ja', value: 'レノン'}, {locale: 'en', value: 'Lennon'}]
|
12
|
+
first_names_attributes: [{ locale: 'ja', value: 'ジョン' }, { locale: 'en', value: 'John' }],
|
13
|
+
last_names_attributes: [{ locale: 'ja', value: 'レノン' }, { locale: 'en', value: 'Lennon' }]
|
14
14
|
)
|
15
|
-
|
15
|
+
end
|
16
16
|
it { expect(user.first_names.count).to eq 2 }
|
17
17
|
it { expect(user.last_names.count).to eq 2 }
|
18
18
|
end
|
19
19
|
|
20
|
-
describe
|
20
|
+
describe 'translatable' do
|
21
21
|
before { I18n.available_locales = [:en, :ja] }
|
22
22
|
let(:user) { create :user }
|
23
23
|
before do
|
24
24
|
create :translated_word, :en, translatable: user
|
25
25
|
create :translated_word, :ja, translatable: user
|
26
26
|
end
|
27
|
-
it { expect(user.first_name(:en)).to eq
|
28
|
-
it { expect(user.first_name(:ja)).to eq
|
29
|
-
it { expect(user.first_name(:fr)).to eq
|
27
|
+
it { expect(user.first_name(:en)).to eq 'John' }
|
28
|
+
it { expect(user.first_name(:ja)).to eq 'ジョン' }
|
29
|
+
it { expect(user.first_name(:fr)).to eq 'John' }
|
30
30
|
|
31
|
-
context
|
31
|
+
context 'default locale = :en' do
|
32
32
|
before { I18n.default_locale = :en }
|
33
33
|
after { I18n.default_locale = :en }
|
34
|
-
it { expect(user.first_name).to eq
|
34
|
+
it { expect(user.first_name).to eq 'John' }
|
35
35
|
end
|
36
36
|
|
37
|
-
context
|
37
|
+
context 'default locale = :ja' do
|
38
38
|
before { I18n.default_locale = :ja }
|
39
39
|
after { I18n.default_locale = :en }
|
40
|
-
it { expect(user.first_name).to eq
|
40
|
+
it { expect(user.first_name).to eq 'ジョン' }
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
data/spec/rails_helper.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Configure Rails Environment
|
2
|
-
ENV[
|
3
|
-
require
|
2
|
+
ENV['RAILS_ENV'] = 'test'
|
3
|
+
require 'spec_helper'
|
4
4
|
require 'pry'
|
5
|
-
require File.expand_path(
|
5
|
+
require File.expand_path('../dummy/config/environment.rb', __FILE__)
|
6
6
|
require 'rspec/rails'
|
7
7
|
|
8
8
|
# Load support files
|
data/spec/spec_helper.rb
CHANGED
@@ -14,65 +14,63 @@
|
|
14
14
|
# users commonly want.
|
15
15
|
#
|
16
16
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
17
|
-
RSpec.configure do |
|
18
|
-
# The settings below are suggested to provide a good initial experience
|
19
|
-
# with RSpec, but feel free to customize to your heart's content.
|
20
|
-
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
config.
|
26
|
-
|
27
|
-
|
28
|
-
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
|
42
|
-
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
47
|
-
|
48
|
-
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
|
54
|
-
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
#
|
66
|
-
#
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
end
|
77
|
-
=end
|
17
|
+
RSpec.configure do |_config|
|
18
|
+
# The settings below are suggested to provide a good initial experience
|
19
|
+
# with RSpec, but feel free to customize to your heart's content.
|
20
|
+
# # These two settings work together to allow you to limit a spec run
|
21
|
+
# # to individual examples or groups you care about by tagging them with
|
22
|
+
# # `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
23
|
+
# # get run.
|
24
|
+
# config.filter_run :focus
|
25
|
+
# config.run_all_when_everything_filtered = true
|
26
|
+
#
|
27
|
+
# # Many RSpec users commonly either run the entire suite or an individual
|
28
|
+
# # file, and it's useful to allow more verbose output when running an
|
29
|
+
# # individual spec file.
|
30
|
+
# if config.files_to_run.one?
|
31
|
+
# # Use the documentation formatter for detailed output,
|
32
|
+
# # unless a formatter has already been configured
|
33
|
+
# # (e.g. via a command-line flag).
|
34
|
+
# config.default_formatter = 'doc'
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# # Print the 10 slowest examples and example groups at the
|
38
|
+
# # end of the spec run, to help surface which specs are running
|
39
|
+
# # particularly slow.
|
40
|
+
# config.profile_examples = 10
|
41
|
+
#
|
42
|
+
# # Run specs in random order to surface order dependencies. If you find an
|
43
|
+
# # order dependency and want to debug it, you can fix the order by providing
|
44
|
+
# # the seed, which is printed after each run.
|
45
|
+
# # --seed 1234
|
46
|
+
# config.order = :random
|
47
|
+
#
|
48
|
+
# # Seed global randomization in this process using the `--seed` CLI option.
|
49
|
+
# # Setting this allows you to use `--seed` to deterministically reproduce
|
50
|
+
# # test failures related to randomization by passing the same `--seed` value
|
51
|
+
# # as the one that triggered the failure.
|
52
|
+
# Kernel.srand config.seed
|
53
|
+
#
|
54
|
+
# # rspec-expectations config goes here. You can use an alternate
|
55
|
+
# # assertion/expectation library such as wrong or the stdlib/minitest
|
56
|
+
# # assertions if you prefer.
|
57
|
+
# config.expect_with :rspec do |expectations|
|
58
|
+
# # Enable only the newer, non-monkey-patching expect syntax.
|
59
|
+
# # For more details, see:
|
60
|
+
# # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
61
|
+
# expectations.syntax = :expect
|
62
|
+
# end
|
63
|
+
#
|
64
|
+
# # rspec-mocks config goes here. You can use an alternate test double
|
65
|
+
# # library (such as bogus or mocha) by changing the `mock_with` option here.
|
66
|
+
# config.mock_with :rspec do |mocks|
|
67
|
+
# # Enable only the newer, non-monkey-patching expect syntax.
|
68
|
+
# # For more details, see:
|
69
|
+
# # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
70
|
+
# mocks.syntax = :expect
|
71
|
+
#
|
72
|
+
# # Prevents you from mocking or stubbing a method that does not exist on
|
73
|
+
# # a real object. This is generally recommended.
|
74
|
+
# mocks.verify_partial_doubles = true
|
75
|
+
# end
|
78
76
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ar-translatable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- masarakki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -136,6 +136,48 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: guard
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: guard-rspec
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: guard-rubocop
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
139
181
|
description: ActiveRecord plugin to translate.
|
140
182
|
email:
|
141
183
|
- masaki@hisme.net
|
@@ -145,15 +187,17 @@ extra_rdoc_files: []
|
|
145
187
|
files:
|
146
188
|
- ".gitignore"
|
147
189
|
- ".rspec"
|
190
|
+
- ".rubocop.yml"
|
148
191
|
- ".travis.yml"
|
149
192
|
- Gemfile
|
193
|
+
- Guardfile
|
150
194
|
- LICENSE.txt
|
151
195
|
- README.md
|
152
196
|
- Rakefile
|
153
197
|
- app/models/translated_word.rb
|
198
|
+
- ar-translatable.gemspec
|
199
|
+
- db/migrate/20140625163354_create_translated_words.rb
|
154
200
|
- lib/ar-translatable.rb
|
155
|
-
- lib/generators/translatable/migration_generator.rb
|
156
|
-
- lib/generators/translatable/templates/migration.rb
|
157
201
|
- lib/translatable.rb
|
158
202
|
- lib/translatable/acts_as_translatable.rb
|
159
203
|
- lib/translatable/engine.rb
|
@@ -194,7 +238,6 @@ files:
|
|
194
238
|
- spec/dummy/config/locales/en.yml
|
195
239
|
- spec/dummy/config/routes.rb
|
196
240
|
- spec/dummy/config/secrets.yml
|
197
|
-
- spec/dummy/db/migrate/20140625163354_create_translated_words.rb
|
198
241
|
- spec/dummy/db/migrate/20140625174008_create_users.rb
|
199
242
|
- spec/dummy/db/schema.rb
|
200
243
|
- spec/dummy/lib/assets/.keep
|
@@ -211,8 +254,7 @@ files:
|
|
211
254
|
- spec/spec_helper.rb
|
212
255
|
- spec/translatable/acts_as_translatable_spec.rb
|
213
256
|
- spec/translatable_spec.rb
|
214
|
-
-
|
215
|
-
homepage: https://github.com/masarakki/translatable
|
257
|
+
homepage: https://github.com/masarakki/ar-translatable
|
216
258
|
licenses:
|
217
259
|
- MIT
|
218
260
|
metadata: {}
|
@@ -271,7 +313,6 @@ test_files:
|
|
271
313
|
- spec/dummy/config/locales/en.yml
|
272
314
|
- spec/dummy/config/routes.rb
|
273
315
|
- spec/dummy/config/secrets.yml
|
274
|
-
- spec/dummy/db/migrate/20140625163354_create_translated_words.rb
|
275
316
|
- spec/dummy/db/migrate/20140625174008_create_users.rb
|
276
317
|
- spec/dummy/db/schema.rb
|
277
318
|
- spec/dummy/lib/assets/.keep
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'rails/generators/active_record'
|
2
|
-
|
3
|
-
module Translatable
|
4
|
-
class MigrationGenerator < ::Rails::Generators::Base
|
5
|
-
include Rails::Generators::Migration
|
6
|
-
source_root File.expand_path('../templates', __FILE__)
|
7
|
-
|
8
|
-
desc 'Install migration file'
|
9
|
-
def install
|
10
|
-
migration_template 'migration.rb', 'db/migrate/create_translated_words.rb'
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.next_migration_number(dirname)
|
14
|
-
ActiveRecord::Generators::Base.next_migration_number(dirname)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class CreateTranslatedWords < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
create_table(:translated_words) do |t|
|
4
|
-
t.string :translatable_type, null: false
|
5
|
-
t.integer :translatable_id, null: false
|
6
|
-
t.string :key, null: false
|
7
|
-
t.string :locale, null: false
|
8
|
-
t.string :value, null: false
|
9
|
-
t.index [:translatable_type, :translatable_id, :key, :locale], name: 'translated_word', unique: true
|
10
|
-
t.timestamps
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
data/translatable.gemspec
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'translatable/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "ar-translatable"
|
8
|
-
spec.version = Translatable::VERSION
|
9
|
-
spec.authors = ["masarakki"]
|
10
|
-
spec.email = ["masaki@hisme.net"]
|
11
|
-
spec.summary = %q{ActiveRecord plugin to translate.}
|
12
|
-
spec.description = %q{ActiveRecord plugin to translate.}
|
13
|
-
spec.homepage = "https://github.com/masarakki/translatable"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = ["lib"]
|
20
|
-
|
21
|
-
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
-
spec.add_dependency "rails", ">= 4.0.0"
|
23
|
-
spec.add_development_dependency "sqlite3"
|
24
|
-
spec.add_development_dependency "rake"
|
25
|
-
spec.add_development_dependency "rspec"
|
26
|
-
spec.add_development_dependency "rspec-rails"
|
27
|
-
spec.add_development_dependency "pry"
|
28
|
-
spec.add_development_dependency "pry-doc"
|
29
|
-
spec.add_development_dependency "factory_girl_rails"
|
30
|
-
end
|