Skip to content

Commit 13a25ec

Browse files
committed
Sets up initial gem to patch shoulda-matchers
Since we're taking advantage of storing UUIDs in MySQL as `binary`, the shoulda-matchers has an issue when the UUID ends in an `f`. This has lead to some flakey tests. [We made an effort to fix this upstream](thoughtbot/shoulda-matchers#1159), which doesn't appear to be gaining traction. This extracts the fix into a gem so we don't have to support a hard fork for this. * Adds rubocop and fix linter issues * Adds circleci config and ingore gem build artifacts * Adds CHANGELOG.md with latest change * Ensure database.yml is correctly setup for CI * Ensure CI builds with mysql to ensure tests run * Adds license to gemspec and updates readme with license info * Prepare README for public consumption * Update gem publishing to use Rubygems * Removes dox-style in favor of raw rubocop configuration to make open-source compatable
1 parent 772ce75 commit 13a25ec

58 files changed

Lines changed: 787 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
version: 2.1
2+
3+
orbs:
4+
gem: doximity/gem-publisher@0
5+
6+
executors:
7+
ruby-latest:
8+
resource_class: small
9+
docker:
10+
- image: circleci/ruby:2.6
11+
environment:
12+
BUNDLE_VERSION: "~> 1.17"
13+
- image: circleci/mysql:5.6
14+
15+
# yaml anchor filters
16+
master_only: &master_only
17+
filters:
18+
branches:
19+
only: master
20+
tags:
21+
ignore: /.*/
22+
pr_only: &pr_only
23+
filters:
24+
branches:
25+
ignore: master
26+
tags:
27+
ignore: /.*/
28+
version_tags_only: &version_tags_only
29+
filters:
30+
branches:
31+
ignore: /.*/
32+
tags:
33+
only: /^v.*/
34+
35+
jobs:
36+
build:
37+
executor: ruby-latest
38+
steps:
39+
- checkout
40+
- run:
41+
name: Install Bundler specific version
42+
command: |
43+
gem install bundler --version "${BUNDLE_VERSION}" --force
44+
- restore_cache:
45+
keys:
46+
- v1-bundle-{{ checksum "Gemfile.lock" }}-
47+
- run:
48+
name: Install Ruby Dependencies
49+
command: bundle check --path=vendor/bundle || bundle install --local --frozen --path=vendor/bundle --jobs=4 --retry=3
50+
- save_cache:
51+
key: v1-bundle-{{ checksum "Gemfile.lock" }}-
52+
paths:
53+
- vendor/bundle
54+
- run:
55+
name: Load mysql database from workspace
56+
command: |
57+
apt-get update -qq && apt-get install -y --no-install-recommends mysql-client
58+
until `nc -z 127.0.0.1 3306`; do
59+
echo 'Waiting for MySQL container...'
60+
sleep 1
61+
done
62+
echo 'MySQL container is up'
63+
- run:
64+
name: Run Tests
65+
command: bundle exec rake ci:specs
66+
environment:
67+
DATABASE_URL: mysql2://127.0.0.1:3306
68+
- store_test_results:
69+
name: Store test results
70+
path: tmp/test-results
71+
- run:
72+
name: Run Rubocop
73+
command: bundle exec rake ci:rubocop
74+
- run:
75+
name: Build documentation
76+
command: bundle exec rake ci:doc
77+
- store_artifacts:
78+
name: Saves documentation
79+
path: doc
80+
- persist_to_workspace:
81+
root: .
82+
paths:
83+
- vendor/bundle
84+
85+
workflows:
86+
version: 2
87+
88+
trunk:
89+
jobs:
90+
- build:
91+
<<: *master_only
92+
- gem/build:
93+
<<: *master_only
94+
executor: ruby-latest
95+
name: gem-build
96+
requires:
97+
- build
98+
99+
pull-requests:
100+
jobs:
101+
- build:
102+
<<: *pr_only
103+
- gem/build:
104+
<<: *pr_only
105+
executor: ruby-latest
106+
name: gem-build
107+
requires:
108+
- build
109+
- pre-release-approval:
110+
<<: *pr_only
111+
type: approval
112+
requires:
113+
- gem-build
114+
- gem/publish:
115+
<<: *pr_only
116+
name: gem-publish
117+
to_rubygems: true
118+
pre_release: true
119+
requires:
120+
- pre-release-approval
121+
context: artifact_publishing
122+
123+
final-release:
124+
jobs:
125+
- build:
126+
<<: *version_tags_only
127+
- gem/build:
128+
<<: *version_tags_only
129+
executor: ruby-latest
130+
name: gem-build
131+
requires:
132+
- build
133+
- gem/publish:
134+
<<: *version_tags_only
135+
name: gem-publish
136+
to_rubygems: true
137+
pre_release: false
138+
requires:
139+
- gem-build
140+
context: artifact_publishing

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*.gem
2+
/.bundle/
3+
/.ruby-version
4+
/.yardoc
5+
/_yardoc/
6+
/coverage/
7+
/doc/
8+
/pkg/
9+
/spec/**/database.yml
10+
/spec/reports/
11+
/tmp/
12+
13+
# rspec failure tracking
14+
.rspec_status
15+
16+
/vendor/bundle/

.rspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--format documentation
2+
--color
3+
--require spec_helper

.rubocop.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
require:
2+
- rubocop-rails
3+
- rubocop-rspec
4+
5+
AllCops:
6+
Exclude:
7+
- "./vendor/**/*"
8+
TargetRubyVersion: 2.6
9+
10+
Layout/DotPosition:
11+
EnforcedStyle: trailing
12+
Enabled: true
13+
Layout/LineLength:
14+
Max: 120
15+
16+
Lint/AmbiguousBlockAssociation:
17+
Exclude:
18+
- ./**/*_spec.rb
19+
Lint/UselessAccessModifier:
20+
ContextCreatingMethods:
21+
- concerning
22+
23+
Metrics/AbcSize:
24+
Max: 20
25+
Metrics/BlockLength:
26+
Exclude:
27+
- "./**/*_spec*.rb"
28+
- "./*.gemspec"
29+
- "./spec/*_helper*.rb"
30+
- "./tasks/ci.rake"
31+
- "./lib/tasks/**/*.rake"
32+
- "Gemfile"
33+
Metrics/CyclomaticComplexity:
34+
Max: 7
35+
Metrics/ModuleLength:
36+
Exclude:
37+
- "./**/*_spec*.rb"
38+
Metrics/MethodLength:
39+
Max: 20
40+
Exclude:
41+
- "./**/*_spec*.rb"
42+
Metrics/PerceivedComplexity:
43+
Max: 8
44+
45+
RSpec/BeforeAfterAll:
46+
Enabled: false
47+
RSpec/ExampleLength:
48+
Enabled: false
49+
RSpec/IteratedExpectation:
50+
Enabled: false
51+
RSpec/FilePath:
52+
Enabled: false
53+
RSpec/MultipleExpectations:
54+
Enabled: false
55+
56+
Rails/ApplicationRecord:
57+
Enabled: false
58+
59+
Security/YAMLLoad:
60+
AutoCorrect: false
61+
62+
Style/Documentation:
63+
Enabled: false
64+
Style/FormatStringToken:
65+
EnforcedStyle: template
66+
Style/LambdaCall:
67+
Enabled: false
68+
Style/NumericLiterals:
69+
Enabled: false
70+
Style/StringLiterals:
71+
EnforcedStyle: double_quotes
72+
ConsistentQuotesInMultiline: true
73+
Enabled: true
74+
Style/StringLiteralsInInterpolation:
75+
EnforcedStyle: double_quotes

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Changelog
2+
=========
3+
4+
## 0.1.2 02/25/2020
5+
* Updates CircleCi config to release to Rubygems
6+
* Cleans gemspec/readme to be open-source compatable
7+
* Updates .rubocop.yml to work for everyone
8+
9+
## 0.1.1 02/06/2020
10+
* Adds CircleCi config

CODE_OF_CONDUCT.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, gender identity and expression, level of experience,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at vstoll@doximity.com. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at [https://contributor-covenant.org/version/1/4][version]
72+
73+
[homepage]: https://contributor-covenant.org
74+
[version]: https://contributor-covenant.org/version/1/4/

Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
gemspec

0 commit comments

Comments
 (0)