yaml_config_file 0.2.0
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/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README +1 -0
- data/README.rdoc +15 -0
- data/Rakefile +19 -0
- data/USAGE +10 -0
- data/VERSION +1 -0
- data/lib/generators/yaml_config_file/templates/config_file.rb +7 -0
- data/lib/generators/yaml_config_file/templates/config_file.yml +15 -0
- data/lib/generators/yaml_config_file/yaml_config_file_generator.rb +17 -0
- data/yaml_config_file.gemspec +50 -0
- metadata +80 -0
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Tammy Cravit
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
YAML Configuration File generator for Rails 3.
|
data/README.rdoc
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
= yaml_config_file
|
2
|
+
|
3
|
+
Generate a YAML configuration file for a Rails 3 application, and an
|
4
|
+
initializer that loads the configuration file.
|
5
|
+
|
6
|
+
For example:
|
7
|
+
|
8
|
+
rails generate yaml_config_file app_config
|
9
|
+
|
10
|
+
This will generate a YAML configuration file in config/app_config.yml, and
|
11
|
+
an initializer in config/initializers/app_config.rb to load it.
|
12
|
+
|
13
|
+
== Copyright
|
14
|
+
|
15
|
+
Copyright (c) 2010 Tammy Cravit. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "yaml_config_file"
|
8
|
+
gem.summary = %Q{YAML Configuration File generator for Rails 3}
|
9
|
+
gem.description = %Q{YAML Configuration File generator for Rails 3}
|
10
|
+
gem.email = "tcravit@taylored-software.com"
|
11
|
+
gem.homepage = "http://github.com/tammycravit/yaml_config_file"
|
12
|
+
gem.authors = ["Tammy Cravit"]
|
13
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
14
|
+
end
|
15
|
+
Jeweler::GemcutterTasks.new
|
16
|
+
rescue LoadError
|
17
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
18
|
+
end
|
19
|
+
|
data/USAGE
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.2.0
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Initializer to load the YAML configuration file from config/<%= gen_file_name %>
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
require 'erb'
|
5
|
+
|
6
|
+
<%= gen_file_name %>_yml = YAML.load(ERB.new(File.read(File.join(Rails.root, "config", "<%= gen_file_name %>.yml"))).result)
|
7
|
+
<%= gen_file_name.upcase %> = <%= gen_file_name %>_yml["global"].merge!(<%= gen_file_name %>_yml[Rails.env]).with_indifferent_access
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# This is the application configuration file. Add your settings here.
|
2
|
+
# Settings in each of the environment-specific sections will override
|
3
|
+
# equivalently-named settings in the global section.
|
4
|
+
|
5
|
+
global:
|
6
|
+
dummy_setting: 0
|
7
|
+
|
8
|
+
development:
|
9
|
+
dummy_setting: 1
|
10
|
+
|
11
|
+
test:
|
12
|
+
dummy_setting: 2
|
13
|
+
|
14
|
+
production:
|
15
|
+
dummy_setting: 3
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class YamlConfigFileGenerator < Rails::Generators::NamedBase
|
2
|
+
|
3
|
+
source_root File.expand_path('../templates', __FILE__)
|
4
|
+
|
5
|
+
class_option :skip_yaml_file, :type => :boolean, :default => false, :description => "Skip generation of the YAML file"
|
6
|
+
class_option :skip_initializer, :type => :boolean, :default => false, :description => "Skip generation of the initializer"
|
7
|
+
|
8
|
+
def yaml_config_file
|
9
|
+
template "config_file.yml", "config/#{gen_file_name}.yml" unless options.skip_yaml_file?
|
10
|
+
template "config_file.rb", "config/initializers/#{gen_file_name}.rb" unless options.skip_initializer?
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
def gen_file_name
|
15
|
+
file_name.underscore
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{yaml_config_file}
|
8
|
+
s.version = "0.2.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Tammy Cravit"]
|
12
|
+
s.date = %q{2010-09-24}
|
13
|
+
s.description = %q{YAML Configuration File generator for Rails 3}
|
14
|
+
s.email = %q{tcravit@taylored-software.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README",
|
18
|
+
"README.rdoc"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".document",
|
22
|
+
".gitignore",
|
23
|
+
"LICENSE",
|
24
|
+
"README",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"USAGE",
|
28
|
+
"VERSION",
|
29
|
+
"lib/generators/yaml_config_file/templates/config_file.rb",
|
30
|
+
"lib/generators/yaml_config_file/templates/config_file.yml",
|
31
|
+
"lib/generators/yaml_config_file/yaml_config_file_generator.rb",
|
32
|
+
"yaml_config_file.gemspec"
|
33
|
+
]
|
34
|
+
s.homepage = %q{http://github.com/tammycravit/yaml_config_file}
|
35
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
36
|
+
s.require_paths = ["lib"]
|
37
|
+
s.rubygems_version = %q{1.3.7}
|
38
|
+
s.summary = %q{YAML Configuration File generator for Rails 3}
|
39
|
+
|
40
|
+
if s.respond_to? :specification_version then
|
41
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
42
|
+
s.specification_version = 3
|
43
|
+
|
44
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
45
|
+
else
|
46
|
+
end
|
47
|
+
else
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yaml_config_file
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Tammy Cravit
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-09-24 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description: YAML Configuration File generator for Rails 3
|
23
|
+
email: tcravit@taylored-software.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files:
|
29
|
+
- LICENSE
|
30
|
+
- README
|
31
|
+
- README.rdoc
|
32
|
+
files:
|
33
|
+
- .document
|
34
|
+
- .gitignore
|
35
|
+
- LICENSE
|
36
|
+
- README
|
37
|
+
- README.rdoc
|
38
|
+
- Rakefile
|
39
|
+
- USAGE
|
40
|
+
- VERSION
|
41
|
+
- lib/generators/yaml_config_file/templates/config_file.rb
|
42
|
+
- lib/generators/yaml_config_file/templates/config_file.yml
|
43
|
+
- lib/generators/yaml_config_file/yaml_config_file_generator.rb
|
44
|
+
- yaml_config_file.gemspec
|
45
|
+
has_rdoc: true
|
46
|
+
homepage: http://github.com/tammycravit/yaml_config_file
|
47
|
+
licenses: []
|
48
|
+
|
49
|
+
post_install_message:
|
50
|
+
rdoc_options:
|
51
|
+
- --charset=UTF-8
|
52
|
+
require_paths:
|
53
|
+
- lib
|
54
|
+
required_ruby_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
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
hash: 3
|
69
|
+
segments:
|
70
|
+
- 0
|
71
|
+
version: "0"
|
72
|
+
requirements: []
|
73
|
+
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 1.3.7
|
76
|
+
signing_key:
|
77
|
+
specification_version: 3
|
78
|
+
summary: YAML Configuration File generator for Rails 3
|
79
|
+
test_files: []
|
80
|
+
|