global_shared_db 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.gitlab-ci.yml +49 -0
- data/.rspec +2 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +13 -0
- data/LICENSE.txt +21 -0
- data/README.md +72 -0
- data/Rakefile +53 -0
- data/bin/console +10 -0
- data/bin/setup +7 -0
- data/config/global_shared_db.example.yml +22 -0
- data/config/settings/base.yml +14 -0
- data/db/global_shared_db_schema.rb +87 -0
- data/db/migrate/2018052101_create_lingochamp_courses.rb +23 -0
- data/db/migrate/2018052102_create_lingochamp_units.rb +19 -0
- data/db/migrate/2018052103_create_lingochamp_lessons.rb +21 -0
- data/db/migrate/2018052104_create_lingochamp_activities.rb +25 -0
- data/gemfiles/5.0.gemfile +3 -0
- data/gemfiles/5.1.gemfile +3 -0
- data/gemfiles/5.2.gemfile +3 -0
- data/global_shared_db.gemspec +39 -0
- data/lib/global_shared_db.rb +67 -0
- data/lib/global_shared_db/concerns/attachment_field.rb +39 -0
- data/lib/global_shared_db/concerns/data_field.rb +38 -0
- data/lib/global_shared_db/load_tasks.rb +7 -0
- data/lib/global_shared_db/models/base_db.rb +17 -0
- data/lib/global_shared_db/models/lingochamp_activity.rb +16 -0
- data/lib/global_shared_db/models/lingochamp_course.rb +21 -0
- data/lib/global_shared_db/models/lingochamp_lesson.rb +19 -0
- data/lib/global_shared_db/models/lingochamp_unit.rb +17 -0
- data/lib/global_shared_db/settings.rb +10 -0
- data/lib/global_shared_db/task_helper.rb +28 -0
- data/lib/global_shared_db/version.rb +3 -0
- data/lib/tasks/generator.rake +42 -0
- data/lib/tasks/global_shared_db.rake +91 -0
- metadata +261 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: abf65ccb0e6b3789f725245febda3f734d8459b2
|
4
|
+
data.tar.gz: bef9deba72f6af664cce17302c6510b4a63f1ff0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e1b594a26b7e49a5103a1103015fb6856de143717d70f5236a94956fab938040f7f88e0e5dac11068cd8ff553a92965996ce7d97853bb6836605a519ea595061
|
7
|
+
data.tar.gz: 21c8d019b857df0ea6f8399777633f585395b3333dd37b78ad1dbd1527436b53df899dda9dcf001e3588d46e270bfd07af76bf322a3b75af92e20c452c014c70
|
data/.gitignore
ADDED
data/.gitlab-ci.yml
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
stages:
|
2
|
+
- bundle
|
3
|
+
- test
|
4
|
+
|
5
|
+
cache:
|
6
|
+
key: global_shared_db
|
7
|
+
paths:
|
8
|
+
- .gems
|
9
|
+
|
10
|
+
bundle:
|
11
|
+
image: stag-reg.llsops.com/backend/global_shared_db:0.0.1
|
12
|
+
variables:
|
13
|
+
LC_ALL: "C.UTF-8"
|
14
|
+
RAILS_ENV: test
|
15
|
+
RACK_ENV: test
|
16
|
+
before_script:
|
17
|
+
- chmod 0600 /root/.ssh/id_rsa
|
18
|
+
script:
|
19
|
+
- bundle config mirror.https://rubygems.org http://m2.llsapp.com/repository/all-engzo-ruby/
|
20
|
+
- bundle install -j8 --path .gems
|
21
|
+
stage: bundle
|
22
|
+
tags:
|
23
|
+
- ruby
|
24
|
+
|
25
|
+
.test_template: &test_template
|
26
|
+
image: stag-reg.llsops.com/backend/global_shared_db:0.0.1
|
27
|
+
services:
|
28
|
+
- stag-reg.llsops.com/library/mysql:5.7
|
29
|
+
variables:
|
30
|
+
LC_ALL: "C.UTF-8"
|
31
|
+
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
|
32
|
+
RAILS_ENV: test
|
33
|
+
RACK_ENV: test
|
34
|
+
CI: "true"
|
35
|
+
before_script:
|
36
|
+
- chmod 0600 /root/.ssh/id_rsa
|
37
|
+
- ln -s -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
38
|
+
- bundle config --local path .gems
|
39
|
+
- cp config/global_shared_db.example.yml config/global_shared_db.yml
|
40
|
+
- sleep 30
|
41
|
+
- bundle exec rake db:create db:migrate
|
42
|
+
stage: test
|
43
|
+
tags:
|
44
|
+
- ruby
|
45
|
+
|
46
|
+
job_test:
|
47
|
+
<<: *test_template
|
48
|
+
script:
|
49
|
+
- bundle exec rspec
|
data/.rspec
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
source 'https://gems.ruby-china.org'
|
2
|
+
|
3
|
+
source 'http://m2.llsapp.com/repository/private-engzo-ruby/' do
|
4
|
+
gem 'globalize', '~> 0.1.1'
|
5
|
+
end
|
6
|
+
|
7
|
+
# Specify your gem's dependencies in global_shared_db.gemspec
|
8
|
+
gemspec
|
9
|
+
|
10
|
+
|
11
|
+
version = ENV['AR_VERSION'] || '5.2'
|
12
|
+
|
13
|
+
eval_gemfile File.expand_path("../gemfiles/#{version}.gemfile", __FILE__)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 jiangzhi.xie
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# GlobalSharedDb
|
2
|
+
|
3
|
+
A shared database for LINGOCHAMP
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'global_shared_db', '0.0.9'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install global_shared_db
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
### Init DB connection
|
24
|
+
|
25
|
+
```
|
26
|
+
GlobalSharedDb.setup({
|
27
|
+
adapter: 'mysql2',
|
28
|
+
host: 'localhost',
|
29
|
+
database: 'global_shared_db',
|
30
|
+
username: 'root',
|
31
|
+
password: nil
|
32
|
+
})
|
33
|
+
```
|
34
|
+
|
35
|
+
### switch connection
|
36
|
+
|
37
|
+
```
|
38
|
+
GlobalSharedDb.establish_connection({host: 'localhost', database: 'xxx'})
|
39
|
+
```
|
40
|
+
|
41
|
+
### Add rake task
|
42
|
+
|
43
|
+
如果你的项目需要对数据库做 create/migrate 操作的话, 在 `Rakefile` 加入如下代码
|
44
|
+
|
45
|
+
```
|
46
|
+
require 'global_shared_db/load_tasks'
|
47
|
+
```
|
48
|
+
|
49
|
+
然后就可以运行一个 global_shared_db 的 task
|
50
|
+
|
51
|
+
```
|
52
|
+
rake global_shared_db:create global_shared_db:migrate
|
53
|
+
```
|
54
|
+
|
55
|
+
## Development
|
56
|
+
|
57
|
+
### Create test DBs
|
58
|
+
|
59
|
+
```
|
60
|
+
rake db:create db:migrate
|
61
|
+
```
|
62
|
+
|
63
|
+
### Add model
|
64
|
+
|
65
|
+
```
|
66
|
+
module GlobalSharedDb
|
67
|
+
class MyModel < BaseDb
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
MyModel # activerecord model
|
72
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
|
4
|
+
require 'global_shared_db/load_tasks'
|
5
|
+
|
6
|
+
require 'pry'
|
7
|
+
|
8
|
+
RSpec::Core::RakeTask.new(:spec)
|
9
|
+
|
10
|
+
task :default => :spec
|
11
|
+
|
12
|
+
desc 'init environment'
|
13
|
+
task :environment do
|
14
|
+
config_file_path = File.join(GlobalSharedDb.root, 'config/global_shared_db.yml')
|
15
|
+
GlobalSharedDb.setup(YAML.load_file(config_file_path)[GlobalSharedDb.env])
|
16
|
+
end
|
17
|
+
|
18
|
+
namespace :db do
|
19
|
+
desc "create database"
|
20
|
+
task :create do
|
21
|
+
Rake::Task['global_shared_db:create'].invoke
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "migrate database"
|
25
|
+
task :migrate do
|
26
|
+
Rake::Task['global_shared_db:migrate'].invoke
|
27
|
+
Rake::Task['db:schema_dump'].invoke unless GlobalSharedDb.env == 'test'
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "roolback database"
|
31
|
+
task :rollback do
|
32
|
+
Rake::Task['global_shared_db:rollback'].invoke
|
33
|
+
Rake::Task['db:schema_dump'].invoke unless GlobalSharedDb.env == 'test'
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "migrate cms tables"
|
37
|
+
task :migrate_cms_tables do
|
38
|
+
Rake::Task['global_shared_db:migrate_cms_tables'].invoke
|
39
|
+
end
|
40
|
+
|
41
|
+
desc "dump database schema"
|
42
|
+
task :schema_dump do
|
43
|
+
Rake::Task['global_shared_db:schema_dump'].invoke
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
if GlobalSharedDb.env != 'production'
|
48
|
+
desc "delete database"
|
49
|
+
task :drop do
|
50
|
+
Rake::Task['global_shared_db:drop'].invoke
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/bin/console
ADDED
data/bin/setup
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
default: &default
|
2
|
+
adapter: mysql2
|
3
|
+
encoding: utf8mb4
|
4
|
+
pool: 5
|
5
|
+
timeout: 5000
|
6
|
+
host: <%= ENV['MYSQL_HOST'] || '127.0.0.1' %>
|
7
|
+
port: <%= ENV['MYSQL_PORT'] || '3306' %>
|
8
|
+
database: <%= ENV['MYSQL_DATABASE'] || 'global_shared_db_dev' %>
|
9
|
+
username: <%= ENV['MYSQL_USERNAME'] || 'root' %>
|
10
|
+
password: <%= ENV['MYSQL_PASSWORD'] %>
|
11
|
+
|
12
|
+
development:
|
13
|
+
<<: *default
|
14
|
+
database: global_shared_db_dev
|
15
|
+
|
16
|
+
test:
|
17
|
+
<<: *default
|
18
|
+
host: 127.0.0.1
|
19
|
+
port: 3306
|
20
|
+
username: root
|
21
|
+
password:
|
22
|
+
database: global_shared_db_test
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# Note that this schema.rb definition is the authoritative source for your
|
6
|
+
# database schema. If you need to create the application database on another
|
7
|
+
# system, you should be using db:schema:load, not running all the migrations
|
8
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
9
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
10
|
+
#
|
11
|
+
# It's strongly recommended that you check this file into your version control system.
|
12
|
+
|
13
|
+
ActiveRecord::Schema.define(version: 2018052104) do
|
14
|
+
|
15
|
+
create_table "lingochamp_activities", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
16
|
+
t.string "course_id", limit: 24
|
17
|
+
t.string "unit_id", limit: 24
|
18
|
+
t.string "lesson_id", limit: 24
|
19
|
+
t.string "activity_id", limit: 24
|
20
|
+
t.string "display_type", limit: 25
|
21
|
+
t.binary "data"
|
22
|
+
t.integer "order_number"
|
23
|
+
t.integer "status", limit: 1, default: 0, comment: "0:已发布 1:撤回"
|
24
|
+
t.integer "published_at"
|
25
|
+
t.datetime "created_at", null: false
|
26
|
+
t.datetime "updated_at", null: false
|
27
|
+
t.index ["activity_id"], name: "index_lingochamp_activities_on_activity_id", unique: true
|
28
|
+
t.index ["course_id"], name: "index_lingochamp_activities_on_course_id"
|
29
|
+
t.index ["display_type"], name: "index_lingochamp_activities_on_display_type"
|
30
|
+
t.index ["lesson_id"], name: "index_lingochamp_activities_on_lesson_id"
|
31
|
+
t.index ["status"], name: "index_lingochamp_activities_on_status"
|
32
|
+
t.index ["unit_id"], name: "index_lingochamp_activities_on_unit_id"
|
33
|
+
t.index ["updated_at"], name: "index_lingochamp_activities_on_updated_at"
|
34
|
+
end
|
35
|
+
|
36
|
+
create_table "lingochamp_courses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
37
|
+
t.string "course_id", limit: 24
|
38
|
+
t.string "locale", limit: 20
|
39
|
+
t.string "function", limit: 20
|
40
|
+
t.integer "stage", limit: 1
|
41
|
+
t.binary "data"
|
42
|
+
t.integer "order_number"
|
43
|
+
t.integer "status", limit: 1, default: 0, comment: "0:已发布 1:撤回"
|
44
|
+
t.integer "published_at"
|
45
|
+
t.datetime "created_at", null: false
|
46
|
+
t.datetime "updated_at", null: false
|
47
|
+
t.index ["course_id"], name: "index_lingochamp_courses_on_course_id", unique: true
|
48
|
+
t.index ["function"], name: "index_lingochamp_courses_on_function"
|
49
|
+
t.index ["locale"], name: "index_lingochamp_courses_on_locale"
|
50
|
+
t.index ["stage"], name: "index_lingochamp_courses_on_stage"
|
51
|
+
t.index ["status"], name: "index_lingochamp_courses_on_status"
|
52
|
+
t.index ["updated_at"], name: "index_lingochamp_courses_on_updated_at"
|
53
|
+
end
|
54
|
+
|
55
|
+
create_table "lingochamp_lessons", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
56
|
+
t.string "course_id", limit: 24
|
57
|
+
t.string "unit_id", limit: 24
|
58
|
+
t.string "lesson_id", limit: 24
|
59
|
+
t.binary "data"
|
60
|
+
t.integer "order_number"
|
61
|
+
t.integer "status", limit: 1, default: 0, comment: "0:已发布 1:撤回"
|
62
|
+
t.integer "published_at"
|
63
|
+
t.datetime "created_at", null: false
|
64
|
+
t.datetime "updated_at", null: false
|
65
|
+
t.index ["course_id"], name: "index_lingochamp_lessons_on_course_id"
|
66
|
+
t.index ["lesson_id"], name: "index_lingochamp_lessons_on_lesson_id", unique: true
|
67
|
+
t.index ["status"], name: "index_lingochamp_lessons_on_status"
|
68
|
+
t.index ["unit_id"], name: "index_lingochamp_lessons_on_unit_id"
|
69
|
+
t.index ["updated_at"], name: "index_lingochamp_lessons_on_updated_at"
|
70
|
+
end
|
71
|
+
|
72
|
+
create_table "lingochamp_units", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", force: :cascade do |t|
|
73
|
+
t.string "course_id", limit: 24
|
74
|
+
t.string "unit_id", limit: 24
|
75
|
+
t.binary "data"
|
76
|
+
t.integer "order_number"
|
77
|
+
t.integer "status", limit: 1, default: 0, comment: "0:已发布 1:撤回"
|
78
|
+
t.integer "published_at"
|
79
|
+
t.datetime "created_at", null: false
|
80
|
+
t.datetime "updated_at", null: false
|
81
|
+
t.index ["course_id"], name: "index_lingochamp_units_on_course_id"
|
82
|
+
t.index ["status"], name: "index_lingochamp_units_on_status"
|
83
|
+
t.index ["unit_id"], name: "index_lingochamp_units_on_unit_id", unique: true
|
84
|
+
t.index ["updated_at"], name: "index_lingochamp_units_on_updated_at"
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class CreateLingochampCourses < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
create_table :lingochamp_courses do |t|
|
4
|
+
t.string :course_id, limit: 24
|
5
|
+
t.string :locale, limit: 20
|
6
|
+
t.string :function, limit: 20
|
7
|
+
t.integer :stage, limit: 1
|
8
|
+
|
9
|
+
t.binary :data
|
10
|
+
t.integer :order_number
|
11
|
+
t.integer :status, limit: 1, default: 0, comment: "0:已发布 1:撤回"
|
12
|
+
t.integer :published_at
|
13
|
+
t.timestamps null: false
|
14
|
+
|
15
|
+
t.index :course_id, unique: true
|
16
|
+
t.index :locale
|
17
|
+
t.index :function
|
18
|
+
t.index :status
|
19
|
+
t.index :updated_at
|
20
|
+
t.index :stage
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreateLingochampUnits < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
create_table :lingochamp_units do |t|
|
4
|
+
t.string :course_id, limit: 24
|
5
|
+
t.string :unit_id, limit: 24
|
6
|
+
|
7
|
+
t.binary :data
|
8
|
+
t.integer :order_number
|
9
|
+
t.integer :status, limit: 1, default: 0, comment: "0:已发布 1:撤回"
|
10
|
+
t.integer :published_at
|
11
|
+
t.timestamps null: false
|
12
|
+
|
13
|
+
t.index :course_id
|
14
|
+
t.index :unit_id, unique: true
|
15
|
+
t.index :status
|
16
|
+
t.index :updated_at
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class CreateLingochampLessons < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
create_table :lingochamp_lessons do |t|
|
4
|
+
t.string :course_id, limit: 24
|
5
|
+
t.string :unit_id, limit: 24
|
6
|
+
t.string :lesson_id, limit: 24
|
7
|
+
|
8
|
+
t.binary :data
|
9
|
+
t.integer :order_number
|
10
|
+
t.integer :status, limit: 1, default: 0, comment: "0:已发布 1:撤回"
|
11
|
+
t.integer :published_at
|
12
|
+
t.timestamps null: false
|
13
|
+
|
14
|
+
t.index :course_id
|
15
|
+
t.index :unit_id
|
16
|
+
t.index :lesson_id, unique: true
|
17
|
+
t.index :status
|
18
|
+
t.index :updated_at
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class CreateLingochampActivities < ActiveRecord::Migration[5.0]
|
2
|
+
def change
|
3
|
+
create_table :lingochamp_activities do |t|
|
4
|
+
t.string :course_id, limit: 24
|
5
|
+
t.string :unit_id, limit: 24
|
6
|
+
t.string :lesson_id, limit: 24
|
7
|
+
t.string :activity_id, limit: 24
|
8
|
+
t.string :display_type, limit: 25
|
9
|
+
|
10
|
+
t.binary :data
|
11
|
+
t.integer :order_number
|
12
|
+
t.integer :status, limit: 1, default: 0, comment: "0:已发布 1:撤回"
|
13
|
+
t.integer :published_at
|
14
|
+
t.timestamps null: false
|
15
|
+
|
16
|
+
t.index :course_id
|
17
|
+
t.index :unit_id
|
18
|
+
t.index :lesson_id
|
19
|
+
t.index :activity_id, unique: true
|
20
|
+
t.index :display_type
|
21
|
+
t.index :status
|
22
|
+
t.index :updated_at
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'global_shared_db/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "global_shared_db"
|
9
|
+
spec.version = GlobalSharedDb::VERSION
|
10
|
+
spec.authors = ["kaiying.zhang"]
|
11
|
+
spec.email = ["kaiying.zhang@liulishuo.com"]
|
12
|
+
|
13
|
+
spec.summary = %q{some shared data.}
|
14
|
+
spec.description = %q{some shared data.}
|
15
|
+
spec.homepage = ""
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
|
19
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "rspec"
|
27
|
+
spec.add_development_dependency "pry"
|
28
|
+
spec.add_development_dependency "byebug"
|
29
|
+
|
30
|
+
spec.add_development_dependency "mysql2", "~> 0.3.20"
|
31
|
+
spec.add_development_dependency "database_cleaner"
|
32
|
+
spec.add_development_dependency "factory_bot"
|
33
|
+
|
34
|
+
spec.add_dependency "activerecord", '>= 4.0.0'
|
35
|
+
spec.add_dependency "activesupport", '>= 4.0.0'
|
36
|
+
spec.add_dependency "mine_setting", '>= 0.0.1'
|
37
|
+
spec.add_dependency "multi_json", '>= 1.11.2'
|
38
|
+
spec.add_dependency "globalize", '~> 0.1.0'
|
39
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require "global_shared_db/version"
|
2
|
+
|
3
|
+
require 'active_record'
|
4
|
+
require 'active_support'
|
5
|
+
require 'active_support/core_ext'
|
6
|
+
|
7
|
+
require 'globalize'
|
8
|
+
|
9
|
+
module GlobalSharedDb
|
10
|
+
|
11
|
+
class << self
|
12
|
+
attr_reader :db_config
|
13
|
+
|
14
|
+
def root
|
15
|
+
@root ||= File.expand_path('../../', __FILE__)
|
16
|
+
end
|
17
|
+
|
18
|
+
def env
|
19
|
+
@env ||= ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'
|
20
|
+
end
|
21
|
+
|
22
|
+
def setup(config)
|
23
|
+
case config
|
24
|
+
when Hash
|
25
|
+
@db_config = config.stringify_keys
|
26
|
+
else
|
27
|
+
raise "Invalid config"
|
28
|
+
end
|
29
|
+
establish_connection(config)
|
30
|
+
end
|
31
|
+
|
32
|
+
def establish_connection(spec)
|
33
|
+
if defined?(Octopus)
|
34
|
+
GlobalSharedDb::BaseDb.octopus_establish_connection(spec)
|
35
|
+
elsif defined?(DbCharmer)
|
36
|
+
GlobalSharedDb::BaseDb.db_magic :connection => spec
|
37
|
+
else
|
38
|
+
GlobalSharedDb::BaseDb.establish_connection(spec)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def valid_config?(config)
|
45
|
+
config[:adapter] && config[:host] && config[:database]
|
46
|
+
rescue
|
47
|
+
false
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
Globalize.translations_field = :translations
|
52
|
+
|
53
|
+
(
|
54
|
+
Dir[File.expand_path('../global_shared_db/*.rb', __FILE__)] +
|
55
|
+
Dir[File.expand_path('../global_shared_db/models/*.rb', __FILE__)]
|
56
|
+
).each do |filepath|
|
57
|
+
filename = File.basename(filepath).gsub(/\.rb$/, '')
|
58
|
+
autoload filename.camelize, filepath
|
59
|
+
end
|
60
|
+
|
61
|
+
module Concerns
|
62
|
+
Dir[File.expand_path('../global_shared_db/concerns/*.rb', __FILE__)].each do |filepath|
|
63
|
+
filename = File.basename(filepath).gsub(/\.rb$/, '')
|
64
|
+
autoload filename.camelize, filepath
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module GlobalSharedDb
|
2
|
+
module Concerns
|
3
|
+
module AttachmentField
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
class InvalidCdnError < StandardError; end
|
7
|
+
|
8
|
+
module ClassMethods
|
9
|
+
def attachment_fields(*ks)
|
10
|
+
ks ||= []
|
11
|
+
|
12
|
+
mod = Module.new do
|
13
|
+
ks.each do |k|
|
14
|
+
define_method("#{k}_url") do
|
15
|
+
v = public_send(k)
|
16
|
+
return v if v.blank?
|
17
|
+
|
18
|
+
attachment_to_url(v)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
include mod
|
24
|
+
end
|
25
|
+
end # ClassMethods
|
26
|
+
|
27
|
+
included do
|
28
|
+
private
|
29
|
+
def attachment_to_url(resource)
|
30
|
+
cdn = GlobalSharedDb::Settings.base['cdn']
|
31
|
+
raise InvalidCdnError if cdn.blank?
|
32
|
+
|
33
|
+
"#{cdn}/#{resource}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module GlobalSharedDb
|
2
|
+
module Concerns
|
3
|
+
module DataField
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
serialize :data, JSON if respond_to?(:serialize)
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
|
12
|
+
def data_fields(*ks)
|
13
|
+
ks ||= []
|
14
|
+
|
15
|
+
mod = Module.new do
|
16
|
+
ks.each do |k|
|
17
|
+
_k = k.to_s
|
18
|
+
|
19
|
+
# Read Method
|
20
|
+
define_method(_k) do
|
21
|
+
self.data && self.data[_k]
|
22
|
+
end
|
23
|
+
|
24
|
+
# Write Method
|
25
|
+
define_method("#{_k}=") do |v|
|
26
|
+
self.data = (self.data || {}).merge(_k => v)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
include mod
|
32
|
+
end
|
33
|
+
|
34
|
+
end # ClassMethods
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module GlobalSharedDb
|
2
|
+
class BaseDb < ActiveRecord::Base
|
3
|
+
|
4
|
+
STATUS_PUBLISHED = 0
|
5
|
+
STATUS_REVOKED = 1
|
6
|
+
|
7
|
+
self.abstract_class = true
|
8
|
+
|
9
|
+
include Concerns::DataField
|
10
|
+
include Concerns::AttachmentField
|
11
|
+
|
12
|
+
validates :order_number, presence: true
|
13
|
+
validates :status, presence: true
|
14
|
+
|
15
|
+
scope :published, -> { where(status: STATUS_PUBLISHED) }
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module GlobalSharedDb
|
2
|
+
class LingochampActivity < BaseDb
|
3
|
+
|
4
|
+
belongs_to(:course, primary_key: :course_id, class_name: GlobalSharedDb::LingochampCourse.to_s, required: false)
|
5
|
+
belongs_to(:unit, primary_key: :unit_id, class_name: GlobalSharedDb::LingochampUnit.to_s, required: false)
|
6
|
+
belongs_to(:lesson, primary_key: :lesson_id, class_name: GlobalSharedDb::LingochampLesson.to_s, required: false)
|
7
|
+
|
8
|
+
data_fields :video, :background_audio
|
9
|
+
attachment_fields :video, :background_audio
|
10
|
+
|
11
|
+
validates :course_id, presence: true
|
12
|
+
validates :unit_id, presence: true
|
13
|
+
validates :lesson_id, presence: true
|
14
|
+
validates :activity_id, presence: true
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module GlobalSharedDb
|
2
|
+
class LingochampCourse < BaseDb
|
3
|
+
|
4
|
+
FUNCTION_STANDARD_COURSE = 'course'
|
5
|
+
FUNCTION_VIDEO_COURSE = 'video_course'
|
6
|
+
|
7
|
+
include Globalize
|
8
|
+
|
9
|
+
has_many(:units, primary_key: :course_id, foreign_key: :course_id, class_name: GlobalSharedDb::LingochampUnit.to_s)
|
10
|
+
has_many(:lessons, primary_key: :course_id, foreign_key: :course_id, class_name: GlobalSharedDb::LingochampLesson.to_s)
|
11
|
+
has_many(:activities, primary_key: :course_id, foreign_key: :course_id, class_name: GlobalSharedDb::LingochampActivity.to_s)
|
12
|
+
|
13
|
+
data_fields :title, :cover, :description, :translations, :lessons_count, :units_count
|
14
|
+
|
15
|
+
attachment_fields :cover
|
16
|
+
|
17
|
+
validates :course_id, presence: true
|
18
|
+
|
19
|
+
globalize :title, :description
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module GlobalSharedDb
|
2
|
+
class LingochampLesson < BaseDb
|
3
|
+
|
4
|
+
include Globalize
|
5
|
+
|
6
|
+
belongs_to(:course, primary_key: :course_id, class_name: GlobalSharedDb::LingochampCourse.to_s, required: false)
|
7
|
+
belongs_to(:unit, primary_key: :unit_id, class_name: GlobalSharedDb::LingochampUnit.to_s, required: false)
|
8
|
+
has_many(:activities, primary_key: :lesson_id, foreign_key: :lesson_id, class_name: GlobalSharedDb::LingochampActivity.to_s)
|
9
|
+
|
10
|
+
data_fields :title, :cover, :package, :video, :description, :stage, :publication_number, :translations, :lessons_count
|
11
|
+
attachment_fields :cover, :package, :video
|
12
|
+
|
13
|
+
validates :course_id, presence: true
|
14
|
+
validates :unit_id, presence: true
|
15
|
+
validates :lesson_id, presence: true
|
16
|
+
|
17
|
+
globalize :title, :description
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module GlobalSharedDb
|
2
|
+
class LingochampUnit < BaseDb
|
3
|
+
|
4
|
+
include Globalize
|
5
|
+
|
6
|
+
belongs_to(:course, primary_key: :course_id, class_name: GlobalSharedDb::LingochampCourse.to_s, required: false)
|
7
|
+
has_many(:lessons, primary_key: :unit_id, foreign_key: :unit_id, class_name: GlobalSharedDb::LingochampLesson.to_s)
|
8
|
+
has_many(:activities, primary_key: :unit_id, foreign_key: :unit_id, class_name: GlobalSharedDb::LingochampActivity.to_s)
|
9
|
+
|
10
|
+
data_fields :title, :description, :translations, :lessons_count
|
11
|
+
|
12
|
+
validates :course_id, presence: true
|
13
|
+
validates :unit_id, presence: true
|
14
|
+
|
15
|
+
globalize :title, :description
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module GlobalSharedDb
|
2
|
+
module TaskHelper
|
3
|
+
extend self
|
4
|
+
|
5
|
+
MIGRATE_PATH = File.join(GlobalSharedDb.root, 'db/migrate')
|
6
|
+
|
7
|
+
def connect_shared_db
|
8
|
+
if defined?(Octopus)
|
9
|
+
ActiveRecord::Base.octopus_establish_connection(
|
10
|
+
GlobalSharedDb.db_config[GlobalSharedDb.env]
|
11
|
+
)
|
12
|
+
elsif defined?(DbCharmer)
|
13
|
+
ActiveRecord::Base.db_magic(connection: GlobalSharedDb.db_config)
|
14
|
+
else
|
15
|
+
ActiveRecord::Base.establish_connection(GlobalSharedDb.db_config)
|
16
|
+
end
|
17
|
+
|
18
|
+
ActiveRecord::Tasks::DatabaseTasks.instance_eval do
|
19
|
+
instance_variable_set(:@root, Pathname.new(GlobalSharedDb.root))
|
20
|
+
instance_variable_set(:@env, GlobalSharedDb.env)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def current_db
|
25
|
+
GlobalSharedDb.db_config['database']
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
namespace :global_shared_db do
|
2
|
+
namespace :gen do
|
3
|
+
|
4
|
+
desc '产生migration模板文件: `rake shared_db:gen:create_migration"[migration_name]"`'
|
5
|
+
task :create_migration, [:migration_name] => :environment do |_, args|
|
6
|
+
migration_name = args[:migration_name]
|
7
|
+
abort "migration_name can not be blank!" unless migration_name
|
8
|
+
|
9
|
+
migration_class_name = migration_name.split('_').map do |chars|
|
10
|
+
chars[0].upcase + chars[1..-1]
|
11
|
+
end.join
|
12
|
+
|
13
|
+
migration_name = migration_name + '.rb'
|
14
|
+
migration_file_name = [next_migration_number, migration_name].join("_")
|
15
|
+
|
16
|
+
template = <<-TMP
|
17
|
+
class #{migration_class_name} < ActiveRecord::Migration
|
18
|
+
def change
|
19
|
+
end
|
20
|
+
end
|
21
|
+
TMP
|
22
|
+
|
23
|
+
File.open("#{migration_dir}/#{migration_file_name}", 'w+') { |f| f.puts template }
|
24
|
+
end
|
25
|
+
|
26
|
+
def migration_dir
|
27
|
+
File.expand_path('db/migrate', GlobalSharedDb.root)
|
28
|
+
end
|
29
|
+
|
30
|
+
def migrations
|
31
|
+
Dir.glob("#{migration_dir}/[0-9]*_*.rb")
|
32
|
+
end
|
33
|
+
|
34
|
+
def next_migration_number
|
35
|
+
date = Time.now.strftime('%Y%m%d')
|
36
|
+
exist_migrations = migrations.select { |migration| File.basename(migration) =~ /^#{date}/ }
|
37
|
+
next_number = exist_migrations.size + 1
|
38
|
+
suffix = next_number.to_s.rjust(2, '0')
|
39
|
+
"#{date}#{suffix}"
|
40
|
+
end
|
41
|
+
end # namespace
|
42
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require 'mysql2'
|
3
|
+
require 'yaml'
|
4
|
+
require 'zlib'
|
5
|
+
require 'global_shared_db'
|
6
|
+
|
7
|
+
namespace :global_shared_db do
|
8
|
+
desc "create database"
|
9
|
+
task :create do
|
10
|
+
Rake::Task['environment'].invoke rescue nil
|
11
|
+
puts "Create #{GlobalSharedDb::TaskHelper.current_db}"
|
12
|
+
ActiveRecord::Tasks::DatabaseTasks.create(GlobalSharedDb.db_config)
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "migrate database"
|
16
|
+
task :migrate => :environment do
|
17
|
+
GlobalSharedDb::TaskHelper.connect_shared_db
|
18
|
+
puts "Migrate #{GlobalSharedDb::TaskHelper.current_db}"
|
19
|
+
|
20
|
+
migrate!
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "roolback database"
|
24
|
+
task :rollback => :environment do
|
25
|
+
GlobalSharedDb::TaskHelper.connect_shared_db
|
26
|
+
puts "Rollback #{GlobalSharedDb::TaskHelper.current_db}"
|
27
|
+
ActiveRecord::Migrator.rollback(GlobalSharedDb::TaskHelper::MIGRATE_PATH)
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "migrate cms tables"
|
31
|
+
task :migrate_cms_tables => :environment do
|
32
|
+
GlobalSharedDb::TaskHelper.connect_shared_db
|
33
|
+
end
|
34
|
+
|
35
|
+
desc 'shared db schema dump'
|
36
|
+
task :schema_dump => :environment do
|
37
|
+
GlobalSharedDb::TaskHelper.connect_shared_db
|
38
|
+
require 'active_record/schema_dumper'
|
39
|
+
File.open('./db/global_shared_db_schema.rb', 'w:utf-8') do |file|
|
40
|
+
ActiveRecord::SchemaDumper.dump(GlobalSharedDb::BaseDb.connection, file)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
if GlobalSharedDb.env != 'production'
|
45
|
+
desc "delete database"
|
46
|
+
task :drop => :environment do
|
47
|
+
GlobalSharedDb::TaskHelper.connect_shared_db
|
48
|
+
puts "Drop #{GlobalSharedDb::TaskHelper.current_db}"
|
49
|
+
ActiveRecord::Tasks::DatabaseTasks.drop(
|
50
|
+
GlobalSharedDb::BaseDb.connection_pool.spec.config.stringify_keys
|
51
|
+
)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
desc 'shared db schema load'
|
56
|
+
task :schema_load => :environment do
|
57
|
+
file = './db/global_shared_db_schema.rb'
|
58
|
+
put "can not execute this task in production!!!" if GlobalSharedDb.env == 'production'
|
59
|
+
|
60
|
+
if GlobalSharedDb.env != 'production' && File.exist?(file)
|
61
|
+
ActiveRecord::Tasks::DatabaseTasks.load_schema_for(GlobalSharedDb.db_config, :ruby, file)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
desc 'migration status'
|
66
|
+
task :migration_status => :environment do
|
67
|
+
GlobalSharedDb::TaskHelper.connect_shared_db
|
68
|
+
ActiveRecord::Migrator.migrations_path = GlobalSharedDb::TaskHelper::MIGRATE_PATH
|
69
|
+
|
70
|
+
Rake::Task['db:migrate:status'].invoke
|
71
|
+
end
|
72
|
+
|
73
|
+
desc 'current migration verson'
|
74
|
+
task :db_verson => :environment do
|
75
|
+
GlobalSharedDb::TaskHelper.connect_shared_db
|
76
|
+
|
77
|
+
Rake::Task['db:version'].invoke
|
78
|
+
end
|
79
|
+
|
80
|
+
def migrate!
|
81
|
+
if ar_below_520?
|
82
|
+
ActiveRecord::Migrator.migrate(GlobalSharedDb::TaskHelper::MIGRATE_PATH)
|
83
|
+
else
|
84
|
+
ActiveRecord::MigrationContext.new(GlobalSharedDb::TaskHelper::MIGRATE_PATH).migrate
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def ar_below_520?
|
89
|
+
ActiveRecord.gem_version < Gem::Version.new("5.2.0")
|
90
|
+
end
|
91
|
+
end
|
metadata
ADDED
@@ -0,0 +1,261 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: global_shared_db
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.9
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- kaiying.zhang
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-07-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: byebug
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: mysql2
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.3.20
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.3.20
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: database_cleaner
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: factory_bot
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: activerecord
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 4.0.0
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 4.0.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: activesupport
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 4.0.0
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 4.0.0
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: mine_setting
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 0.0.1
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 0.0.1
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: multi_json
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 1.11.2
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 1.11.2
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: globalize
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: 0.1.0
|
188
|
+
type: :runtime
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: 0.1.0
|
195
|
+
description: some shared data.
|
196
|
+
email:
|
197
|
+
- kaiying.zhang@liulishuo.com
|
198
|
+
executables: []
|
199
|
+
extensions: []
|
200
|
+
extra_rdoc_files: []
|
201
|
+
files:
|
202
|
+
- ".gitignore"
|
203
|
+
- ".gitlab-ci.yml"
|
204
|
+
- ".rspec"
|
205
|
+
- CODE_OF_CONDUCT.md
|
206
|
+
- Gemfile
|
207
|
+
- LICENSE.txt
|
208
|
+
- README.md
|
209
|
+
- Rakefile
|
210
|
+
- bin/console
|
211
|
+
- bin/setup
|
212
|
+
- config/global_shared_db.example.yml
|
213
|
+
- config/settings/base.yml
|
214
|
+
- db/global_shared_db_schema.rb
|
215
|
+
- db/migrate/2018052101_create_lingochamp_courses.rb
|
216
|
+
- db/migrate/2018052102_create_lingochamp_units.rb
|
217
|
+
- db/migrate/2018052103_create_lingochamp_lessons.rb
|
218
|
+
- db/migrate/2018052104_create_lingochamp_activities.rb
|
219
|
+
- gemfiles/5.0.gemfile
|
220
|
+
- gemfiles/5.1.gemfile
|
221
|
+
- gemfiles/5.2.gemfile
|
222
|
+
- global_shared_db.gemspec
|
223
|
+
- lib/global_shared_db.rb
|
224
|
+
- lib/global_shared_db/concerns/attachment_field.rb
|
225
|
+
- lib/global_shared_db/concerns/data_field.rb
|
226
|
+
- lib/global_shared_db/load_tasks.rb
|
227
|
+
- lib/global_shared_db/models/base_db.rb
|
228
|
+
- lib/global_shared_db/models/lingochamp_activity.rb
|
229
|
+
- lib/global_shared_db/models/lingochamp_course.rb
|
230
|
+
- lib/global_shared_db/models/lingochamp_lesson.rb
|
231
|
+
- lib/global_shared_db/models/lingochamp_unit.rb
|
232
|
+
- lib/global_shared_db/settings.rb
|
233
|
+
- lib/global_shared_db/task_helper.rb
|
234
|
+
- lib/global_shared_db/version.rb
|
235
|
+
- lib/tasks/generator.rake
|
236
|
+
- lib/tasks/global_shared_db.rake
|
237
|
+
homepage: ''
|
238
|
+
licenses:
|
239
|
+
- MIT
|
240
|
+
metadata: {}
|
241
|
+
post_install_message:
|
242
|
+
rdoc_options: []
|
243
|
+
require_paths:
|
244
|
+
- lib
|
245
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
246
|
+
requirements:
|
247
|
+
- - ">="
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
version: '0'
|
250
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
251
|
+
requirements:
|
252
|
+
- - ">="
|
253
|
+
- !ruby/object:Gem::Version
|
254
|
+
version: '0'
|
255
|
+
requirements: []
|
256
|
+
rubyforge_project:
|
257
|
+
rubygems_version: 2.6.14
|
258
|
+
signing_key:
|
259
|
+
specification_version: 4
|
260
|
+
summary: some shared data.
|
261
|
+
test_files: []
|