Skip to content

Commit

Permalink
Apply new-gem-template
Browse files Browse the repository at this point in the history
  • Loading branch information
palkan committed Sep 10, 2020
1 parent 052ce76 commit 36fe2db
Show file tree
Hide file tree
Showing 20 changed files with 241 additions and 71 deletions.
3 changes: 3 additions & 0 deletions .gem_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bump:
file: lib/isolator/version.rb
skip_ci: true
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: palkan

---

## What did you do?

## What did you expect to happen?

## What actually happened?

## Additional context

## Environment

**Ruby Version:**

**Framework Version (Rails, whatever):**

**Isolator Version:**
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: palkan

---

## Is your feature request related to a problem? Please describe.

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

## Describe the solution you'd like

A clear and concise description of what you want to happen.

## Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.

## Additional context

Add any other context or screenshots about the feature request here.
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--
First of all, thanks for contributing!
If it's a typo fix or minor documentation update feel free to skip the rest of this template!
-->

## What is the purpose of this pull request?

<!--
If it's a bug fix, then link it to the issue, for example:
Fixes #xxx
-->

## What changes did you make? (overview)

## Is there anything you'd like reviewers to focus on?

## Checklist

- [ ] I've added tests for this change
- [ ] I've added a Changelog entry
- [ ] I've updated a documentation
47 changes: 47 additions & 0 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build

on:
push:
branches:
- master
pull_request:

jobs:
rspec:
runs-on: ubuntu-latest
env:
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
CI: true
strategy:
fail-fast: false
matrix:
ruby: ["2.7"]
gemfile: ["gemfiles/rails6.gemfile"]
include:
- ruby: "2.5"
gemfile: "gemfiles/rails5.gemfile"
- ruby: "2.6"
gemfile: "gemfiles/rails5.gemfile"
- ruby: "2.7"
gemfile: "gemfiles/railsmaster.gemfile"
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: /home/runner/bundle
key: bundle-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ hashFiles(matrix.gemfile) }}-${{ hashFiles('**/*.gemspec') }}
restore-keys: |
bundle-${{ matrix.ruby }}-${{ matrix.gemfile }}-
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Bundle install
run: |
bundle config path /home/runner/bundle
bundle config --global gemfile ${{ matrix.gemfile }}
bundle install
bundle update
- name: Run RSpec
run: |
bundle exec rspec
21 changes: 21 additions & 0 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Lint Ruby

on:
push:
branches:
- master
pull_request:

jobs:
rubocop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Lint Ruby code with RuboCop
run: |
gem install bundler
bundle install --gemfile gemfiles/rubocop.gemfile --jobs 4 --retry 3
bundle exec --gemfile gemfiles/rubocop.gemfile rubocop
1 change: 1 addition & 0 deletions .mdlrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rules "~MD013", "~MD033"
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-f d
--color
16 changes: 16 additions & 0 deletions .rubocop-md.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
inherit_from: ".rubocop.yml"

require:
- rubocop-md

AllCops:
Include:
- '**/*.md'

Lint/Void:
Exclude:
- '**/*.md'

Lint/DuplicateMethods:
Exclude:
- '**/*.md'
26 changes: 2 additions & 24 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require:
- standard/cop/semantic_blocks
- rubocop-md

inherit_gem:
standard: config/base.yml
Expand All @@ -12,7 +11,8 @@ AllCops:
- 'Gemfile'
- 'vendor/**/*'
- 'gemfiles/**/*'
- 'lib/generators/**/templates/**/*'
- 'lib/.rbnext/**/*'
- 'lib/generators/**/templates/*.rb'
DisplayCopNames: true
TargetRubyVersion: 2.5

Expand All @@ -27,25 +27,3 @@ Style/TrailingCommaInArrayLiteral:

Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: no_comma

Lint/Void:
Exclude:
- '**/*.md'

# See https://github.com/rubocop-hq/rubocop/issues/4222
Lint/AmbiguousBlockAssociation:
Exclude:
- 'spec/**/*'
- '**/*.md'

Lint/DuplicateMethods:
Exclude:
- '**/*.md'

Naming/FileName:
Exclude:
- '**/*.md'

Layout/InitialIndentation:
Exclude:
- 'CHANGELOG.md'
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

16 changes: 8 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
source "https://rubygems.org"
# frozen_string_literal: true

git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
source 'https://rubygems.org'

# Specify your gem's dependencies in isolator.gemspec
gemspec
gem 'pry-byebug', platform: :mri

