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

(IAC-364) Basic infrastructure #1

Merged
merged 6 commits into from
Feb 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Setting ownership to the modules team
* @puppetlabs/modules
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/

# rspec failure tracking
.rspec_status
3 changes: 3 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--format documentation
--color
--require spec_helper
142 changes: 142 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
require: rubocop-rspec

AllCops:
TargetRubyVersion: 2.3
Exclude:
# binstubs, and other utilities
- bin/**/*
- vendor/**/*
- vendor/**/.*
# package testing gems
- package-testing/vendor/**/*
- package-testing/vendor/**/.*

# Metrics, excludes complexity and sizing metrics for now, as ruby's defaults are very strict
Metrics/AbcSize:
Enabled: False

Metrics/BlockLength:
Description: rspec uses long describe blocks, so allow long blocks under spec/
Enabled: False
Exclude:
- 'spec/**/*.rb'

Metrics/ClassLength:
Enabled: False

Metrics/CyclomaticComplexity:
Enabled: False

Layout/LineLength:
Description: People have wide screens, use them.
Max: 200

Metrics/MethodLength:
Enabled: False

Metrics/ModuleLength:
Enabled: False

Metrics/ParameterLists:
Enabled: False

Metrics/PerceivedComplexity:
Enabled: False

# RSpec cops
RSpec/BeforeAfterAll:
Description: Beware of using after(:all) as it may cause state to leak between tests. A necessary evil in acceptance testing.
Exclude:
- 'spec/acceptance/**/*.rb'
- 'package-testing/spec/package/**/*.rb'

RSpec/DescribeClass:
Description: This cop does not account for rspec-puppet, and beaker-rspec usage.
Enabled: False

RSpec/HookArgument:
Description: Prefer explicit :each argument, matching existing module's style
EnforcedStyle: each

RSpec/NestedGroups:
Description: Nested groups can lead to cleaner tests with less duplication
Max: 10

RSpec/ExampleLength:
Description: Forcing short examples leads to the creation of one-time use let() helpers
Enabled: False

RSpec/MessageSpies:
EnforcedStyle: receive

RSpec/ScatteredSetup:
Enabled: False

# Style Cops
Style/AsciiComments:
Description: Names, non-english speaking communities.
Enabled: False

Style/BlockDelimiters:
Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to be consistent then.
EnforcedStyle: braces_for_chaining

Style/ClassAndModuleChildren:
Description: Compact style reduces the required amount of indentation.
EnforcedStyle: compact

Style/EmptyElse:
Description: Enforce against empty else clauses, but allow `nil` for clarity.
EnforcedStyle: empty

Style/FormatString:
Description: Following the main puppet project's style, prefer the % format format.
EnforcedStyle: percent

Style/FormatStringToken:
Description: Following the main puppet project's style, prefer the simpler template tokens over annotated ones.
EnforcedStyle: template

Style/IfUnlessModifier:
Description: Post-fix `if` modifiers are hard to parse for newcomers. We don't want to encourage them. Post-fix `unless` modifiers could be nice in some cases, but the Cop doesn't differentiate.
Enabled: false

Style/Lambda:
Description: Prefer the keyword for easier discoverability.
EnforcedStyle: literal

Style/MethodCalledOnDoEndBlock:
Enabled: true

Style/RegexpLiteral:
Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168
EnforcedStyle: percent_r

Style/SymbolProc:
Description: SymbolProc notation is not discoverable
Enabled: false

Style/TernaryParentheses:
Description: Checks for use of parentheses around ternary conditions. Enforce parentheses on complex expressions for better readability, but seriously consider breaking it up.
EnforcedStyle: require_parentheses_when_complex

Style/TrailingCommaInArguments:
Description: Prefer always trailing comma on multiline argument lists. This makes diffs, and re-ordering nicer.
EnforcedStyleForMultiline: comma

Style/TrailingCommaInArrayLiteral:
Description: Prefer always trailing comma on multiline literals. This makes diffs, and re-ordering nicer.
EnforcedStyleForMultiline: comma

Style/TrailingCommaInHashLiteral:
Description: Prefer always trailing comma on multiline literals. This makes diffs, and re-ordering nicer.
EnforcedStyleForMultiline: comma

Style/SymbolArray:
Description: Using percent style obscures symbolic intent of array's contents.
Enabled: true
EnforcedStyle: brackets

