Skip to content
This repository has been archived by the owner on Jan 29, 2022. It is now read-only.

Commit

Permalink
Rework routes, libs, helpers, and tests to fit MVC
Browse files Browse the repository at this point in the history
All API routes have been moved to controllers in
Api::V1::<ControllerName>. These controllers are configured to respond
to their original urls for backwards compatibility. This compatibility
will be removed in 2.0.0.

All r10k helpers have been moved to a new R10kHelpers file in
`app/helpers/r10k_helpers.rb`. All global controller methods are now
private methods within the main ApplicationController, while
controller-specific methods now exist in their controllers. Any
non-public method is now private.

All library-based code is now contained in a `PuppetWebhook` module
within the `lib/` directory in the root of the codedir. Theses include
body parsers, mcollective client, and chatops clients.

New tests have been added for the parsers, controllers, and helpers
  • Loading branch information
dhollinger committed Jan 23, 2019
1 parent b089f4e commit 1264129
Show file tree
Hide file tree
Showing 58 changed files with 1,280 additions and 1,008 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[*]
end_of_line = lf
insert_final_newline = true

# Matches multiple files with brace expansion notation
# Set default charset
[*.{rb,ru}]
charset = utf-8
indent_size = space
indent_size = 2

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ webhook.lock
logs/*.log
.idea/
coverage
Gemfile.lock
.byebug_history
vendor/
.bundle/
.vscode/
.yardoc/
doc/
public/
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ cache: bundler
dist: trusty
before_install:
- bundle -v
- rm Gemfile.lock || true
- gem install bundler -v 1.16.0
- gem install bundler -v 1.17.1
- bundle -v
before_script:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
Expand All @@ -19,7 +18,11 @@ after_script:
matrix:
fast_finish: true
include:
- rvm: 2.2.0
- rvm: 2.4.5
env: CHECK=test
- rvm: 2.5.3
env: CHECK=test
- rvm: 2.6.0
env: CHECK=test
- rvm: 2.4.2
env: CHECK=test_and_report_coverage
Expand All @@ -42,4 +45,3 @@ deploy:
on:
tags: true
repo: voxpupuli/puppet_webhook

2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,4 @@ These should not affect the functionality of the module.



\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
8 changes: 8 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Alexander Fisher alex@linfratech.co.uk
Ben Ford ben.ford@puppetlabs.com
Chet Hosey ChetRHosey@eaton.com
David Hollinger III david.hollinger@moduletux.com
Ewoud Kohl van Wijngaarden ewoud@kohlvanwijngaarden.nl
Lee Lowder l.lowder@keepingyouhonest.net
Tim Meusel tim@bastelfreak.de
Will Berman wlbberman@gmail.com
38 changes: 37 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
source 'https://rubygems.org'

gemspec
gem 'sinatra'
gem 'sinatra-contrib'
# gem 'sinatra-authentication'
gem 'activerecord', '~> 4.2', '>= 4.2.6', require: 'active_record'
gem 'bcrypt'
gem 'github_changelog_generator'
gem 'mcollective-client'
gem 'pry'
gem 'puma'
gem 'r10k'
gem 'rake'
gem 'require_all'
gem 'rocket-chat-notifier'
gem 'shotgun'
gem 'sinatra-activerecord', require: 'sinatra/activerecord'
gem 'slack-notifier'
gem 'sqlite3'
gem 'thin'
gem 'tux'

group :development do
gem 'debase'
gem 'rubocop'
gem 'ruby-debug-ide'
gem 'yard'
end

group :test do
gem 'capybara'
gem 'coveralls'
gem 'database_cleaner', git: 'https://github.com/bmabey/database_cleaner.git'
gem 'rack-test'
gem 'rspec'
gem 'simplecov'
gem 'simplecov-console'
gem 'webmock'
end
268 changes: 268 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
GIT
remote: https://github.com/bmabey/database_cleaner.git
revision: 4c2408ffdbbd990e78d6590f4ef6ba5e58aca673
specs:
database_cleaner (1.7.0)

GEM
remote: https://rubygems.org/
specs:
activemodel (4.2.11)
activesupport (= 4.2.11)
builder (~> 3.1)
activerecord (4.2.11)
activemodel (= 4.2.11)
activesupport (= 4.2.11)
arel (~> 6.0)
activesupport (4.2.11)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
ansi (1.5.0)
arel (6.0.4)
ast (2.4.0)
backports (3.11.4)
bcrypt (3.1.12)
bond (0.5.1)
builder (3.2.3)
capybara (3.12.0)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (~> 1.2)
xpath (~> 3.2)
coderay (1.1.2)
colored (1.2)
concurrent-ruby (1.1.4)
coveralls (0.8.22)
json (>= 1.8, < 3)
simplecov (~> 0.16.1)
term-ansicolor (~> 1.3)
thor (~> 0.19.4)
tins (~> 1.6)
crack (0.4.3)
safe_yaml (~> 1.0.0)
cri (2.15.2)
colored (~> 1.2)
daemons (1.3.1)
debase (0.2.2)
debase-ruby_core_source (>= 0.10.2)
debase-ruby_core_source (0.10.4)
diff-lcs (1.3)
docile (1.3.1)
eventmachine (1.2.7)
faraday (0.13.1)
multipart-post (>= 1.2, < 3)
faraday-http-cache (2.0.0)
faraday (~> 0.8)
faraday_middleware (0.12.2)
faraday (>= 0.7.4, < 1.0)
fast_gettext (1.1.2)
gettext (3.2.9)
locale (>= 2.0.5)
text (>= 1.3.0)
gettext-setup (0.30)
fast_gettext (~> 1.1.0)
gettext (>= 3.0.2)
locale
github_changelog_generator (1.14.3)
activesupport
faraday-http-cache
multi_json
octokit (~> 4.6)
rainbow (>= 2.1)
rake (>= 10.0)
retriable (~> 2.1)
hashdiff (0.3.8)
hirb (0.7.3)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jaro_winkler (1.5.1)
json (2.1.0)
locale (2.1.2)
log4r (1.1.10)
mcollective-client (2.12.4)
json
stomp
systemu
method_source (0.9.2)
mini_mime (1.0.1)
mini_portile2 (2.4.0)
minitar (0.7)
minitest (5.11.3)
multi_json (1.13.1)
multipart-post (2.0.0)
mustermann (1.0.3)
nokogiri (1.9.1)
mini_portile2 (~> 2.4.0)
octokit (4.13.0)
sawyer (~> 0.8.0, >= 0.5.3)
parallel (1.12.1)
parser (2.5.3.0)
ast (~> 2.4.0)
powerpack (0.1.2)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
public_suffix (3.0.3)
puma (3.12.0)
puppet_forge (2.2.9)
faraday (>= 0.9.0, < 0.14.0)
faraday_middleware (>= 0.9.0, < 0.13.0)
gettext-setup (~> 0.11)
minitar
semantic_puppet (~> 1.0)
r10k (3.1.0)
colored (= 1.2)
cri (~> 2.15.1)
gettext-setup (~> 0.24)
log4r (= 1.1.10)
multi_json (~> 1.10)
puppet_forge (~> 2.2.8)
rack (2.0.6)
rack-protection (2.0.5)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rainbow (3.0.0)
rake (12.3.2)
regexp_parser (1.3.0)
require_all (2.0.0)
retriable (2.1.0)
ripl (0.7.1)
bond (~> 0.5.1)
ripl-multi_line (0.3.1)
ripl (>= 0.3.6)
ripl-rack (0.2.0)
rack (>= 1.0)
rack-test (>= 0.5)
ripl (>= 0.3.5)
rocket-chat-notifier (0.1.0)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
rubocop (0.61.1)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.5, != 2.5.1.1)
powerpack (~> 0.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.4.0)
ruby-debug-ide (0.6.1)
rake (>= 0.8.1)
ruby-progressbar (1.10.0)
safe_yaml (1.0.4)
sawyer (0.8.1)
addressable (>= 2.3.5, < 2.6)
faraday (~> 0.8, < 1.0)
semantic_puppet (1.0.2)
shotgun (0.9.2)
rack (>= 1.0)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-console (0.4.2)
ansi
hirb
simplecov
simplecov-html (0.10.2)
sinatra (2.0.5)
mustermann (~> 1.0)
rack (~> 2.0)
rack-protection (= 2.0.5)
tilt (~> 2.0)
sinatra-activerecord (2.0.13)
activerecord (>= 3.2)
sinatra (>= 1.0)
sinatra-contrib (2.0.5)
backports (>= 2.8.2)
multi_json
mustermann (~> 1.0)
rack-protection (= 2.0.5)
sinatra (= 2.0.5)
tilt (>= 1.3, < 3)
slack-notifier (2.3.2)
sqlite3 (1.3.13)
stomp (1.4.8)
systemu (2.6.5)
term-ansicolor (1.7.1)
tins (~> 1.0)
text (1.3.1)
thin (1.7.2)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0, >= 1.0.4)
rack (>= 1, < 3)
thor (0.19.4)
thread_safe (0.3.6)
tilt (2.0.9)
tins (1.20.2)
tux (0.3.0)
ripl (>= 0.3.5)
ripl-multi_line (>= 0.2.4)
ripl-rack (>= 0.2.0)
sinatra (>= 1.2.1)
tzinfo (1.2.5)
thread_safe (~> 0.1)
unicode-display_width (1.4.1)
webmock (3.5.1)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff
xpath (3.2.0)
nokogiri (~> 1.8)
yard (0.9.16)

PLATFORMS
ruby

DEPENDENCIES
activerecord (~> 4.2, >= 4.2.6)
bcrypt
capybara
coveralls
database_cleaner!
debase
github_changelog_generator
mcollective-client
pry
puma
r10k
rack-test
rake
require_all
rocket-chat-notifier
rspec
rubocop
ruby-debug-ide
shotgun
simplecov
simplecov-console
sinatra
sinatra-activerecord
sinatra-contrib
slack-notifier
sqlite3
thin
tux
webmock
yard

BUNDLED WITH
1.17.1
Loading

0 comments on commit 1264129

Please sign in to comment.