Skip to content

Instantly share code, notes, and snippets.

@dimanon
Created April 8, 2012 12:03
Show Gist options
  • Save dimanon/2336868 to your computer and use it in GitHub Desktop.
Save dimanon/2336868 to your computer and use it in GitHub Desktop.
opt
#!/usr/bin/env ruby
require 'optparse'
require_relative 'check'
require_relative 'directory'
options = {}
opt = OptionParser.new do |key|
key.banner = "Usage: serious DIRNAME [--views] [--public] [--heroku] [--no-git]\n" +
"Note: Only lowercase letters and dashes ('-') are allowed for DIRNMAE\n" +
"Options:"
key.on("--views", "Copies the default views into your site"){ options[:views] = true }
key.on("--public", "Copies the default public folder into your site"){ options[:public] = true }
key.on("--no-git", "Will not create a new git repository"){ options[:no_git] = true }
key.on("--heroku", "Creates a heroku app named with dirname."){ options[:heroku] = true}
key.on("--help", "Show help"){ puts opt; exit }
end
dir_check = Check.new(ARGV)
unless dir_check.ok?
puts opt
exit
end
opt.parse!(ARGV)
blog = Directory.new(ARGV.first)
blog.create_blog_root
Dir.chdir(blog.blog_root)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment