Sha256: 458dace87a96f6d6a002cc67a1959bb82ef27e5af0be8cb2d67d886fcb0c1487
Contents?: true
Size: 685 Bytes
Versions: 1
Compression:
Stored size: 685 Bytes
Contents
require "parseconfig" class Primo CONFIG_FILE = File.expand_path('~/.primo').freeze def self.create name, template system "rails new #{name} -m #{path_for(template)}" end def self.default value ensure_config File.write CONFIG_FILE, File.read(CONFIG_FILE) .gsub(/^default *= *\S*/m, "default = '#{value}'") end def self.current_template ensure_config ParseConfig.new(CONFIG_FILE)["default"] end def self.path_for template return File.expand_path("templates/#{template}.rb") unless template =~ /\.rb$/i template end def self.ensure_config FileUtils.cp("data/.primo", CONFIG_FILE) unless File.exists?(CONFIG_FILE) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
primo-0.0.6 | lib/primo.rb |