Module: Squasher

Extended by:
Squasher
Included in:
Squasher
Defined in:
lib/squasher.rb,
lib/squasher/config.rb,
lib/squasher/render.rb,
lib/squasher/worker.rb,
lib/squasher/cleaner.rb,
lib/squasher/version.rb

Defined Under Namespace

Classes: Cleaner, Config, Render, Worker

Constant Summary collapse

VERSION =
"0.1.0"

Instance Method Summary collapse

Instance Method Details

#ask(*args) ⇒ Object



24
25
26
27
# File 'lib/squasher.rb', line 24

def ask(*args)
  tell(*args)
  $stdin.gets[0].downcase == 'y'
end

#cleanObject



15
16
17
# File 'lib/squasher.rb', line 15

def clean
  Cleaner.process
end

#error(*args) ⇒ Object



36
37
38
39
# File 'lib/squasher.rb', line 36

def error(*args)
  tell(*args)
  exit
end

#rake(command, description = nil) ⇒ Object



19
20
21
22
# File 'lib/squasher.rb', line 19

def rake(command, description = nil)
  tell(description) if description
  system("bundle exec rake #{ command }")
end

#squash(raw_date) ⇒ Object



9
10
11
12
13
# File 'lib/squasher.rb', line 9

def squash(raw_date)
  parts = raw_date.to_s.split('/').map(&:to_i)
  date = Time.new(*parts)
  Worker.process(date)
end

#tell(key, options = {}) ⇒ Object



29
30
31
32
33
34
# File 'lib/squasher.rb', line 29

def tell(key, options = {})
  message = messages.fetch(key.to_s)
  message = colorize(message)
  options.each { |key, value| message.gsub!(":#{ key }", value) }
  puts message
end