Skip to content

Commit

Permalink
Upgraded danger, danger-changelog and added danger-toc.
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock committed May 9, 2020
1 parent 4456d2c commit f685ca7
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 34 deletions.
11 changes: 6 additions & 5 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2016-07-30 11:43:22 -0400 using RuboCop version 0.42.0.
# on 2020-05-09 10:55:58 -0400 using RuboCop version 0.82.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 18
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
# Offense count: 14
# Cop supports --auto-correct.
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 195
Layout/LineLength:
Max: 169
12 changes: 1 addition & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,7 @@ language: ruby
sudo: false

rvm:
- 2.3.1
- 2.3.0
- 2.2
- 2.1
- ruby-head
- jruby-9.0.5.0
- rbx-2

allow_failures:
- ruby-head
- rbx-2
- 2.6.6

before_script:
- bundle exec danger
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
### Changelog

### 0.1.2 (Next)
### 0.2.0 (Next)

* [#8](https://github.com/ruby-grape/danger/pull/8): Upgraded Danger 8.0, danger-changelog 0.6.1 and added danger-toc 0.2.0 - [@dblock](https://github.com/dblock).
* Your contribution here.

### 0.1.1 (12/5/2016)
### 0.1.1 (2016/12/05)

* [#7](https://github.com/ruby-grape/danger/pull/7): Upgraded to danger 4.0.1 and danger-changelog 0.2.0 - [@dblock](https://github.com/dblock).

### 0.1.0 (9/3/2016)
### 0.1.0 (2016/09/03)

* [#5](https://github.com/ruby-grape/danger/pull/5): Initial public release as a gem for Danger 3.2.0 - [@dblock](https://github.com/dblock).

Expand Down
16 changes: 11 additions & 5 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# --------------------------------------------------------------------------------------------------------------------
# Has any changes happened inside the actual library code?
# --------------------------------------------------------------------------------------------------------------------
Expand All @@ -7,9 +9,7 @@ has_spec_changes = !git.modified_files.grep(/spec/).empty?
# --------------------------------------------------------------------------------------------------------------------
# You've made changes to lib, but didn't write any tests?
# --------------------------------------------------------------------------------------------------------------------
if has_app_changes && !has_spec_changes
warn("There're library changes, but not tests. That's OK as long as you're refactoring existing code.", sticky: false)
end
warn("There're library changes, but not tests. That's OK as long as you're refactoring existing code.", sticky: false) if has_app_changes && !has_spec_changes

# --------------------------------------------------------------------------------------------------------------------
# You've made changes to specs, but no library code has changed?
Expand All @@ -21,15 +21,21 @@ end
# --------------------------------------------------------------------------------------------------------------------
# Have you updated CHANGELOG.md?
# --------------------------------------------------------------------------------------------------------------------
changelog.check
changelog.check!

# --------------------------------------------------------------------------------------------------------------------
# Do you have a TOC?
# --------------------------------------------------------------------------------------------------------------------
toc.check!

# --------------------------------------------------------------------------------------------------------------------
# Don't let testing shortcuts get into master by accident,
# ensuring that we don't get green builds based on a subset of tests.
# --------------------------------------------------------------------------------------------------------------------

(git.modified_files + git.added_files - %w(Dangerfile)).each do |file|
(git.modified_files + git.added_files - %w[Dangerfile]).each do |file|
next unless File.file?(file)

contents = File.read(file)
if file.start_with?('spec')
fail("`xit` or `fit` left in tests (#{file})") if contents =~ /^\w*[xf]it/
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ source 'https://rubygems.org'

gemspec

gem 'rubocop', '0.42.0'
gem 'rubocop', '0.82.0'
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,41 @@

[![Build Status](https://travis-ci.org/ruby-grape/danger.svg?branch=master)](https://travis-ci.org/ruby-grape/danger)

### Setup
## Table of Contents

- [Setup](#setup)
- [Set DANGER_GITHUB_API_TOKEN in Travis-CI](#set-danger_github_api_token-in-travis-ci)
- [Add Danger](#add-danger)
- [Add Dangerfile](#add-dangerfile)
- [Add Danger to Travis-CI](#add-danger-to-travis-ci)
- [Commit via a Pull Request](#commit-via-a-pull-request)
- [License](#license)

## Setup

Enable Danger for a project within the [ruby-grape organization](https://github.com/ruby-grape).

#### Set DANGER_GITHUB_API_TOKEN in Travis-CI
### Set DANGER_GITHUB_API_TOKEN in Travis-CI

In Travis-CI, choose _Settings_ and add `DANGER_GITHUB_API_TOKEN` in _Environment Variables_. Set the value to the API key for the [grape-bot](https://github.com/grape-bot) user, look in [this build log](https://travis-ci.org/ruby-grape/danger/builds/148579641) for its value.

#### Add Danger
### Add Danger

Add `ruby-grape-danger` to `Gemfile`.

```ruby
gem 'ruby-grape-danger', '~> 0.1.0', require: false
```

#### Add Dangerfile
### Add Dangerfile

Commit a `Dangerfile`, eg. [Grape's Dangerfile](https://github.com/ruby-grape/grape/blob/master/Dangerfile).

```ruby
danger.import_dangerfile(gem: 'ruby-grape-danger')
```

#### Add Danger to Travis-CI
### Add Danger to Travis-CI

Add Danger to `.travis.yml`, eg. [Grape's Travis.yml](https://github.com/ruby-grape/grape/blob/master/.travis.yml).

Expand All @@ -40,7 +50,7 @@ matrix:
- bundle exec danger
```
#### Commit via a Pull Request
### Commit via a Pull Request
To test things out, make a dummy entry in `CHANGELOG.md` that doesn't match the standard format and make a pull request. Iterate until green.

Expand Down
4 changes: 3 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'rubygems'
require 'bundler'

Expand All @@ -11,4 +13,4 @@ RuboCop::RakeTask.new
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)

task default: [:rubocop, :spec]
task default: %i[rubocop spec]
5 changes: 3 additions & 2 deletions ruby-grape-danger.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Gem::Specification.new do |s|

s.add_development_dependency 'rake'
s.add_development_dependency 'rspec'
s.add_runtime_dependency 'danger', '~> 4.0.1'
s.add_runtime_dependency 'danger-changelog', '~> 0.2.0'
s.add_runtime_dependency 'danger', '~> 8.0.0'
s.add_runtime_dependency 'danger-changelog', '~> 0.6.1'
s.add_runtime_dependency 'danger-toc', '~> 0.2.0'
end

0 comments on commit f685ca7

Please sign in to comment.