Sha256: b0829aa9aa690bab6c720ef8616c2003d785818b4f5c3c6c91cbc0605b22ffac

Contents?: true

Size: 1.74 KB

Versions: 1

Compression:

Stored size: 1.74 KB

Contents

#
# Blogaze
# Copyright (C) 2011-2013 Jack Polgar
#
# Blogaze is released under the BSD 3-clause license.
# @license http://opensource.org/licenses/BSD-3-Clause
#

module Blogaze
  module Bin
    class Create < Shebang::Command
      command :create
      banner  'Creates the files for a Blogaze installation'
      usage   'blogaze create [DIR]'

      # Path to the prototype application to use for new installations.
      PROTOTYPE = __DIR__('../../../proto')

      def index
        # Require the name argument
        if ARGV[0] == '' or ARGV[0].nil?
          puts "Missing argument [NAME]"
          return
        end

        # Destination to copy files
        destination = File.join(Dir.pwd, ARGV[0])

        # Make sure the destination doesn't exist
        if File.directory?(destination) and !option(:f)
          puts "Directory already exists with name: #{ARGV[0]}"
          return
        else
          # Copy files
          puts 'Copying files...'
          FileUtils.cp_r(PROTOTYPE, destination)

          # Rename config files
          ['config.default.rb', 'database.default.rb'].each do |config|
            FileUtils.mv(destination + "/config/#{config}", destination + "/config/" + config.gsub('.default', ''))
          end

          # Tell the user what to do next
          puts 'Done.'
          puts
          puts "You will need to enter your database information"
          puts "into the 'config/database.rb' file then run the"
          puts "following commands:"
          puts
          puts "  rake db:migrate"
          puts "  rake db:defaults"
          puts
          puts "The default admin account is:"
          puts "  Username: admin"
          puts "  Password: myadmin"
          puts
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blogaze-0.0.2 lib/blogaze/bin/create.rb