database_fork 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04574ce63b8ffaee559e658f2dae84d148b7c29e
4
- data.tar.gz: db2386f28f81ca972e189c1b9a188dca33f07f08
3
+ metadata.gz: d818505a7ac098516ffcfa22212eda7b29511f0b
4
+ data.tar.gz: 8c9664a4c650a9e32904f3067ce8096dcc55b47f
5
5
  SHA512:
6
- metadata.gz: f62e70674fd53c2b970e44b6ed59650fd6bf50f59c4518b4e7a1c373cdfaf03a10144549a691bcb96d7d42f1427911100b10aff5ddc9273cb367253aed99dde8
7
- data.tar.gz: eae82273430626967731953b465d67a1204a95df624241655e05d431fb145f02d53065109066b89354a0a0e7c255d8770e3db39c029252ae91e25633123afa0f
6
+ metadata.gz: 02f28fd37538c2771f01e545823e50469465e7d1a22ce58f989771a8ecb99ba8abafefe97287bd99b2fb06e68869154b227910ae61c6a9acb1a8da2f8c968bad
7
+ data.tar.gz: d8ea9235c8a94eeff72a49de21b4e8c9494ad5c9e38a8266fbe1c47732ab7b1c21bd463174d3b7a27c5f142a84e6f12c0a8b154985c8772a35d67dfe3bd2e15a
data/README.md CHANGED
@@ -1,24 +1,48 @@
1
1
  # DatabaseFork
2
2
 
3
- TODO: Write a gem description
3
+ Create a copy of your development and test databases when you switch git branches.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
- gem 'database_fork'
9
+ gem 'database_fork', '>= 0.0.5'
10
10
 
11
11
  And then execute:
12
12
 
13
13
  $ bundle
14
-
15
- Or install it yourself as:
16
-
17
- $ gem install database_fork
18
-
19
- ## Usage
20
-
21
- TODO: Write usage instructions here
14
+
15
+ Add this file to your .gitignore:
16
+
17
+ .db_forks.yml
18
+
19
+ Add the git hook:
20
+
21
+ touch .git/hooks/post-checkout
22
+ sudo chmod +x .git/hooks/post-checkout
23
+
24
+ Now add this to the .git/hooks/post-checkout file:
25
+
26
+ #!/usr/bin/env ruby
27
+ if File.exists?(File.join(ENV['PWD'], 'Gemfile'))
28
+ require 'rubygems'
29
+ require 'bundler/setup'
30
+ require 'database_fork'
31
+
32
+ DatabaseFork.new(ENV['PWD']).run
33
+ else
34
+ puts "DatabaseFork: No Gemfile found in #{ENV['PWD']}. Run from to your Application's root!"
35
+ end
36
+
37
+ Rails: add this line at the end of your application.rb:
38
+
39
+ unless Rails.env.production?
40
+ begin
41
+ DatabaseFork.setup_env(Rails.env, Rails.root)
42
+ rescue LoadError
43
+ 'DatabaseFork not available'
44
+ end
45
+ end
22
46
 
23
47
  ## Contributing
24
48
 
@@ -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.4'
7
+ spec.version = '0.0.5'
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
@@ -24,7 +24,7 @@ class DatabaseFork
24
24
 
25
25
  def reset_all_environments!(root_dir, logger = Logger.new(STDOUT))
26
26
  logger.info 'removing DATABASE_FORK_* files'
27
- FileUtils.rm Dir[File.join(root_dir, 'tmp', 'DATABASE_FORK_*')]
27
+ FileUtils.rm Dir[File.join(root_dir, 'tmp', 'DATABASE_FORK_*')], force: true
28
28
  end
29
29
 
30
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: database_fork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - the-architect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-18 00:00:00.000000000 Z
11
+ date: 2014-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler