lib/ronin/gen/generators/library.rb in ronin-gen-1.1.0.rc1 vs lib/ronin/gen/generators/library.rb in ronin-gen-1.1.0.rc2

- old
+ new

@@ -1,7 +1,7 @@ # -# Copyright (c) 2009-2011 Hal Brodigan (postmodern.mod3 at gmail.com) +# Copyright (c) 2009-2012 Hal Brodigan (postmodern.mod3 at gmail.com) # # This file is part of Ronin Gen. # # Ronin Gen is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -61,11 +61,12 @@ :default => [] parameter :generators, :type => Array[String], :default => [] - parameter :no_git, :type => true + parameter :git, :type => true, + :default => true # # Sets up the library generator. # def setup @@ -88,24 +89,19 @@ # # Generates top-level files. # def generate - unless no_git? - run "git init" - end + run 'git', 'init' if git? template 'Gemfile.erb', 'Gemfile' cp 'Rakefile' template 'name.gemspec.erb', "#{@name}.gemspec" template 'gemspec.yml.erb', 'gemspec.yml' - unless no_git? - cp '.gitignore' - end - + cp '.gitignore' if git? cp '.rspec' cp '.document' template '.yardopts.erb', '.yardopts' cp 'COPYING.txt' @@ -137,13 +133,13 @@ File.join('spec',@dir_name,"#{@dir_name}_spec.rb") generate_commands unless @commands.empty? generate_generators unless @generators.empty? - unless no_git? - run 'git add .' - run 'git commit -m "Initial commit."' + if git? + run 'git', 'add', '.' + run 'git', 'commit', '-m', 'Initial commit.' end end # # Generates any optional commands for the library. @@ -154,10 +150,10 @@ @commands.each do |name| @command_file = name.downcase.gsub(/[_-]+/,'_') @command_class = @command_file.to_const_string template File.join('bin','ronin-command.erb'), - File.join('bin','ronin-' + @command_file.gsub('_','-')) + File.join('bin','ronin-' + @command_file.gsub('_','-')) template File.join(COMMANDS_DIR,'command.rb.erb'), File.join(COMMANDS_DIR,"#{@command_file}.rb") end end