maximus 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 70e71aa9bf1801ab2da6baad0c7a6de45759d5b2
4
- data.tar.gz: 1f3fc9752270915bfe051d3e76ba034816c7c42b
3
+ metadata.gz: dfcfe18a00fe7415422140b106609c011870cea5
4
+ data.tar.gz: db6a33810bb07a2fe58f0e29e9dd9e59f4c48e3e
5
5
  SHA512:
6
- metadata.gz: 2d24180804d7722eeaef5faedabc1ef5b0915af20ff9cee8cb30ce230cff669bd994f1de046894d6e96c35894f35aab4cce5b6248ab4a6d48b39961099bd287a
7
- data.tar.gz: 04e6694a21cc3926fc9338b26827480f8423e104fb5562ead917959edb7a563f12a01c180ad154ded26ab4c4bb4ff6433bcc9f684d4ced8559ae98a71fc6334a
6
+ metadata.gz: cfef49478e9d9f9b994c80f77ab9c987963b6f396828023b9e99902254d03b2382b56755d8929ba96154cb41f0571e5b9474a66ea9378788c314f63f1e6c03c7
7
+ data.tar.gz: 2d38e52edb5a2cc6850d7f303d86d87d48a1e9f6c98237aed90f0a31b478c42a598549fa0f6d0164de2c0912abcdc253caf1b8fe084bb2d68b4f3056f8a70668
data/README.md CHANGED
@@ -6,25 +6,81 @@ The all-in-one linting solution.
6
6
 
7
7
  Plays nice with Middleman and Rails.
8
8
 
9
- In the development block:
9
+ ## Install
10
10
 
11
- `gem 'maximus', git: 'git@bitbucket.org:wearefine/maximus.git'`
11
+ * Gemfile: `gem 'maximus', group: :development`
12
+ * Elsewhere/command line: `gem install maximus`
13
+ * Globally with RVM (~/.rvm/gemsets/global.gems): `maximus`
14
+
15
+ Maximus has several node dependencies that can be installed with a `npm install -g jshint phantomas stylestats` or a `maximus install` once the gem is successfully installed.
16
+
17
+ ## Config
18
+
19
+ Lints and statistics can be configured turned on or off with a `maximus.yml` file in the root directory maximus is being called in. `config/maximus.yml` will be checked if a config file isn't found in the root, and if there's still no luck, [the default config](lib/maximus/config/maximus.yml) will be loaded.
20
+
21
+ Parent options are identical to the [command line flags](#command-line-flags) with the exception of `include` and `exclude`.
22
+
23
+ ```yaml
24
+ domain: 'http://localhost'
25
+ port: 3000
26
+ paths:
27
+ home: '/'
28
+ ```
29
+
30
+ Configs for each lint or statistic are identical to their own syntax.
31
+
32
+ ```yaml
33
+ scsslint:
34
+ linters:
35
+ Compass::*:
36
+ enabled: true
37
+ ```
38
+
39
+ For systems that are JavaScript based, like JSHint, the YAML is converted to JSON.
40
+
41
+ ```yaml
42
+ jshint:
43
+ browser: true
44
+ unused: true
45
+ jquery: true
46
+ ```
47
+
48
+ Some configs can be massive and it's more readable to break these into their own files. They can be loaded by setting the value to the path of the desired config.
49
+
50
+ ```yaml
51
+ rubocop: 'config/rubocop.yml'
52
+ ```
53
+
54
+ Systems and groups of systems can be disabled with booleans. Groups of systems override individual preferences.
55
+
56
+ ```yaml
57
+ brakeman: false
58
+ statistics: false # no statistics will run
59
+ lints: true # all lints including brakeman will run
60
+ ```
61
+
62
+ ### [Sample Config](lib/maximus/config/maximus-example.yml)
12
63
 
13
64
  ## Command Line Flags
14
65
 
15
66
  Flag | Accepts | Description
16
67
  --------------------|----------------------------------|--------------------
17
- `-p`/`--path` | String/Array | Absolute path to URLs or files
68
+ `-fp`/`--filepaths` | String/Array | Space-separated path(s) to files
69
+ `-u`/`--urls` | String/Array | Statistics only - Space-separated path(s) to relative URL paths
70
+ `-d`/`--domain` | String | Statistics only - Web address (prepended to paths)
71
+ `-po`/`--port` | String/Numeric | Statistics only - Port to use if required (appended to domain)
18
72
  `-f`/`--frontend` | Boolean/Blank | Run all front-end lints
19
73
  `-b`/`--backend` | Boolean/Blank | Run all back-end lints
20
- `-s`/`--statistics` | Boolean/Blank | Run all back-end lints
21
- `-a`/`--all` | Boolean/Blank | Run all everything
74
+ `-s`/`--statistics` | Boolean/Blank | Run all statistics
75
+ `-a`/`--all` | Boolean/Blank | Run everything
22
76
  `-i`/`--include` | String/Array | Include specific lints or statistics
23
77
  `-i`/`--exclude` | String/Array | Exclude specific lints or statistics
24
- `-c`/`--commit` | String/`working`/`last`/`master` |
78
+ `-git`/`--sha` | String | Run maximus based on a git commit, working copy (`working`, default), the last commit (`last` or `HEAD^`), or the master branch (`master`)
79
+ `-c`/`--config` | String | Path to config file
80
+
25
81
 
26
82
  * Lint tasks can accept glob notation, i.e. `**/*.scss`
27
- * Arrays are space-separated, i.e. `--path=http://localhost:3000/ http://localhost:3000/about`
83
+ * Arrays are space-separated, i.e. `--urls=/ /about`
28
84
 
29
85
  ## Command Line Commands
30
86
 
@@ -35,23 +91,23 @@ Command | Description
35
91
  `backend` | Runs all back-end lints
36
92
  `statistics` | Runs all statistics
37
93
 
38
- ## Examples
94
+ ### Examples
39
95
 
40
96
  Default. Lints based on your working directory
41
97
 
42
- `maximus -c working`
98
+ `maximus -g working`
43
99
 
44
100
  Lints based on the previous commit by `HEAD^`
45
101
 
46
- `maximus -c last`
102
+ `maximus -g last`
47
103
 
48
104
  Lints based on the commit on the master branch
49
105
 
50
- `maximus -c master`
106
+ `maximus -g master`
51
107
 
52
108
  Lints based on commit d96a8e23
53
109
 
54
- `maximus -c d96a8e23`
110
+ `maximus -g d96a8e23`
55
111
 
56
112
  ## Lint syntax
57
113
 
@@ -66,3 +122,34 @@ When adding new lints, the JSON output should obey the following format:
66
122
  line: <position Integer>
67
123
  } ]
