Class: Codelation::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/codelation/base.rb,
lib/codelation/version.rb,
lib/codelation/development.rb,
lib/codelation/development/atom.rb,
lib/codelation/development/ruby.rb,
lib/codelation/development/postgres.rb,
lib/codelation/development/dot_files.rb,
lib/codelation/development/sequel_pro.rb,
lib/codelation/development/atom_packages.rb,
lib/codelation/development/install_methods.rb

Constant Summary collapse

ATOM_APP_DOWNLOAD_URL =
"https://atom.io/download/mac"
RUBY_INSTALL_VERSION =
"0.5.0"
RUBY_INSTALL_URL =
"https://github.com/postmodern/ruby-install/archive/v#{RUBY_INSTALL_VERSION}.tar.gz"
RUBY_VERSION =
"2.2.0"
POSTGRES_APP_DOWNLOAD_URL =
"https://github.com/PostgresApp/PostgresApp/releases/download/9.4.1.0/Postgres-9.4.1.0.zip"
SEQUEL_PRO_APP_DOWNLOAD_URL =
"http://codelation-cli.s3.amazonaws.com/sequel-pro-1.0.2.zip"

Instance Method Summary collapse

Instance Method Details

#development_installObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/codelation/development.rb', line 6

def development_install
  print_heading("Installing Atom.app")
  install_atom

  print_heading("Installing Atom Packages")
  install_atom_packages

  print_heading("Installing Dot Files")
  install_dot_files

  print_heading("Installing Postgres.app")
  install_postgres

  print_heading("Installing Ruby")
  install_ruby

  print_heading("Installing Sequel Pro.app")
  install_sequel_pro

  print_heading("Installing Codelation CLI to PATH")
  install_codelation_cli
end

#updateObject



10
11
12
13
14
# File 'lib/codelation/version.rb', line 10

def update
  command = "gem install codelation-cli"
  puts "Running #{command}..."
  exec(command)
end

#versionObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/codelation/version.rb', line 17

def version
  gem_version = "v#{Codelation::VERSION}"

  # Grab the latest version of the RubyGem
  rubygems_json = open("https://rubygems.org/api/v1/gems/codelation-cli.json").read
  rubygems_version = "v#{JSON.parse(rubygems_json)['version'].strip}"

  upgrade_message = ""
  if gem_version != rubygems_version
    upgrade_message = " Run `codelation update` to install"
  end

  puts
  puts "Codelation CLI"
  puts "  Installed: #{gem_version}"
  puts "  Latest:    #{rubygems_version}#{upgrade_message}"
  puts
end