chatworkify 0.1.1 โ†’ 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e269173ad834a7f4eb319b677a093f12a72ae2ae7a2f5453a4d98e7c10edfb21
4
- data.tar.gz: 3ea3927ff1586fb8180fd59f7a2178bda6489a6a7e377094e3d00d8064f11123
3
+ metadata.gz: 848599fb2da99e229b58fb9b86158e8d49b4d9f09178dc3d52ac03608f39e6d5
4
+ data.tar.gz: aace466c461681bf99f3f3e92b111700e0d08d8ce472beef0f23e6ec7a025a50
5
5
  SHA512:
6
- metadata.gz: b7178d42c697b22b817b289d4ec65f633bddeee70e1a7c52d1d3961125d9859f0c1b4c098ab9887999675481536d4c46e67f703c4383f4c308bae7d59e181f16
7
- data.tar.gz: 6570f18eeae56db71b596e7bf7064fb600a96090e51012abd971871ac065f4f585bf29e86339625c5923a4494ff29cd93e0f707be503209f1bd62355fc87620e
6
+ metadata.gz: 85a86589397d74b30f3b24c642d855b5bca16dccfddf2e1cdf08820675b010541f698eb4abec7690e3a0f8787af4dfb9ea95ca98618e4267ba9ac2b7ec6452fa
7
+ data.tar.gz: 8114c60bd44fe1f5b3c692654d8dfc3d5dbb7769dd11c95a36b42a6c84386403a89a7b080e79ea305dc86605bae199e175456ce01e58cc17207011b3b394d492
data/.rubocop.yml CHANGED
@@ -1,13 +1,18 @@
1
- AllCops:
2
- TargetRubyVersion: 2.6
3
-
4
1
  Style/StringLiterals:
5
2
  Enabled: true
6
- EnforcedStyle: double_quotes
3
+ EnforcedStyle: single_quotes
7
4
 
8
5
  Style/StringLiteralsInInterpolation:
9
6
  Enabled: true
10
- EnforcedStyle: double_quotes
7
+ EnforcedStyle: single_quotes
11
8
 
12
9
  Layout/LineLength:
13
10
  Max: 120
11
+
12
+ AllCops:
13
+ TargetRubyVersion: 2.6
14
+ Exclude:
15
+ - 'vendor/**/*'
16
+ - 'bin/*'
17
+ - 'Gemfile.lock'
18
+ - 'Rakefile'
data/Gemfile CHANGED
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- source "https://rubygems.org"
3
+ source 'https://rubygems.org'
4
4
 
5
5
  # Specify your gem's dependencies in chatworkify.gemspec
6
6
  gemspec
7
7
 
8
- gem "rake", "~> 13.0"
8
+ gem 'rake', '~> 13.0'
9
9
 
10
- gem "minitest", "~> 5.0"
10
+ gem 'minitest', '~> 5.0'
11
11
 
12
- gem "rubocop", "~> 1.21"
12
+ gem 'rubocop', '~> 1.21'
data/README.md CHANGED
@@ -24,6 +24,24 @@ Require the gem in your `Capfile`:
24
24
 
25
25
  require 'capistrano/slackify'
26
26
 
27
+ ## Configuration
28
+
29
+ ### Puts `CHATWORK_API_TOKEN` into your ENV
30
+
31
+ - Export to your `bash`: `export CHATWORK_API_TOKEN=xxx`
32
+
33
+ - Add to `.env` if you're using `config` gem
34
+
35
+
36
+ ### Puts `CHATWORK_ROOM_ID` into your ENV or custom in `config/deploy`
37
+
38
+ ```ruby
39
+ # config/deploy.rb
40
+ ...
41
+ set :chatwork_room_id, 'xxx'
42
+ ...
43
+ ```
44
+
27
45
  ### Copyright
28
46
 
29
47
  ยฉphunt
data/chatworkify.gemspec CHANGED
@@ -1,31 +1,32 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
 
5
- require_relative "lib/chatworkify/version"
6
+ require_relative 'lib/chatworkify/version'
6
7
 
7
8
  Gem::Specification.new do |spec|
8
- spec.name = "chatworkify"
9
+ spec.name = 'chatworkify'
9
10
  spec.version = Chatworkify::VERSION
10
- spec.authors = ["phunt"]
11
- spec.email = ["phunt@runsystem.net"]
11
+ spec.authors = ['phunt']
12
+ spec.email = ['phunt@runsystem.net']
12
13
 
13
- spec.summary = %q{Publish deployment notifications to Chatwork via the API}
14
- spec.description = %q{Publish deployment notifications to Chatwork via the API}
15
- spec.homepage = "https://github.com/rs-phunt/chatworkify"
16
- spec.license = "MIT"
17
- spec.required_ruby_version = ">= 1.9.1"
14
+ spec.summary = 'Publish deployment notifications to Chatwork via the API'
15
+ spec.description = 'Publish deployment notifications to Chatwork via the API'
16
+ spec.homepage = 'https://github.com/rs-phunt/chatworkify'
17
+ spec.license = 'MIT'
18
+ spec.required_ruby_version = '>= 2.6'
18
19
 
