paraphraser 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/paraphraser/convertor.rb +15 -6
- data/paraphraser.gemspec +2 -3
- metadata +4 -5
- data/lib/paraphraser/kernel_ext.rb +0 -13
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.4
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__), 'kernel_ext'))
|
2
|
-
|
3
1
|
module Paraphraser
|
4
2
|
class Convertor
|
5
3
|
|
@@ -12,12 +10,14 @@ module Paraphraser
|
|
12
10
|
class << self
|
13
11
|
|
14
12
|
def convert
|
13
|
+
apply_obj_overrides
|
14
|
+
|
15
15
|
exit(0) unless agree_to_proceed?
|
16
16
|
|
17
17
|
Rake::Task['db:drop'].invoke
|
18
18
|
Rake::Task['db:create'].invoke
|
19
19
|
|
20
|
-
|
20
|
+
with_ar_stubbed do
|
21
21
|
announce "CreateSchemaMigrations"
|
22
22
|
migrations.each do |migration|
|
23
23
|
announce "#{migration.version} : #{migration.name}"
|
@@ -56,13 +56,13 @@ module Paraphraser
|
|
56
56
|
@@migrations ||= ActiveRecord::Migrator.new(direction, migrations_path).migrations
|
57
57
|
end
|
58
58
|
|
59
|
-
def
|
59
|
+
def with_ar_stubbed(&block)
|
60
60
|
ActiveRecord::Migration.verbose = false
|
61
|
-
|
61
|
+
apply_ar_overrides
|
62
62
|
yield
|
63
63
|
end
|
64
64
|
|
65
|
-
def
|
65
|
+
def apply_ar_overrides
|
66
66
|
connection.class.send(:define_method, :execute_with_paraphrasing) do |sql, name = nil|
|
67
67
|
print "#{sql};\n" and STDOUT.flush unless sql =~ /^SHOW/
|
68
68
|
execute_without_paraphrasing sql, name
|
@@ -70,6 +70,15 @@ module Paraphraser
|
|
70
70
|
connection.class.send(:alias_method_chain, :execute, :paraphrasing)
|
71
71
|
end
|
72
72
|
|
73
|
+
def apply_obj_overrides
|
74
|
+
Object.send(:define_method, :migration_file) { @@file ||= File.open('migration.sql', 'w') }
|
75
|
+
Object.send(:define_method, :print_with_file_output) do |string|
|
76
|
+
migration_file.write string
|
77
|
+
print_without_file_output(string)
|
78
|
+
end
|
79
|
+
Object.send(:alias_method_chain, :print, :file_output)
|
80
|
+
end
|
81
|
+
|
73
82
|
def update_schema_migrations_table(version)
|
74
83
|
connection.execute "INSERT INTO `schema_migrations` (version) VALUES ('#{version}')"
|
75
84
|
end
|
data/paraphraser.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{paraphraser}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Vinay Patel"]
|
12
|
-
s.date = %q{2011-01-
|
12
|
+
s.date = %q{2011-01-07}
|
13
13
|
s.description = %q{Paraphraser, is a very simple gem.
|
14
14
|
It adds a rake task that will drop, re-create and migrate a database (default is test) and will output the sql generated in the migration process.
|
15
15
|
It will output the sql to screen as well as to a file ./migration.sql.
|
@@ -29,7 +29,6 @@ It will output the sql to screen as well as to a file ./migration.sql.
|
|
29
29
|
"VERSION",
|
30
30
|
"lib/paraphraser.rb",
|
31
31
|
"lib/paraphraser/convertor.rb",
|
32
|
-
"lib/paraphraser/kernel_ext.rb",
|
33
32
|
"lib/paraphraser/railtie.rb",
|
34
33
|
"lib/paraphraser/railties/paraphraser.rake",
|
35
34
|
"paraphraser.gemspec",
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 4
|
9
|
+
version: 1.0.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Vinay Patel
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-01-
|
17
|
+
date: 2011-01-07 00:00:00 -06:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -70,7 +70,6 @@ files:
|
|
70
70
|
- VERSION
|
71
71
|
- lib/paraphraser.rb
|
72
72
|
- lib/paraphraser/convertor.rb
|
73
|
-
- lib/paraphraser/kernel_ext.rb
|
74
73
|
- lib/paraphraser/railtie.rb
|
75
74
|
- lib/paraphraser/railties/paraphraser.rake
|
76
75
|
- paraphraser.gemspec
|
@@ -90,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
89
|
requirements:
|
91
90
|
- - ">="
|
92
91
|
- !ruby/object:Gem::Version
|
93
|
-
hash: -
|
92
|
+
hash: -510589165
|
94
93
|
segments:
|
95
94
|
- 0
|
96
95
|
version: "0"
|