onceover-codequality 0.1.1 → 0.2.0

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: 435eb54d0970e1cd68cf84062cc809ee021ece0d
4
- data.tar.gz: '03583b96994f073a2a53b7e6061e4db2f66c7906'
3
+ metadata.gz: 0fd0fa7b9afbcebd806a148ee5f9550f7d0fb240
4
+ data.tar.gz: 1751c2747cd62a34dc3e49f253eaa2ac14e49929
5
5
  SHA512:
6
- metadata.gz: 525c36a6417ec005cf9b8839fae16053a3748945da12c9ad140819a6017732eb91f654edd4d6ecbfd73f8a59b66dcc5bf019c292077576dc425c67f045c46bef
7
- data.tar.gz: f7f713f7ef1bba783fd54067bf057258dde2264fa069003fed16e681fbc81e9a626549f96bb999f8fb5bc13d705b7cbb843a571c63516da1a5c17a79a97de707
6
+ metadata.gz: 829ea5f9e914b9a4527c975ec9db4832f60c91eb8c6f7ccc9afd7a73de46032c40afc7f40599bc6fd35712c7f95415e4dabb9659c65ea786c270d1784f7ba95f
7
+ data.tar.gz: 39cec48a3ff533236403f183badcaccedae5c6c20ad6229685177d998607291e4daca7c7d893ea2b9b66fe4036337485fb121058176d597bcb26c34d30e5aa5d
data/README.md CHANGED
@@ -8,6 +8,8 @@ The plugin checks your control repository for:
8
8
  * Linting
9
9
  * Syntax
10
10
 
