lib/primo.rb in primo-0.0.5 vs lib/primo.rb in primo-0.0.6

- old
+ new

@@ -2,12 +2,12 @@ class Primo CONFIG_FILE = File.expand_path('~/.primo').freeze - def self.create name - system "rails new #{name} -m #{current_template_path}" + 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) @@ -17,13 +17,12 @@ def self.current_template ensure_config ParseConfig.new(CONFIG_FILE)["default"] end - def self.current_template_path - default = current_template - default = File.expand_path("templates/#{default}.rb") unless default =~ /\.rb$/i - default + 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 \ No newline at end of file