Module: HW::Actions

Included in:
Thor
Defined in:
lib/hw/actions.rb

Instance Method Summary collapse

Instance Method Details

#bundleObject



16
17
18
19
# File 'lib/hw/actions.rb', line 16

def bundle
  header "Bundling gems"
  run "bundle install --quiet"
end

#error(msg) ⇒ Object



8
# File 'lib/hw/actions.rb', line 8

def error msg;   say_status "error",   msg, :red;    end

#header(msg) ⇒ Object



2
3
4
# File 'lib/hw/actions.rb', line 2

def header msg
  say_status ">>>", "\e[36m#{msg}\e[0m", :cyan
end

#info(msg) ⇒ Object



6
# File 'lib/hw/actions.rb', line 6

def info msg;    say_status "info",    msg, :white;  end

#migrate(env = :development) ⇒ Object



21
22
23
24
# File 'lib/hw/actions.rb', line 21

def migrate env = :development
  header "Migrating the database"
  rake "db:migrate", :env => env
end

#replace_file(destination, data = nil, config = {}, &block) ⇒ Object



11
12
13
14
# File 'lib/hw/actions.rb', line 11

def replace_file(destination, data = nil, config = {}, &block)
  remove_file(destination)
  create_file(destination, data, config, block)
end

#success(msg) ⇒ Object



7
# File 'lib/hw/actions.rb', line 7

def success msg; say_status "success", msg, :green;  end

#warn(msg) ⇒ Object



9
# File 'lib/hw/actions.rb', line 9

def warn msg;    say_status "warning", msg, :yellow; end

#worker(filename, data = nil, &block) ⇒ Object



26
27
28
# File 'lib/hw/actions.rb', line 26

def worker filename, data=nil, &block
  create_file("app/workers/#{filename}", data, :verbose => false, &block)
end