# Enforce LF line endings, even when on Windows
Layout/EndOfLine:
EnforcedStyle: lf
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
os: linux
language: ruby
cache: bundler
rvm:
- 2.5.7
before_install: gem install bundler -v 2.1.4
11 changes: 11 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

source 'https://rubygems.org'

# Specify your gem's dependencies in rspec_honeycomb_formatter.gemspec
gemspec

gem 'rake', '~> 12.0'
gem 'rspec', '~> 3.0'
gem 'rubocop'
gem 'rubocop-rspec'
53 changes: 53 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
PATH
remote: .
specs:
rspec_honeycomb_formatter (0.1.0)

GEM
remote: https://rubygems.org/
specs:
ast (2.4.0)
diff-lcs (1.3)
jaro_winkler (1.5.4)
parallel (1.19.1)
parser (2.7.0.2)
ast (~> 2.4.0)
rainbow (3.0.0)
rake (12.3.3)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.1)
rspec-support (~> 3.9.1)
rspec-expectations (3.9.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.2)
rubocop (0.79.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.7.0.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
rubocop-rspec (1.38.0)
rubocop (>= 0.68.1)
ruby-progressbar (1.10.1)
unicode-display_width (1.6.1)

PLATFORMS
ruby

DEPENDENCIES
rake (~> 12.0)
rspec (~> 3.0)
rspec_honeycomb_formatter!
rubocop
rubocop-rspec

BUNDLED WITH
2.1.4
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# RspecHoneycombFormatter

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rspec_honeycomb_formatter`. To experiment with that code, run `bin/console` for an interactive prompt.

TODO: Delete this and the text above, and describe your gem

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'rspec_honeycomb_formatter'
```

And then execute:

$ bundle install

Or install it yourself as:

$ gem install rspec_honeycomb_formatter

## Usage

TODO: Write usage instructions here

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rspec_honeycomb_formatter.

13 changes: 13 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'

RSpec::Core::RakeTask.new(:spec)

RuboCop::RakeTask.new(:rubocop) do |task|
task.options = %w[-D -S -E]
end

task default: [:rubocop, :spec]
24 changes: 24 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
install:
- set PATH=C:\Ruby25-x64\bin;%PATH%
- gem install bundler -v 2.1.4
- bundle -v
- bundle install --retry 2

build: off

branches:
only:
- master

before_test:
- bundle env
- type Gemfile.lock

test_script:
- bundle exec rake

# Uncomment this block to enable RDP access to the AppVeyor test instance for
# debugging purposes.
# on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
7 changes: 7 additions & 0 deletions lib/rspec_honeycomb_formatter.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

require 'rspec_honeycomb_formatter/version'

# main module containing the custom formatter
module RspecHoneycombFormatter
end
5 changes: 5 additions & 0 deletions lib/rspec_honeycomb_formatter/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

module RspecHoneycombFormatter
VERSION = '0.1.0'
end
27 changes: 27 additions & 0 deletions rspec_honeycomb_formatter.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

require_relative 'lib/rspec_honeycomb_formatter/version'

Gem::Specification.new do |spec|
spec.name = 'rspec_honeycomb_formatter'
spec.version = RspecHoneycombFormatter::VERSION
spec.authors = ['David Schmitt', 'Team IAC']
spec.email = ['david.schmitt@puppet.com', 'https://puppetlabs.github.io/iac/']

spec.summary = 'A custom RSpec formatter for https://honeycomb.io'
spec.homepage = 'https://github.com/puppetlabs/rspec_honeycomb_formatter'
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')

spec.metadata['homepage_uri'] = spec.homepage
spec.metadata['source_code_uri'] = 'https://github.com/puppetlabs/rspec_honeycomb_formatter'
spec.metadata['changelog_uri'] = 'https://github.com/puppetlabs/rspec_honeycomb_formatter/blob/master/CHANGELOG.md'

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files = Dir.chdir(File.expand_path(__dir__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
end
spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ['lib']
end
7 changes: 7 additions & 0 deletions spec/rspec_honeycomb_formatter_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

RSpec.describe RspecHoneycombFormatter do
it 'has a version number' do
expect(RspecHoneycombFormatter::VERSION).not_to be nil
end
end
16 changes: 16 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

require 'bundler/setup'
require 'rspec_honeycomb_formatter'

RSpec.configure do |config|
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = '.rspec_status'

# Disable RSpec exposing methods globally on `Module` and `main`
config.disable_monkey_patching!

config.expect_with :rspec do |c|
c.syntax = :expect
end
end