danger-typetalk 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 565734e897c25b2bb939c82796034213a9e69bd62dc94c6dc5a4af495b2e1251
4
+ data.tar.gz: b95729b5d48cf03ab757f690791241310202c0e73d19b8e028d30cf4d1003ea7
5
+ SHA512:
6
+ metadata.gz: 6dcb7f2def9b554345f4534285d4f52fa7cfaff8d51f13acc09e6044d1ef5a611750bde56579aa035b7399a8577417de9a17bc3cf3a91e0ebccef53d02d3cdac
7
+ data.tar.gz: 5be0a5b8ef205cc500050709b709e3f50b94bc6c9ee4ce654c068511088dc909781788c70857379f6b17f87c155f19f42b1d26516f73d1715aa48c9379978021
@@ -0,0 +1,50 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in danger-typetalk.gemspec
4
+ gemspec
@@ -0,0 +1,66 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ danger-typetalk (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ addressable (2.5.2)
10
+ public_suffix (>= 2.0.2, < 4.0)
11
+ claide (1.0.2)
12
+ claide-plugins (0.9.2)
13
+ cork
14
+ nap
15
+ open4 (~> 1.3)
16
+ colored2 (3.1.2)
17
+ cork (0.3.0)
18
+ colored2 (~> 3.1)
19
+ danger (5.11.1)
20
+ claide (~> 1.0)
21
+ claide-plugins (>= 0.9.2)
22
+ colored2 (~> 3.1)
23
+ cork (~> 0.1)
24
+ faraday (~> 0.9)
25
+ faraday-http-cache (~> 1.0)
26
+ git (~> 1.5)
27
+ kramdown (~> 1.5)
28
+ no_proxy_fix
29
+ octokit (~> 4.7)
30
+ terminal-table (~> 1)
31
+ faraday (0.15.4)
32
+ multipart-post (>= 1.2, < 3)
33
+ faraday-http-cache (1.3.1)
34
+ faraday (~> 0.8)
35
+ git (1.5.0)
36
+ kramdown (1.17.0)
37
+ multipart-post (2.0.0)
38
+ nap (1.1.0)
39
+ no_proxy_fix (0.1.2)
40
+ octokit (4.13.0)
41
+ sawyer (~> 0.8.0, >= 0.5.3)
42
+ open4 (1.3.4)
43
+ public_suffix (3.0.3)
44
+ rack (2.0.6)
45
+ rack-test (1.1.0)
46
+ rack (>= 1.0, < 3)
47
+ rake (10.5.0)
48
+ sawyer (0.8.1)
49
+ addressable (>= 2.3.5, < 2.6)
50
+ faraday (~> 0.8, < 1.0)
51
+ terminal-table (1.8.0)
52
+ unicode-display_width (~> 1.1, >= 1.1.1)
53
+ unicode-display_width (1.4.1)
54
+
55
+ PLATFORMS
56
+ ruby
57
+
58
+ DEPENDENCIES
59
+ bundler (~> 2.0)
60
+ danger
61
+ danger-typetalk!
62
+ rack-test
63
+ rake (~> 10.0)
64
+
65
+ BUNDLED WITH
66
+ 2.0.1
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Horie Issei
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 all
13
+ 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 THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ danger-typetalk
2
+ ===
3
+
4
+ Danger plugin to send notification to Typetalk.
@@ -0,0 +1,7 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new
5
+
6
+ desc 'Run specs'
7
+ task default: :spec
@@ -0,0 +1,27 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "typetalk/gem_version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "danger-typetalk"
8
+ spec.version = Typetalk::VERSION
9
+ spec.authors = ["Issei Horie"]
10
+ spec.email = ["is2ei.horie@gmail.com"]
11
+
12
+ spec.summary = 'Danger plugin to send notification to Typetalk.'
13
+ spec.description = 'Danger plugin to send notification to Typetalk.'
14
+ spec.homepage = 'https://github.com/is2ei/danger-typetalk'
15
+
16
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
17
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ end
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 2.0"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency 'rack-test'
26
+ spec.add_development_dependency 'danger'
27
+ end
@@ -0,0 +1 @@
1
+ require 'typetalk/plugin'
@@ -0,0 +1 @@
1
+ require 'typetalk/gem_version'
@@ -0,0 +1,3 @@
1
+ module Typetalk
2
+ VERSION = "0.1.0".freeze
3
+ end
@@ -0,0 +1,48 @@
1
+ module Danger
2
+ class Typetalk < Plugin
3
+
4
+ attr_accessor :token
5
+ attr_accessor :topic_id
6
+
7
+ def initialize(dangerfile)
8
+ super(dangerfile)
9
+
10
+ @token = ENV['TYPETALK_TOKEN']
11
+ @topic_id = ENV['TYPETALK_TOPIC_ID']
12
+ end
13
+
14
+ def notify
15
+ return if topic_id.nil?
16
+ post_message(report)
17
+ end
18
+
19
+ private
20
+
21
+ def report
22
+ r = status_report
23
+ .reject { |_, v| v.empty? }
24
+ .map do |k, v|
25
+ case k.to_json
26
+ when 'errors' then
27
+ "[ERROR]\n" + v.join("\n")
28
+ when 'warnings' then
29
+ "[WARNING]\n" + v.join("\n")
30
+ end
31
+ end
32
+ r.join("\n\n")
33
+ end
34
+
35
+ def post_message(msg)
36
+ uri = URI("typetalk.com/api/v1/topics/#{@topic_id}")
37
+ body = { message: msg }.to_json
38
+ post(uri, body)
39
+ end
40
+
41
+ def post(uri, body)
42
+ req = Net::HTTP::Post.new(uri.request_uri, { 'Content-Type' => 'application/json' })
43
+ Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
44
+ http.request(req)
45
+ end
46
+ end
47
+ end
48
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: danger-typetalk
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Issei Horie
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-01-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rack-test
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: danger
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: Danger plugin to send notification to Typetalk.
70
+ email:
71
+ - is2ei.horie@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - Gemfile.lock
79
+ - LICENSE
80
+ - README.md
81
+ - Rakefile
82
+ - danger-typetalk.gemspec
83
+ - lib/danger_plugin.rb
84
+ - lib/typetalk.rb
85
+ - lib/typetalk/gem_version.rb
86
+ - lib/typetalk/plugin.rb
87
+ homepage: https://github.com/is2ei/danger-typetalk
88
+ licenses: []
89
+ metadata: {}
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 2.7.3
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: Danger plugin to send notification to Typetalk.
110
+ test_files: []