Skip to content

Commit

Permalink
remove tzinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
papakvy committed Sep 17, 2024
1 parent 0354f01 commit 3a360cf
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 17 deletions.
1 change: 0 additions & 1 deletion chatopsify.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ Gem::Specification.new do |spec|
# Uncomment to register a new dependency of your gem

spec.add_dependency 'capistrano', '~> 3.2', '>= 3.2.0'
spec.add_dependency 'tzinfo', '~> 1.1'
spec.add_development_dependency 'bundler', '~> 2'
spec.add_development_dependency 'rake', '~> 1'

Expand Down
5 changes: 2 additions & 3 deletions lib/capistrano/tasks/chatopsify.cap
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
namespace :chatops do
desc "Notify ChatOps Started"
task :notify_started do
# return
set :chatops_time_started, Time.now
run_locally do
if fetch(:chatops_notify_events).include? :started
Expand Down Expand Up @@ -51,7 +50,7 @@ namespace :load do
servers.map{ |e| ["#{e.hostname} (#{e.properties.fetch(:my_property)&.upcase!})"]}.join(', ')
}
set :chatops_deploy_starting_text, ->{
"### :zap: ⎡#{fetch(:application)}⎦ is deploying by ⎡*#{fetch(:local_user)}*⎦: Starting •••"
"### :zap: ⎡#{fetch(:application)}⎦ is being deployed by ⎡*#{fetch(:local_user)}*⎦: Starting •••"
}
set :chatops_deploy_succeed_text, ->{
time_elapsed = Integer(fetch(:chatops_time_finished, 0).to_i - fetch(:chatops_time_started, 0).to_i)
Expand All @@ -61,7 +60,7 @@ namespace :load do
set :chatops_deploy_failed_text, ->{
time_elapsed = Integer(fetch(:chatops_time_finished, 0).to_i - fetch(:chatops_time_started, 0).to_i)
"### :sos: ⎡#{fetch(:application)}⎦ was deployed by ⎡#{fetch(:local_user)}⎦: " \
"*failed* in **#{time_elapsed}** seconds."
"*failed* within **#{time_elapsed}** seconds."
}
set :chatops_notify_events, [:started, :finished, :failed]
end
Expand Down
4 changes: 1 addition & 3 deletions lib/chatopsify/co.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

require 'json'
require 'net/http'
require 'tzinfo'

module Chatopsify
# ChatOps service
class Co
def initialize(api_key = nil)
@api_key = api_key || load_api_key
Expand Down Expand Up @@ -105,7 +103,7 @@ def msg_fmt(status = nil)
| Server | #{fetch(:ip_address) }|
| Branch | #{fetch(:branch)} |
| Revision | #{fetch(:current_revision) || '<empty>'} |
| Timestamp | #{TZInfo::Timezone.get('Asia/Ho_Chi_Minh')&.now || Time.now} |
| Timestamp | #{Time.now.getlocal("+07:00") || Time.now} |
"""
end
end
Expand Down
10 changes: 0 additions & 10 deletions lib/chatopsify/co_service.rb

This file was deleted.

0 comments on commit 3a360cf

Please sign in to comment.