Skip to content

Commit 2232734

Browse files
authored
Merge pull request #195 from capistrano/set-up-travis-and-danger
Set up Travis and Danger
2 parents 7fe416a + 7203e35 commit 2232734

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sudo: false
2+
language: ruby
3+
rvm:
4+
- 2.3.3
5+
before_install: gem install bundler -v '~> 1.14' --conservative
6+
before_script: bundle exec danger

Dangerfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Adapted from https://github.com/ruby-grape/danger/blob/master/Dangerfile
2+
# Q: What is a Dangerfile, anyway? A: See http://danger.systems/
3+
4+
# ------------------------------------------------------------------------------
5+
# Additional pull request data
6+
# ------------------------------------------------------------------------------
7+
project_name = github.pr_json["base"]["repo"]["name"]
8+
pr_number = github.pr_json["number"]
9+
pr_url = github.pr_json["_links"]["html"]["href"]
10+
11+
# ------------------------------------------------------------------------------
12+
# What changed?
13+
# ------------------------------------------------------------------------------
14+
has_lib_changes = !git.modified_files.grep(/^lib/).empty?
15+
has_changelog_changes = git.modified_files.include?("CHANGELOG.md")
16+
17+
# ------------------------------------------------------------------------------
18+
# Have you updated CHANGELOG.md?
19+
# ------------------------------------------------------------------------------
20+
if !has_changelog_changes && has_lib_changes
21+
markdown <<-MARKDOWN
22+
Here's an example of a CHANGELOG.md entry (place it immediately under the `* Your contribution here!` line):
23+
24+
```markdown
25+
* [##{pr_number}](#{pr_url}): #{github.pr_title} - [@#{github.pr_author}](https://github.com/#{github.pr_author}).
26+
```
27+
MARKDOWN
28+
warn("Please update CHANGELOG.md with a description of your changes. "\
29+
"If this PR is not a user-facing change (e.g. just refactoring), "\
30+
"you can disregard this.", :sticky => false)
31+
end
32+
33+
# ------------------------------------------------------------------------------
34+
# Did you remove the CHANGELOG's "Your contribution here!" line?
35+
# ------------------------------------------------------------------------------
36+
if has_changelog_changes
37+
unless IO.read("CHANGELOG.md") =~ /^\* Your contribution here/i
38+
fail(
39+
"Please put the `* Your contribution here!` line back into CHANGELOG.md.",
40+
:sticky => false
41+
)
42+
end
43+
end

Rakefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
require "bundler/gem_tasks"
2+
3+
# Do nothing by default
4+
task :default

capistrano-rails.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ Gem::Specification.new do |gem|
1818
gem.add_dependency 'capistrano', '~> 3.1'
1919
gem.add_dependency 'capistrano-bundler', '~> 1.1'
2020

21+
gem.add_development_dependency 'danger'
2122
end

0 commit comments

Comments
 (0)