Sha256: 24dc4f3f29a33b31559aeb0ba8926f2cb4a0ee37ea95021b0e37dbd415893d7a

Contents?: true

Size: 1.24 KB

Versions: 22

Compression:

Stored size: 1.24 KB

Contents

#!/usr/bin/env ruby

require 'erb'

DADDY_HOME = File.dirname(File.dirname(__FILE__))

action = ARGV[0]

if action == 'new'
  RAILS_VERSION = '4.0.13'
  puts "using rails #{RAILS_VERSION}"

  APP_NAME = ARGV[1]

  [
    "sudo gem install rails -v=#{RAILS_VERSION} --no-ri --no-rdoc",
    "rails _#{RAILS_VERSION}_ new #{APP_NAME} -d mysql --skip-bundle",
  ].each do |command|
    puts command
    exit 1 unless system(command)
  end

  # Gemfile
  template = File.join(DADDY_HOME, 'templates', 'Gemfile.erb')
  gemfile = File.join(APP_NAME, 'Gemfile')
  File.write(gemfile, ERB.new(File.read(template)).result)

  [
    "bundle install",
    "bundle exec rake dad:install",
    "bundle exec rake dad:db:config",
    "bundle exec rake dad:db:create",
    "bundle exec rake db:migrate",
    "bundle exec rails g controller welcome index --no-helper --no-assets",
    "echo '<h1>Welcome to #{APP_NAME}</h1>' > #{File.join('app', 'views', 'welcome', 'index.html.erb')}"
  ].each do |command|
    puts command
    exit 1 unless system("cd #{APP_NAME} && #{command}")
  end

  # routes
  template = File.join(DADDY_HOME, 'templates', 'config', 'routes.rb.erb')
  routes = File.join(APP_NAME, 'config', 'routes.rb')
  File.write(routes, ERB.new(File.read(template)).result)

end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
daddy-0.4.1 bin/dad
daddy-0.4.0 bin/dad
daddy-0.3.38 bin/dad
daddy-0.3.37 bin/dad
daddy-0.3.36 bin/dad
daddy-0.3.35 bin/dad
daddy-0.3.34 bin/dad
daddy-0.3.33 bin/dad
daddy-0.3.32 bin/dad
daddy-0.3.31 bin/dad
daddy-0.3.30 bin/dad
daddy-0.3.29 bin/dad
daddy-0.3.28 bin/dad
daddy-0.3.27 bin/dad
daddy-0.3.26 bin/dad
daddy-0.3.25 bin/dad
daddy-0.3.24 bin/dad
daddy-0.3.23 bin/dad
daddy-0.3.22 bin/dad
daddy-0.3.21 bin/dad