chatopsify 0.0.4 → 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 +4 -4
 - data/README.md +14 -11
 - data/chatopsify.gemspec +0 -1
 - data/lib/capistrano/tasks/chatopsify.cap +2 -3
 - data/lib/chatopsify/co.rb +1 -3
 - data/lib/chatopsify/version.rb +1 -1
 - metadata +2 -17
 - data/lib/chatopsify/co_service.rb +0 -10
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 1ad7c973ce861d481cbc1b15b008de15c5a489c84ed1410d61ec2bb834bed9be
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: a87c09f10af7611b2453756767b1b413f4a89bd504afa16e2e353ec79cc58bbe
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 2a37716e4e9e248095a2ad2a2754eccd59315b1f684e1efcc5a2d14da788d37f71521e7d1b35344720e2095cbef4908e73336050c76bef40b8769c37a27ebb95
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: b8cb3e14161a00fea4ea68f58199e82ba75741a75dae5733655bb078d724966f819521ed23f8cb47f2d06ad0dfed83e0090487b26670892640c289eea3c9473b
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,9 +1,9 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # Chatopsify
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            
         
     | 
| 
       6 
     | 
    
         
            -
            
         
     | 
| 
      
 3 
     | 
    
         
            +
            
         
     | 
| 
      
 4 
     | 
    
         
            +
            
         
     | 
| 
      
 5 
     | 
    
         
            +
            <!-- 
         
     | 
| 
      
 6 
     | 
    
         
            +
             -->
         
     | 
| 
       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 
     | 
    
         
            -
            ###  
     | 
| 
       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 
     | 
    
         
            -
            ###  
     | 
| 
      
 40 
     | 
    
         
            +
            ### Using `config/deploy`
         
     | 
| 
       40 
41 
     | 
    
         | 
| 
       41 
42 
     | 
    
         
             
            ```ruby
         
     | 
| 
       42 
43 
     | 
    
         
             
            # config/deploy.rb
         
     | 
| 
       43 
44 
     | 
    
         
             
            ...
         
     | 
| 
       44 
     | 
    
         
            -
            set : 
     | 
| 
      
 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
         
     | 
| 
         @@ -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  
     | 
| 
      
 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*  
     | 
| 
      
 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 | #{ 
     | 
| 
      
 106 
     | 
    
         
            +
            | Timestamp | #{Time.now.getlocal("+07:00") || Time.now} |
         
     | 
| 
       109 
107 
     | 
    
         
             
            """
         
     | 
| 
       110 
108 
     | 
    
         
             
                  end
         
     | 
| 
       111 
109 
     | 
    
         
             
                end
         
     | 
    
        data/lib/chatopsify/version.rb
    CHANGED
    
    
    
        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. 
     | 
| 
      
 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- 
     | 
| 
      
 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
         
     |