rails-default-database 1.0.4 → 1.0.6

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.markdown CHANGED
@@ -8,3 +8,10 @@ Gemfile) will be automatically configured with Rails defaults:
8
8
  gem 'rails-default-database'
9
9
 
10
10
  You can still override the defaults by creating `config/database.yml`.
11
+ Use `rake db:config` to create `config/database.yml` with the defaults
12
+ that would have been assumed.
13
+
14
+ License
15
+ -------
16
+
17
+ Copyright (c) Tim Pope. MIT License.
@@ -0,0 +1,7 @@
1
+ desc 'Write out config/database.yml from rails-default-database'
2
+ task 'db:config' do
3
+ contents = Rails.configuration.database_configuration.to_yaml
4
+ File.open(Rails.root.join('config/database.yml'), 'w') do |f|
5
+ f.puts contents.sub(/^---\n/, '')
6
+ end
7
+ end
@@ -1,18 +1,16 @@
1
1
  Rails::Application::Configuration.class_eval do
2
2
 
3
3
  def database_configuration_with_default
4
- config_file = begin
5
- database_configuration_without_default
6
- rescue Errno::ENOENT
7
- {}
8
- end
4
+ config_file =
5
+ begin
6
+ database_configuration_without_default
7
+ rescue Errno::ENOENT
8
+ end || {}
9
9
 
10
- default_config.merge(config_file)
10
+ default_database_configuration.merge(config_file)
11
11
  end
12
12
 
13
- private
14
-
15
- def default_config
13
+ def default_database_configuration
16
14
  name = File.basename(root)
17
15
  generator = begin
18
16
  require 'pg'
@@ -62,3 +60,9 @@ Rails::Application::Configuration.class_eval do
62
60
 
63
61
  alias_method_chain :database_configuration, :default
64
62
  end
63
+
64
+ class RailsDefaultDatabaseRailtie < Rails::Railtie
65
+ rake_tasks do
66
+ load 'rails-default-database.rake'
67
+ end
68
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-default-database
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-30 00:00:00.000000000Z
12
+ date: 2012-01-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
16
- requirement: &74522770 !ruby/object:Gem::Requirement
16
+ requirement: &82419040 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *74522770
24
+ version_requirements: *82419040
25
25
  description: Provides a default database configuration for Rails applications that
26
26
  lack one
27
27
  email: ruby@tpope.org
@@ -32,6 +32,7 @@ files:
32
32
  - README.markdown
33
33
  - MIT-LICENSE
34
34
  - lib/rails-default-database.rb
35
+ - lib/rails-default-database.rake
35
36
  homepage: http://github.com/tpope/rails-default-database
36
37
  licenses: []
37
38
  post_install_message:
@@ -52,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
52
53
  version: '0'
53
54
  requirements: []
54
55
  rubyforge_project:
55
- rubygems_version: 1.8.6
56
+ rubygems_version: 1.8.10
56
57
  signing_key:
57
58
  specification_version: 3
58
59
  summary: Make database.yml optional in Rails