Sha256: 65ccef8f93d050d084ac26335a38d7ae8cd8e170073faf1ae8ca336f51a89ae6

Contents?: true

Size: 1.43 KB

Versions: 4

Compression:

Stored size: 1.43 KB

Contents

#!/usr/bin/env ruby -w

require 'fileutils'
require 'optparse'
require 'methadone'
require 'methadone/cli'

include FileUtils
include Methadone::Main
include Methadone::CLI

main do |app_name|
  check_and_prepare_basedir!(app_name,options[:force])
  using_readme = options[:readme]

  gemname = File.basename(app_name)
  debug "Creating project for gem #{gemname}"

  chdir File.dirname(app_name)

  %x[bundle gem #{gemname}]

  chdir gemname

  template_dirs_in(:full).each  { |dir| mkdir_p dir }

  ["Rakefile", ".gitignore", "test/tc_something.rb", "features/support/env.rb"].each do |file|
    copy_file file, :binding => binding
  end

  if using_readme
    copy_file "README.rdoc", :binding => binding 
  end

  copy_file "features/executable.feature", :as => "#{gemname}.feature", :binding => binding
  copy_file "features/step_definitions/executable_steps.rb", :as => "#{gemname}_steps.rb"
  copy_file "bin/executable", :as => gemname, :executable => true

  add_to_file "#{gemname}.gemspec", [
    "  s.add_development_dependency('rdoc')",
    "  s.add_development_dependency('aruba')",
    "  s.add_development_dependency('rake','~> 0.9.2')",
    "  s.add_dependency('methadone')",
  ], :before => /^end\s*$/
end

options[:readme] = true

description "Kick the bash habit by bootstrapping your Ruby command-line apps"

on("--force","Overwrite files if they exist")
on("--[no-]readme","[Do not ]produce a README file")

arg :app_name, :required

go!

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
methadone-0.3.4 bin/methadone
methadone-0.3.3 bin/methadone
methadone-0.3.2 bin/methadone
methadone-0.3.1 bin/methadone