Sha256: 11cdc6accc7ac590f71427cec0ffe7aaa501d4bfd6d592ed43ff7e974b6cc8b0
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
#!/usr/bin/env ruby command = ARGV[0] error(%% No command specified, please use one of the following new: start a new project update: update mvp inside current project %) unless command case command.downcase when 'new' project = if ARGV[1] ARGV[1] else $stdin.reopen(File.open("/dev/tty", "r")) print "Project name? " STDIN.gets.chomp end error('Must specify a project name') if project == "" slug = slugify(project) puts run "git clone git@github.com:ian/mvp-rails.git #{slug}" puts puts "Initializing Project" files = Dir.glob("#{slug}/**/*").select { |f| File.file?(f) } files.each do |file_name| text = File.read(file_name) new_contents = text.gsub(/__PROJECT_NAME__/, project) .gsub(/__PROJECT_NAME_SLUG__/, slug) File.open(file_name, "w") {|file| file.puts new_contents } end run "cd #{slug} && rm -rf .git && rm install.rb && git init" run "cd #{slug}; bin/setup", "Project Setup" when 'update' puts "TBD" end BEGIN { def slugify(name) slug = name.gsub(/'/, '').gsub(/[^a-z0-9]+/, '_') slug.chop! if slug[-1] == '-' slug end def error(message) puts puts "Error: #{message}" exit 1 end def run(cmd, message=nil) if message puts puts message end system cmd end }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
minimum-viable-product-0.0.5 | bin/mvp |