migreazy 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +1 -1
  3. data/VERSION +1 -1
  4. data/lib/migreazy.rb +16 -13
  5. data/migreazy.gemspec +9 -8
  6. metadata +12 -16
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 733f6436b7b36b9472ed4a515de86f7ded75a639
4
+ data.tar.gz: 8d6a4f247db9e4920a43b3bf504ac030e5f5253f
5
+ SHA512:
6
+ metadata.gz: 283a6be192ed09491b75a62798fe3ba98e6d4f8607723c0c16c24cdf3b4c5e35e84ce1d8033eb06b8f05d2ff29b6246d877ddfb023a4615ccf9eeca518183915
7
+ data.tar.gz: 704da8c44a49441c3bb833ad2ca9ddb1d06921fc991c977891a0fc69cb1974d9f694e48e20146497eb92841968822ef49177c4fbf778cd2451c1cb5b019b9725
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ begin
7
7
  gem.email = "sera@fhwang.net"
8
8
  gem.homepage = "http://github.com/fhwang/migreazy"
9
9
  gem.authors = ["Francis Hwang"]
10
- gem.add_dependency 'grit'
10
+ gem.add_dependency 'rugged', '~> 0.21.0'
11
11
  end
12
12
  Jeweler::GemcutterTasks.new
13
13
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.2
1
+ 2.0.3
@@ -1,4 +1,4 @@
1
- require 'grit'
1
+ require 'rugged'
2
2
 
3
3
  module Migreazy
4
4
  @@db_connected = false
@@ -11,6 +11,15 @@ module Migreazy
11
11
  end
12
12
  end
13
13
 
14
+ def self.migration_numbers(branch_name)
15
+ repo = Rugged::Repository.new '.'
16
+ branch = repo.branches[branch_name]
17
+ db_oid = branch.target.tree['db'][:oid]
18
+ migrate_oid = repo.lookup(db_oid)['migrate'][:oid]
19
+ all_migrations = repo.lookup(migrate_oid).map { |e| e[:name] }
20
+ all_migrations.map { |name| name.gsub(/^0*(\d+)_.*/, '\1') }
21
+ end
22
+
14
23
  class Action
15
24
  def initialize(args)
16
25
  @args = args
@@ -85,14 +94,13 @@ module Migreazy
85
94
  end
86
95
 
87
96
  def run
88
- repo = Grit::Repo.new '.'
89
- branches = repo.heads.select { |head|
90
- (head.commit.tree / "db/migrate").contents.any? { |blob|
91
- blob.name =~ /^0*#{@migration_number}/
92
- }
97
+ repo = Rugged::Repository.new '.'
98
+ local_branches = repo.branches.each_name(:local).sort
99
+ matching_branches = local_branches.select { |branch_name|
100
+ Migreazy.migration_numbers(branch_name).include?(@migration_number)
93
101
  }
94
102
  puts "Migration #{@migration_number} found in " +
95
- branches.map(&:name).join(', ')
103
+ matching_branches.join(', ')
96
104
  end
97
105
  end
98
106
  end
@@ -124,12 +132,7 @@ module Migreazy
124
132
  class GitBranch < Source
125
133
  def initialize(git_branch_name)
126
134
  @git_branch_name = git_branch_name
127
- repo = Grit::Repo.new '.'
128
- head = repo.heads.detect { |h| h.name == @git_branch_name }
129
- all_migrations = (head.commit.tree / "db/migrate").contents
130
- @migrations = all_migrations.map { |blob|
131
- blob.name.gsub(/^0*(\d+)_.*/, '\1')
132
- }
135
+ @migrations = Migreazy.migration_numbers(git_branch_name)
133
136
  end
134
137
 
135
138
  def description
@@ -2,14 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: migreazy 2.0.3 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
8
  s.name = "migreazy"
8
- s.version = "2.0.2"
9
+ s.version = "2.0.3"
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
11
13
  s.authors = ["Francis Hwang"]
12
- s.date = "2014-01-13"
14
+ s.date = "2014-06-29"
13
15
  s.description = "migreazy helps manage Rails migrations across git branches."
14
16
  s.email = "sera@fhwang.net"
15
17
  s.executables = ["migreazy"]
@@ -26,20 +28,19 @@ Gem::Specification.new do |s|
26
28
  "migreazy.gemspec"
27
29
  ]
28
30
  s.homepage = "http://github.com/fhwang/migreazy"
29
- s.require_paths = ["lib"]
30
- s.rubygems_version = "1.8.23"
31
+ s.rubygems_version = "2.2.2"
31
32
  s.summary = "migreazy helps manage Rails migrations across git branches."
32
33
 
33
34
  if s.respond_to? :specification_version then
34
- s.specification_version = 3
35
+ s.specification_version = 4
35
36
 
36
37
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
37
- s.add_runtime_dependency(%q<grit>, [">= 0"])
38
+ s.add_runtime_dependency(%q<rugged>, ["~> 0.21.0"])
38
39
  else
39
- s.add_dependency(%q<grit>, [">= 0"])
40
+ s.add_dependency(%q<rugged>, ["~> 0.21.0"])
40
41
  end
41
42
  else
42
- s.add_dependency(%q<grit>, [">= 0"])
43
+ s.add_dependency(%q<rugged>, ["~> 0.21.0"])
43
44
  end
44
45
  end
45
46
 
metadata CHANGED
@@ -1,32 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: migreazy
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
5
- prerelease:
4
+ version: 2.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Francis Hwang
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-01-13 00:00:00.000000000 Z
11
+ date: 2014-06-29 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: grit
14
+ name: rugged
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: '0'
19
+ version: 0.21.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '0'
26
+ version: 0.21.0
30
27
  description: migreazy helps manage Rails migrations across git branches.
31
28
  email: sera@fhwang.net
32
29
  executables:
@@ -44,26 +41,25 @@ files:
44
41
  - migreazy.gemspec
45
42
  homepage: http://github.com/fhwang/migreazy
46
43
  licenses: []
44
+ metadata: {}
47
45
  post_install_message:
48
46
  rdoc_options: []
49
47
  require_paths:
50
48
  - lib
51
49
  required_ruby_version: !ruby/object:Gem::Requirement
52
- none: false
53
50
  requirements:
54
- - - ! '>='
51
+ - - ">="
55
52
  - !ruby/object:Gem::Version
56
53
  version: '0'
57
54
  required_rubygems_version: !ruby/object:Gem::Requirement
58
- none: false
59
55
  requirements:
60
- - - ! '>='
56
+ - - ">="
61
57
  - !ruby/object:Gem::Version
62
58
  version: '0'
63
59
  requirements: []
64
60
  rubyforge_project:
65
- rubygems_version: 1.8.23
61
+ rubygems_version: 2.2.2
66
62
  signing_key:
67
- specification_version: 3
63
+ specification_version: 4
68
64
  summary: migreazy helps manage Rails migrations across git branches.
69
65
  test_files: []