capistrano-rocketdeploy 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cb0d9b6602f4506569134aae9ebe39d495d2976e8651e343226a6615aead04b2
4
+ data.tar.gz: 238befbd588aafdf073f268e00c60703dabc5d6a5cdf5679d95e83a499317496
5
+ SHA512:
6
+ metadata.gz: 509cd7ed770d1aa06dd078796130590dfea29d2fd9613c3023be6a0d52f81e4b11901dce5158632904a338325569ee4992a8c7c17e7c799bcc8ed40de9eb6d25
7
+ data.tar.gz: 7e479858f29fce529e220a8e390d35143b6f359bd651a3152c89b073c9825ffc55651693c33389ba132e0acd17be246845d3c6695f1ef59596a6f357b990b9ad
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,11 @@
1
+ #inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ DisplayCopNames: true
5
+ DisplayStyleGuide: true
6
+
7
+ Style/StringLiterals:
8
+ Enabled: false
9
+
10
+ Style/RaiseArgs:
11
+ EnforcedStyle: compact
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.5.1
5
+ before_install: gem install bundler -v 1.16.2
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in capistrano-deploy_notifier.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,66 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ capistrano-rocketdeploy (0.1.0)
5
+ capistrano (~> 3.0)
6
+ httparty (~> 0.16)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ airbrussh (1.3.1)
12
+ sshkit (>= 1.6.1, != 1.7.0)
13
+ capistrano (3.11.0)
14
+ airbrussh (>= 1.0.0)
15
+ i18n
16
+ rake (>= 10.0.0)
17
+ sshkit (>= 1.9.0)
18
+ coderay (1.1.2)
19
+ concurrent-ruby (1.1.4)
20
+ diff-lcs (1.3)
21
+ httparty (0.16.3)
22
+ mime-types (~> 3.0)
23
+ multi_xml (>= 0.5.2)
24
+ i18n (1.5.1)
25
+ concurrent-ruby (~> 1.0)
26
+ method_source (0.9.2)
27
+ mime-types (3.2.2)
28
+ mime-types-data (~> 3.2015)
29
+ mime-types-data (3.2018.0812)
30
+ multi_xml (0.6.0)
31
+ net-scp (1.2.1)
32
+ net-ssh (>= 2.6.5)
33
+ net-ssh (5.1.0)
34
+ pry (0.12.2)
35
+ coderay (~> 1.1.0)
36
+ method_source (~> 0.9.0)
37
+ rake (10.5.0)
38
+ rspec (3.8.0)
39
+ rspec-core (~> 3.8.0)
40
+ rspec-expectations (~> 3.8.0)
41
+ rspec-mocks (~> 3.8.0)
42
+ rspec-core (3.8.0)
43
+ rspec-support (~> 3.8.0)
44
+ rspec-expectations (3.8.2)
45
+ diff-lcs (>= 1.2.0, < 2.0)
46
+ rspec-support (~> 3.8.0)
47
+ rspec-mocks (3.8.0)
48
+ diff-lcs (>= 1.2.0, < 2.0)
49
+ rspec-support (~> 3.8.0)
50
+ rspec-support (3.8.0)
51
+ sshkit (1.18.0)
52
+ net-scp (>= 1.1.2)
53
+ net-ssh (>= 2.8.0)
54
+
55
+ PLATFORMS
56
+ ruby
57
+
58
+ DEPENDENCIES
59
+ bundler (~> 1.16)
60
+ capistrano-rocketdeploy!
61
+ pry (~> 0.12.2)
62
+ rake (~> 10.0)
63
+ rspec (~> 3.0)
64
+
65
+ BUNDLED WITH
66
+ 1.17.2
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Artem
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # capistrano-rocketdeploy
2
+
3
+ capistrano-rocketdeploy sends notifications about deployments to application [rocketdeploy](https://rscz.ru/rocketdeploy/server)
4
+
5
+ ## Installation
6
+
7
+ Add this line to your Ruby On Rails application's Gemfile (after `gem 'capistrano', require: false`) in development section.
8
+ For example:
9
+
10
+ ```ruby
11
+ group :development do
12
+ # Other awesome gems
13
+ # ...
14
+
15
+ gem 'capistrano', require: false
16
+ gem 'capistrano-rocketdeploy', require: false
17
+ end
18
+ ```
19
+
20
+ And then execute:
21
+ ```
22
+ $ bundle
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ Add this to your Capfile
28
+
29
+ ```ruby
30
+ require 'capistrano/rocketdeploy'
31
+ ```
32
+
33
+ Set in `config/deploy.rb`
34
+
35
+ ```
36
+ set :rocketdeploy_token, 'secret_and_very_long_project_token' # generate by rocketdeploy
37
+ ```
38
+
39
+
40
+ ## Development
41
+
42
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
43
+
44
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
45
+
46
+ ## Contributing
47
+
48
+ Bug reports and pull requests are welcome on RocketScience Gitlab at [https://rscz.ru/rocketdeploy/capistrano-rocketdeploy](https://rscz.ru/rocketdeploy/capistrano-rocketdeploy).
49
+
50
+ ## License
51
+
52
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
53
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "capistrano/rocket_deploy"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,42 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "capistrano/rocketdeploy/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "capistrano-rocketdeploy"
8
+ spec.version = Capistrano::Rocketdeploy::VERSION
9
+ spec.authors = ["Artem Yegorov"]
10
+ spec.email = ["yegorov0725@yandex.ru", "glebtv@gmail.com"]
11
+
12
+ spec.summary = %q{Deploy notifier for RocketDeploy server}
13
+ spec.description = %q{}
14
+ spec.homepage = "https://rscz.ru/rocketdeploy/capistrano-rocketdeploy"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ # if spec.respond_to?(:metadata)
20
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
21
+ # else
22
+ # raise "RubyGems 2.0 or newer is required to protect against " \
23
+ # "public gem pushes."
24
+ # end
25
+
26
+ # Specify which files should be added to the gem when it is released.
27
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
28
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
29
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
30
+ end
31
+ # spec.bindir = "exe"
32
+ # spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
33
+ spec.require_paths = ["lib"]
34
+
35
+ spec.add_dependency 'capistrano', '~> 3.0'
36
+ spec.add_dependency 'httparty', '~> 0.16'
37
+
38
+ spec.add_development_dependency 'pry', '~> 0.12.2'
39
+ spec.add_development_dependency 'bundler', '~> 1.16'
40
+ spec.add_development_dependency 'rake', '~> 10.0'
41
+ spec.add_development_dependency 'rspec', '~> 3.0'
42
+ end
@@ -0,0 +1,4 @@
1
+ require "capistrano/rocketdeploy/version"
2
+ require "capistrano/rocketdeploy/client"
3
+
4
+ load File.expand_path("tasks/notify.rake", __dir__)
@@ -0,0 +1,35 @@
1
+ module Capistrano
2
+ module Rocketdeploy
3
+ class Client
4
+ include HTTParty
5
+ base_uri
6
+
7
+ def initialize(service, page)
8
+ @options = { query: { site: service, page: page } }
9
+ end
10
+
11
+ def deploy_started(params)
12
+ self.class.post("/deploy/started", body(params))
13
+ end
14
+
15
+ def deploy_finished(params)
16
+ self.class.post("/deploy/finished", body(params))
17
+ end
18
+
19
+ def deploy_failed(params)
20
+ self.class.post("/deploy/failed", body(params))
21
+ end
22
+
23
+ private
24
+ def body(params)
25
+ {
26
+ body: params.to_json,
27
+ headers: {
28
+ 'Content-Type' => 'application/json'
29
+ }
30
+ }
31
+ end
32
+ end
33
+ end
34
+ end
35
+
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module Rocketdeploy
3
+ VERSION = "0.1.0".freeze
4
+ end
5
+ end
@@ -0,0 +1,44 @@
1
+ namespace :rocketdeploy do
2
+ task :collect_env do
3
+ @data = {
4
+ local_user: fetch(:local_user),
5
+ branch: fetch(:branch),
6
+ current_revision: fetch(:current_revision),
7
+ stage: fetch(:stage),
8
+ repo_url: fetch(:repo_url),
9
+ hosts: [],
10
+ }
11
+ end
12
+
13
+ task :notify_deploy_started => [:collect_env] do
14
+ on roles(:app) do |host|
15
+ host_url = "#{host&.user}.#{host&.hostname}"
16
+ p @data
17
+ @data.hosts.push(host_url)
18
+ end
19
+
20
+ client = fetch(:rocketdeploy_client)
21
+ client.deploy_started(@data)
22
+ end
23
+
24
+ task :notify_deploy_finished => [:collect_env] do
25
+ client = fetch(:rocketdeploy_client)
26
+ client.deploy_finished(@data)
27
+ end
28
+
29
+ task :notify_deploy_failed => [:collect_env] do
30
+ client = fetch(:rocketdeploy_client)
31
+ client.deploy_failed(@data)
32
+ end
33
+
34
+ before "deploy:updated", "rocketdeploy:notify_deploy_started"
35
+ after "deploy:finished", "rocketdeploy:notify_deploy_finished"
36
+ before "deploy:reverted", "rocketdeploy:notify_deploy_failed"
37
+ end
38
+
39
+ namespace :load do
40
+ task :defaults do
41
+ require 'capistrano-rocketdeploy'
42
+ set(:rocketdeploy_client, -> { Capistrano::Rocketdeploy::Client.new(fetch(:hipchat_token))[fetch(:hipchat_room_name)] })
43
+ end
44
+ end
metadata ADDED
@@ -0,0 +1,145 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-rocketdeploy
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Artem Yegorov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-01-09 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'
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'
27
+ - !ruby/object:Gem::Dependency
28
+ name: httparty
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.16'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.16'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.12.2
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.12.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.16'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.16'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ description: ''
98
+ email:
99
+ - yegorov0725@yandex.ru
100
+ - glebtv@gmail.com
101
+ executables: []
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".gitignore"
106
+ - ".rspec"
107
+ - ".rubocop.yml"
108
+ - ".travis.yml"
109
+ - Gemfile
110
+ - Gemfile.lock
111
+ - LICENSE.txt
112
+ - README.md
113
+ - Rakefile
114
+ - bin/console
115
+ - bin/setup
116
+ - capistrano-rocketdeploy.gemspec
117
+ - lib/capistrano/rocketdeploy.rb
118
+ - lib/capistrano/rocketdeploy/client.rb
119
+ - lib/capistrano/rocketdeploy/version.rb
120
+ - lib/capistrano/tasks/notify.rake
121
+ homepage: https://rscz.ru/rocketdeploy/capistrano-rocketdeploy
122
+ licenses:
123
+ - MIT
124
+ metadata: {}
125
+ post_install_message:
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ requirements: []
140
+ rubyforge_project:
141
+ rubygems_version: 2.7.7
142
+ signing_key:
143
+ specification_version: 4
144
+ summary: Deploy notifier for RocketDeploy server
145
+ test_files: []