bugsnag-capistrano 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/ISSUE_TEMPLATE/A.md +14 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +50 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +24 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +16 -0
- data/.github/support.md +22 -0
- data/.github/workflows/tests.yml +34 -0
- data/CHANGELOG.md +8 -0
- data/CONTRIBUTING.md +2 -1
- data/Gemfile +7 -0
- data/README.md +0 -1
- data/Rakefile +0 -11
- data/VERSION +1 -1
- data/lib/bugsnag-capistrano/capistrano2.rb +1 -1
- data/lib/bugsnag-capistrano/tasks/bugsnag.cap +1 -1
- data/spec/capistrano_spec.rb +81 -37
- data/spec/helpers/capistrano.rb +71 -0
- data/spec/helpers/server.rb +63 -0
- data/spec/release_spec.rb +3 -5
- data/spec/spec_helper.rb +2 -0
- metadata +12 -5
- data/.travis.yml +0 -77
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3168c9e9326354256532148f5b3e4549c265ed24f5e2839d1acdad19dc11aae6
|
4
|
+
data.tar.gz: 168d0ce8410d7bb134a3c25e3419c3fa443fa3f87c261fc3e206fdb713780203
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ded5c9418e59257e5fb753df27810d85e1d7577c65551fb35f250379f41bf131e3187f30c740a6dc70792e851381a1227316a6cf56be4d09cf4e01444eb4bf6
|
7
|
+
data.tar.gz: 384d6f05fcec38924bf69e26f6d54ccd0953c55c6d79145660257729f95561b7f1bfb898df7f51b4eea5671e4e06a454f8833d46b6e39756a7af75bc68902613
|
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
name: Having trouble getting started?
|
3
|
+
about: Please contact us at support@bugsnag.com for assistance with integrating Bugsnag
|
4
|
+
into your application.
|
5
|
+
title: ''
|
6
|
+
labels: ''
|
7
|
+
assignees: ''
|
8
|
+
|
9
|
+
---
|
10
|
+
Please checkout our [documentation](https://docs.bugsnag.com/build-integrations/capistrano/) for guides, references and tutorials.
|
11
|
+
|
12
|
+
If you have questions about your integration please contact us at [support@bugsnag.com](mailto:support@bugsnag.com).
|
13
|
+
|
14
|
+
Alternatively, view additional options at [support.md](../SUPPORT.md).
|
@@ -0,0 +1,50 @@
|
|
1
|
+
---
|
2
|
+
name: Bug report
|
3
|
+
about: Create a report to help us improve the library
|
4
|
+
title: ''
|
5
|
+
labels: ''
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
<!-- Before raising, please check if somebody else has already reported your issue. -->
|
11
|
+
|
12
|
+
### Describe the bug
|
13
|
+
A clear and concise description of what the bug is.
|
14
|
+
|
15
|
+
### Steps to reproduce
|
16
|
+
1. Go to '...'
|
17
|
+
2. Click on '....'
|
18
|
+
3. Scroll down to '....'
|
19
|
+
4. See error
|
20
|
+
|
21
|
+
### Environment
|
22
|
+
* Bugsnag version:
|
23
|
+
* Ruby version:
|
24
|
+
* Bundle version:
|
25
|
+
* Capfile:
|
26
|
+
|
27
|
+
<!--
|
28
|
+
Below are a few approaches you might take to communicate the issue, in
|
29
|
+
descending order of awesomeness. Please choose one and feel free to delete
|
30
|
+
the others from this template.
|
31
|
+
-->
|
32
|
+
|
33
|
+
### Example Repo <!-- Option 1 -->
|
34
|
+
|
35
|
+
- [ ] Create a minimal repository that can reproduce the issue
|
36
|
+
- [ ] Link to it here:
|
37
|
+
|
38
|
+
### Example code snippet <!-- Option 2 -->
|
39
|
+
|
40
|
+
```
|
41
|
+
# (Insert code sample to reproduce the problem)
|
42
|
+
```
|
43
|
+
|
44
|
+
<!-- Error messages, if any -->
|
45
|
+
<details><summary>Error messages:</summary>
|
46
|
+
|
47
|
+
```
|
48
|
+
|
49
|
+
```
|
50
|
+
</details>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
---
|
2
|
+
name: Feature request
|
3
|
+
about: Suggest an idea for this project
|
4
|
+
title: ''
|
5
|
+
labels: ''
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
<!-- Before creating, please check if somebody else has already reported your feature request. -->
|
11
|
+
|
12
|
+
### Description
|
13
|
+
<!-- Is your feature request related to a problem? Please describe.
|
14
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
15
|
+
-->
|
16
|
+
|
17
|
+
**Describe the solution you'd like**
|
18
|
+
<!-- A clear and concise description of what you want to happen. -->
|
19
|
+
|
20
|
+
**Describe alternatives you've considered**
|
21
|
+
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
|
22
|
+
|
23
|
+
**Additional context**
|
24
|
+
<!--Add any other context about the feature request here.-->
|
@@ -0,0 +1,16 @@
|
|
1
|
+
## Goal
|
2
|
+
|
3
|
+
<!-- Why is this change necessary? -->
|
4
|
+
|
5
|
+
## Design
|
6
|
+
|
7
|
+
<!-- Why was this approach used? -->
|
8
|
+
|
9
|
+
## Changeset
|
10
|
+
|
11
|
+
<!-- What changed? -->
|
12
|
+
|
13
|
+
## Testing
|
14
|
+
|
15
|
+
<!-- How was it tested? What manual and automated tests were
|
16
|
+
run/added? -->
|
data/.github/support.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
## Are you having trouble getting started?
|
2
|
+
If you haven't already, please checkout our [documentation](https://docs.bugsnag.com/build-integrations/capistrano/) for guides, references and tutorials.
|
3
|
+
|
4
|
+
Or, if you wish you can [contact us directly](mailto:support@bugsnag.com) for assistance on integrating Bugsnag into your application, troubleshooting an issue or a question about our supported features.
|
5
|
+
|
6
|
+
When contacting support, please include as much information as necessary, including:
|
7
|
+
|
8
|
+
- example code snippet
|
9
|
+
- steps to reproduce
|
10
|
+
- expected/actual behaviour
|
11
|
+
|
12
|
+
* Bugsnag version:
|
13
|
+
* Ruby version:
|
14
|
+
* Bundle version:
|
15
|
+
* Capfile:
|
16
|
+
|
17
|
+
## Bug or Feature Requests
|
18
|
+
If you would like to raise a bug or feature request please do so by creating a [New Issue](https://github.com/bugsnag/bugsnag-capistrano/issues/new/choose) and selecting bug or feature.
|
19
|
+
Please note: we cannot promise that we will fulfil all requests
|
20
|
+
|
21
|
+
## Pull Requests
|
22
|
+
If you have made a fix and would like to raise a pull request, please read our [CONTRIBUTING.md](../CONTRIBUTING.md) file before creating the pull request.
|
@@ -0,0 +1,34 @@
|
|
1
|
+
name: Tests
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
specs:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
strategy:
|
9
|
+
fail-fast: false
|
10
|
+
matrix:
|
11
|
+
ruby-version: ['2.0', '2.1', '2.2', '2.3', '2.4', '2.5', '2.6', '2.7', '3.0']
|
12
|
+
use-capistrano-2: ['false']
|
13
|
+
include:
|
14
|
+
- ruby-version: '2.0'
|
15
|
+
use-capistrano-2: 'true'
|
16
|
+
- ruby-version: '2.1'
|
17
|
+
use-capistrano-2: 'true'
|
18
|
+
|
19
|
+
env:
|
20
|
+
BUNDLE_WITH: test
|
21
|
+
CAP_2_TEST: ${{ matrix.use-capistrano-2 }}
|
22
|
+
|
23
|
+
steps:
|
24
|
+
- uses: actions/checkout@v2
|
25
|
+
|
26
|
+
- name: Install Ruby
|
27
|
+
uses: ruby/setup-ruby@v1
|
28
|
+
with:
|
29
|
+
ruby-version: ${{ matrix.ruby-version }}
|
30
|
+
bundler-cache: true
|
31
|
+
|
32
|
+
- run: bundle info capistrano
|
33
|
+
|
34
|
+
- run: bundle exec rake spec
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## 2.1.0 (13-07-2021)
|
2
|
+
|
3
|
+
### Enhancements
|
4
|
+
|
5
|
+
* Allow using a Bugsnag-specific repo URL with a new `:bugsnag_repo_url` variable
|
6
|
+
| [#22](https://github.com/bugsnag/bugsnag-capistrano/pull/22)
|
7
|
+
| [Simon](https://github.com/stoivo)
|
8
|
+
|
1
9
|
## 2.0.0 (03-04-2018)
|
2
10
|
|
3
11
|
Major changes have been made with the 2.0.0 release. For a full list please consult the [upgrading guide](https://github.com/bugsnag/bugsnag-capistrano/blob/master/UPGRADING.md).
|
data/CONTRIBUTING.md
CHANGED
data/Gemfile
CHANGED
@@ -8,6 +8,13 @@ group :test, optional: true do
|
|
8
8
|
gem 'addressable', '~>2.3.8'
|
9
9
|
gem 'webmock', RUBY_VERSION <= '1.9.3' ? '2.3.2': '>2.3.2'
|
10
10
|
gem 'capistrano', ENV['CAP_2_TEST'] == 'true' ? '~> 2.15.0': '~> 3.9.0'
|
11
|
+
|
12
|
+
# WEBrick is no longer in the stdlib in Ruby 3.0
|
13
|
+
gem 'webrick' if RUBY_VERSION >= '3.0.0'
|
14
|
+
gem 'rexml', '< 3.2.5' if RUBY_VERSION == '2.0.0'
|
15
|
+
|
16
|
+
# i18n added a call to Module#using in 1.3.0, which doesn't exist until Ruby 2.1
|
17
|
+
gem 'i18n', '< 1.3.0' if RUBY_VERSION == '2.0.0'
|
11
18
|
end
|
12
19
|
|
13
20
|
gemspec
|
data/README.md
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# Bugsnag deploy tracking with Capistrano
|
2
|
-
[![Build status](https://travis-ci.org/bugsnag/bugsnag-capistrano.svg?branch=master)](https://travis-ci.org/bugsnag/bugsnag-capistrano)
|
3
2
|
|
4
3
|
Bugsnag Capistrano automatically notifies Bugsnag when you deploy your
|
5
4
|
application with [Capistrano](https://github.com/capistrano/capistrano),
|
data/Rakefile
CHANGED
@@ -1,16 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'rubygems'
|
4
|
-
require 'bundler'
|
5
|
-
require 'bundler/gem_tasks'
|
6
|
-
begin
|
7
|
-
Bundler.setup(:default)
|
8
|
-
rescue Bundler::BundlerError => e
|
9
|
-
$stderr.puts e.message
|
10
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
11
|
-
exit e.status_code
|
12
|
-
end
|
13
|
-
|
14
3
|
require 'rdoc/task'
|
15
4
|
RDoc::Task.new do |rdoc|
|
16
5
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.1.0
|
@@ -17,7 +17,7 @@ module Bugsnag
|
|
17
17
|
:metadata => fetch(:bugsnag_metadata, nil),
|
18
18
|
:release_stage => fetch(:bugsnag_env) || ENV["BUGSNAG_RELEASE_STAGE"] || fetch(:rails_env) || fetch(:stage) || "production",
|
19
19
|
:revision => fetch(:current_revision, ENV["BUGSNAG_REVISION"]),
|
20
|
-
:repository => fetch(:repo_url, ENV["BUGSNAG_REPOSITORY"]),
|
20
|
+
:repository => fetch(:bugsnag_repo_url, fetch(:repo_url, ENV["BUGSNAG_REPOSITORY"])),
|
21
21
|
:source_control_provider => fetch(:bugsnag_source_control_provider, ENV["BUGSNAG_SOURCE_CONTROL_PROVIDER"]),
|
22
22
|
:endpoint => fetch(:bugsnag_endpoint, nil)
|
23
23
|
})
|
@@ -28,7 +28,7 @@ namespace :bugsnag do
|
|
28
28
|
:metadata => fetch(:bugsnag_metadata),
|
29
29
|
:release_stage => fetch(:bugsnag_env) || ENV["BUGSNAG_RELEASE_STAGE"] || fetch(:rails_env) || fetch(:stage) || "production",
|
30
30
|
:revision => fetch(:current_revision, ENV["BUGSNAG_REVISION"]),
|
31
|
-
:repository => fetch(:repo_url, ENV["BUGSNAG_REPOSITORY"]),
|
31
|
+
:repository => fetch(:bugsnag_repo_url, fetch(:repo_url, ENV["BUGSNAG_REPOSITORY"])),
|
32
32
|
:source_control_provider => fetch(:bugsnag_source_control_provider, ENV["BUGSNAG_SOURCE_CONTROL_PROVIDER"]),
|
33
33
|
:endpoint => fetch(:bugsnag_endpoint)
|
34
34
|
})
|
data/spec/capistrano_spec.rb
CHANGED
@@ -1,51 +1,27 @@
|
|
1
|
-
|
2
|
-
require 'rspec/expectations'
|
3
|
-
require 'rspec/mocks'
|
4
|
-
|
5
|
-
require 'webrick'
|
1
|
+
require_relative './spec_helper'
|
6
2
|
|
7
3
|
describe "bugsnag capistrano" do
|
4
|
+
server = Helpers::Server.new
|
8
5
|
|
9
|
-
server
|
10
|
-
|
11
|
-
cap_2 = ENV['CAP_2_TEST'] == 'true'
|
12
|
-
fixture_path = cap_2 ? '../examples/capistrano2' : '../examples/capistrano3'
|
13
|
-
exec_string = cap_2 ? 'bundle exec cap deploy' : 'bundle exec cap test deploy'
|
14
|
-
example_path = File.join(File.dirname(__FILE__), fixture_path)
|
15
|
-
|
16
|
-
before do
|
17
|
-
server = WEBrick::HTTPServer.new :Port => 0, :Logger => WEBrick::Log.new(STDOUT), :AccessLog => []
|
18
|
-
server.mount_proc '/deploy' do |req, res|
|
19
|
-
queue.push req.body
|
20
|
-
res.status = 200
|
21
|
-
res.body = "OK\n"
|
22
|
-
end
|
23
|
-
Thread.new{ server.start }
|
24
|
-
end
|
25
|
-
|
26
|
-
after do
|
27
|
-
server.stop
|
28
|
-
queue.clear
|
29
|
-
end
|
30
|
-
|
31
|
-
let(:request) { JSON.parse(queue.pop) }
|
6
|
+
before { server.start }
|
7
|
+
after { server.stop }
|
32
8
|
|
33
9
|
it "sends a deploy notification to the set endpoint" do
|
34
|
-
ENV['BUGSNAG_ENDPOINT'] =
|
10
|
+
ENV['BUGSNAG_ENDPOINT'] = server.url
|
35
11
|
ENV['BUGSNAG_APP_VERSION'] = "1"
|
36
12
|
|
37
|
-
Dir.chdir(example_path) do
|
38
|
-
system(
|
13
|
+
Dir.chdir(Helpers::Capistrano.example_path) do
|
14
|
+
system(Helpers::Capistrano.deploy_command)
|
39
15
|
end
|
40
16
|
|
41
|
-
payload =
|
17
|
+
payload = server.last_request
|
42
18
|
expect(payload["apiKey"]).to eq('YOUR_API_KEY')
|
43
19
|
expect(payload["appVersion"]).to eq("1")
|
44
20
|
expect(payload["releaseStage"]).to eq('production')
|
45
21
|
end
|
46
22
|
|
47
23
|
it "allows modifications of deployment characteristics" do
|
48
|
-
ENV['BUGSNAG_ENDPOINT'] =
|
24
|
+
ENV['BUGSNAG_ENDPOINT'] = server.url
|
49
25
|
ENV['BUGSNAG_API_KEY'] = "this is a test key"
|
50
26
|
ENV['BUGSNAG_RELEASE_STAGE'] = "test"
|
51
27
|
ENV['BUGSNAG_REVISION'] = "test"
|
@@ -54,11 +30,11 @@ describe "bugsnag capistrano" do
|
|
54
30
|
ENV['BUGSNAG_SOURCE_CONTROL_PROVIDER'] = "github"
|
55
31
|
ENV['BUGSNAG_AUTO_ASSIGN_RELEASE'] = 'true'
|
56
32
|
|
57
|
-
Dir.chdir(example_path) do
|
58
|
-
system(
|
33
|
+
Dir.chdir(Helpers::Capistrano.example_path) do
|
34
|
+
system(Helpers::Capistrano.deploy_command)
|
59
35
|
end
|
60
36
|
|
61
|
-
payload =
|
37
|
+
payload = server.last_request
|
62
38
|
expect(payload["apiKey"]).to eq('this is a test key')
|
63
39
|
expect(payload["releaseStage"]).to eq('test')
|
64
40
|
expect(payload["appVersion"]).to eq("1")
|
@@ -68,5 +44,73 @@ describe "bugsnag capistrano" do
|
|
68
44
|
expect(payload["sourceControl"]["provider"]).to eq("github")
|
69
45
|
expect(payload["autoAssignRelease"]).to eq(true)
|
70
46
|
end
|
71
|
-
end
|
72
47
|
|
48
|
+
it "uses 'repo_url' in preference to 'BUGSNAG_REPOSITORY'" do
|
49
|
+
ENV['BUGSNAG_REPOSITORY'] = "unused@repo.com:unused/unused_repo.git"
|
50
|
+
|
51
|
+
capfile = Helpers::Capistrano.generate_capfile({
|
52
|
+
bugsnag_api_key: "this is a test key",
|
53
|
+
app_version: "1",
|
54
|
+
bugsnag_auto_assign_release: true,
|
55
|
+
bugsnag_builder: "bob",
|
56
|
+
bugsnag_metadata: { a: 1, b: 2 },
|
57
|
+
bugsnag_env: "test",
|
58
|
+
current_revision: "test1234",
|
59
|
+
repo_url: "test@repo.com:test/test_repo.git",
|
60
|
+
bugsnag_source_control_provider: "github",
|
61
|
+
bugsnag_endpoint: server.url,
|
62
|
+
})
|
63
|
+
|
64
|
+
Helpers::Capistrano.run(capfile)
|
65
|
+
|
66
|
+
payload = server.last_request
|
67
|
+
|
68
|
+
expect(payload["apiKey"]).to eq('this is a test key')
|
69
|
+
expect(payload["appVersion"]).to eq("1")
|
70
|
+
expect(payload["autoAssignRelease"]).to eq(true)
|
71
|
+
expect(payload["builderName"]).to eq("bob")
|
72
|
+
expect(payload["buildTool"]).to eq("bugsnag-capistrano")
|
73
|
+
expect(payload["metadata"]).to eq({ "a" => 1, "b" => 2 })
|
74
|
+
expect(payload["releaseStage"]).to eq("test")
|
75
|
+
expect(payload["sourceControl"]).to eq({
|
76
|
+
"revision" => "test1234",
|
77
|
+
"repository" => "test@repo.com:test/test_repo.git",
|
78
|
+
"provider" => "github",
|
79
|
+
})
|
80
|
+
end
|
81
|
+
|
82
|
+
it "uses 'bugsnag_repo_url' in preference to 'repo_url'" do
|
83
|
+
ENV['BUGSNAG_REPOSITORY'] = "unused@repo.com:unused/unused_repo.git"
|
84
|
+
|
85
|
+
capfile = Helpers::Capistrano.generate_capfile({
|
86
|
+
bugsnag_api_key: "this is a test key",
|
87
|
+
app_version: "1",
|
88
|
+
bugsnag_auto_assign_release: true,
|
89
|
+
bugsnag_builder: "bob",
|
90
|
+
bugsnag_metadata: { a: 1, b: 2 },
|
91
|
+
bugsnag_env: "test",
|
92
|
+
current_revision: "test1234",
|
93
|
+
repo_url: "test@repo.com:test/test_repo.git",
|
94
|
+
bugsnag_repo_url: "https://repo.com/test/test_repo.git",
|
95
|
+
bugsnag_source_control_provider: "github",
|
96
|
+
bugsnag_endpoint: server.url,
|
97
|
+
})
|
98
|
+
|
99
|
+
Helpers::Capistrano.run(capfile)
|
100
|
+
|
101
|
+
payload = server.last_request
|
102
|
+
|
103
|
+
expect(payload["apiKey"]).to eq('this is a test key')
|
104
|
+
expect(payload["appVersion"]).to eq("1")
|
105
|
+
expect(payload["autoAssignRelease"]).to eq(true)
|
106
|
+
expect(payload["builderName"]).to eq("bob")
|
107
|
+
expect(payload["buildTool"]).to eq("bugsnag-capistrano")
|
108
|
+
expect(payload["metadata"]).to eq({ "a" => 1, "b" => 2 })
|
109
|
+
expect(payload["releaseStage"]).to eq("test")
|
110
|
+
expect(payload["sourceControl"]).to eq({
|
111
|
+
"revision" => "test1234",
|
112
|
+
"repository" => "https://repo.com/test/test_repo.git",
|
113
|
+
"provider" => "github",
|
114
|
+
})
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'tmpdir'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module Helpers
|
5
|
+
class Capistrano
|
6
|
+
def self.version_2?
|
7
|
+
ENV['CAP_2_TEST'] == 'true'
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.deploy_command
|
11
|
+
return 'bundle exec cap deploy' if version_2?
|
12
|
+
|
13
|
+
'bundle exec cap test deploy'
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.example_path
|
17
|
+
fixture_path = version_2? ? '../../examples/capistrano2' : '../../examples/capistrano3'
|
18
|
+
|
19
|
+
File.join(File.dirname(__FILE__), fixture_path)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.generate_capfile(variables)
|
23
|
+
return generate_v2_capfile(variables) if version_2?
|
24
|
+
|
25
|
+
capfile = <<-RUBY.gsub(/^\s+/, "")
|
26
|
+
require "capistrano/setup"
|
27
|
+
|
28
|
+
require "capistrano/deploy"
|
29
|
+
require "capistrano/scm/git"
|
30
|
+
install_plugin Capistrano::SCM::Git
|
31
|
+
|
32
|
+
require "bugsnag-capistrano"
|
33
|
+
RUBY
|
34
|
+
|
35
|
+
# add calls to set each variable - "set(:key, value)"
|
36
|
+
variables.each do |key, value|
|
37
|
+
capfile << "set(:#{key}, #{value.inspect})\n"
|
38
|
+
end
|
39
|
+
|
40
|
+
capfile
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.generate_v2_capfile(variables)
|
44
|
+
capfile = "require 'bugsnag-capistrano'\n"
|
45
|
+
|
46
|
+
# add calls to set each variable - "set(:key, value)"
|
47
|
+
variables.each do |key, value|
|
48
|
+
capfile << "set(:#{key}, #{value.inspect})\n"
|
49
|
+
end
|
50
|
+
|
51
|
+
# add an empty deploy task
|
52
|
+
capfile << "task :deploy do\nend"
|
53
|
+
|
54
|
+
capfile
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.run(capfile)
|
58
|
+
Dir.mktmpdir do |path|
|
59
|
+
FileUtils.cp_r("#{example_path}/.", path)
|
60
|
+
|
61
|
+
File.open("#{path}/Capfile", "w") do |file|
|
62
|
+
file.write(capfile)
|
63
|
+
end
|
64
|
+
|
65
|
+
Dir.chdir(path) do
|
66
|
+
system(deploy_command)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'webrick'
|
3
|
+
|
4
|
+
module Helpers
|
5
|
+
class Server
|
6
|
+
def initialize
|
7
|
+
@queue = Queue.new
|
8
|
+
@server = nil
|
9
|
+
@thread = nil
|
10
|
+
end
|
11
|
+
|
12
|
+
def start
|
13
|
+
@server = WEBrick::HTTPServer.new({
|
14
|
+
Port: 0,
|
15
|
+
Logger: WEBrick::Log.new(STDOUT),
|
16
|
+
AccessLog: []
|
17
|
+
})
|
18
|
+
|
19
|
+
@server.mount_proc('/deploy') do |req, res|
|
20
|
+
@queue.push(req.body)
|
21
|
+
|
22
|
+
res.status = 200
|
23
|
+
res.body = "OK\n"
|
24
|
+
end
|
25
|
+
|
26
|
+
@thread = Thread.new { @server.start }
|
27
|
+
|
28
|
+
loop do
|
29
|
+
break if @server.status == :Running
|
30
|
+
|
31
|
+
sleep(0.1)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def stop
|
36
|
+
@queue.clear
|
37
|
+
@server.stop
|
38
|
+
@thread.join(5)
|
39
|
+
@server = nil
|
40
|
+
end
|
41
|
+
|
42
|
+
def url
|
43
|
+
raise "Server is not running!" if @server.nil?
|
44
|
+
|
45
|
+
"http://localhost:" + @server.config[:Port].to_s + "/deploy"
|
46
|
+
end
|
47
|
+
|
48
|
+
def last_request
|
49
|
+
retries = 0
|
50
|
+
|
51
|
+
begin
|
52
|
+
JSON.parse(@queue.pop(true))
|
53
|
+
rescue ThreadError
|
54
|
+
raise if retries >= 10
|
55
|
+
|
56
|
+
retries += 1
|
57
|
+
sleep(0.1)
|
58
|
+
|
59
|
+
retry
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/spec/release_spec.rb
CHANGED
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bugsnag-capistrano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keegan Lowenstein
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2021-07-13 00:00:00.000000000 Z
|
15
15
|
dependencies: []
|
16
16
|
description: Correlate Capistrano deploys with new errors and increased error rates
|
17
17
|
in Bugsnag
|
@@ -23,8 +23,13 @@ extra_rdoc_files:
|
|
23
23
|
- README.md
|
24
24
|
- CHANGELOG.md
|
25
25
|
files:
|
26
|
+
- ".github/ISSUE_TEMPLATE/A.md"
|
27
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
28
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
29
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
30
|
+
- ".github/support.md"
|
31
|
+
- ".github/workflows/tests.yml"
|
26
32
|
- ".gitignore"
|
27
|
-
- ".travis.yml"
|
28
33
|
- CHANGELOG.md
|
29
34
|
- CONTRIBUTING.md
|
30
35
|
- Gemfile
|
@@ -40,7 +45,10 @@ files:
|
|
40
45
|
- lib/bugsnag-capistrano/release.rb
|
41
46
|
- lib/bugsnag-capistrano/tasks/bugsnag.cap
|
42
47
|
- spec/capistrano_spec.rb
|
48
|
+
- spec/helpers/capistrano.rb
|
49
|
+
- spec/helpers/server.rb
|
43
50
|
- spec/release_spec.rb
|
51
|
+
- spec/spec_helper.rb
|
44
52
|
homepage: http://github.com/bugsnag/bugsnag-capistrano
|
45
53
|
licenses:
|
46
54
|
- MIT
|
@@ -60,8 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
68
|
- !ruby/object:Gem::Version
|
61
69
|
version: '0'
|
62
70
|
requirements: []
|
63
|
-
|
64
|
-
rubygems_version: 2.6.11
|
71
|
+
rubygems_version: 3.2.11
|
65
72
|
signing_key:
|
66
73
|
specification_version: 4
|
67
74
|
summary: Notify Bugsnag when deploying with Capistrano
|
data/.travis.yml
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
sudo: false
|
2
|
-
language: ruby
|
3
|
-
cache: bundler
|
4
|
-
before_install:
|
5
|
-
- gem update --system 2.6.11
|
6
|
-
- gem install bundler -v 1.12.0
|
7
|
-
- gem --version
|
8
|
-
|
9
|
-
before_script:
|
10
|
-
- bundle list | grep 'bugsnag\|capistrano'
|
11
|
-
script: bundle exec rake spec
|
12
|
-
|
13
|
-
jobs:
|
14
|
-
include:
|
15
|
-
# JRuby 1.9
|
16
|
-
- stage: test
|
17
|
-
env: CAP_2_TEST=true
|
18
|
-
install: bundle _1.12.0_ install --with test bugsnag
|
19
|
-
rvm: jruby-19mode
|
20
|
-
- stage: test
|
21
|
-
env: CAP_2_TEST=true
|
22
|
-
install: bundle _1.12.0_ install --with test --without bugsnag
|
23
|
-
rvm: jruby-19mode
|
24
|
-
- stage: test
|
25
|
-
install: bundle _1.12.0_ install --with test bugsnag
|
26
|
-
rvm: jruby-19mode
|
27
|
-
- stage: test
|
28
|
-
install: bundle _1.12.0_ install --with test --without bugsnag
|
29
|
-
rvm: jruby-19mode
|
30
|
-
|
31
|
-
# Ruby 2.0.0
|
32
|
-
- stage: test
|
33
|
-
env: CAP_2_TEST=true
|
34
|
-
install: bundle install --with test bugsnag --binstubs
|
35
|
-
rvm: 2.0.0
|
36
|
-
- stage: test
|
37
|
-
env: CAP_2_TEST=true
|
38
|
-
install: bundle install --with test --without bugsnag --binstubs
|
39
|
-
rvm: 2.0.0
|
40
|
-
- stage: test
|
41
|
-
install: bundle install --with test bugsnag --binstubs
|
42
|
-
rvm: 2.0.0
|
43
|
-
- stage: test
|
44
|
-
install: bundle install --with test --without bugsnag --binstubs
|
45
|
-
rvm: 2.0.0
|
46
|
-
|
47
|
-
# Ruby 2.1.10
|
48
|
-
- stage: test
|
49
|
-
env: CAP_2_TEST=true
|
50
|
-
install: bundle install --with test bugsnag --binstubs
|
51
|
-
rvm: 2.1.10
|
52
|
-
- stage: test
|
53
|
-
env: CAP_2_TEST=true
|
54
|
-
install: bundle install --with test --without bugsnag --binstubs
|
55
|
-
rvm: 2.1.10
|
56
|
-
- stage: test
|
57
|
-
install: bundle install --with test bugsnag --binstubs
|
58
|
-
rvm: 2.1.10
|
59
|
-
- stage: test
|
60
|
-
install: bundle install --with test --without bugsnag --binstubs
|
61
|
-
rvm: 2.1.10
|
62
|
-
|
63
|
-
# Ruby 2.3.0
|
64
|
-
- stage: test
|
65
|
-
install: bundle install --with test bugsnag --binstubs
|
66
|
-
rvm: 2.3.0
|
67
|
-
- stage: test
|
68
|
-
install: bundle install --with test --without bugsnag --binstubs
|
69
|
-
rvm: 2.3.0
|
70
|
-
|
71
|
-
# Ruby 2.4.2
|
72
|
-
- stage: test
|
73
|
-
install: bundle install --with test bugsnag --binstubs
|
74
|
-
rvm: 2.4.2
|
75
|
-
- stage: test
|
76
|
-
install: bundle install --with test --without bugsnag --binstubs
|
77
|
-
rvm: 2.4.2
|