module Surak

Constants

VERSION

Public Class Methods

install() click to toggle source
# File lib/surak.rb, line 70
def self.install
  puts "Installing Bower via npm"
  `sudo npm install -g bower`
  puts "Installing Grunt via npm"
  `sudo npm install -g grunt`
end
new(name) click to toggle source
# File lib/surak.rb, line 77
def self.new(name)
  puts "creating new project: #{name}"
  gem_dir = Gem::Specification.find_by_name("surak").gem_dir
  template_dir = gem_dir + '/lib/template'
  if !File.exist?(name)
    `mkdir #{name}`
    `cp -a #{template_dir+"/."} #{name}/.`
    Dir.chdir(name) do
      puts "Running: 'npm install'"
      `npm install`
      puts "Running: 'bower install'"
      `bower install`
    end
  else
    puts "File/Folder already exists with name: #{name}"
  end
end
start() click to toggle source
# File lib/surak.rb, line 95
def self.start
  if File.exist?("surak.json")
    puts "In correct directory"

    monitor = Surak::FileWatcherWrapper.new
    server = Surak::Server.new

    monitor_l = lambda { monitor.start }
    server_l = lambda { server.start }
    processes = [monitor_l, server_l]

    Parallel.each(processes) {|process| process.call }
  else
    puts "You must be in the root directory of a surak project to run this."
    puts "You are currently in #{Dir.pwd}"
  end
end