mschuerig-branch_db 0.0.8 → 0.0.9

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.
@@ -15,7 +15,7 @@ Give each git branch its own databases for ActiveRecord.
15
15
  == SYNOPSIS:
16
16
 
17
17
  Put the following block of code into config/environment.rb *before*
18
- Rails::Initializer.run. This code ensures that the database is
18
+ Rails::Initializer.run. This code ensures that the database is
19
19
  automatically switched, based on the checked out git branch.
20
20
 
21
21
  # config/environment.rb
data/Rakefile CHANGED
@@ -1,24 +1,24 @@
1
- %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
2
- require File.dirname(__FILE__) + '/lib/branch_db'
3
-
4
- # Generate all the Rake tasks
5
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
6
- $hoe = Hoe.new('branch_db', BranchDb::VERSION) do |p|
7
- p.developer('Michael Schuerig', 'michael@schuerig.de')
8
- p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
9
- p.extra_deps = [
10
- ['activerecord','>= 2.0.2'],
11
- ]
12
- p.extra_dev_deps = [
13
- ['newgem', ">= #{::Newgem::VERSION}"]
14
- ]
15
-
16
- p.clean_globs |= %w[**/.DS_Store tmp *.log]
17
- path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
18
- p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
19
- p.rsync_args = '-av --delete --ignore-errors'
20
- end
21
-
22
- require 'newgem/tasks' # load /tasks/*.rake
23
- Dir['tasks/**/*.rake'].each { |t| load t }
24
-
1
+ %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
2
+ require File.dirname(__FILE__) + '/lib/branch_db'
3
+
4
+ # Generate all the Rake tasks
5
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
6
+ $hoe = Hoe.new('branch_db', BranchDb::VERSION) do |p|
7
+ p.developer('Michael Schuerig', 'michael@schuerig.de')
8
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
9
+ p.extra_deps = [
10
+ ['activerecord','>= 2.0.2'],
11
+ ]
12
+ p.extra_dev_deps = [
13
+ ['newgem', ">= #{::Newgem::VERSION}"]
14
+ ]
15
+
16
+ p.clean_globs |= %w[**/.DS_Store tmp *.log]
17
+ path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
18
+ p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
19
+ p.rsync_args = '-av --delete --ignore-errors'
20
+ end
21
+
22
+ require 'newgem/tasks' # load /tasks/*.rake
23
+ Dir['tasks/**/*.rake'].each { |t| load t }
24
+
@@ -2,21 +2,20 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{branch_db}
5
- s.version = "0.0.8"
5
+ s.version = "0.0.9"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Michael Schuerig"]
9
- s.date = %q{2009-05-21}
9
+ s.date = %q{2009-05-25}
10
10
  s.description = %q{Give each git branch its own databases for ActiveRecord.}
11
11
  s.email = ["michael@schuerig.de"]
12
12
  s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.rdoc"]
13
13
  s.files = [".gitignore", "History.txt", "Manifest.txt", "README.rdoc", "Rakefile", "branch_db.gemspec", "lib/branch_db.rb", "lib/branch_db/configuration_twiddler.rb", "lib/branch_db/mysql_switcher.rb", "lib/branch_db/postgresql_switcher.rb", "lib/branch_db/real_db_switchers_common.rb", "lib/branch_db/sqlite_switcher.rb", "lib/branch_db/switcher.rb", "lib/branch_db/task_helper.rb", "lib/tasks/db_branches.rb", "rails/properties.rb", "test/mocks.rb", "test/test_configuration_twiddler.rb", "test/test_helper.rb", "test/test_postgresql_switcher.rb", "test/test_sqlite_switcher.rb", "test/test_switcher.rb"]
