bin/nephos-generator in nephos-server-0.2.3 vs bin/nephos-generator in nephos-server-0.2.4

- old
+ new

@@ -24,10 +24,11 @@ def root return {plain: "index"} end end EOF + puts "Controller \"#{name}\" created at location \"#{file}\"" end def create_application_dir dir raise "Directory #{dir} already exists" if Dir.exists? dir Dir.mkdir dir @@ -39,11 +40,11 @@ def initialize_application raise "Not an empty dir" unless Dir[File.expand_path "*"].empty? File.write "routes.rb", ROUTE_RB File.write "Gemfile", GEMFILE - Dir.mkdir "controllers" + Dir.mkdir "app" begin `git init .` puts "Git repository initialized" rescue Errno::ENOENT => err puts "Warning: git repository not initialized" @@ -60,20 +61,24 @@ opts.banner = "Usage: nephos-generator [controller name] [appli [name]]" end.parse! case ARGV[0] when "c", "controller" - if not ARGV[1].to_s.match(/[\w_\-\.]+/) - generate_controller("#{ARGV[1]}Controller", "src/#{ARGV[1]}.rb") + if ARGV[1].to_s.match(/[\w_\-\.]+/) + generate_controller("#{ARGV[1].capitalize}Controller", "app/#{ARGV[1].downcase}.rb") + else + puts "error" end when "a", "appli", "application" if not ARGV[1].to_s.empty? create_application_dir(ARGV[1]) puts "Application #{ARGV[1]} created" move_to_application_dir(ARGV[1]) end initialize_application puts "Application initialized" + else + puts "\"#{ARGV[0]}\" not recognized has a command" end rescue => err puts "Error: #{err.message}" end