class Linner::Command

Public Class Methods

source_root() click to toggle source
# File lib/linner/command.rb, line 9
def self.source_root
  File.dirname(__FILE__)
end

Public Instance Methods

build() click to toggle source
# File lib/linner/command.rb, line 59
def build
  Linner.compile = true
  Linner.strict = true if options[:strict]
  clean
  env.merge_with_environment(options[:environment])
  Bundler.new(env).perform
  perform
rescue
  Notifier.error $!
end
check() click to toggle source
# File lib/linner/command.rb, line 24
def check
  env.merge_with_environment(options[:environment])
  message = Linner::Bundler.new(env).check
  puts (message.first ? "🍵 :" : "👻 :") + message.last
end
clean() click to toggle source
# File lib/linner/command.rb, line 88
def clean
  FileUtils.rm_rf Dir.glob("#{env.public_folder}/*")
end
install() click to toggle source
# File lib/linner/command.rb, line 36
def install
  begin
    env.merge_with_environment(options[:environment])
    Linner::Bundler.new(env).perform
  rescue
    puts "👻 : Install failed!"
    puts $!
    return
  end
  puts "🍵 : Perfect installed all bundles!"
end
new(name) click to toggle source
# File lib/linner/command.rb, line 93
def new(name)
  directory('templates', name)
  chmod("#{name}/bin/server", 0755)
end
version() click to toggle source
# File lib/linner/command.rb, line 14
def version
  puts Linner::VERSION
end
watch() click to toggle source
# File lib/linner/command.rb, line 76
def watch
  clean
  env.merge_with_environment(options[:environment])
  Bundler.new(env).perform
  perform
  watch_for_env
  watch_for_perform
  watch_for_reload rescue nil
  sleep
end

Private Instance Methods

env() click to toggle source
# File lib/linner/command.rb, line 99
def env
  Linner.env
end
exit!() click to toggle source
# File lib/linner/command.rb, line 128
def exit!
  Notifier.exit
  Kernel::exit
end
perform() click to toggle source
# File lib/linner/command.rb, line 103
def perform
  Notifier.profile { Linner.perform }
end
watch_for_env() click to toggle source
# File lib/linner/command.rb, line 121
def watch_for_env
  Listen.to Linner.root, filter: /(config\.yml|Linnerfile)$/ do |modified, added, removed|
    Linner.env = Environment.new Linner.config_file
    Bundler.new(env).perform
  end
end
watch_for_perform() click to toggle source
# File lib/linner/command.rb, line 107
def watch_for_perform
  Listen.to env.watched_paths do |modified, added, removed|
    Linner.cache.expire_by(modified + added + removed)
    perform
  end
end
watch_for_reload() click to toggle source
# File lib/linner/command.rb, line 114
def watch_for_reload
  reactor = Reactor.supervise_as(:reactor).actors.first
  Listen.to env.public_folder, relative_path: true do |modified, added, removed|
    reactor.reload_browser(modified + added + removed)
  end
end