Class: Tol::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/tol/cli.rb

Instance Method Summary collapse

Instance Method Details

#codecheck_helpObject



56
57
58
# File 'lib/tol/cli.rb', line 56

def codecheck_help
  puts "  #{Rainbow("tol codecheck").foreground(:red)}     \# Checks the code for left over binding.pry or console.log."
end

#database_helpObject



48
49
50
# File 'lib/tol/cli.rb', line 48

def database_help
  puts "  #{Rainbow("tol db").foreground(:red)}            \# Copies the latest version of the database from Heroku to the local development system."
end

#git_helpObject



52
53
54
# File 'lib/tol/cli.rb', line 52

def git_help
  puts "  #{Rainbow("tol cm").foreground(:red)}            \# Quick commit and push."
end

#helpObject



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/tol/cli.rb', line 36

def help
  puts "  #{Rainbow("Take Off Labs").foreground(:green).underline} :: " +
       "#{Rainbow("A collection of useful tools for Rails development").underline}\n\n"

  database_help
  git_help
  codecheck_help
  newapp_help
  heroku_help
  help_help
end

#help_helpObject



70
71
72
# File 'lib/tol/cli.rb', line 70

def help_help
  puts "  #{Rainbow("tol help").foreground(:red)}          \# Displays this help message."
end

#heroku_helpObject



66
67
68
# File 'lib/tol/cli.rb', line 66

def heroku_help
  puts "  #{Rainbow("tol heroku:deploy").foreground(:red)} \# Deploy the app to Heroku."
end

#newapp_helpObject



60
61
62
63
64
# File 'lib/tol/cli.rb', line 60

def newapp_help
  puts "  #{Rainbow("tol newapp:aws").foreground(:red)}    \# Set up Amazon Web Services S3 Buckets + (Carrierwave & Asset Sync)."
  puts "  #{Rainbow("tol newapp:heroku").foreground(:red)} \# Set up Heroku."
  puts "  #{Rainbow("tol newapp:www").foreground(:red)}    \# Set up a middleware that redirects non-www to www."
end

#runObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/tol/cli.rb', line 11

def run
  if ARGV.length == 0
    help
  else
    case ARGV.first
    when "db"
      Tol::Database.new.run
    when "cm"
      Tol::Git.new.commit
    when "codecheck"
      Tol::Codecheck.new.run
    when "newapp:aws"
      Tol::Newapp.new.awsbuckets
    when "newapp:heroku"
      Tol::Newapp.new.heroku
    when "newapp:www"
      Tol::Newapp.new.www_redirect
    when "heroku:deploy"
      Tol::Heroku.new.deploy
    else
      help
    end
  end
end