Sha256: 923efda37e65c81c21466afe36df08389b40438b026d65344ffceeb4e3936816

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

#! /usr/bin/env ruby

# script to automate creation of new sinatra project
require 'colorize'
require 'ostruct'
require 'dindi'

# validate ARGV
if ARGV.size == 0
  puts "ERROR: Parameters needed.  Run with -h to view options".red
  puts ""
  exit
end

# parse ARGV
options = OpenStruct.new
begin
  Dindi::CommandParser.parse(ARGV, options)
rescue Exception => e
  exit!
end

# make sure project name is valid
if options.project_name.nil? or options.project_absolute_dir.nil?
  puts "ERROR: PROJECT_NAME is needed. Run with -h to view options".red
  puts ""
  exit
end

# create project default directories
Dindi::FileHelper.create_default_directories(options)

# create project files from templates
Dindi::FileHelper.copy_file_templates(options)

# Completion
puts "Your project folder #{options.project_name} was successfully created".green

# Optional steps
if options.with_bundle_install
  puts "Running 'bundle install --path vendor/bundle' ......."
  bundler_result = system("cd #{options.project_absolute_dir}; bundle install --path vendor/bundle")
  if bundler_result
    puts "passed".green + " bundler install"
  else
    puts "failed".red + " bundler install"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dindi-1.0 bin/dindi