Sha256: 03f49847a7615a2c61cd387ee65c3c5544cd8861215cbaadd0444b12b9863379
Contents?: true
Size: 1.42 KB
Versions: 21
Compression:
Stored size: 1.42 KB
Contents
#!/usr/bin/env ruby require File.join(File.dirname(__FILE__), "..", "lib", "perennial") Perennial::Application.processing(ARGV) do |a| a.banner = "Perennial v#{Perennial::VERSION} CLI" a.generator! a.option(:force, "force the creation of the application") a.add("create PATH [APP-NAME]", "Creates a Perennial-based library with a given PATH and, if provided, APP-NAME.") do |path, *args| # Get the app name, path etc. opts = args.extract_options! app_name = args.empty? ? File.basename(path) : args.shift path = File.expand_path(path) # Check if the folder exists if File.exist?(path) && !opts[:force] die! "The path you tried to use, #{path}, already exists. Please try another or pass --force" end # Convert the name and class name. app_path = app_name.underscore app_module = app_name.camelize # Actually do the generation. env = {:application_module => app_module, :application_path => app_path} setup_generator path folders 'tmp', 'config', 'lib', 'handlers', 'test' template 'application.erb', "lib/#{app_path}.rb", env template 'boot.erb', 'config/boot.rb', env template 'setup.erb', 'config/setup.rb', env template 'rakefile.erb', 'Rakefile', env template 'test_helper.erb', 'test/test_helper.rb', env template 'test.erb', "test/#{app_path}_test.rb", env end end
Version data entries
21 entries across 21 versions & 2 rubygems