Sha256: d45337920c4cbdcebdcd8c4c411df3badb5458af660b199a19a68afb1f2b27b5

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

#!/usr/bin/env ruby

require_relative '../lib/katapult/util'

case (command = ARGV.shift)
when 'target'
  app_name = ARGV.shift

  puts 'Creating new Rails application ...'
  system "rails new #{app_name} --skip-test-unit --skip-bundle --database mysql"

  Dir.chdir app_name

  puts
  puts 'Initializing git repository ...'
  system 'git init'
  Katapult::Util.git_commit "rails new #{app_name}"

  puts
  puts 'Installing katapult ...'
  File.open('Gemfile', 'a') do |file|
    file.puts "gem 'katapult'#{ ENV['KATAPULT_GEMFILE_OPTIONS'] }"
  end
  system 'bundle install'
  system 'bundle exec rails generate katapult:install'
  Katapult::Util.git_commit 'rails generate katapult:install'

  puts
  puts 'Generating katapult basics ...'
  system 'bundle exec rails generate katapult:basics'
  Katapult::Util.git_commit 'rails generate katapult:basics'

  puts
  puts 'Done.'

when 'fire'
  app_model_path = 'lib/katapult/application_model.rb'

  puts 'Loading katapult ...'
  system 'bin/rails generate katapult:transform ' + app_model_path

else
  puts 'Usage: katapult [target APP_NAME | fire]'
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
katapult-0.1.1 bin/katapult
katapult-0.1.0 bin/katapult