Permalink
Browse files

fix #32 now biogem can create projects into subdirectory (existing or…

… not)

user option --directory to set the destination directory otherwise it
will be used the default '.'
  • Loading branch information...
1 parent 3fe4a7a commit c0da52e5c21e98ed50580fdc8aefc25db99f18f6 @helios committed Apr 24, 2013
Showing with 10 additions and 3 deletions.
  1. +9 −3 lib/bio-gem/application.rb
  2. +1 −0 lib/bio-gem/mod/jeweler/options.rb
View
@@ -6,6 +6,7 @@ class Application
class << self
include Shellwords
def run!(*arguments)
+
options = build_options(arguments)
if options[:invalid_argument]
@@ -29,9 +30,14 @@ def run!(*arguments)
end
begin
- generator = Jeweler::Generator.new(options)
- generator.run
- return 0
+ if options[:directory]!='.'
+ FileUtils.mkdir_p options[:directory]
+ end
+ FileUtils.cd options[:directory] do
+ generator = Jeweler::Generator.new(options)
+ generator.run
+ return 0
+ end
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 1
@@ -24,6 +24,7 @@ def initialize(args)
require 'optparse'
@opts = OptionParser.new do |o|
+ self[:directory]='.'
o.banner = "Usage: #{File.basename($0)} [options] reponame\ne.g. #{File.basename($0)} the-perfect-gem"
o.on('--directory [DIRECTORY]', 'specify the directory to generate into') do |directory|

0 comments on commit c0da52e

Please sign in to comment.