sga_fields_synchronizer 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
@@ -26,7 +26,6 @@ class FieldsSynchronizerGenerator < Rails::Generator::Base
|
|
26
26
|
end
|
27
27
|
|
28
28
|
elsif(@action_to_invoke == "sync")
|
29
|
-
|
30
29
|
FieldsReader.init
|
31
30
|
skipped_tables = (options[:skipped_table] || []) << "common_fields"
|
32
31
|
dictionary = File.join(RAILS_ROOT,'config','fields_dictionary.yml')
|
@@ -78,7 +77,8 @@ class FieldsSynchronizerGenerator < Rails::Generator::Base
|
|
78
77
|
|
79
78
|
def get_to_be_deleted_columns tab_cols, tgt_cols
|
80
79
|
tab_cols_dup = tab_cols.dup
|
81
|
-
|
80
|
+
tgt_col_keys = tgt_cols.keys.collect{|key| (key =~ /^\d{1,}([^\d].*)$/) ? $1 : key}
|
81
|
+
tab_cols_dup.delete_if{|k,v| tgt_col_keys.include?(k)}
|
82
82
|
tab_cols_dup
|
83
83
|
end
|
84
84
|
|
@@ -90,21 +90,24 @@ class FieldsSynchronizerGenerator < Rails::Generator::Base
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def get_changed_columns tab_cols, tgt_cols
|
93
|
-
|
93
|
+
tgt_cols_hash = {}
|
94
|
+
tgt_col_keys = tgt_cols.keys.collect{|key| (key =~ /^\d{1,}([^\d].*)$/) ? (tgt_cols_hash[$1] = key; $1) : key}
|
95
|
+
(tab_cols.keys & tgt_col_keys).inject({}) do |hash, col|
|
94
96
|
origin_type = tab_cols[col].type.to_s
|
95
|
-
|
97
|
+
target_col = tgt_cols_hash[col] || col
|
98
|
+
target_type = tgt_cols[target_col][1]
|
96
99
|
if origin_type == target_type
|
97
|
-
unless(target_col_options = tgt_cols[
|
100
|
+
unless(target_col_options = tgt_cols[target_col][2]).blank?
|
98
101
|
[:null, :default, :limit, :precision, :scale].each do |k|
|
99
102
|
next unless target_col_options.keys.include?(k)
|
100
103
|
if target_col_options[k] != tab_cols[col].send(k)
|
101
|
-
hash[col] = [tgt_cols[
|
104
|
+
hash[col] = [tgt_cols[target_col], tab_cols[col]]
|
102
105
|
break
|
103
106
|
end
|
104
107
|
end
|
105
108
|
end
|
106
109
|
else
|
107
|
-
hash[col] = [tgt_cols[
|
110
|
+
hash[col] = [tgt_cols[target_col], tab_cols[col]]
|
108
111
|
end
|
109
112
|
hash
|
110
113
|
end
|
@@ -112,8 +115,12 @@ class FieldsSynchronizerGenerator < Rails::Generator::Base
|
|
112
115
|
|
113
116
|
def get_added_columns tab_cols, tgt_cols
|
114
117
|
tgt_dup = tgt_cols.dup
|
115
|
-
|
116
|
-
tgt_dup
|
118
|
+
converted_cols = {}
|
119
|
+
tgt_dup.each_pair do |k,v|
|
120
|
+
converted_cols[(k =~ /^\d{1,}([^\d].*)$/) ? $1 : k] = v
|
121
|
+
end
|
122
|
+
converted_cols.delete_if {|k,v| tab_cols.keys.include?(k)}
|
123
|
+
converted_cols
|
117
124
|
end
|
118
125
|
|
119
126
|
def migration_prefix
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# 属性名
|
6
6
|
# - 前台显示名称
|
7
7
|
# - 数据类型
|
8
|
-
# -
|
8
|
+
# - [最小值,最大值]
|
9
9
|
|
10
10
|
|
11
11
|
####################################################
|
@@ -16,194 +16,153 @@
|
|
16
16
|
configs:
|
17
17
|
|
18
18
|
common_fields: &common_fields
|
19
|
-
|
19
|
+
1id:
|
20
|
+
- "Id"
|
21
|
+
- "integer"
|
22
|
+
- :null: false
|
23
|
+
:primary: true
|
24
|
+
:limit: 4
|
25
|
+
2created_at:
|
26
|
+
- "创建时间"
|
27
|
+
- "datetime"
|
28
|
+
3updated_at:
|
29
|
+
- "更新时间"
|
30
|
+
- "datetime"
|
31
|
+
4name:
|
20
32
|
- "名称"
|
21
33
|
- "string"
|
22
|
-
|
34
|
+
5job_id:
|
23
35
|
- "职业类型"
|
24
36
|
- "integer"
|
25
|
-
|
26
|
-
:default: 1
|
27
|
-
level:
|
37
|
+
6level:
|
28
38
|
- "等级"
|
29
39
|
- "integer"
|
30
|
-
|
31
|
-
health_point:
|
40
|
+
7health_point:
|
32
41
|
- "生命值"
|
33
42
|
- "integer"
|
34
|
-
|
43
|
+
8max_health_point:
|
35
44
|
- "生命上限"
|
36
45
|
- "integer"
|
37
|
-
|
46
|
+
9magic_point:
|
38
47
|
- "魔法值"
|
39
48
|
- "integer"
|
40
|
-
|
49
|
+
10max_magic_point:
|
41
50
|
- "魔法上限"
|
42
51
|
- "integer"
|
43
|
-
|
52
|
+
11max_attack_point:
|
44
53
|
- "最大攻击力"
|
45
54
|
- "integer"
|
46
|
-
|
55
|
+
12min_attack_point:
|
47
56
|
- "最小攻击力"
|
48
57
|
- "integer"
|
49
|
-
|
58
|
+
13max_magic_attack_point:
|
50
59
|
- "最大法术攻击力"
|
51
60
|
- "integer"
|
52
|
-
|
61
|
+
14min_magic_attack_point:
|
53
62
|
- "最小法术攻击力"
|
54
63
|
- "integer"
|
55
|
-
|
64
|
+
15max_defence_point:
|
56
65
|
- "最大防御力"
|
57
66
|
- "integer"
|
58
|
-
|
67
|
+
16min_defence_point:
|
59
68
|
- "最小防御力"
|
60
69
|
- "integer"
|
61
|
-
|
70
|
+
17max_magic_defence_point:
|
62
71
|
- "最大法术防御力"
|
63
72
|
- "integer"
|
64
|
-
|
73
|
+
18min_magic_defence_point:
|
65
74
|
- "最小法术防御力"
|
66
75
|
- "integer"
|
67
|
-
|
76
|
+
19health_restore_speed:
|
68
77
|
- "生命恢复"
|
69
78
|
- "integer"
|
70
|
-
|
79
|
+
20magic_restore_speed:
|
71
80
|
- "法力恢复"
|
72
81
|
- "integer"
|
73
|
-
|
74
|
-
- "
|
82
|
+
21hit_rate:
|
83
|
+
- "命中率"
|
75
84
|
- "integer"
|
76
|
-
|
77
|
-
- "
|
85
|
+
22attack_dodge_rate:
|
86
|
+
- "闪避率"
|
78
87
|
- "integer"
|
79
|
-
|
80
|
-
- "物理闪避率"
|
81
|
-
- "integer"
|
82
|
-
magic_dodge_rate:
|
83
|
-
- "魔法闪避率"
|
84
|
-
- "integer"
|
85
|
-
power_hit_rate:
|
88
|
+
23power_hit_rate:
|
86
89
|
- "暴击率"
|
87
90
|
- "integer"
|
88
|
-
|
91
|
+
24power_hit_point:
|
89
92
|
- "暴击威力"
|
90
93
|
- "integer"
|
91
|
-
|
94
|
+
25explode_point:
|
92
95
|
- "爆发值"
|
93
96
|
- "integer"
|
94
|
-
|
97
|
+
26luck_point:
|
95
98
|
- "幸运值"
|
96
99
|
- "integer"
|
97
|
-
|
100
|
+
27defence_rate:
|
98
101
|
- "伤害减免概率"
|
99
102
|
- "integer"
|
100
|
-
|
103
|
+
28defence_level:
|
101
104
|
- "伤害减免等级"
|
102
105
|
- "integer"
|
103
|
-
|
106
|
+
29move_speed:
|
104
107
|
- "行走速度"
|
105
108
|
- "integer"
|
106
|
-
|
109
|
+
30attack_speed:
|
107
110
|
- "攻击速度"
|
108
111
|
- "integer"
|
109
|
-
fire_attack:
|
110
|
-
- "火属性伤害"
|
111
|
-
- "integer"
|
112
|
-
thunder_attack:
|
113
|
-
- "雷属性伤害"
|
114
|
-
- "integer"
|
115
|
-
ice_attack:
|
116
|
-
- "冰属性伤害"
|
117
|
-
- "integer"
|
118
|
-
poison_attack:
|
119
|
-
- "毒属性伤害"
|
120
|
-
- "integer"
|
121
|
-
fire_defence:
|
122
|
-
- "火属性防御"
|
123
|
-
- "integer"
|
124
|
-
thunder_defence:
|
125
|
-
- "雷属性防御"
|
126
|
-
- "integer"
|
127
|
-
ice_defence:
|
128
|
-
- "冰属性防御"
|
129
|
-
- "integer"
|
130
|
-
poison_defence:
|
131
|
-
- "毒属性防御"
|
132
|
-
- "integer"
|
133
112
|
|
134
|
-
|
135
|
-
############ PlayerCharacter Fields ########
|
136
|
-
############ Last edited by Tengxianggong ########
|
137
|
-
############ Last edited at Jun 17, 2010 ########
|
138
|
-
####################################################
|
139
|
-
|
140
|
-
player_characters:
|
113
|
+
monsters:
|
141
114
|
|
142
115
|
<<: *common_fields
|
143
116
|
|
144
|
-
|
145
|
-
- "
|
146
|
-
- "
|
147
|
-
|
148
|
-
|
149
|
-
- "
|
150
|
-
hair_style:
|
151
|
-
- "发型"
|
152
|
-
- "integer"
|
153
|
-
hair_color:
|
154
|
-
- "发色"
|
155
|
-
- "integer"
|
156
|
-
exp:
|
157
|
-
- "经验值"
|
158
|
-
- "integer"
|
159
|
-
stage:
|
160
|
-
- "修仙阶段"
|
161
|
-
- "integer"
|
162
|
-
skill_point:
|
163
|
-
- "元神点数"
|
164
|
-
- "integer"
|
165
|
-
fame_point:
|
166
|
-
- "声望值"
|
117
|
+
0nick_name:
|
118
|
+
- "内部代号"
|
119
|
+
- "string"
|
120
|
+
|
121
|
+
32health_point_line_n:
|
122
|
+
- "生命值倍数"
|
167
123
|
- "integer"
|
168
|
-
|
169
|
-
- "
|
124
|
+
33move_kind:
|
125
|
+
- "移动类型"
|
170
126
|
- "integer"
|
171
|
-
|
172
|
-
- "
|
127
|
+
34injury_type:
|
128
|
+
- "受伤类型"
|
173
129
|
- "integer"
|
174
|
-
|
175
|
-
- "
|
130
|
+
35death_effect:
|
131
|
+
- "死亡特效"
|
176
132
|
- "integer"
|
177
|
-
|
178
|
-
- "
|
133
|
+
36base_bonus_rate:
|
134
|
+
- "基础爆率"
|
179
135
|
- "integer"
|
180
|
-
|
181
|
-
- "
|
136
|
+
37bonus_n:
|
137
|
+
- "爆出数量"
|
182
138
|
- "integer"
|
183
|
-
|
184
|
-
- "
|
139
|
+
38bonus_exp:
|
140
|
+
- "奖励经验"
|
185
141
|
- "integer"
|
186
|
-
|
187
|
-
- "
|
142
|
+
90version: # Runmway development columns # Monster acts_as_versioned magic column
|
143
|
+
- "版本"
|
188
144
|
- "integer"
|
189
|
-
|
190
|
-
- "
|
145
|
+
39priority:
|
146
|
+
- "开发优先级"
|
191
147
|
- "integer"
|
192
|
-
|
193
|
-
- "
|
148
|
+
98user_id:
|
149
|
+
- "创建者"
|
194
150
|
- "integer"
|
195
|
-
|
196
|
-
- "
|
151
|
+
39monster_id:
|
152
|
+
- "父怪兽" #clone monster
|
197
153
|
- "integer"
|
198
|
-
|
199
|
-
- "
|
154
|
+
40guard_distance:
|
155
|
+
- "警戒范围"
|
200
156
|
- "integer"
|
201
|
-
|
202
|
-
- "
|
157
|
+
41call_distance:
|
158
|
+
- "呼叫距离"
|
203
159
|
- "integer"
|
204
|
-
|
205
|
-
- "
|
160
|
+
42yield_rate:
|
161
|
+
- "物品爆率"
|
206
162
|
- "integer"
|
207
|
-
|
208
|
-
- "
|
163
|
+
43white_box:
|
164
|
+
- "动态属性"
|
165
|
+
- "text"
|
166
|
+
44board_icon_id:
|
167
|
+
- "头像"
|
209
168
|
- "integer"
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sga_fields_synchronizer}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["tim.teng"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-01-14}
|
13
13
|
s.description = %q{ A synchronizer for most frequently edited columns based on yml file}
|
14
14
|
s.email = %q{tim.rubist@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 3
|
9
|
+
version: 0.1.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- tim.teng
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2011-01-14 00:00:00 +08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|