Sha256: e6bd2b1bd58f0f05b712c155c9837d67ce24d496c72854574e57ad677783475c

Contents?: true

Size: 1.51 KB

Versions: 3

Compression:

Stored size: 1.51 KB

Contents

#!/usr/bin/env ruby
#encoding: utf-8
require 'fileutils'

local_path = File.expand_path("../../", __FILE__)
users_path = Dir.pwd

files  = %w(ec.rb dashboard.rb config.ru _config.yml Rakefile Gemfile README.md LICENSE)

def copy_files(local_path, users_path, files, dev=false)
  files.each do |filename|
    FileUtils.cp_r local_path + '/' + filename, users_path, :verbose => true
  end
  FileUtils.cp_r local_path + "/lib", users_path, :verbose => true
  FileUtils.cp_r local_path + "/public", users_path, :verbose => true
  FileUtils.cp_r local_path + "/views", users_path, :verbose => true
  if dev
     FileUtils.cp_r local_path + "/spec", users_path, :verbose => true
     FileUtils.cp_r local_path + '/.rspec', users_path, :verbose => true
  end
end

if ARGV[0] == 'install'
  if ARGV[1] == '--dev'
    copy_files(local_path, users_path, files, true)
  else
    copy_files(local_path, users_path, files)
  end
  puts "done!"
elsif ARGV[0] == 'update'
  files.delete("_config.yml")
  files.delete("Gemfile")
  if ARGV[1] == '--dev'
    copy_files(local_path, users_path, files, true)
  else
    copy_files(local_path, users_path, files)
  end
  puts "done!"
elsif ARGV[0] == '--help' || ARGV[0] == '-h' || ARGV[0].nil?
  puts 'ec install, copies all the required files in the current directory.'
  puts 'ec update, same as install but skips _config.yml and Gemfile.'
  puts 'pass the --dev flag to "ec install" or "ec update" to also copy the test suite.'
else
  puts "Uknown command : #{ARGV[0]}, see ec --help for available commands."
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
easycomments-1.0.5 bin/ec
easycomments-1.0.4 bin/ec
easycomments-1.0.3 bin/ec