68
124
  ```
125
+
126
+ ## Changelog
127
+
128
+ ### 0.1.3
129
+
130
+ Features:
131
+
132
+ * Options are defined once in Config class
133
+ * `maximus.yml` can be loaded to set the config
134
+ * All lint and statistic options can be in the maximus config file
135
+ * More command line flags
136
+
137
+ ### 0.1.2 (December 18, 2014)
138
+
139
+ Features:
140
+
141
+ * Better inline documentation
142
+
143
+ Bugfixes:
144
+
145
+ * Resolve exiting error when no lint errors are preset (0efef67)
146
+
147
+ ### 0.1.1 (December 9, 2014)
148
+
149
+ * Description and homepage update
150
+
151
+ ### 0.1.0 (December 9, 2014)
152
+
153
+ * Initial
154
+
155
+
data/lib/maximus/cli.rb CHANGED
@@ -2,15 +2,30 @@ require 'thor'
2
2
 
3
3
  # @since 0.1.0
4
4
  class Maximus::CLI < Thor
5
+
5
6
  include Thor::Actions
6
- class_option :path, aliases: ["-p", "-u", "\--url"], default: nil, desc: "Space-separated path(s) to URLs or files"
7
- class_option :frontend, default: false, lazy_default: false, type: :boolean, desc: "Do front-end lints", aliases: ["-f", "--front-end"]
8
- class_option :backend, default: false, lazy_default: false, type: :boolean, desc: "Do back-end lints", aliases: ["-b", "--back-end"]
9
- class_option :statistics, default: false, lazy_default: false, type: :boolean, desc: "Do statistics", aliases: ["-s"]
10
- class_option :all, default: false, lazy_default: false, type: :boolean, desc: "Do everything", aliases: ["-a"]
11
- class_option :include, default: [], type: :array, aliases: ["-i"], desc: "Include only specific lints or statistics"
12
- class_option :exclude, default: [], type: :array, aliases: ["-e"], desc: "Exlude specific lints or statistics"
13
- class_option :commit, default: 'working', type: :string, banner: "working, last, master, or sha", aliases: ["-c", "--sha"], desc: "Lint by commit or working copy"
7
+
8
+ class_option :frontend, aliases: ['-f', '--front-end'], type: :boolean, default: false, lazy_default: false, desc: "Do front-end lints"
9
+ class_option :backend, aliases: ['-b', '--back-end'], type: :boolean, default: false, lazy_default: false, desc: "Do back-end lints"
10
+ class_option :statistics, aliases: ['-s'], type: :boolean, default: false, lazy_default: false, desc: "Do statistics"
11
+ class_option :all, aliases: ['-a'], type: :boolean, default: false, lazy_default: false, desc: "Do everything"
12
+
13
+ class_option :filepath, aliases: ['-fp'], type: :array, default: [], desc: "Space-separated path(s) to files"
14
+ class_option :urls, aliases: ['-u'], type: :array, default: ['/'], desc: "Statistics only - Space-separated path(s) to relative URL paths"
15
+ class_option :domain, aliases: ['-d'], type: :string, default: 'http://localhost', desc: "Statistics only - Web address (prepended to paths)"
16
+ class_option :port, aliases: ['-po'], type: :numeric, default: nil, desc: 'Statistics only - Port to use if required (appended to domain)'
17
+
18
+ class_option :include, aliases: ['-i'], type: :array, default: [], desc: "Include only specific lints or statistics"
19
+ class_option :exclude, aliases: ['-e'], type: :array, default: [], desc: "Exlude specific lints or statistics"
20
+
21
+ class_option :config, aliases: ['-c'], type: :string, default: 'maximus.yml', desc: 'Path to config file'
22
+
23
+ class_option :git, aliases: ['-g', '--sha'], type: :string, default: 'working', banner: "working, last, master, or sha", desc: "Lint by commit or working copy"
24
+
25
+ def initialize(*args)
26
+ super
27
+ @config ||= Maximus::Config.new(default_options)
28
+ end
14
29
 
15
30
  desc "frontend", "Execute all front-end tasks"
16
31
  def frontend
@@ -44,11 +59,11 @@ class Maximus::CLI < Thor
44
59
  # If include flag is enabled, run based on what's included
45
60
  return options[:include].each { |i| send(i) } unless options[:include].blank?
46
61
  # If all flag is not enabled, lint working copy as it's supposed to be
47
- return Maximus::GitControl.new({ commit: options[:commit], is_dev: true }).lints_and_stats(true)
62
+ @config.settings[:commit] = options[:git]
63
+ return Maximus::GitControl.new({config: @config}).lints_and_stats(true)
48
64
  end
49
65
 
50
66
  # @todo something better than just installing in the global npm file
51
- # and including phantomjs
52
67
  desc "install", "Install all dependencies"
53
68
  def install
54
69
  `npm install -g jshint phantomas stylestats`
@@ -65,41 +80,45 @@ class Maximus::CLI < Thor
65
80
  end
66
81
  def default_options
67
82
  {
68
- path: options[:path],
69
- is_dev: true
83
+ file_paths: options[:filepath],
84
+ paths: options[:urls],
85
+ domain: options[:domain],
86
+ port: options[:port],
87
+ is_dev: true,
88
+ config_file: options[:config]
70
89
  }
71
90
  end
72
91
 
73
92
  def scsslint
74
- Maximus::Scsslint.new(default_options).result
93
+ Maximus::Scsslint.new({config: @config}).result
75
94
  end
76
95
 
77
96
  def jshint
78
- Maximus::Jshint.new(default_options).result
97
+ Maximus::Jshint.new({config: @config}).result
79
98
  end
80
99
 
81
100
  def rubocop
82
- Maximus::Rubocop.new(default_options).result
101
+ Maximus::Rubocop.new({config: @config}).result
83
102
  end
84
103
 
85
104
  def railsbp
86
- Maximus::Railsbp.new(default_options).result
105
+ Maximus::Railsbp.new({config: @config}).result
87
106
  end
88
107
 
89
108
  def brakeman
90
- Maximus::Brakeman.new(default_options).result
109
+ Maximus::Brakeman.new({config: @config}).result
91
110
  end
92
111
 
93
112
  def stylestats
94
- Maximus::Stylestats.new(default_options).result
113
+ Maximus::Stylestats.new({config: @config}).result
95
114
  end
96
115
 
97
116
  def phantomas
98
- Maximus::Phantomas.new(default_options).result
117
+ Maximus::Phantomas.new({config: @config}).result
99
118
  end
100
119
 
101
120
  def wraith
102
- Maximus::Wraith.new(default_options).result
121
+ Maximus::Wraith.new({config: @config}).result
103
122
  end
104
123
  end
105
124
 
@@ -0,0 +1,129 @@
1
+ # Config for all
2
+ domain: 'http://localhost'
3
+ port: 3000
4
+
5
+ paths:
6
+ home: '/'
7
+
8
+ # Lints
9
+
10
+ # lints: true # enable all lints
11
+
12
+ scsslint:
13
+ scss_files: 'app/assets/stylesheets/'
14
+
15
+ # output format will always be JSON, so don't bother setting
16
+ # Format: whatever
17
+
18
+ linters:
19
+ Compass::*:
20
+ enabled: true
21
+ Compass::PropertyWithMixin:
22
+ ignore:
23
+ - 'inline-block'
24
+ - 'border-radius'
25
+ - 'box-shadow'
26
+ - 'opacity'
27
+ - 'text-shadow'
28
+ Indentation:
29
+ enabled: false
30
+ character: tab
31
+ severity: warning
32
+ width: 1
33
+ NameFormat:
34
+ convention: BEM
35
+ enabled: false
36
+ SelectorFormat:
37
+ enabled: false
38
+ DeclarationOrder:
39
+ enabled: false
40
+ EmptyLineBetweenBlocks:
41
+ enabled: false
42
+ NestingDepth:
43
+ max_depth: 6
44
+ severity: error
45
+ SelectorDepth:
46
+ max_depth: 5
47
+ severity: error
48
+ LeadingZero:
49
+ enabled: false
50
+ PlaceholderInExtend:
51
+ enabled: false
52
+ PropertySortOrder:
53
+ enabled: false
54
+ QualifyingElement:
55
+ enabled: true
56
+ allow_element_with_attribute: true
57
+ SpaceAfterPropertyColon:
58
+ enabled: false
59
+ UnnecessaryParentReference:
60
+ severity: error
61
+ VendorPrefixes:
62
+ exclude:
63
+ - '-webkit-tap-highlight-color'
64
+ - '-webkit-font-smoothing'
65
+ - '-moz-osx-font-smoothing'
66
+ - '-webkit-appearance'
67
+ - '-moz-placeholder'
68
+ - '-ms-input-placeholder'
69
+ - '-moz-pre-wrap'
70
+
71
+ jshint:
72
+ browser: true
73
+ esnext: true
74
+ globals: {}
75
+ globalstrict: true
76
+ undef: true
77
+ unused: true
78
+ jquery: true
79
+
80
+ rubocop: 'rubocop.yml'
81
+
82
+ brakeman: true
83
+
84
+ rails_best_practice: false
85
+
86
+ # Statistics
87
+ phantomas:
88
+ block-domain: 'google-analytics.com'
89
+ skip-modules:
90
+ - 'Caching'
91
+ - 'localStorage'
92
+ - 'Cookies'
93
+ - 'assetsWithQueryString'
94
+ - 'nodesWithInlineCSS'
95
+
96
+ stylestats:
97
+ published: false
98
+ paths: false
99
+ stylesheets: false
100
+ styleElements: true
101
+ size: true
102
+ dataUriSize: true
103
+ ratioOfDataUriSize: true
104
+ gzippedSize: false
105
+ simplicity: true
106
+ rules: true
107
+ selectors: true
108
+ mostIdentifier: true
109
+ mostIdentifierSelector: true
110
+ lowestCohesion: true
111
+ lowestCohesionSelector: true
112
+ totalUniqueFontSizes: true
113
+ uniqueFontSize: true
114
+ totalUniqueColors: true
115
+ uniqueColor: true
116
+ idSelectors: true
117
+ universalSelectors: true
118
+ unqualifiedAttributeSelectors: true
119
+ javascriptSpecificSelectors: "[#\\.]js\\-"
120
+ importantKeywords: true
121
+ floatProperties: true
122
+ mediaQueries: true
123
+ propertiesCount: 10
124
+ requestOptions: {}
125
+
126
+ wraith:
127
+ browser:
128
+ phantomjs: phantomjs
129
+ casperjs: casperjs
@@ -0,0 +1,2 @@
1
+ lints: true
2
+ statistics: true