11
+ And then generates documentation using [Puppet Strings](https://github.com/puppetlabs/puppet-strings/)
12
+
11
13
  For sure you can hack around with rake/make and hack something up each time but aint nobody got time for that!
12
14
 
13
15
  ## Installation
@@ -43,6 +45,13 @@ $onceover run codequality --no_lint
43
45
  $ onceover run codequality --no_syntax
44
46
  ```
45
47
 
48
+ **Skip documentation generation**
49
+
50
+ ```shell
51
+ $ onceover run codequality --no_doc
52
+ ```
53
+
54
+
46
55
  ## Sample output
47
56
 
48
57
  **All clear**
@@ -103,7 +112,17 @@ $ bundle exec onceover run codequality
103
112
  **What are you using under-the-hood?**
104
113
 
105
114
  * [puppet-lint](https://github.com/rodjek/puppet-lint)
106
- * [puppet-syntax](https://github.com/voxpupuli/puppet-syntax)
115
+ * [puppet-syntax](https://github.com/voxpupuli/puppet-syntax)
116
+ * [puppet-strings](https://github.com/puppetlabs/puppet-strings/)
117
+
118
+
119
+ **My docs change a ton of files every time I run?**
120
+ This is because the timestamp is embedded inside the generated docs by default. This is fixed in the master branch of Puppet Strings which has not been released as a gem yet. You can reference the fixed version in your control repository Gemfile, like this:
121
+
122
+ ```ruby
123
+ gem 'puppet-strings',
124
+ :git => 'https://github.com/puppetlabs/puppet-strings'
125
+ ```
107
126
 
108
127
  ## Development
109
128
 
@@ -1,5 +1,6 @@
1
1
  require "onceover/codequality/lint"
2
2
  require "onceover/codequality/syntax"
3
+ require "onceover/codequality/docs"
3
4
  class Onceover
4
5
  module CodeQuality
5
6
  class CLI
@@ -7,7 +8,7 @@ class Onceover
7
8
  def self.command
8
9
  @cmd ||= Cri::Command.define do
9
10
  name 'codequality'
10
- usage 'codequality [--no-lint] [--no-syntax]'
11
+ usage 'codequality [--no-syntax] [--no-lint] [--no-docs]'
11
12
  summary "Code Quality checking for onceover"
12
13
  description <<-DESCRIPTION
13
14
  Check files in your Control Repository for Lint and Syntax errors
@@ -15,10 +16,12 @@ Check files in your Control Repository for Lint and Syntax errors
15
16
 
16
17
  option :l, :no_lint, 'Do not check for lint errors', :argument => :optional
17
18
  option :x, :no_syntax, 'Do not check for syntax errors', :argument => :optional
19
+ option :d, :no_docs, 'Do not generate documentation (puppet-strings) for local modules', :argument => :optional
18
20
 
19
21
  run do |opts, args, cmd|
20
22
  no_lint = opts[:no_lint] || false
21
23
  no_syntax = opts[:no_syntax] || false
24
+ no_docs = opts[:no_docs] || false
22
25
  status = true
23
26
  if ! no_lint
24
27
  logger.info "Checking for lint..."
@@ -36,6 +39,14 @@ Check files in your Control Repository for Lint and Syntax errors
36
39
  end
37
40
  end
38
41
 
42
+ if ! no_docs
43
+ logger.info "Generating documentation..."
44
+ if ! Onceover::CodeQuality::Docs.puppet_strings
45
+ status = false
46
+ logger.error "Documentation generation failed, see previous errors"
47
+ end
48
+ end
49
+
39
50
  if status
40
51
  logger.info "Code Quality tests passed, have a nice day"
41
52
  else
@@ -0,0 +1,23 @@
1
+ # Support for generating documentation using Puppet Strings for each module
2
+ # listed in the site directory
3
+ class Onceover
4
+ module CodeQuality
5
+ module Docs
6
+ LOCAL_MOD_DIR = "site"
7
+
8
+ def self.puppet_strings
9
+ status = true
10
+ if Dir.exist?(LOCAL_MOD_DIR)
11
+ Dir.glob("#{LOCAL_MOD_DIR}/*/") { |dir|
12
+ Dir.chdir(dir) {
13
+ status &= system("puppet strings")
14
+ }
15
+ }
16
+ end
17
+
18
+ status
19
+ end
20
+
21
+ end
22
+ end
23
+ end
@@ -4,9 +4,16 @@ class Onceover
4
4
  module CodeQuality
5
5
  module Syntax
6
6
  def self.puppet
7
+ status = true
8
+ if File.exist?("Puppetfile")
9
+ status &= system("r10k puppetfile check")
10
+ else
11
+ logger.warn("No Puppetfile found... continuing")
12
+ end
13
+
7
14
  # rake task contains an exit statement so run it in a subshell to
8
15
  # capture and continue
9
- status = system(
16
+ status &= system(
10
17
  "ruby << EOD
11
18
  require 'puppet-syntax/tasks/puppet-syntax'
12
19
  Rake::Task['syntax'].invoke
@@ -1,5 +1,5 @@
1
1
  class Onceover
2
2
  module CodeQuality
3
- VERSION = "0.1.1"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -27,4 +27,5 @@ Gem::Specification.new do |spec|
27
27
  spec.add_runtime_dependency 'onceover', '~> 3'
28
28
  spec.add_runtime_dependency 'puppet-syntax', '~> 2'
29
29
  spec.add_runtime_dependency 'puppet-lint', '~> 2'
30
+ spec.add_runtime_dependency 'puppet-strings', '~> 1'
30
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onceover-codequality
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Declarative Systems
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-12 00:00:00.000000000 Z
11
+ date: 2017-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '2'
97
+ - !ruby/object:Gem::Dependency
98
+ name: puppet-strings
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1'
97
111
  description:
98
112
  email:
99
113
  - sales@declarativesystems.com
@@ -112,6 +126,7 @@ files:
112
126
  - bin/setup
113
127
  - lib/onceover/codequality.rb
114
128
  - lib/onceover/codequality/cli.rb
129
+ - lib/onceover/codequality/docs.rb
115
130
  - lib/onceover/codequality/lint.rb
116
131
  - lib/onceover/codequality/syntax.rb
117
132
  - lib/onceover/codequality/version.rb