lib/rubyneat/cli/generate.rb in rubyneat-0.3.5.alpha.5 vs lib/rubyneat/cli/generate.rb in rubyneat-0.3.5.alpha.6
- old
+ new
@@ -30,14 +30,31 @@
def create_project_root_files
@ruby = OpenStruct.new version: RUBY_VERSION,
engine: RUBY_ENGINE,
platform: RUBY_PLATFORM
- %w{Gemfile README.md}.
- map{ |pfile| [pfile, "#{name.snake}/#{pfile}"] }.
- each{ |source, destination| template source, destination }
+ tcopy %w{Gemfile README.md}.
+ map{ |pfile| [pfile, "#{name.snake}/#{pfile}"] }
end
+
+ def create_project_bin_files
+ tcopy %w{ neat }.
+ map{ |pfile| ["bin/#{pfile}", "#{name.snake}/bin/#{pfile}"] }, exec: true
+ end
+
+ def create_project_config_files
+ tcopy %w{ boot.rb }.
+ map{|pfile| ["config/#{pfile}", "#{name.snake}/config/#{pfile}"]}
+ end
+
+ private
+ def tcopy(from_to_list, exec: false)
+ from_to_list.each{ |from, to|
+ template from, to
+ File.chmod(0755, to) if exec
+ }
+ end
end
class Neater < Thor::Group
include Thor::Actions
extend GenHelpers
@@ -103,10 +120,9 @@
end
end
class Generate < Thor
register Generator::Neater, 'neater', 'neater', 'Generates a neater'
- register Generator::NewProject, 'new', 'new', 'Generates a new NEAT project'
end
end
end
class String