paraphraser 0.1.0 → 0.1.1

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.0
1
+ 0.1.1
data/lib/convertor.rb ADDED
@@ -0,0 +1,54 @@
1
+ module Paraphraser
2
+ class Convertor
3
+
4
+ @@direction = :up
5
+ cattr_accessor :direction
6
+
7
+ @@migrations_path = 'db/migrate'
8
+ cattr_accessor :migrations_path
9
+
10
+ class << self
11
+
12
+ def convert
13
+ with_activerecord_stubbed do
14
+ migrations.each { |migration| migration.migrate(direction) }
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ def connection
21
+ ActiveRecord::Base.connection
22
+ end
23
+
24
+ def migrations
25
+ @migrations ||= ActiveRecord::Migrator.new(direction, migrations_path).migrations
26
+ end
27
+
28
+ def with_activerecord_stubbed(&block)
29
+ apply_stubs
30
+ yield
31
+ reset_stubs
32
+ end
33
+
34
+ def apply_stubs
35
+ connection.instance_eval do
36
+ alias_method :real_execute, :execute
37
+
38
+ def execute(*args)
39
+ p '--', args.first
40
+ end
41
+ end
42
+ end
43
+
44
+ def reset_stubs
45
+ connection.instance_eval do
46
+ alias_method :execute, :real_execute
47
+ end
48
+ end
49
+
50
+ end
51
+
52
+ end
53
+ end
54
+
data/paraphraser.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{paraphraser}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
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"]
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
  "README.rdoc",
25
25
  "Rakefile",
26
26
  "VERSION",
27
- "lib/paraphraser.rb",
27
+ "lib/convertor.rb",
28
28
  "paraphraser.gemspec",
29
29
  "test/helper.rb",
30
30
  "test/test_paraphraser.rb"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Vinay Patel
@@ -64,7 +64,7 @@ files:
64
64
  - README.rdoc
65
65
  - Rakefile
66
66
  - VERSION
67
- - lib/paraphraser.rb
67
+ - lib/convertor.rb
68
68
  - paraphraser.gemspec
69
69
  - test/helper.rb
70
70
  - test/test_paraphraser.rb
@@ -82,7 +82,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
82
  requirements:
83
83
  - - ">="
84
84
  - !ruby/object:Gem::Version
85
- hash: -463811311
85
+ hash: 750516335
86
86
  segments:
87
87
  - 0
88
88
  version: "0"
data/lib/paraphraser.rb DELETED
File without changes