gem "pry-byebug"
gemspec

gem "sqlite3", "~> 1.4.0"
eval_gemfile "gemfiles/rubocop.gemfile"

local_gemfile = File.join(__dir__, "Gemfile.local")
local_gemfile = "#{File.dirname(__FILE__)}/Gemfile.local"

if File.exist?(local_gemfile)
eval(File.read(local_gemfile)) # rubocop:disable Security/Eval
else
gem "rails", "~> 6.0"
gem 'rails', '~> 6.0'
gem 'sqlite3', '~> 1.4.0'
end

gem 'uniform_notifier', '~> 1.11'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Cult Of Martians](http://cultofmartians.com/assets/badges/badge.svg)](http://cultofmartians.com/tasks/isolator.html)
[![Gem Version](https://badge.fury.io/rb/isolator.svg)](https://badge.fury.io/rb/isolator)
[![Build Status](https://travis-ci.org/palkan/isolator.svg?branch=master)](https://travis-ci.org/palkan/isolator)
![Build](https://github.com/palkan/isolator/workflows/Build/badge.svg)

# Isolator

Expand Down
43 changes: 43 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# How to release a gem

This document describes a process of releasing a new version of a gem.

1. Bump version.

```sh
git commit -m "Bump 1.<x>.<y>"
```

We're (kinda) using semantic versioning:

- Bugfixes should be released as fast as possible as patch versions.
- New features could be combined and released as minor or patch version upgrades (depending on the _size of the feature_—it's up to maintainers to decide).
- Breaking API changes should be avoided in minor and patch releases.
- Breaking dependencies changes (e.g., dropping older Ruby support) could be released in minor versions.

How to bump a version:

- Change the version number in `lib/isolator/version.rb` file.
- Update the changelog (add new heading with the version name and date).
- Update the installation documentation if necessary (e.g., during minor and major updates).

2. Push code to GitHub and make sure CI passes.

```sh
git push
```

3. Release a gem.

```sh
gem release -t
git push --tags
```

We use [gem-release](https://github.com/svenfuchs/gem-release) for publishing gems with a single command:

```sh
gem release -t
```

Don't forget to push tags and write release notes on GitHub (if necessary).
16 changes: 13 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,19 @@

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

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

task default: [:rubocop, :spec]
begin
require "rubocop/rake_task"
RuboCop::RakeTask.new

RuboCop::RakeTask.new("rubocop:md") do |task|
task.options << %w[-c .rubocop-md.yml]
end
rescue LoadError
task(:rubocop) {}
task("rubocop:md") {}
end

task default: %w[rubocop rubocop:md spec]
5 changes: 5 additions & 0 deletions gemfiles/rails6.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source 'https://rubygems.org'

gem 'rails', '~> 6.0'

gemspec path: '..'
4 changes: 4 additions & 0 deletions gemfiles/rubocop.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source "https://rubygems.org" do
gem "rubocop-md", "~> 0.3"
gem "standard", "~> 0.5.0"
end
8 changes: 2 additions & 6 deletions isolator.gemspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# frozen_string_literal: true

lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "isolator/version"
require_relative "lib/isolator/version"

Gem::Specification.new do |spec|
spec.name = "isolator"
Expand All @@ -17,9 +15,7 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = ">= 2.5.0"

spec.files = `git ls-files -z`.split("\x0").reject do |f|
f.match(%r{^(test|spec|features)/})
end
spec.files = Dir.glob("lib/**/*") + %w[README.md LICENSE.txt CHANGELOG.md]

spec.metadata = {
"bug_tracker_uri" => "http://github.com/palkan/isolator/issues",
Expand Down
2 changes: 1 addition & 1 deletion spec/support/active_record_init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

class User < ActiveRecord::Base; end

ActiveRecord::Base.logger = Logger.new(STDOUT) if ENV["LOG"]
ActiveRecord::Base.logger = Logger.new($stdout) if ENV["LOG"]
2 changes: 1 addition & 1 deletion spec/support/rails_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class TestApp < Rails::Application
config.eager_load = true

config.log_level = ENV["LOG"] ? :debug : :fatal
config.logger = ENV["LOG"] ? Logger.new(STDOUT) : Logger.new("/dev/null")
config.logger = ENV["LOG"] ? Logger.new($stdout) : Logger.new("/dev/null")

config.active_support.test_order = :random
end
Expand Down

0 comments on commit 36fe2db

Please sign in to comment.