class Ghost::Manager::Installer

Attributes

install_directory[RW]

Public Class Methods

new(install_path) click to toggle source
# File lib/ghost/manager/installer.rb, line 10
def initialize install_path
  self.install_directory = File.expand_path install_path
end

Public Instance Methods

generate_theme() click to toggle source
# File lib/ghost/manager/installer.rb, line 73
def generate_theme
  # say "<%= color('Sorry, this does not quite work yet', :red, :bold) %>"
  # Make sure Yeoman is ready to roll
  # say "<%= color('Installing Yeoman...', :light_blue, :bold) %>"
  # system "npm install -g yo bower grunt-cli gulp"



end
install() click to toggle source
# File lib/ghost/manager/installer.rb, line 14
def install
  # Directory exists and is not empty
  if Dir.exists? install_directory and Dir.entries(install_directory).select{|x| ![".", ".."].include? x}.any?
    say "<%= color('Directory already exists and is not empty', :yellow, :bold) %>"
    result = ask "<%= color('Do you want to replace it? (y/n)') %>"

    if result == "y"
      system 'rm', '-rf', install_directory
      system 'mkdir', '-p', install_directory
    else
      return
    end
  else
    # Create the directory
    system 'mkdir', '-p', install_directory
  end


  say "<%= color('Cloning latest ghost version', :bold, :light_blue) %>"
  puts ""

  # Clone the latest version of ghost from github
  system "cd #{install_directory} && git clone https://github.com/TryGhost/Ghost.git ."

  puts ""
  say "<%= color('Installing node modules', :bold, :light_blue) %>"
  puts ""
  # Install packages
  system "cd #{install_directory} && npm install"

  # Build ember stuff
  puts ""
  say "<%= color('Building ember componenets...', :bold, :light_blue) %>"
  puts ""

  system "cd #{install_directory} && grunt init"
end
update_install() click to toggle source
# File lib/ghost/manager/installer.rb, line 52
def update_install
  say "<%= color('Updating ghost install...', :light_blue, :bold) %>"
  puts ""

  system "cd #{install_directory} && git stash && git pull && git stash pop"

  puts ""
  say "<%= color('Installing new node modules...', :light_blue, :bold) %>"
  puts ""

  system "cd #{install_directory} && npm install"

  # Build ember stuff
  puts ""
  say "<%= color('Building ember componenets...', :bold, :light_blue) %>"
  puts ""

  system "cd #{install_directory} && grunt init"
end