capistrano-jianliao 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
+ SHA1:
3
+ metadata.gz: cb3740f97072a4302c355fd4854ea8d61a7b95b1
4
+ data.tar.gz: 905aa6d398be9db945466d92cc1fcef2ad0bd7ad
5
+ SHA512:
6
+ metadata.gz: 87ac61ca81b37a9c8d3997a4671ccf6518a0515d0283fff1cdc919a6472f7b0f574cd238ec80aef9d6dcbc71efb3c1b0c43a63af49f06429f564298694c87b57
7
+ data.tar.gz: 35b8487cab1323da5d620c0f41a333f993007b54e8bd1dbe32d7d418f6329995e71841ae4047c6d976fdd15c24c4518c9b223de31093b9de464c9cf528d38d06
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://ruby.taobao.org/'
2
+
3
+ # Specify your gem's dependencies in slackistrano.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,50 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ capistrano-jianliao (0.1.0)
5
+ capistrano (>= 3.0.1)
6
+ json
7
+
8
+ GEM
9
+ remote: https://ruby.taobao.org/
10
+ specs:
11
+ capistrano (3.4.0)
12
+ i18n
13
+ rake (>= 10.0.0)
14
+ sshkit (~> 1.3)
15
+ colorize (0.7.7)
16
+ diff-lcs (1.2.5)
17
+ i18n (0.7.0)
18
+ json (1.8.3)
19
+ net-scp (1.2.1)
20
+ net-ssh (>= 2.6.5)
21
+ net-ssh (3.0.1)
22
+ rake (10.4.2)
23
+ rspec (3.4.0)
24
+ rspec-core (~> 3.4.0)
25
+ rspec-expectations (~> 3.4.0)
26
+ rspec-mocks (~> 3.4.0)
27
+ rspec-core (3.4.1)
28
+ rspec-support (~> 3.4.0)
29
+ rspec-expectations (3.4.0)
30
+ diff-lcs (>= 1.2.0, < 2.0)
31
+ rspec-support (~> 3.4.0)
32
+ rspec-mocks (3.4.0)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.4.0)
35
+ rspec-support (3.4.1)
36
+ sshkit (1.7.1)
37
+ colorize (>= 0.7.0)
38
+ net-scp (>= 1.1.2)
39
+ net-ssh (>= 2.8.0)
40
+
41
+ PLATFORMS
42
+ ruby
43
+
44
+ DEPENDENCIES
45
+ capistrano-jianliao!
46
+ rake
47
+ rspec
48
+
49
+ BUNDLED WITH
50
+ 1.10.6
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Philip Hallstrom
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
File without changes
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ task :default => :spec
4
+ require 'rspec/core/rake_task'
5
+ RSpec::Core::RakeTask.new
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'capistrano/jianliao/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "capistrano-jianliao"
8
+ gem.version = Capistrano::Jianliao::VERSION
9
+ gem.authors = ["nickcen"]
10
+ gem.email = ["cenyongh@gmail.com"]
11
+ gem.description = %q{Send notifications to Jianliao about Capistrano deployments.}
12
+ gem.summary = %q{Send notifications to Jianliao about Capistrano deployments.}
13
+ gem.homepage = "https://github.com/nickcen/capistrano-jianliao"
14
+ gem.license = 'MIT'
15
+
16
+ gem.required_ruby_version = '>= 2.0.0'
17
+
18
+ gem.files = `git ls-files`.split($/)
19
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
20
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
21
+ gem.require_paths = ["lib"]
22
+
23
+ gem.add_dependency 'capistrano', '>= 3.0.1'
24
+ gem.add_dependency 'json'
25
+ gem.add_development_dependency 'rake'
26
+ gem.add_development_dependency 'rspec'
27
+ end
@@ -0,0 +1,6 @@
1
+ load File.expand_path("../jianliao/tasks/jianliao.rake", __FILE__)
2
+
3
+ module Capistrano
4
+ module Jianliao
5
+ end
6
+ end
@@ -0,0 +1,54 @@
1
+ require 'json'
2
+ require 'net/http'
3
+
4
+ namespace :jianliao do
5
+ namespace :deploy do
6
+ task :updated do
7
+ if fetch(:jianliao_url)
8
+ run_locally do
9
+ elapsed = 1
10
+ announcement = "#{announced_application_name} successfully deployed."
11
+
12
+ post_jianliao_message(announcement)
13
+ end
14
+ end
15
+ end
16
+
17
+ def short_revision
18
+ deployed_revision = fetch(:deployed_revision)
19
+ deployed_revision[0..7] if deployed_revision
20
+ end
21
+
22
+ def announced_application_name
23
+ jianliao_application = fetch(:jianliao_application)
24
+ "".tap do |output|
25
+ output << jianliao_application if jianliao_application
26
+ output << " (#{short_revision})" if short_revision
27
+ end
28
+ end
29
+
30
+ def post_jianliao_message(message)
31
+ uri = URI(fetch(:jianliao_url))
32
+
33
+ payload = {
34
+ "authorName" => fetch(:jianliao_authorname),
35
+ "text" => message
36
+ }
37
+
38
+ res = Net::HTTP.post_form(uri, payload)
39
+ end
40
+ end
41
+ end
42
+
43
+ after 'deploy:finishing', 'jianliao:deploy:updated'
44
+
45
+ namespace :load do
46
+ task :defaults do
47
+ set :jianliao_url, -> { ENV['JIANLIAO_URL'] } # Incoming WebHook URL.
48
+ set :jianliao_application, -> { ENV['JIANLIAO_APPLICATION'] || 'application' }
49
+ set :jianliao_authorname, -> { ENV['JIANLIAO_AUTHORNAME'] || 'deploybot' }
50
+
51
+ set :deployer, -> { ENV['GIT_AUTHOR_NAME'] || %x[git config user.name].chomp }
52
+ set :deployed_revision, -> { ENV['GIT_COMMIT'] || %x[git rev-parse #{fetch :branch}].strip }
53
+ end
54
+ end
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module Jianliao
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,12 @@
1
+ namespace :deploy do
2
+ task :updating do
3
+ end
4
+ task :reverting do
5
+ end
6
+ task :finishing do
7
+ end
8
+ task :finishing_rollback do
9
+ end
10
+ task :failed do
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'capistrano/all'
4
+ require 'capistrano/setup'
5
+ load 'capistrano_deploy_stubs.rake'
6
+ require 'capistrano/jianliao'
7
+ require 'rspec'
8
+
9
+ # Requires supporting files with custom matchers and macros, etc,
10
+ # in ./support/ and its subdirectories.
11
+ Dir['#{File.dirname(__FILE__)}/support/**/*.rb'].each {|f| require f}
12
+
13
+ RSpec.configure do |config|
14
+ config.order = 'random'
15
+ config.filter_run :focus
16
+ config.run_all_when_everything_filtered = true
17
+ end
@@ -0,0 +1,13 @@
1
+ require 'spec_helper'
2
+
3
+ describe Capistrano::Jianliao do
4
+ before(:each) do
5
+ Rake::Task['load:defaults'].invoke
6
+ end
7
+
8
+ describe "before/after hooks" do
9
+ it "invokes jianliao:deploy:updated after deploy:finishing" do
10
+ Rake::Task['deploy:finishing'].execute
11
+ end
12
+ end
13
+ end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-jianliao
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - nickcen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-23 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: rake
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: rspec
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 Jianliao about Capistrano deployments.
70
+ email:
71
+ - cenyongh@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - Gemfile
77
+ - Gemfile.lock
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - capistrano-jianliao.gemspec
82
+ - lib/capistrano/jianliao.rb
83
+ - lib/capistrano/jianliao/tasks/jianliao.rake
84
+ - lib/capistrano/jianliao/version.rb
85
+ - spec/capistrano_deploy_stubs.rake
86
+ - spec/spec_helper.rb
87
+ - spec/tasks_spec.rb
88
+ homepage: https://github.com/nickcen/capistrano-jianliao
89
+ licenses:
90
+ - MIT
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: 2.0.0
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.4.8
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: Send notifications to Jianliao about Capistrano deployments.
112
+ test_files:
113
+ - spec/capistrano_deploy_stubs.rake
114
+ - spec/spec_helper.rb
115
+ - spec/tasks_spec.rb
116
+ has_rdoc: