chatopsify 0.0.3 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 296a8fa9bb7d7496e1f073aa6f08e0900a38ca045bef70ad4bfb285400e0e7e7
4
- data.tar.gz: 5932bac724d4db9fbac66388761f1a7c66ace06dc89050b5c9d2d4060efc987a
3
+ metadata.gz: 1ad7c973ce861d481cbc1b15b008de15c5a489c84ed1410d61ec2bb834bed9be
4
+ data.tar.gz: a87c09f10af7611b2453756767b1b413f4a89bd504afa16e2e353ec79cc58bbe
5
5
  SHA512:
6
- metadata.gz: 6188cd8506de37a49c2376dc6ee8679a1fb4252e5f179074404696d44b0730974102943b99e7acb3b1c516d9db3c41256a66088766b146172a585ad9e01f862f
7
- data.tar.gz: 92e6aa61b3b7660d3118657cd140e0b01aa8d543ae6a6007d9ee6f822b984bd3a389f13ab985bf13c024dd7ad1ba60dfa5e374ab4daf519f7dc6b27713accea8
6
+ metadata.gz: 2a37716e4e9e248095a2ad2a2754eccd59315b1f684e1efcc5a2d14da788d37f71521e7d1b35344720e2095cbef4908e73336050c76bef40b8769c37a27ebb95
7
+ data.tar.gz: b8cb3e14161a00fea4ea68f58199e82ba75741a75dae5733655bb078d724966f819521ed23f8cb47f2d06ad0dfed83e0090487b26670892640c289eea3c9473b
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # Chatopsify
2
2
 
3
- ![Gem](https://img.shields.io/gem/v/Chatopsify?color=%234cc61f&label=Gem%20version&logo=ruby&logoColor=red)
4
- ![Gem](https://img.shields.io/gem/dt/Chatopsify?color=%2330c754&label=Downloads&logo=rubygems&logoColor=red)
5
- ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/rs-phunt/Chatopsify/Tests%20%F0%9F%A7%AA?label=Tests&logo=github)
6
- ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/rs-phunt/Chatopsify/Rubocop%20Lint?label=Rubocop&logo=github)
3
+ ![Gem](https://img.shields.io/gem/v/chatopsify?color=%25234cc61f&label=Gem%20version&logo=ruby&logoColor=red)
4
+ ![Gem](https://img.shields.io/gem/dt/chatopsify?color=%2330c754&label=Downloads&logo=rubygems&logoColor=red)
5
+ <!-- ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/rs-phunt/Chatopsify/Tests%20%F0%9F%A7%AA?label=Tests&logo=github)
6
+ ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/rs-phunt/Chatopsify/Rubocop%20Lint?label=Rubocop&logo=github) -->
7
7
 
8
8
  ## Installation
9
9
 
@@ -29,19 +29,22 @@ Require the gem in your `Capfile`:
29
29
 
30
30
  ## Configuration
31
31
 
32
- ### Puts `CHATOPS_API_KEY` into your ENV
33
-
34
- - Export to your `bash`: `export CHATOPS_API_KEY=xxx`
35
-
36
- - Add to `.env` if you're using `dotenv` gem
32
+ ### Using ENV (or `.env`)
37
33
 
34
+ ```bash
35
+ export CHATOPS_URI='your_chatops_uri'
36
+ export CHATOPS_API_KEY='your_chatops_api_key'
37
+ export CHATOPS_CHANNEL_ID='your_channel_id'
38
+ ```
38
39
 
39
- ### Puts `CHATOPS_CHANNEL_ID` into your ENV or custom in `config/deploy`
40
+ ### Using `config/deploy`
40
41
 
41
42
  ```ruby
42
43
  # config/deploy.rb
43
44
  ...
44
- set :chatops_channel_id, 'xxx'
45
+ set :chatops_uri, 'your_chatops_uri'
46
+ set :chatops_api_key, 'your_chatops_api_key'
47
+ set :chatops_channel_id, 'your_channel_id'
45
48
  ...
46
49
  ```
47
50
 
data/chatopsify.gemspec CHANGED
@@ -31,7 +31,6 @@ Gem::Specification.new do |spec|
31
31
  # Uncomment to register a new dependency of your gem
32
32
 
33
33
  spec.add_dependency 'capistrano', '~> 3.2', '>= 3.2.0'
34
- spec.add_dependency 'tzinfo', '~> 1.1'
35
34
  spec.add_development_dependency 'bundler', '~> 2'
36
35
  spec.add_development_dependency 'rake', '~> 1'
37
36
 
@@ -1,7 +1,6 @@
1
1
  namespace :chatops do
2
2
  desc "Notify ChatOps Started"
3
3
  task :notify_started do
4
- # return
5
4
  set :chatops_time_started, Time.now
6
5
  run_locally do
7
6
  if fetch(:chatops_notify_events).include? :started
@@ -9,8 +8,8 @@ namespace :chatops do
9
8
  end
10
9
  end
11
10
  end
12
- # before 'deploy:starting', 'chatops:notify_started'
13
- before 'rbenv:validate', 'chatops:notify_started'
11
+ before 'deploy:starting', 'chatops:notify_started'
12
+ # before 'rbenv:validate', 'chatops:notify_started'
14
13
 
15
14
  desc "Notify ChatOps Finished"
16
15
  task :notify_finished do
@@ -22,8 +21,8 @@ namespace :chatops do
22
21
  end
23
22
  end
24
23
  end
25
- # after 'deploy:finished', 'chatops:notify_finished'
26
- before 'deploy:failed', 'chatops:notify_finished'
24
+ after 'deploy:finished', 'chatops:notify_finished'
25
+ # before 'deploy:failed', 'chatops:notify_finished'
27
26
 
28
27
  desc "Notify ChatOps Finished"
29
28
  task :notify_failed do
@@ -51,7 +50,7 @@ namespace :load do
51
50
  servers.map{ |e| ["#{e.hostname} (#{e.properties.fetch(:my_property)&.upcase!})"]}.join(', ')
52
51
  }
53
52
  set :chatops_deploy_starting_text, ->{
54
- "### :zap: ⎡#{fetch(:application)}⎦ is deploying by ⎡*#{fetch(:local_user)}*⎦: Starting •••"
53
+ "### :zap: ⎡#{fetch(:application)}⎦ is being deployed by ⎡*#{fetch(:local_user)}*⎦: Starting •••"
55
54
  }
56
55
  set :chatops_deploy_succeed_text, ->{
57
56
  time_elapsed = Integer(fetch(:chatops_time_finished, 0).to_i - fetch(:chatops_time_started, 0).to_i)
@@ -61,7 +60,7 @@ namespace :load do
61
60
  set :chatops_deploy_failed_text, ->{
62
61
  time_elapsed = Integer(fetch(:chatops_time_finished, 0).to_i - fetch(:chatops_time_started, 0).to_i)
63
62
  "### :sos: ⎡#{fetch(:application)}⎦ was deployed by ⎡#{fetch(:local_user)}⎦: " \
64
- "*failed* in **#{time_elapsed}** seconds."
63
+ "*failed* within **#{time_elapsed}** seconds."
65
64
  }
66
65
  set :chatops_notify_events, [:started, :finished, :failed]
67
66
  end
data/lib/chatopsify/co.rb CHANGED
@@ -2,10 +2,8 @@
2
2
 
3
3
  require 'json'
4
4
  require 'net/http'
5
- require 'tzinfo'
6
5
 
7
6
  module Chatopsify
8
- # ChatOps service
9
7
  class Co
10
8
  def initialize(api_key = nil)
11
9
  @api_key = api_key || load_api_key
@@ -105,7 +103,7 @@ module Chatopsify
105
103
  | Server | #{fetch(:ip_address) }|
106
104
  | Branch | #{fetch(:branch)} |
107
105
  | Revision | #{fetch(:current_revision) || '<empty>'} |
108
- | Timestamp | #{TZInfo::Timezone.get('Asia/Ho_Chi_Minh')&.now || Time.now} |
106
+ | Timestamp | #{Time.now.getlocal("+07:00") || Time.now} |
109
107
  """
110
108
  end
111
109
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Chatopsify
4
- VERSION = '0.0.3'
4
+ VERSION = '0.0.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chatopsify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - phunt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-16 00:00:00.000000000 Z
11
+ date: 2024-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -30,20 +30,6 @@ dependencies:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 3.2.0
33
- - !ruby/object:Gem::Dependency
34
- name: tzinfo
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '1.1'
40
- type: :runtime
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: '1.1'
47
33
  - !ruby/object:Gem::Dependency
48
34
  name: bundler
49
35
  requirement: !ruby/object:Gem::Requirement
@@ -96,7 +82,6 @@ files:
96
82
  - lib/capistrano/tasks/chatopsify.cap
97
83
  - lib/chatopsify.rb
98
84
  - lib/chatopsify/co.rb
99
- - lib/chatopsify/co_service.rb
100
85
  - lib/chatopsify/version.rb
101
86
  - lib/core_ext/custom_lib.rb
102
87
  - test/chatworkify_test.rb
@@ -1,10 +0,0 @@
1
- module Chatopsify
2
- class CoService
3
- CO_URI = 'https://chat.runsystem.vn/api/v4/posts'.freeze
4
-
5
- def initialize(api_key, channel_id)
6
- @api_key = api_key
7
- @channel_id = channel_id
8
- end
9
- end
10
- end