tempostrano 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.travis.yml +5 -0
- data/Gemfile +3 -0
- data/LICENSE +19 -0
- data/README.md +42 -0
- data/Rakefile +5 -0
- data/lib/tempostrano.rb +15 -0
- data/lib/tempostrano/tasks/tempo.rake +45 -0
- data/lib/tempostrano/version.rb +3 -0
- data/spec/tasks_spec.rb +7 -0
- data/tempostrano.gemspec +27 -0
- metadata +111 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c4c3c820b2d06699fc04b796487b487a8a543a59
|
4
|
+
data.tar.gz: e842c497323172e91e8a5748643492ee3b9eed6e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 49b2c13e2e8f9357164548d0ee09cfcb689f64af8e03d39e406b7c45d5dd8499ba0c8dc18f1089a6a5ce65a92b246b1ce9a95c940fbccbf9ea14453fad657c0f
|
7
|
+
data.tar.gz: b8b12a5b500645d5a446c758b902909b40280833245977478fe784337cd7963cc5482d5831d0a6d64cbdb3257ff58bbf2323e06005ae22d05e046f042cd3ccec
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2015 Ikimea
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is furnished
|
8
|
+
to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# Capistrano::Tempo
|
2
|
+
|
3
|
+
Notify Tempo about Capistrano deployments. These instructions are for Capistrano 3.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'capistrano-tempo'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install capistrano-tempo
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Load this gem in Capfile:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
# Capfile
|
25
|
+
require 'capistrano/tempo'
|
26
|
+
```
|
27
|
+
|
28
|
+
Setup your Tempo credentials in `deploy.rb`
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
set :tempo_url, "_YOUR_TEMPO_URL"
|
32
|
+
set :tempo_api_token, "_YOUR_API_TOKEN_HERE"
|
33
|
+
set :tempo_project, "My project ID or Slug"
|
34
|
+
```
|
35
|
+
|
36
|
+
## Contributing
|
37
|
+
|
38
|
+
1. Fork it
|
39
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
40
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
41
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
42
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lib/tempostrano.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
load File.expand_path("../lib/tempostrano/tasks/tempo.rake", __FILE__)
|
5
|
+
|
6
|
+
module Tempo
|
7
|
+
def self.post(project: nil, token: nil, message: nil, payload: {})
|
8
|
+
payload['agent'] = 'capistrano'
|
9
|
+
|
10
|
+
params = {'payload' => payload.to_json}
|
11
|
+
uri = URI(URI.encode("#{fetch(:tempo_url)}/api/v1/provider/#{project}/notify/deployer?access_token=#{token}"))
|
12
|
+
|
13
|
+
Net::HTTP.post_form(uri, params)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
|
3
|
+
namespace :tempo do
|
4
|
+
task :starting do
|
5
|
+
set :start_time, Time.now
|
6
|
+
|
7
|
+
begin
|
8
|
+
current_branch = execute "git branch | sed -n '/\* /s///p'".chomp
|
9
|
+
rescue
|
10
|
+
current_branch = "master"
|
11
|
+
end
|
12
|
+
set :current_branch, current_branch
|
13
|
+
end
|
14
|
+
|
15
|
+
task :finished do
|
16
|
+
branch = fetch(:current_branch)
|
17
|
+
start_time = fetch(:start_time)
|
18
|
+
elapsed = Time.now.to_i - start_time.to_i
|
19
|
+
commit_id = execute "git rev-parse --verify HEAD"
|
20
|
+
git_author_name = execute "git config user.name".chomp
|
21
|
+
git_author_email = execute "git config user.email".chomp
|
22
|
+
|
23
|
+
message = "#{git_author_name} deployed #{fetch(:repo_url)} with branch #{branch} on #{fetch(:stage)} in #{elapsed} seconds."
|
24
|
+
|
25
|
+
Tempo.post(
|
26
|
+
project: fetch(:tempo_project),
|
27
|
+
token: fetch(:tempo_token),
|
28
|
+
payload: {
|
29
|
+
message: message,
|
30
|
+
branch: branch,
|
31
|
+
sha1: commit_id.chop!,
|
32
|
+
author_name: git_author_name,
|
33
|
+
author_email: git_author_email
|
34
|
+
}
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
def execute(command, directory = ".")
|
39
|
+
directory = ARGV.first unless ARGV.empty?
|
40
|
+
`#{command}`
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
after 'deploy:starting', 'tempo:starting'
|
45
|
+
after 'deploy:finished', 'tempo:finished'
|
data/spec/tasks_spec.rb
ADDED
data/tempostrano.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'tempostrano/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |gem|
|
8
|
+
gem.name = "tempostrano"
|
9
|
+
gem.version = Tempostrano::VERSION
|
10
|
+
|
11
|
+
gem.licenses = ["MIT"]
|
12
|
+
gem.authors = ["Ikimea"]
|
13
|
+
gem.email = ["support@ikimea.com"]
|
14
|
+
gem.description = %q{Send notifications to Tempo about Capistrano deployments.}
|
15
|
+
gem.summary = %q{Send notifications to Tempo about Capistrano deployments.}
|
16
|
+
gem.homepage = "https://github.com/tempo-project/tempostrano"
|
17
|
+
|
18
|
+
gem.required_ruby_version = '>= 2.0.0'
|
19
|
+
gem.add_dependency 'capistrano', '>= 3.0.1'
|
20
|
+
|
21
|
+
gem.require_paths = ["lib"]
|
22
|
+
gem.files = `git ls-files`.split($/)
|
23
|
+
|
24
|
+
gem.add_dependency 'json'
|
25
|
+
gem.add_development_dependency "rspec"
|
26
|
+
gem.add_development_dependency "rake"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tempostrano
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ikimea
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: capistrano
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.0.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.0.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Send notifications to Tempo about Capistrano deployments.
|
70
|
+
email:
|
71
|
+
- support@ikimea.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- .travis.yml
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- lib/tempostrano.rb
|
83
|
+
- lib/tempostrano/tasks/tempo.rake
|
84
|
+
- lib/tempostrano/version.rb
|
85
|
+
- spec/tasks_spec.rb
|
86
|
+
- tempostrano.gemspec
|
87
|
+
homepage: https://github.com/tempo-project/tempostrano
|
88
|
+
licenses:
|
89
|
+
- MIT
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 2.0.0
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.4.2
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: Send notifications to Tempo about Capistrano deployments.
|
111
|
+
test_files: []
|