database_fork 0.0.6 → 0.0.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f8543171bd7da48b3d7460d386e6da0835d82f91
4
- data.tar.gz: 8d9260622294e19703d355b4bde7ce4bad59863f
3
+ metadata.gz: 8c55bfad322d375591c58edb013cd6ddb50e5592
4
+ data.tar.gz: cf3428234871dbc9d381b0b73a37a1ff362c0699
5
5
  SHA512:
6
- metadata.gz: 8663a7657e361f7ee8bc08c1596bae16653ee0e2ef168069cc7ca8bedd0cca1512e729dcb25f48123dbda7b5e0476016fa1e3676ae99ed7feb2f1f60fbb2ad42
7
- data.tar.gz: f8f244b8d7698d0636bfcc2e654a9f142a2c94148c68693ea3232648ccf92a6280ab867c940b047b2e1a07ecf9a01df1ebd8e0c82dc218d56150243e0e8354d0
6
+ metadata.gz: 5057ca6ac35017463ce3278a8dfcdd639a1948fd8daa0e27e6bac00e7bfb8e3dda5160370a4dd12e71443bdd3f0f1f1431f95435a0e471c66d46b9e8e3c53b95
7
+ data.tar.gz: 8035c591db231b8e2f073003e06916ea7e42b7f0757d2d580bcd8fdef27e0c29e24a154a2ed4ae063829b3dc6dc65e34aa55cad59fbfb52689a34041e7fb989d
data/README.md CHANGED
@@ -6,7 +6,7 @@ Create a copy of your development and test databases when you switch git branche
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
- gem 'database_fork', '>= 0.0.6'
9
+ gem 'database_fork', '>= 0.0.7'
10
10
 
11
11
  And then execute:
12
12
 
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'database_fork'
7
- spec.version = '0.0.6'
7
+ spec.version = '0.0.7'
8
8
  spec.authors = ['the-architect']
9
9
  spec.email = ['marcel.scherf@epicteams.com']
10
10
  spec.summary = %q{Fork your database}
data/lib/database_fork.rb CHANGED
@@ -39,7 +39,7 @@ class DatabaseFork
39
39
  end
40
40
 
41
41
  def run
42
- if Regexp.new(config['check_branch_name_regex']).match(current_branch)
42
+ if qualified_branch?(current_branch) && !ignored_branch?(current_branch)
43
43
  log_info 'branch qualified for database forking'
44
44
 
45
45
  config['environments'].each do |env|
@@ -61,7 +61,6 @@ class DatabaseFork
61
61
  adapter.reset_env
62
62
  end
63
63
  end
64
-
65
64
  end
66
65
 
67
66
  else
@@ -71,6 +70,14 @@ class DatabaseFork
71
70
  save_config
72
71
  end
73
72
 
73
+ def qualified_branch?(branch_name)
74
+ Regexp.new(config['check_branch_name_regex']).match(branch_name)
75
+ end
76
+
77
+ def ignored_branch?(branch_name)
78
+ config['ignore'] ||= []
79
+ config['ignore'].include?(branch_name)
80
+ end
74
81
 
75
82
  def ask_user(question)
76
83
  log_info question
@@ -97,6 +104,7 @@ class DatabaseFork
97
104
  end
98
105
 
99
106
  def save_config
107
+ config['ignore'].uniq!
100
108
  File.open(@config_file, 'w') do |f|
101
109
  f.puts @config.to_yaml
102
110
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: database_fork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - the-architect