19
- # spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
20
+ # spec.metadata['allowed_push_host'] = 'TODO: Set to your gem server 'https://example.com''
20
21
 
21
- spec.metadata["homepage_uri"] = spec.homepage
22
- spec.metadata["source_code_uri"] = "https://github.com/rs-phunt/chatworkify"
23
- spec.metadata["changelog_uri"] = "https://github.com/rs-phunt/chatworkify/blob/master/CHANGELOG.md"
22
+ spec.metadata['homepage_uri'] = spec.homepage
23
+ spec.metadata['source_code_uri'] = 'https://github.com/rs-phunt/chatworkify'
24
+ spec.metadata['changelog_uri'] = 'https://github.com/rs-phunt/chatworkify/blob/master/CHANGELOG.md'
24
25
 
25
26
  spec.files = `git ls-files -z`.split("\x0")
26
- spec.bindir = "exe"
27
+ spec.bindir = 'exe'
27
28
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
28
- spec.require_paths = ["lib"]
29
+ spec.require_paths = ['lib']
29
30
 
30
31
  # Uncomment to register a new dependency of your gem
31
32
  spec.add_dependency 'chatwork', '~> 0.1'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'chatworkify'
2
4
 
3
- load File.expand_path('../tasks/chatworkify.cap', __FILE__)
5
+ load File.expand_path('tasks/chatworkify.cap', __dir__)
@@ -38,6 +38,7 @@ end
38
38
 
39
39
  namespace :load do
40
40
  task :defaults do
41
+ set :chatwork_room_id, nil
41
42
  set :local_user, ->{ ENV["USER"] || ENV["LOGNAME"] || ENV["USERNAME"] }
42
43
  set :ip_address, ->{
43
44
  servers = release_roles(:all)
@@ -1,21 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Chatworkify
4
+ # Chatwork service
4
5
  class Cw
5
- def initialize(api_key = nil, room_id = nil)
6
+ def initialize(api_key = nil)
6
7
  @api_key = api_key || ENV['CHATWORK_API_TOKEN']
7
- @room_id = room_id || ENV['CHATWORK_ROOM_ID']
8
+ @room_id = fetch(:chatwork_room_id) || ENV['CHATWORK_ROOM_ID']
8
9
  end
9
10
 
10
11
  def call(body = nil)
11
12
  ChatWork.api_key = @api_key
12
- body = body || 'No body input!'
13
+ body ||= 'No body input!'
13
14
  ChatWork::Message.create(room_id: @room_id, body: body)
14
15
  rescue ChatWork::APIError => e
15
- puts "#{e.message}"
16
+ puts e.message
16
17
  end
17
18
  end
18
19
 
20
+ # Chatwork service libs
19
21
  class CwLib
20
22
  class << self
21
23
  def text(status)
@@ -29,13 +31,14 @@ module Chatworkify
29
31
  end
30
32
  end
31
33
 
32
- def message_body(status=:starting)
33
- %{[code]๐Ÿ‘ป #{text(status)}
34
+ def message_body(status = :starting)
35
+ %(
36
+ [code]๐Ÿ‘ป #{text(status)}
34
37
  โ— ๐•Š๐•ฅ๐•’๐•˜๐•– : #{fetch(:stage).upcase!}
35
38
  โ— ๐•Š๐•–๐•ฃ๐•ง๐•–๐•ฃ : #{fetch(:ip_address)}
36
39
  โ— ๐”น๐•ฃ๐•’๐•Ÿ๐•”๐•™ : #{fetch(:branch)}
37
40
  โ— โ„๐•–๐•ง๐•š๐•ค๐•š๐• ๐•Ÿ: #{fetch(:current_revision) || '<empty>'}[/code]
38
- }
41
+ )
39
42
  end
40
43
  end
41
44
  end
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Chatworkify
4
- VERSION = "0.1.1"
4
+ VERSION = '0.1.2'
5
5
  end
data/lib/chatworkify.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'chatwork'
3
4
  require 'chatworkify/version'
4
5
  require 'chatworkify/cw'
@@ -1,11 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Custom methods for String class
1
4
  class String
2
5
  def truncate(max)
3
6
  length > max ? "#{self[0...max]}..." : self
4
7
  end
5
8
  end
6
9
 
10
+ # Custom methods for Symbol class
7
11
  class Symbol
8
12
  def upcase!
9
- self.to_s.upcase
13
+ to_s.upcase
10
14
  end
11
15
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "test_helper"
3
+ require 'test_helper'
4
4
 
5
5
  class ChatworkifyTest < Minitest::Test
6
6
  def test_that_it_has_a_version_number
data/test/test_helper.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
4
- require "chatworkify"
3
+ $LOAD_PATH.unshift File.expand_path('lib', __dir__)
4
+ require 'chatworkify'
5
5
 
6
- require "minitest/autorun"
6
+ require 'minitest/autorun'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chatworkify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - phunt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-22 00:00:00.000000000 Z
11
+ date: 2021-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chatwork
@@ -114,14 +114,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: 1.9.1
117
+ version: '2.6'
118
118
  required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - ">="
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  requirements: []
124
- rubygems_version: 3.2.22
124
+ rubygems_version: 3.1.4
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: Publish deployment notifications to Chatwork via the API