Module: Canuby

Defined in:
lib/canuby.rb,
lib/canuby/version.rb

Overview

Copyright (C) 2018 Sandro Jäckel. All rights reserved.

This file is part of Canuby.

Canuby is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Canuby is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Canuby. If not, see <www.gnu.org/licenses/>.

Constant Summary collapse

VERSION =
'0.0.2'
CONFIG_VERSION =
'0'

Class Method Summary collapse

Class Method Details

.mainObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/canuby.rb', line 43

def self.main
  $options = ArgParser.parse(ARGV)
  logger.info('===== Welcome to Canuby! =====')
  logger.debug('Running in debug mode.')
  logger.debug($options)

  if $options.only_check_config
    Config.load
    Config.check

  elsif $options.list
    require 'canuby/tasks'
    Rake.application.tasks.each do |t|
      # puts "#{t}".sub /:[a-z]{0,}$/, ''
      # puts "#{t}".match /^[A-z]{0,}:[A-z1-9]{0,}/
      puts t.to_s.yellow + ' ' * (45 - t.to_s.length) + t.comment.to_s unless t.comment.nil?
    end

  elsif $options.list_all
    require 'canuby/tasks'
    Rake.application.tasks.each do |t|
      puts t
    end

  else
    require 'canuby/tasks'
    Rake.application[$options.target.to_s].invoke
    Config.write
  end

  logger.info('===========  Done  ===========')
end