class Bio::Gem::Generator::Application
Public Class Methods
build_options(arguments)
click to toggle source
# File lib/bio-gem/application.rb 56 def build_options(arguments) 57 env_opts_string = ENV['JEWELER_OPTS'] || "" 58 env_opts = Jeweler::Generator::Options.new(shellwords(env_opts_string)) 59 argument_opts = Jeweler::Generator::Options.new(arguments) 60 61 env_opts.merge(argument_opts) 62 end
run!(*arguments)
click to toggle source
# File lib/bio-gem/application.rb 8 def run!(*arguments) 9 10 options = build_options(arguments) 11 12 if options[:invalid_argument] 13 $stderr.puts options[:invalid_argument] 14 options[:show_help] = true 15 end 16 17 if options[:show_version] 18 $stderr.puts "Version: #{Jeweler::Version::STRING}" 19 return 1 20 end 21 22 if options[:show_help] 23 $stderr.puts options.opts 24 return 1 25 end 26 27 if options[:project_name].nil? || options[:project_name].squeeze.strip == "" 28 $stderr.puts options.opts 29 return 1 30 end 31 32 begin 33 if options[:directory]!='.' 34 FileUtils.mkdir_p options[:directory] 35 end 36 FileUtils.cd options[:directory] do 37 generator = Jeweler::Generator.new(options) 38 generator.run 39 return 0 40 end 41 rescue Jeweler::NoGitUserName 42 $stderr.puts %Q{No user.name found in ~/.gitconfig. Please tell git about yourself (see http://help.github.com/git-email-settings/ for details). For example: git config --global user.name "mad voo"} 43 return 1 44 rescue Jeweler::NoGitUserEmail 45 $stderr.puts %Q{No user.email found in ~/.gitconfig. Please tell git about yourself (see http://help.github.com/git-email-settings/ for details). For example: git config --global user.email mad.vooo@gmail.com} 46 return 1 47 rescue Jeweler::NoGitHubUser 48 $stderr.puts %Q{Please specify --github-username or set github.user in ~/.gitconfig (see http://github.com/blog/180-local-github-config for details). For example: git config --global github.user defunkt} 49 return 1 50 rescue Jeweler::FileInTheWay 51 $stderr.puts "The directory #{options[:project_name]} already exists. Maybe move it out of the way before continuing?" 52 return 1 53 end 54 end