14
- s.has_rdoc = true
15
14
  s.homepage = %q{http://github.com/mschuerig/branch_db}
16
15
  s.rdoc_options = ["--main", "README.rdoc"]
17
16
  s.require_paths = ["lib"]
18
17
  s.rubyforge_project = %q{branch_db}
19
- s.rubygems_version = %q{1.3.2}
18
+ s.rubygems_version = %q{1.3.3}
20
19
  s.summary = %q{Give each git branch its own databases for ActiveRecord.}
21
20
  s.test_files = ["test/test_sqlite_switcher.rb", "test/test_helper.rb", "test/test_configuration_twiddler.rb", "test/test_postgresql_switcher.rb", "test/test_switcher.rb"]
22
21
 
@@ -2,9 +2,9 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  module BranchDb
5
- VERSION = '0.0.8'
5
+ VERSION = '0.0.9'
6
6
  DEFAULT_BRANCH = 'master'
7
-
7
+
8
8
  class Error < StandardError; end
9
9
 
10
10
  def self.current_repo_branch(raise_on_error = false)
@@ -3,7 +3,7 @@ require 'branch_db'
3
3
 
4
4
  module BranchDb # :nodoc
5
5
  module ConfigurationTwiddler
6
-
6
+
7
7
  def self.included(base)
8
8
  base.send(:alias_method, :database_configuration_without_branches, :database_configuration)
9
9
  base.send(:alias_method, :database_configuration, :database_configuration_with_branches)
@@ -6,21 +6,17 @@ module BranchDb # :nodoc:
6
6
 
7
7
  class MysqlSwitcher < Switcher
8
8
  include RealDbSwitchersCommon
9
-
9
+
10
10
  def self.can_handle?(config)
11
11
  config['adapter'] == 'mysql'
12
12
  end
13
-
13
+
14
14
  def current
15
15
  current_branch = branch_db_exists?(@branch) ? @branch : 'master'
16
16
  puts "#{@rails_env}: #{branch_db(current_branch)} (MySQL)"
17
17
  end
18
-
18
+
19
19
  protected
20
-
21
- def self.show_branches(rails_env, config)
22
- super
23
- end
24
20
 
25
21
  def create_database(branch)
26
22
  ### TODO when copying a database, determine charset and collation from original
@@ -31,36 +27,33 @@ module BranchDb # :nodoc:
31
27
  ActiveRecord::Base.connection.create_database(config['database'], :charset => (config['charset'] || charset), :collation => (config['collation'] || collation))
32
28
  ActiveRecord::Base.establish_connection(config)
33
29
  end
34
-
30
+
35
31
  def drop_database(branch)
36
32
  config = branch_config(branch)
37
33
  ActiveRecord::Base.establish_connection(config)
38
34
  ActiveRecord::Base.connection.drop_database config['database']
39
- @existing_databases = nil
35
+ reset_existing_databases
40
36
  nil
41
37
  end
42
-
43
- def existing_databases
44
- @existing_databases ||=
45
- begin
46
- raw_dbs = `mysql #{command_options(@config)} -e 'SHOW DATABASES'`
47
- if $? == 0
48
- existing_dbs = raw_dbs.split("\n").drop(1)
49
- existing_dbs -= %w( information_schema )
50
- else
51
- raise Error, "Cannot determine existing databases."
52
- end
53
- end
38
+
39
+ def self.find_existing_databases
40
+ raw_dbs = `mysql #{command_options(@config)} -e 'SHOW DATABASES'`
41
+ if $? == 0
42
+ existing_dbs = raw_dbs.split("\n").drop(1)
43
+ existing_dbs -= %w( information_schema )
44
+ else
45
+ raise Error, "Cannot determine existing databases."
46
+ end
54
47
  end
55
-
48
+
56
49
  def dump_command(config, dump_file)
57
50
  %{mysqldump #{command_options(config)} #{config["database"]} > #{dump_file}}
58
51
  end
59
-
52
+
60
53
  def load_command(config, dump_file)
61
54
  %{mysql #{command_options(config)} #{config["database"]} < #{dump_file}}
62
55
  end
63
-
56
+
64
57
  def command_options(config)
65
58
  returning opts = '' do
66
59
  %w( user username password password host host).each_slice(2) do |o, k|
@@ -6,21 +6,17 @@ module BranchDb # :nodoc:
6
6
 
7
7
  class PostgresqlSwitcher < Switcher
8
8
  include RealDbSwitchersCommon
9
-
9
+
10
10
  def self.can_handle?(config)
11
11
  config['adapter'] == 'postgresql'
12
12
  end
13
-
13
+
14
14
  def current
15
15
  current_branch = branch_db_exists?(@branch) ? @branch : 'master'
16
16
  puts "#{@rails_env}: #{branch_db(current_branch)} (PostgreSQL)"
17
17
  end
18
-
18
+
19
19
  protected
20
-
21
- def self.show_branches(rails_env, config)
22
- super
23
- end
24
20
 
25
21
  def create_database(branch)
26
22
  config = branch_config(branch).merge(
@@ -30,32 +26,29 @@ module BranchDb # :nodoc:
30
26
  ActiveRecord::Base.establish_connection(config)
31
27
  nil
32
28
  end
33
-
29
+
34
30
  def drop_database(branch)
35
31
  config = branch_config(branch)
36
32
  ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres', 'schema_search_path' => 'public'))
37
33
  ActiveRecord::Base.connection.drop_database(config['database'])
38
- @existing_databases = nil
34
+ reset_existing_databases
39
35
  nil
40
36
  end
41
-
42
- def existing_databases
43
- @existing_databases ||=
44
- begin
45
- raw_dbs = `psql -l`
46
- if $? == 0
47
- existing_dbs = raw_dbs.split("\n").drop_while { |l| l !~ /^-/ }.drop(1).take_while { |l| l !~ /^\(/ }.map { |l| l.split('|')[0].strip }
48
- existing_dbs.reject { |db| db =~ /^template/ }
49
- else
50
- raise Error, "Cannot determine existing databases."
51
- end
52
- end
37
+
38
+ def self.find_existing_databases
39
+ raw_dbs = `psql -l`
40
+ if $? == 0
41
+ existing_dbs = raw_dbs.split("\n").drop_while { |l| l !~ /^-/ }.drop(1).take_while { |l| l !~ /^\(/ }.map { |l| l.split('|')[0].strip }
42
+ existing_dbs.reject { |db| db =~ /^template/ }
43
+ else
44
+ raise Error, "Cannot determine existing databases."
45
+ end
53
46
  end
54
-
47
+
55
48
  def dump_command(config, dump_file)
56
49
  %{pg_dump #{command_options(config)} --clean #{config['database']} > #{dump_file}}
57
50
  end
58
-
51
+
59
52
  def load_command(config, dump_file)
60
53
  %{psql #{command_options(config)} -f "#{dump_file}" #{config['database']}}
61
54
  end
@@ -1,8 +1,41 @@
1
+
1
2
  module BranchDb # :nodoc:
2
3
 
3
4
  module RealDbSwitchersCommon
5
+ def self.included(base)
6
+ base.extend(ClassMethods)
7
+ end
8
+
9
+ module ClassMethods
10
+ def branch_dbs
11
+ existing_databases.grep
12
+ end
13
+
14
+ def find_existing_databases
15
+ raise Error, "Classes including RealDbSwitchersCommon must implement #find_existing_databases."
16
+ end
17
+
18
+ def existing_databases
19
+ @existing_databases ||= find_existing_databases
20
+ end
21
+
22
+ def reset_existing_databases
23
+ @existing_databases = nil
24
+ end
25
+
26
+ def show_branches(rails_env, config)
27
+ case per_branch = config['per_branch']
28
+ when true
29
+ master_db = config['database']
30
+ pat = master_db.split(/[_-]/).join('(?:(?:[-_]+)|(?:[-_]+[-_\w]+?[-_]+))')
31
+ dbs = existing_databases.grep(/^#{pat}$/)
32
+ puts "#{rails_env}: #{dbs.join(', ')}."
33
+ end
34
+ end
35
+ end
36
+
4
37
  protected
5
-
38
+
6
39
  def branch_db(branch)
7
40
  if branch == 'master'
8
41
  @config['database']
@@ -12,14 +45,14 @@ module BranchDb # :nodoc:
12
45
  end
13
46
 
14
47
  def branch_db_exists?(branch)
15
- existing_databases.include?(branch_db(branch))
48
+ self.class.existing_databases.include?(branch_db(branch))
16
49
  end
17
-
50
+
18
51
  def copy_database(from_branch, to_branch)
19
52
  dump_file = dump_branch_db(from_branch)
20
53
  load_branch_db(to_branch, dump_file)
21
54
  end
22
-
55
+
23
56
  def dump_branch_db(branch)
24
57
  require 'tempfile'
25
58
  config = branch_config(branch)
@@ -33,7 +66,7 @@ module BranchDb # :nodoc:
33
66
  ensure
34
67
  File.umask(old_umask)
35
68
  end
36
-
69
+
37
70
  def load_branch_db(branch, dump_file)
38
71
  config = branch_config(branch)
39
72
  cmd = load_command(config, dump_file)
@@ -12,9 +12,9 @@ module BranchDb # :nodoc:
12
12
  current_branch = branch_db_exists?(@branch) ? @branch : 'master'
13
13
  puts "#{@rails_env}: #{rails_root_relative(branch_db(current_branch))} (SQLite)"
14
14
  end
15
-
15
+
16
16
  protected
17
-
17
+
18
18
  def self.show_branches(rails_env, config)
19
19
  super
20
20
  end
@@ -26,17 +26,17 @@ module BranchDb # :nodoc:
26
26
  @config['database'].sub(/(.+)\./, "\\1_#{branch}.")
27
27
  end
28
28
  end
29
-
29
+
30
30
  def branch_db_exists?(branch)
31
31
  File.exists?(branch_db_path(branch))
32
32
  end
33
-
33
+
34
34
  def create_database(branch)
35
35
  config = branch_config(branch)
36
36
  ActiveRecord::Base.establish_connection(config)
37
37
  ActiveRecord::Base.connection
38
38
  end
39
-
39
+
40
40
  def drop_database(branch)
41
41
  FileUtils.rm_f(branch_db_path(branch))
42
42
  end
@@ -44,9 +44,9 @@ module BranchDb # :nodoc:
44
44
  def copy_database(from_branch, to_branch)
45
45
  FileUtils.cp(branch_db_path(from_branch), branch_db_path(to_branch))
46
46
  end
47
-
47
+
48
48
  private
49
-
49
+
50
50
  def branch_db_path(branch)
51
51
  File.join(RAILS_ROOT, branch_db(branch))
52
52
  end
@@ -10,15 +10,15 @@ module BranchDb # :nodoc:
10
10
  end
11
11
  switcher
12
12
  end
13
-
13
+
14
14
  def self.can_handle?(config)
15
15
  raise Error, "Subclasses of BranchDb::Switcher must implement #can_handle?(config)."
16
16
  end
17
-
17
+
18
18
  def self.create(rails_env, config, branch, options = {})
19
19
  which(config).new(rails_env, config, branch, options)
20
20
  end
21
-
21
+
22
22
  def self.branches(rails_env, config)
23
23
  self.which(config).show_branches(rails_env, config)
24
24
  end
@@ -32,17 +32,17 @@ module BranchDb # :nodoc:
32
32
  def current
33
33
  # Must be implemented in subclasses.
34
34
  end
35
-
35
+
36
36
  def exists?
37
37
  branch_db_exists?(@branch)
38
38
  end
39
-
39
+
40
40
  def switch!
41
41
  if exists?
42
42
  @config.replace(branch_config(@branch))
43
43
  end
44
44
  end
45
-
45
+
46
46
  def create_empty_database
47
47
  db = branch_db(@branch)
48
48
  if branch_db_exists?(@branch)
@@ -58,40 +58,34 @@ module BranchDb # :nodoc:
58
58
  create_database(@branch)
59
59
  yield if block_given?
60
60
  end
61
-
61
+
62
62
  def delete_database
63
63
  ensure_branch_db_exists!(@branch)
64
64
  puts "Dropping existing database #{branch_db(@branch)}..."
65
65
  drop_database(@branch)
66
66
  end
67
-
67
+
68
68
  def copy_from(from_branch)
69
69
  ensure_branch_db_exists!(from_branch)
70
70
 
71
71
  create_empty_database do
72
- puts "Copying data from #{from_branch}..."
72
+ puts "Copying data from #{branch_db(from_branch)}..."
73
73
  copy_database(from_branch, @branch)
74
74
  end
75
75
  end
76
-
76
+
77
77
  protected
78
-
78
+
79
79
  def self.show_branches(rails_env, config)
80
- case per_branch = config['per_branch']
81
- when true
80
+ if config['per_branch']
82
81
  puts "#{rails_env}: Has branch databases. Cannot determine which ones."
83
- # when Hash
84
- # puts "#{rails_env}:"
85
- # per_branch.each do |db|
86
- # puts " #{db}"
87
- # end
88
82
  end
89
83
  end
90
84
 
91
85
  def verbose?
92
86
  @verbose
93
87
  end
94
-
88
+
95
89
  def branch_config(branch)
96
90
  @config.merge('database' => branch_db(branch))
97
91
  end
@@ -105,23 +99,23 @@ module BranchDb # :nodoc:
105
99
  def branch_db_exists?(branch)
106
100
  false
107
101
  end
108
-
102
+
109
103
  def branch_db(branch)
110
104
  # Must be implemented in subclasses.
111
105
  end
112
-
106
+
113
107
  def create_database(branch)
114
108
  # Must be implemented in subclasses.
115
109
  end
116
-
110
+
117
111
  def drop_database(branch)
118
112
  # Must be implemented in subclasses.
119
113
  end
120
-
114
+
121
115
  def copy_database(from_branch, to_branch)
122
116
  # Must be implemented in subclasses.
123
117
  end
124
-
118
+
125
119
  private
126
120
 
127
121
  def self.switchers
@@ -7,7 +7,7 @@ module BranchDb # :nodoc:
7
7
  def current_branch
8
8
  BranchDb::current_repo_branch(true)
9
9
  end
10
-
10
+
11
11
  def environment_options
12
12
  returning options = {} do
13
13
  [:overwrite, :verbose].each do |opt|
@@ -15,7 +15,7 @@ module BranchDb # :nodoc:
15
15
  end
16
16
  end
17
17
  end
18
-
18
+
19
19
  def target_branch
20
20
  ENV['BRANCH'] || current_branch
21
21
  end
@@ -23,7 +23,7 @@ module BranchDb # :nodoc:
23
23
  def originating_branch
24
24
  ENV['ORIG_BRANCH'] || 'master' ### TODO determine originating branch
25
25
  end
26
-
26
+
27
27
  def each_local_config
28
28
  ActiveRecord::Base.configurations.each do |rails_env, config|
29
29
  next unless config['database']
@@ -38,7 +38,7 @@ module BranchDb # :nodoc:
38
38
  end
39
39
  end
40
40
  end
41
-
41
+
42
42
  def each_local_database(*args)
43
43
  options = args.last.kind_of?(Hash) ? args.pop : {}
44
44
  options = options.reverse_merge(environment_options)
@@ -7,14 +7,14 @@ namespace :db do
7
7
  require 'branch_db/task_helper'
8
8
  include BranchDb::TaskHelper
9
9
  end
10
-
10
+
11
11
  desc "List all branch databases"
12
12
  task :list => :setup do
13
13
  each_local_config do |rails_env, config|
14
14
  BranchDb::Switcher.branches(rails_env, config)
15
15
  end
16
16
  end
17
-
17
+
18
18
  desc "Currently selected databases."
19
19
  task :current => :setup do
20
20
  each_local_database { |switcher| switcher.current }
@@ -24,7 +24,7 @@ namespace :db do
24
24
  task :create => :setup do
25
25
  each_local_database { |switcher| switcher.create_empty_database }
26
26
  end
27
-
27
+
28
28
  desc "Copy databases from one branch to another. Default is from ORIG_BRANCH=master to BRANCH=<current branch>"
29
29
  task :copy => :setup do
30
30
  each_local_database { |switcher| switcher.copy_from(originating_branch) }
@@ -20,7 +20,7 @@ module Recorder
20
20
  def verify(*expected)
21
21
  assert_equal(expected, recorded_calls)
22
22
  end
23
- end
23
+ end
24
24
 
25
25
  module BranchDb
26
26
  def self.set_branch(branch)
@@ -29,24 +29,26 @@ module BranchDb
29
29
  def self.current_repo_branch
30
30
  @branch
31
31
  end
32
-
32
+
33
33
  class MysqlSwitcher < Switcher
34
+ include RealDbSwitchersCommon
34
35
  include Recorder
35
36
  record :create_database, :drop_database, :load_branch_db
36
37
  record(:dump_branch_db) { 'the-dump-file' }
37
38
 
38
- def existing_databases
39
+ def self.find_existing_databases
39
40
  %w( testit_development testit_feature_development testit_test )
40
41
  end
41
42
  end
42
43
 
43
44
  ### FIXME this repetition is dumb
44
45
  class PostgresqlSwitcher < Switcher
46
+ include RealDbSwitchersCommon
45
47
  include Recorder
46
48
  record :create_database, :drop_database, :load_branch_db
47
49
  record(:dump_branch_db) { 'the-dump-file' }
48
50
 
49
- def existing_databases
51
+ def self.find_existing_databases
50
52
  %w( testit_development testit_feature_development testit_test )
51
53
  end
52
54
  end
@@ -8,7 +8,7 @@ class MockConfiguration
8
8
  def initialize(config)
9
9
  @config = config
10
10
  end
11
-
11
+
12
12
  def database_configuration
13
13
  @config
14
14
  end
@@ -21,13 +21,13 @@ module RealDatabaseTests
21
21
  assert_env_db 'testit_development', 'development'
22
22
  assert_env_db 'testit_test', 'test'
23
23
  end
24
-
24
+
25
25
  def test_branch
26
26
  BranchDb.set_branch('feature')
27
27
  assert_env_db 'testit_feature_development', 'development'
28
28
  assert_env_db 'testit_test', 'test'
29
29
  end
30
-
30
+
31
31
  def test_non_existing_branch
32
32
  BranchDb.set_branch('erehwon')
33
33
  assert_env_db 'testit_development', 'development'
@@ -53,7 +53,7 @@ class TestConfigurationTwiddlerPostgreSQL < Test::Unit::TestCase
53
53
  }
54
54
  })
55
55
  end
56
-
56
+
57
57
  include RealDatabaseTests
58
58
  end
59
59
 
@@ -71,14 +71,14 @@ class TestConfigurationTwiddlerMysql < Test::Unit::TestCase
71
71
  }
72
72
  })
73
73
  end
74
-
74
+
75
75
  include RealDatabaseTests
76
76
  end
77
77
 
78
78
  class TestConfigurationTwiddlerSQLite < Test::Unit::TestCase
79
79
  def setup
80
80
  create_mock_sqlite_db(
81
- 'db/development.sqlite3',
81
+ 'db/development.sqlite3',
82
82
  'db/development_feature.sqlite3',
83
83
  'db/test.sqlite3'
84
84
  )
@@ -94,23 +94,23 @@ class TestConfigurationTwiddlerSQLite < Test::Unit::TestCase
94
94
  }
95
95
  })
96
96
  end
97
-
97
+
98
98
  def teardown
99
99
  FileUtils.rm_rf(RAILS_ROOT)
100
100
  end
101
-
101
+
102
102
  def test_master_branch
103
103
  BranchDb.set_branch('master')
104
104
  assert_env_db 'db/development.sqlite3', 'development'
105
105
  assert_env_db 'db/test.sqlite3', 'test'
106
106
  end
107
-
107
+
108
108
  def test_branch
109
109
  BranchDb.set_branch('feature')
110
110
  assert_env_db 'db/development_feature.sqlite3', 'development'
111
111
  assert_env_db 'db/test.sqlite3', 'test'
112
112
  end
113
-
113
+
114
114
  def test_non_existing_branch
115
115
  BranchDb.set_branch('erehwon')
116
116
  assert_env_db 'db/development.sqlite3', 'development'
@@ -22,9 +22,9 @@ class TestPostgresqlSwitcher < Test::Unit::TestCase
22
22
  branch = options.delete(:branch) || 'feature'
23
23
  BranchDb::PostgresqlSwitcher.new(env, @config[env], branch, options)
24
24
  end
25
-
25
+
26
26
  def test_branches
27
- assert_stdout "development: Has branch databases. Cannot determine which ones.\n" do
27
+ assert_stdout "development: testit_development, testit_feature_development.\n" do
28
28
  BranchDb::Switcher.branches('development', @config['development'])
