Class: Linner::Command

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/linner/command.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



9
10
11
# File 'lib/linner/command.rb', line 9

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#buildObject



59
60
61
62
63
64
65
66
# 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
end

#checkObject



24
25
26
27
28
# 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

#cleanObject



86
87
88
# File 'lib/linner/command.rb', line 86

def clean
  FileUtils.rm_rf Dir.glob("#{env.public_folder}/*")
end

#installObject



36
37
38
39
40
41
42
43
44
45
46
# 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) ⇒ Object



91
92
93
94
# File 'lib/linner/command.rb', line 91

def new(name)
  directory('templates', name)
  chmod("#{name}/bin/server", 0755)
end

#versionObject



14
15
16
# File 'lib/linner/command.rb', line 14

def version
  puts Linner::VERSION
end

#watchObject



74
75
76
77
78
79
80
81
82
83
# File 'lib/linner/command.rb', line 74

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