capistrano-idobata 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9ff4d86579458df315077da11b62879f7ccdc4ec
4
+ data.tar.gz: b311c915ef68e1e1c67d40cd406949704221989d
5
+ SHA512:
6
+ metadata.gz: 3a5c6a0dc05dd65724807f5ba992dccae6c74655b5b5db07ac0f14d277bb5087c2abc19450a16da55851910257bedee3acd43ab3765f54ec68c3604691221669
7
+ data.tar.gz: 4e1e4567232c8b3e2c3741e9a97372f6346da4331b19d454ac76cc3097a36d675d85661a3e23eed8849e2d9713395ec13d76a59867c33d1036df1737c8a5abd5
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-idobata.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Mitsutaka Mimura
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
@@ -0,0 +1,36 @@
1
+ # Capistrano::Idobata
2
+
3
+ Capistrano 3 integration with [idobata](http://idobata.io)
4
+
5
+ ![](https://f.cloud.github.com/assets/43500/2460021/a57d4620-af64-11e3-83fe-f7c09d92f66d.png)
6
+
7
+
8
+ ## Installation
9
+
10
+ ```
11
+ # Gemfile
12
+ gem 'capistrano-idobata'
13
+ ```
14
+
15
+ ```
16
+ # Capfile
17
+ require 'capistrano/idobata'
18
+ ```
19
+
20
+ ```
21
+ # deploy.rb
22
+ set :idobata_hook_url, 'https://idobata.io/hook/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
23
+ ```
24
+
25
+ ## Support
26
+
27
+ - Ruby 2.0 or higher
28
+ - Capistrano 3 or higher
29
+
30
+ ## Contributing
31
+
32
+ 1. Fork it ( http://github.com/<my-github-username>/capistrano-idobata/fork )
33
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
34
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
35
+ 4. Push to the branch (`git push origin my-new-feature`)
36
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'capistrano/idobata/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "capistrano-idobata"
8
+ spec.version = Capistrano::Idobata::VERSION
9
+ spec.authors = ["Mitsutaka Mimura"]
10
+ spec.email = ["takkanm@gmail.com"]
11
+ spec.summary = %q{Capistrano 3 integration with Idobata}
12
+ spec.description = %q{Capistrano 3 integration with Idobata}
13
+ spec.homepage = "https://github.com/takkanm/capistrano-idobata"
14
+ spec.license = "MIT"
15
+
16
+ spec.add_dependency 'capistrano', '~> 3.0'
17
+ spec.add_dependency 'rest-client'
18
+
19
+ spec.files = `git ls-files -z`.split("\x0")
20
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.5"
25
+ spec.add_development_dependency "rake"
26
+ end
@@ -0,0 +1,57 @@
1
+ require 'restclient'
2
+
3
+ namespace :idobata do
4
+ task :setup do
5
+ @deploy_infomation = Capistrano::Idobata::DeployInfomation.new(
6
+ idobata_hook_url: fetch(:idobata_hook_url, nil),
7
+ application: fetch(:application),
8
+ stage: fetch(:stage, 'production'),
9
+ branch: fetch(:branch, nil)
10
+ )
11
+
12
+ @idobata_client = Capistrano::Idobata::Client.new(@deploy_infomation.idobata_hook_url)
13
+ end
14
+
15
+ task :starting do
16
+ if @idobata_client.valid?
17
+ message = if @deploy_infomation.branch
18
+ "deploy #{@deploy_infomation.application}'s #{@deploy_infomation.branch} to #{@deploy_infomation.stage} start !! :rocket:"
19
+ else
20
+ "deploy #{@deploy_infomation.application}' to #{@deploy_infomation.stage} start !! :rocket:"
21
+ end
22
+
23
+ @idobata_client.send(message)
24
+ end
25
+ end
26
+
27
+ task :finished do
28
+ if @idobata_client.valid?
29
+ message = if @deploy_infomation.branch
30
+ ":white_check_mark: deploy #{@deploy_infomation.application}'s #{@deploy_infomation.branch} to #{@deploy_infomation.stage} success !!"
31
+ else
32
+ ":white_check_mark: deploy #{@deploy_infomation.application}' to #{@deploy_infomation.stage} success !!"
33
+ end
34
+
35
+ @idobata_client.send(message)
36
+ end
37
+ end
38
+
39
+ task :faild do
40
+ if @idobata_client.valid?
41
+
42
+ message = if @deploy_infomation.branch
43
+ ":broken_heart: deploy #{@deploy_infomation.application}'s #{@deploy_infomation.branch} to #{@deploy_infomation.stage} failed !!"
44
+ else
45
+ ":broken_heart: deploy #{@deploy_infomation.application}' to #{@deploy_infomation.stage} failed !!"
46
+ end
47
+
48
+ @idobata_client.send(message)
49
+ end
50
+ end
51
+ end
52
+
53
+ before 'idobata:starting', 'idobata:setup'
54
+
55
+ after 'deploy:starting', 'idobata:starting'
56
+ after 'deploy:finished', 'idobata:finished'
57
+ after 'deploy:failed', 'idobata:faild'
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module Idobata
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,33 @@
1
+ require "capistrano/idobata/version"
2
+ require 'pathname'
3
+
4
+ module Capistrano
5
+ module Idobata
6
+ class Client
7
+ def initialize(hook_url)
8
+ @hook_url = hook_url
9
+ end
10
+
11
+ def valid?
12
+ !! @hook_url
13
+ end
14
+
15
+ def send(message)
16
+ RestClient.post @hook_url, source: message
17
+ end
18
+ end
19
+
20
+ class DeployInfomation
21
+ attr_reader :idobata_hook_url, :application, :stage, :branch
22
+
23
+ def initialize(idobata_hook_url: nil, application: nil, stage: nil, branch: nil)
24
+ @idobata_hook_url = idobata_hook_url
25
+ @application = application
26
+ @stage = stage
27
+ @branch = branch
28
+ end
29
+ end
30
+ end
31
+ end
32
+
33
+ load Pathname.new(__dir__).join('idobata', 'tasks', 'capistrano-idobata.rake')
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-idobata
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Mitsutaka Mimura
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-19 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: rest-client
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: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.5'
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: Capistrano 3 integration with Idobata
70
+ email:
71
+ - takkanm@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - capistrano-idobata.gemspec
82
+ - lib/capistrano/idobata.rb
83
+ - lib/capistrano/idobata/tasks/capistrano-idobata.rake
84
+ - lib/capistrano/idobata/version.rb
85
+ homepage: https://github.com/takkanm/capistrano-idobata
86
+ licenses:
87
+ - MIT
88
+ metadata: {}
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubyforge_project:
105
+ rubygems_version: 2.2.2
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: Capistrano 3 integration with Idobata
109
+ test_files: []
110
+ has_rdoc: