Skip to content

Commit 89550bc

Browse files
committed
Add the bug report templates to the Travis CI build
The bug report templates are now executed from the `ci/travis.rb` when `GEM` contains `guides`. I started by creating a `test` task in `guides/Rakefile` to handle this, but since inline `gemfile` must not be executed with `bundle exec`, that rake task would not be consistent with others. So I went back by executing them directly from `Build`. Use inline Gemfile dependency when reporting gem bugs
1 parent 423f141 commit 89550bc

File tree

6 files changed

+49
-17
lines changed

6 files changed

+49
-17
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ env:
1919
- "GEM=ar:sqlite3"
2020
- "GEM=ar:postgresql"
2121
- "GEM=aj:integration"
22+
- "GEM=guides"
2223
rvm:
2324
- 2.2.2
2425
- ruby-head

ci/travis.rb

+24-8
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@
1616
class Build
1717
MAP = {
1818
'railties' => 'railties',
19-
'ap' => 'actionpack',
20-
'am' => 'actionmailer',
21-
'amo' => 'activemodel',
22-
'as' => 'activesupport',
23-
'ar' => 'activerecord',
24-
'av' => 'actionview',
25-
'aj' => 'activejob'
19+
'ap' => 'actionpack',
20+
'am' => 'actionmailer',
21+
'amo' => 'activemodel',
22+
'as' => 'activesupport',
23+
'ar' => 'activerecord',
24+
'av' => 'actionview',
25+
'aj' => 'activejob',
26+
'guides' => 'guides'
2627
}
2728

2829
attr_reader :component, :options
@@ -36,7 +37,11 @@ def run!(options = {})
3637
self.options.update(options)
3738
Dir.chdir(dir) do
3839
announce(heading)
39-
rake(*tasks)
40+
if guides?
41+
run_bug_report_templates
42+
else
43+
rake(*tasks)
44+
end
4045
end
4146
end
4247

@@ -71,6 +76,10 @@ def activerecord?
7176
gem == 'activerecord'
7277
end
7378

79+
def guides?
80+
gem == 'guides'
81+
end
82+
7483
def isolated?
7584
options[:isolated]
7685
end
@@ -96,6 +105,12 @@ def rake(*tasks)
96105
end
97106
true
98107
end
108+
109+
def run_bug_report_templates
110+
Dir.glob('bug_report_templates/*.rb').all? do |file|
111+
system(Gem.ruby, '-w', file)
112+
end
113+
end
99114
end
100115

101116
if ENV['GEM']=='aj:integration'
@@ -110,6 +125,7 @@ def rake(*tasks)
110125
next if ENV['TRAVIS_PULL_REQUEST'] && ENV['TRAVIS_PULL_REQUEST'] != 'false' && isolated
111126
next if gem == 'railties' && isolated
112127
next if gem == 'aj:integration' && isolated
128+
next if gem == 'guides' && isolated
113129

114130
build = Build.new(gem, :isolated => isolated)
115131
results[build.key] = build.run!

guides/bug_report_templates/action_controller_gem.rb

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
# Activate the gem you are reporting the issue against.
2-
gem 'rails', '4.2.0'
1+
require 'bundler/inline'
2+
3+
gemfile(true) do
4+
source 'https://rubygems.org'
5+
# Activate the gem you are reporting the issue against.
6+
gem 'rails', '4.2.0'
7+
end
38

4-
require 'rails'
59
require 'rack/test'
610
require 'action_controller/railtie'
711

guides/bug_report_templates/action_controller_master.rb

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
gem 'arel', github: 'rails/arel'
77
end
88

9-
require 'rails'
109
require 'action_controller/railtie'
1110

1211
class TestApp < Rails::Application

guides/bug_report_templates/active_record_gem.rb

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
# Activate the gem you are reporting the issue against.
2-
gem 'activerecord', '4.2.0'
1+
require 'bundler/inline'
2+
3+
gemfile(true) do
4+
source 'https://rubygems.org'
5+
# Activate the gem you are reporting the issue against.
6+
gem 'activerecord', '4.2.0'
7+
gem 'sqlite3'
8+
end
9+
310
require 'active_record'
411
require 'minitest/autorun'
512
require 'logger'

guides/bug_report_templates/generic_gem.rb

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
# Activate the gems you are reporting the issue against.
2-
gem 'activesupport', '4.2.0'
3-
require 'active_support'
1+
require 'bundler/inline'
2+
3+
gemfile(true) do
4+
source 'https://rubygems.org'
5+
# Activate the gem you are reporting the issue against.
6+
gem 'activesupport', '4.2.0'
7+
end
8+
49
require 'active_support/core_ext/object/blank'
510
require 'minitest/autorun'
611

0 commit comments

Comments
 (0)