rails-db_env 0.0.1
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.
- data/Readme.md +23 -0
- data/lib/rails-db_env.rb +14 -0
- data/rails-db_env.gemspec +19 -0
- metadata +71 -0
data/Readme.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
About
|
3
|
+
-------------
|
4
|
+
A `rails` development utility to help you quickly switch between configured databases.
|
5
|
+
|
6
|
+
Why and How
|
7
|
+
-------------
|
8
|
+
|
9
|
+
Sometimes you may want to run your local copy of app against `staging` DB:
|
10
|
+
|
11
|
+
rails2app$ DB_ENV=staging ./script/server
|
12
|
+
|
13
|
+
starts a server with default `RAILS_ENV`(`development`) and database configured against `staging:` configuration in `database.yml`
|
14
|
+
|
15
|
+
|
16
|
+
TODO
|
17
|
+
-------------
|
18
|
+
- rails3
|
19
|
+
- tests
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
data/lib/rails-db_env.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Rails::Configuration.class_eval do
|
2
|
+
def database_configuration_with_db_env
|
3
|
+
puts "connecting to: #{ENV['DB_ENV']}"
|
4
|
+
|
5
|
+
(config = database_configuration_without_db_env).merge({
|
6
|
+
"_#{Rails.env}" => config[Rails.env], # original config
|
7
|
+
Rails.env => config[ENV['DB_ENV']] # overriden one
|
8
|
+
})
|
9
|
+
end
|
10
|
+
|
11
|
+
alias :database_configuration_without_db_env :database_configuration
|
12
|
+
alias :database_configuration :database_configuration_with_db_env
|
13
|
+
|
14
|
+
end if ENV['DB_ENV']
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env gem build
|
2
|
+
# -*- encoding: utf-8 -*-
|
3
|
+
$:.push File.expand_path("../lib", __FILE__)
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "rails-db_env"
|
7
|
+
s.version = "0.0.1"
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = %w[gmarik blibbey]
|
10
|
+
s.email = ['gmarik+no+spam@gmail.com']
|
11
|
+
s.homepage = 'http://github.com/gmarik/rails-db_env'
|
12
|
+
s.summary = %q{ allows to set database environment independently from RAILS_ENV }
|
13
|
+
s.description = %q{ DB_ENV=staging ./script/server }
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails-db_env
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- gmarik
|
14
|
+
- blibbey
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2011-03-09 00:00:00 -06:00
|
20
|
+
default_executable:
|
21
|
+
dependencies: []
|
22
|
+
|
23
|
+
description: " DB_ENV=staging ./script/server "
|
24
|
+
email:
|
25
|
+
- gmarik+no+spam@gmail.com
|
26
|
+
executables: []
|
27
|
+
|
28
|
+
extensions: []
|
29
|
+
|
30
|
+
extra_rdoc_files: []
|
31
|
+
|
32
|
+
files:
|
33
|
+
- Readme.md
|
34
|
+
- lib/rails-db_env.rb
|
35
|
+
- rails-db_env.gemspec
|
36
|
+
has_rdoc: true
|
37
|
+
homepage: http://github.com/gmarik/rails-db_env
|
38
|
+
licenses: []
|
39
|
+
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options: []
|
42
|
+
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
hash: 3
|
51
|
+
segments:
|
52
|
+
- 0
|
53
|
+
version: "0"
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
hash: 3
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
version: "0"
|
63
|
+
requirements: []
|
64
|
+
|
65
|
+
rubyforge_project:
|
66
|
+
rubygems_version: 1.5.0
|
67
|
+
signing_key:
|
68
|
+
specification_version: 3
|
69
|
+
summary: allows to set database environment independently from RAILS_ENV
|
70
|
+
test_files: []
|
71
|
+
|