automigration 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +6 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +50 -0
- data/Rakefile +18 -0
- data/automigration.gemspec +24 -0
- data/lib/automigration/base_extention.rb +15 -0
- data/lib/automigration/fields/belongs_to.rb +29 -0
- data/lib/automigration/fields/boolean.rb +9 -0
- data/lib/automigration/fields/date.rb +9 -0
- data/lib/automigration/fields/datetime.rb +9 -0
- data/lib/automigration/fields/float.rb +9 -0
- data/lib/automigration/fields/integer.rb +9 -0
- data/lib/automigration/fields/password.rb +9 -0
- data/lib/automigration/fields/string.rb +9 -0
- data/lib/automigration/fields/sys/base.rb +95 -0
- data/lib/automigration/fields/sys/db_column.rb +36 -0
- data/lib/automigration/fields/sys/keeper.rb +113 -0
- data/lib/automigration/fields/sys/slice_creater.rb +32 -0
- data/lib/automigration/fields/text.rb +9 -0
- data/lib/automigration/fields/time.rb +9 -0
- data/lib/automigration/migrator.rb +189 -0
- data/lib/automigration/version.rb +3 -0
- data/lib/automigration.rb +42 -0
- data/lib/tasks/automigration.rake +8 -0
- data/log/.gitkeep +0 -0
- data/test/auto_migration_test.rb +186 -0
- data/test/belongs_to_test.rb +51 -0
- data/test/db_column_test.rb +23 -0
- data/test/fields/accessible_test.rb +13 -0
- data/test/fields_test.rb +34 -0
- data/test/models/accessible_model.rb +6 -0
- data/test/models/auto_migration1.rb +14 -0
- data/test/models/auto_migration1a.rb +7 -0
- data/test/models/auto_migration2.rb +8 -0
- data/test/models/auto_migration3.rb +5 -0
- data/test/models/belongs_to_model.rb +9 -0
- data/test/models/boolean_model.rb +5 -0
- data/test/models/form_field.rb +6 -0
- data/test/models/form_field2.rb +6 -0
- data/test/models/local_name.rb +5 -0
- data/test/models/local_name2.rb +5 -0
- data/test/models/not_automigrable.rb +2 -0
- data/test/models/searchable.rb +6 -0
- data/test/models/simple.rb +5 -0
- data/test/models/user1.rb +7 -0
- data/test/test_helper.rb +34 -0
- metadata +131 -0
data/test/test_helper.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
require 'automigration'
|
4
|
+
require 'test/unit'
|
5
|
+
require 'rails'
|
6
|
+
require 'action_controller/railtie'
|
7
|
+
require 'active_record'
|
8
|
+
|
9
|
+
# fake rails application
|
10
|
+
class AutomigrateApplication < Rails::Application
|
11
|
+
config.active_support.deprecation = :log
|
12
|
+
end
|
13
|
+
AutomigrateApplication.initialize!
|
14
|
+
|
15
|
+
# AR connection
|
16
|
+
ActiveRecord::Base.establish_connection(
|
17
|
+
:adapter => 'postgresql',
|
18
|
+
:database => 'automigration_test'
|
19
|
+
)
|
20
|
+
|
21
|
+
# whitelist attributes
|
22
|
+
ActiveRecord::Base.attr_accessible nil
|
23
|
+
|
24
|
+
# load test models
|
25
|
+
Dir[File.expand_path("../models/*.rb", __FILE__)].each do |file|
|
26
|
+
require file
|
27
|
+
end
|
28
|
+
|
29
|
+
# prepare tables for test models
|
30
|
+
Automigration::Migrator.set_models_load_path([File.expand_path("../models", __FILE__)])
|
31
|
+
Automigration::Migrator.all_tables.each do |table|
|
32
|
+
ActiveRecord::Base.connection.drop_table(table)
|
33
|
+
end
|
34
|
+
Automigration::Migrator.new(:skip_output => true).update_schema!
|
metadata
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: automigration
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Alexey Vakhov
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-03-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: &85450600 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.1'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *85450600
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: ansi
|
27
|
+
requirement: &85450390 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *85450390
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: pg
|
38
|
+
requirement: &85450160 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *85450160
|
47
|
+
description: Store your migrations direct in models
|
48
|
+
email:
|
49
|
+
- vakhov@gmail.com
|
50
|
+
executables: []
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- .gitignore
|
55
|
+
- Gemfile
|
56
|
+
- LICENSE
|
57
|
+
- README.md
|
58
|
+
- Rakefile
|
59
|
+
- automigration.gemspec
|
60
|
+
- lib/automigration.rb
|
61
|
+
- lib/automigration/base_extention.rb
|
62
|
+
- lib/automigration/fields/belongs_to.rb
|
63
|
+
- lib/automigration/fields/boolean.rb
|
64
|
+
- lib/automigration/fields/date.rb
|
65
|
+
- lib/automigration/fields/datetime.rb
|
66
|
+
- lib/automigration/fields/float.rb
|
67
|
+
- lib/automigration/fields/integer.rb
|
68
|
+
- lib/automigration/fields/password.rb
|
69
|
+
- lib/automigration/fields/string.rb
|
70
|
+
- lib/automigration/fields/sys/base.rb
|
71
|
+
- lib/automigration/fields/sys/db_column.rb
|
72
|
+
- lib/automigration/fields/sys/keeper.rb
|
73
|
+
- lib/automigration/fields/sys/slice_creater.rb
|
74
|
+
- lib/automigration/fields/text.rb
|
75
|
+
- lib/automigration/fields/time.rb
|
76
|
+
- lib/automigration/migrator.rb
|
77
|
+
- lib/automigration/version.rb
|
78
|
+
- lib/tasks/automigration.rake
|
79
|
+
- log/.gitkeep
|
80
|
+
- test/auto_migration_test.rb
|
81
|
+
- test/belongs_to_test.rb
|
82
|
+
- test/db_column_test.rb
|
83
|
+
- test/fields/accessible_test.rb
|
84
|
+
- test/fields_test.rb
|
85
|
+
- test/models/accessible_model.rb
|
86
|
+
- test/models/auto_migration1.rb
|
87
|
+
- test/models/auto_migration1a.rb
|
88
|
+
- test/models/auto_migration2.rb
|
89
|
+
- test/models/auto_migration3.rb
|
90
|
+
- test/models/belongs_to_model.rb
|
91
|
+
- test/models/boolean_model.rb
|
92
|
+
- test/models/form_field.rb
|
93
|
+
- test/models/form_field2.rb
|
94
|
+
- test/models/local_name.rb
|
95
|
+
- test/models/local_name2.rb
|
96
|
+
- test/models/not_automigrable.rb
|
97
|
+
- test/models/searchable.rb
|
98
|
+
- test/models/simple.rb
|
99
|
+
- test/models/user1.rb
|
100
|
+
- test/test_helper.rb
|
101
|
+
homepage: ''
|
102
|
+
licenses: []
|
103
|
+
post_install_message:
|
104
|
+
rdoc_options: []
|
105
|
+
require_paths:
|
106
|
+
- lib
|
107
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
108
|
+
none: false
|
109
|
+
requirements:
|
110
|
+
- - ! '>='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
segments:
|
114
|
+
- 0
|
115
|
+
hash: 429303219
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
none: false
|
118
|
+
requirements:
|
119
|
+
- - ! '>='
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '0'
|
122
|
+
segments:
|
123
|
+
- 0
|
124
|
+
hash: 429303219
|
125
|
+
requirements: []
|
126
|
+
rubyforge_project: automigration
|
127
|
+
rubygems_version: 1.8.17
|
128
|
+
signing_key:
|
129
|
+
specification_version: 3
|
130
|
+
summary: AR automigration
|
131
|
+
test_files: []
|