Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow loading a personal config from /.big_old_rails_template/

Signed-off-by: Mike Gunderloy <MikeG1@larkfarm.com>
  • Loading branch information...
commit 1c9c206cbaa92b911a78b392b1b65bf9b5bf0ac9 1 parent 5bced73
@edavis10 edavis10 authored ffmike committed
Showing with 15 additions and 4 deletions.
  1. +2 −1  README
  2. +13 −3 lark_template.rb
View
3  README
@@ -6,7 +6,8 @@ I should warn you of two things. First, it’s a pretty heavyweight template, st
There is some configuration available for the template. See config.yml to set persistent configuration information. If you don't have a
config.yml, or it doesn't have an option that the template is looking for, you'll be prompted at runtime for some of the information, and
-reasonably sensible defaults will be used for the rest. You should review config.yml before you first run the template.
+reasonably sensible defaults will be used for the rest. You should review config.yml before you first run the template. If you would like
+to setup some personal options, copy the config.yml to ~/.big_old_rails_template/ and it will be used instead.
Here’s a list of what this template sets up:
View
16 lark_template.rb
@@ -160,9 +160,19 @@ def update_app
# Option set-up
begin
template_options = {}
- template_path = File.expand_path(File.dirname(template), File.join(root,'..'))
- open(File.join(template_path, "config.yml")) do |f|
- template_options = YAML.load(f)
+ template_paths = [
+ File.expand_path(File.join(ENV['HOME'],'.big_old_rails_template')),
+ File.expand_path(File.dirname(template), File.join(root,'..'))
+ ]
+
+ template_paths.each do |template_path|
+ template = File.join(template_path, "config.yml")
+ next unless File.exists? template
+
+ open(template) do |f|
+ template_options = YAML.load(f)
+ break
+ end
end
rescue
end
Please sign in to comment.
Something went wrong with that request. Please try again.