Sha256: 717f2eab4c785e859e169ef1cddedb8863d3f2e661d87c3631aed2883e599b9b

Contents?: true

Size: 1.65 KB

Versions: 1

Compression:

Stored size: 1.65 KB

Contents

require 'zoku/commands/new'

$thor_runner = nil

module Zoku
  class Generator < Thor

    # Prints the currently installed Zoku version
    #
    desc "version", "Print Zoku Version"
    long_desc "Print out the currently installed Zoku gem version"
    def version
      puts "Zoku #{Zoku::VERSION}"
    end

    # Generates a new rails project and performs the opinionated setup steps
    #
    desc "new PROJECT", "Generate a new rails project"
    long_desc <<-NEW_PROJECT
      `new PROJECT` will generate a new opinionated rails project
    NEW_PROJECT
    option :build
    option :run
    def new(target_path)
      Commands::New.new(target_path).init
      if options[:build]
        puts `docker-compose build`
        puts `docker-compose run web bundle exec rake db:create db:migrate db:seed`
        puts `docker-compose up` if options[:run]
      end
    end

    # Initializes a new or existing project
    #
    desc "init [PATH]", "Initialize a new project"
    long_desc "meh"
    def init(path)
      puts path
    end

    # Checks to see if the internet is still down
    #
    # @option packets [Integer] :packets packet count to test with
    # @return [String] a string containing the current status
    desc "check", "Check to see if the internet is still down"
    long_desc "sigh"
    option :packets
    def check
      puts 'Checking to see if you are online...'
      count = options[:packets] ? options[:packets] : 2
      result = (`ping 8.8.8.8 -c #{count} | grep transmitted`).to_s
      if result.include?('100.0% packet loss')
        puts 'womp womp'
      else
        puts 'hooray, it looks like you may be online!'
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zoku-0.0.1 lib/zoku/cli.rb