Class: Maximus::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/maximus/cli.rb

Overview

Since:

  • 0.1.0

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ CLI

Returns a new instance of CLI.

Since:

  • 0.1.0


25
26
27
28
# File 'lib/maximus/cli.rb', line 25

def initialize(*args)
  super
  @config ||= Maximus::Config.new(default_options)
end

Instance Method Details

#backendObject

Since:

  • 0.1.0


36
37
38
# File 'lib/maximus/cli.rb', line 36

def backend
  ['rubocop', 'railsbp', 'brakeman'].each { |e| check_exclude(e) }
end

#frontendObject

Since:

  • 0.1.0


31
32
33
# File 'lib/maximus/cli.rb', line 31

def frontend
  ['scsslint', 'jshint'].each { |e| check_exclude(e) }
end

#gitObject

Since:

  • 0.1.0


53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/maximus/cli.rb', line 53

def git
  all_tasks = ['frontend', 'backend', 'statistics']
  # If all flag is enabled, run everything
  return all_tasks.each { |a| send(a) } if options[:all]
  # Lint by category unless all flags are blank
  return all_tasks.each { |a| check_option(a) } unless options[:frontend].blank? && options[:backend].blank? && options[:statistics].blank?
  # If include flag is enabled, run based on what's included
  return options[:include].each { |i| send(i) } unless options[:include].blank?
  # If all flag is not enabled, lint working copy as it's supposed to be
  @config.settings[:commit] = options[:git]
  return Maximus::GitControl.new({config: @config}).lints_and_stats(true)
end

#installObject

Since:

  • 0.1.0


68
69
70
# File 'lib/maximus/cli.rb', line 68

def install
  `npm install -g jshint phantomas stylestats`
end

#rubyObject

Since:

  • 0.1.0


48
49
50
# File 'lib/maximus/cli.rb', line 48

def ruby
  backend
end

#statisticsObject

Since:

  • 0.1.0


41
42
43
# File 'lib/maximus/cli.rb', line 41

def statistics
  ['stylestats', 'phantomas', 'wraith'].each { |e| check_exclude(e) }
end