Sha256: 5e586dea91b7b2a7dcc43054fe5cd2a01eb01daa5fa11de146676cbf66bc0598

Contents?: true

Size: 1.49 KB

Versions: 9

Compression:

Stored size: 1.49 KB

Contents

module MagLove
  class Application
    include Commander::Methods
    
    def run
      program :version, MagLove::VERSION
      program :description, 'MagLoft Themes Toolkit'
      program :help, 'Author', 'Tobias Strebitzer <tobias.strebitzer@magloft.com>'
      program :help, 'Website', 'http://www.magloft.com'
      program :help_formatter, Commander::HelpFormatter::TerminalCompact
      global_option '-x', '--verbose' do
        logger.level = :debug
      end
      global_option '--verbosity LEVEL', 'Specify verbosity level (*info*, debug, warn, error)' do |verbosity|
        verbosity = "info" if !["info", "debug", "warn", "error"].include?(verbosity.to_s)
        logger.level = verbosity.to_sym
      end
      global_option '--production'
      default_command :help
      
      logger.level = ENV["LOG_LEVEL"].to_sym if ENV["LOG_LEVEL"]
      
      MagLove::Command::Theme.new.run
      MagLove::Command::Core.new.run
      MagLove::Command::Compile.new.run
      MagLove::Command::Compress.new.run
      MagLove::Command::Copy.new.run
      MagLove::Command::Util.new.run
      MagLove::Command::Font.new.run
      MagLove::Command::Sync.new.run
      MagLove::Command::Server.new.run
      
      # allow colons
      ARGV[0] = ARGV[0].gsub(":", "-") if ARGV[0]
      
      # merge first two commands
      if ARGV.length > 1 and defined_commands.keys.include?("#{ARGV[0]}-#{ARGV[1]}")
        ARGV[0] = "#{ARGV[0]}-#{ARGV[1]}"
        ARGV.slice!(1)
      end
      
      run!
    end
    
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
maglove-0.5.9 lib/maglove/application.rb
maglove-0.5.8 lib/maglove/application.rb
maglove-0.5.7 lib/maglove/application.rb
maglove-0.5.5 lib/maglove/application.rb
maglove-0.5.4 lib/maglove/application.rb
maglove-0.5.2 lib/maglove/application.rb
maglove-0.5.1 lib/maglove/application.rb
maglove-0.5.0 lib/maglove/application.rb
maglove-0.3.0 lib/maglove/application.rb