Sha256: 6c8aa3fdaee603bcf6f8db2403cb8eccefe31c73c13c59b3b93de7793735d553
Contents?: true
Size: 1.35 KB
Versions: 3
Compression:
Stored size: 1.35 KB
Contents
module Jack class Settings def initialize(root=nil) @root = root || '.' end # The options from the files get merged with the following precedence: # # current folder - The current folder’s jack/settings.yml values take the highest precedence. # user - The user’s ~/.jack/settings.yml values take the second highest precedence. # default - The default settings bundled with the tool takes the lowest precedence. # # More info: http://jack-eb.com/docs/settings/ def data return @settings_yaml if @settings_yaml project_file = "#{@root}/jack/settings.yml" project = File.exist?(project_file) ? YAML.load_file(project_file) : {} user_file = "#{home}/.jack/settings.yml" user = File.exist?(user_file) ? YAML.load_file(user_file) : {} default_file = File.expand_path("../default/settings.yml", __FILE__) default = YAML.load_file(default_file) @settings_yaml = default.merge(user.merge(project)) end def home # hack but fast ENV['TEST'] ? "spec/fixtures/home" : ENV['HOME'] end def create_flags create.inject("") {|s,(k,v)| s << %{--#{k} "#{v}" } ; s }.strip end def create data["create"] end def app_name_pattern conventions["app_name_pattern"] end def conventions data["conventions"] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
jack-eb-1.4.4 | lib/jack/settings.rb |
jack-eb-1.4.3 | lib/jack/settings.rb |
jack-eb-1.4.2 | lib/jack/settings.rb |