Class: Bio::Gem::Generator::Application
- Inherits:
-
Object
- Object
- Bio::Gem::Generator::Application
- Defined in:
- lib/bio-gem/application.rb
Class Method Summary collapse
-
.run!(*arguments) ⇒ Object
Return an hash with :exit=>(0|1) and optionally and :options which is another hash This function has been stolen from Jeweler and mdified with the return hash, the original class returns just 0|1 the problem is that I need to identify the name of the project_name from outside to use bundler.
Class Method Details
.run!(*arguments) ⇒ Object
Return an hash with :exit=>(0|1) and optionally and :options which is another hash This function has been stolen from Jeweler and mdified with the return hash, the original class returns just 0|1 the problem is that I need to identify the name of the project_name from outside to use bundler.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/bio-gem/application.rb', line 10 def run!(*arguments) env_opts = if ENV['JEWELER_OPTS'] Jeweler::Generator::Options.new(ENV['JEWELER_OPTS'].split(' ')) end = Jeweler::Generator::Options.new(arguments) = .merge(env_opts) if env_opts if [:invalid_argument] $stderr.puts [:invalid_argument] [:show_help] = true end if [:show_help] $stderr.puts .opts return {:exit=>1} end if [:project_name].nil? || [:project_name].squeeze.strip == "" $stderr.puts .opts return {:exit=>1} end begin generator = Jeweler::Generator.new() generator.run return {:exit=>0, :options=>} rescue Jeweler::NoGitUserName $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"} return {:exit=>1} rescue Jeweler::NoGitUserEmail $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 [email protected]} return {:exit=>1} rescue Jeweler::NoGitHubUser $stderr.puts %Q{No github.user found in ~/.gitconfig. Please tell git about your GitHub account (see http://github.com/blog/180-local-github-config for details). For example: git config --global github.user defunkt} return {:exit=>1} rescue Jeweler::NoGitHubToken $stderr.puts %Q{No github.token found in ~/.gitconfig. Please tell git about your GitHub account (see http://github.com/blog/180-local-github-config for details). For example: git config --global github.token 6ef8395fecf207165f1a82178ae1b984} return {:exit=>1} rescue Jeweler::FileInTheWay $stderr.puts "The directory #{[:project_name]} already exists. Maybe move it out of the way before continuing?" return {:exit=>1} end end |