29
29
  end
30
30
  assert_stdout "" do
@@ -5,7 +5,7 @@ require 'mocks'
5
5
  class TestSqliteSwitcher < Test::Unit::TestCase
6
6
  def setup
7
7
  create_mock_sqlite_db(
8
- 'db/development.sqlite3',
8
+ 'db/development.sqlite3',
9
9
  'db/development_feature.sqlite3',
10
10
  'db/test.sqlite3'
11
11
  )
@@ -31,7 +31,7 @@ class TestSqliteSwitcher < Test::Unit::TestCase
31
31
  branch = options.delete(:branch) || 'feature'
32
32
  BranchDb::SqliteSwitcher.new(env, @config[env], branch, options)
33
33
  end
34
-
34
+
35
35
  def test_branches
36
36
  assert_stdout "development: Has branch databases. Cannot determine which ones.\n" do
37
37
  BranchDb::Switcher.branches('development', @config['development'])
@@ -2,7 +2,7 @@
2
2
  require 'test_helper'
3
3
 
4
4
  class TestSwitcher < Test::Unit::TestCase
5
-
5
+
6
6
  def test_dummy
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mschuerig-branch_db
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Schuerig
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-21 00:00:00 -07:00
12
+ date: 2009-05-25 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -76,7 +76,7 @@ files:
76
76
  - test/test_postgresql_switcher.rb
77
77
  - test/test_sqlite_switcher.rb
78
78
  - test/test_switcher.rb
79
- has_rdoc: true
79
+ has_rdoc: false
80
80
  homepage: http://github.com/mschuerig/branch_db
81
81
  post_install_message:
82
82
  rdoc_options: