evrone-ci-common 0.0.7 → 0.0.8
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/Rakefile +3 -1
 - data/lib/evrone/ci/common/version.rb +1 -1
 - data/spec/lib/scm/git_spec.rb +8 -4
 - metadata +1 -5
 - data/.travis.yml +0 -5
 - data/lib/evrone/ci/common/perform_message_wrapper.rb +0 -50
 - data/spec/lib/common/perform_message_wrapper_spec.rb +0 -79
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 79ab6124b2aedbcb0d99eb7ff63b91ca328fced8
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 98c1cf5d4f1d710a1048aa3534a83da3d2d9621d
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e5d607bec596152b451fe5500aec15bd91f9711a94b433e88084690f46c7203b98ac0f404681bfb67c5fb4c370e4f1dc91a107096dedff28f2129434bcd4836c
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: aae92750aecc4022610c34e67fcd5c9c7755415585250351ec4d81e7c9b47a8ab33413437c5695855822055f7a495a0deb6c7df4614beade23f414eb14eefe78
         
     | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/spec/lib/scm/git_spec.rb
    CHANGED
    
    | 
         @@ -60,8 +60,12 @@ describe Evrone::CI::SCM::Git do 
     | 
|
| 
       60 
60 
     | 
    
         | 
| 
       61 
61 
     | 
    
         
             
              context "make_fetch_command" do
         
     | 
| 
       62 
62 
     | 
    
         
             
                include Evrone::Common::Spawn
         
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
                let(:run)  
     | 
| 
      
 63 
     | 
    
         
            +
                let(:env) { {'GIT_SSH' => git.git_ssh.location.path} }
         
     | 
| 
      
 64 
     | 
    
         
            +
                let(:run) do
         
     | 
| 
      
 65 
     | 
    
         
            +
                  git.git_ssh.open do
         
     | 
| 
      
 66 
     | 
    
         
            +
                    spawn(env, git.make_fetch_command) {|o| puts o }
         
     | 
| 
      
 67 
     | 
    
         
            +
                  end
         
     | 
| 
      
 68 
     | 
    
         
            +
                end
         
     | 
| 
       65 
69 
     | 
    
         
             
                subject { git.make_fetch_command }
         
     | 
| 
       66 
70 
     | 
    
         | 
| 
       67 
71 
     | 
    
         
             
                before do
         
     | 
| 
         @@ -84,8 +88,8 @@ describe Evrone::CI::SCM::Git do 
     | 
|
| 
       84 
88 
     | 
    
         | 
| 
       85 
89 
     | 
    
         
             
                context "twice" do
         
     | 
| 
       86 
90 
     | 
    
         
             
                  it "should be" do
         
     | 
| 
       87 
     | 
    
         
            -
                    code =  
     | 
| 
       88 
     | 
    
         
            -
                      puts o 
     | 
| 
      
 91 
     | 
    
         
            +
                    code = git.git_ssh.open do
         
     | 
| 
      
 92 
     | 
    
         
            +
                      spawn(env, git.make_fetch_command) {|o| puts o }
         
     | 
| 
       89 
93 
     | 
    
         
             
                    end
         
     | 
| 
       90 
94 
     | 
    
         
             
                    expect(code).to eq 0
         
     | 
| 
       91 
95 
     | 
    
         
             
                  end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: evrone-ci-common
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.8
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Dmitry Galinsky
         
     | 
| 
         @@ -117,7 +117,6 @@ extra_rdoc_files: [] 
     | 
|
| 
       117 
117 
     | 
    
         
             
            files:
         
     | 
| 
       118 
118 
     | 
    
         
             
            - .gitignore
         
     | 
| 
       119 
119 
     | 
    
         
             
            - .rspec
         
     | 
| 
       120 
     | 
    
         
            -
            - .travis.yml
         
     | 
| 
       121 
120 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       122 
121 
     | 
    
         
             
            - LICENSE.txt
         
     | 
| 
       123 
122 
     | 
    
         
             
            - README.md
         
     | 
| 
         @@ -126,14 +125,12 @@ files: 
     | 
|
| 
       126 
125 
     | 
    
         
             
            - lib/evrone/ci/common.rb
         
     | 
| 
       127 
126 
     | 
    
         
             
            - lib/evrone/ci/common/helper/middlewares.rb
         
     | 
| 
       128 
127 
     | 
    
         
             
            - lib/evrone/ci/common/helper/shell.rb
         
     | 
| 
       129 
     | 
    
         
            -
            - lib/evrone/ci/common/perform_message_wrapper.rb
         
     | 
| 
       130 
128 
     | 
    
         
             
            - lib/evrone/ci/common/tagged_logging.rb
         
     | 
| 
       131 
129 
     | 
    
         
             
            - lib/evrone/ci/common/version.rb
         
     | 
| 
       132 
130 
     | 
    
         
             
            - lib/evrone/ci/scm/git.rb
         
     | 
| 
       133 
131 
     | 
    
         
             
            - lib/evrone/ci/scm/git/git_ssh.rb
         
     | 
| 
       134 
132 
     | 
    
         
             
            - spec/lib/common/helper/middlewares_spec.rb
         
     | 
| 
       135 
133 
     | 
    
         
             
            - spec/lib/common/helper/shell_spec.rb
         
     | 
| 
       136 
     | 
    
         
            -
            - spec/lib/common/perform_message_wrapper_spec.rb
         
     | 
| 
       137 
134 
     | 
    
         
             
            - spec/lib/scm/git_spec.rb
         
     | 
| 
       138 
135 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       139 
136 
     | 
    
         
             
            homepage: ''
         
     | 
| 
         @@ -163,6 +160,5 @@ summary: Common code for ci 
     | 
|
| 
       163 
160 
     | 
    
         
             
            test_files:
         
     | 
| 
       164 
161 
     | 
    
         
             
            - spec/lib/common/helper/middlewares_spec.rb
         
     | 
| 
       165 
162 
     | 
    
         
             
            - spec/lib/common/helper/shell_spec.rb
         
     | 
| 
       166 
     | 
    
         
            -
            - spec/lib/common/perform_message_wrapper_spec.rb
         
     | 
| 
       167 
163 
     | 
    
         
             
            - spec/lib/scm/git_spec.rb
         
     | 
| 
       168 
164 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
    
        data/.travis.yml
    DELETED
    
    
| 
         @@ -1,50 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            module Evrone
         
     | 
| 
       2 
     | 
    
         
            -
              module CI
         
     | 
| 
       3 
     | 
    
         
            -
                module Common
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
                  module PerformMessageWrapper
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
                    def self.included(base)
         
     | 
| 
       8 
     | 
    
         
            -
                      base.send :extend, ClassMethods
         
     | 
| 
       9 
     | 
    
         
            -
                    end
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                    module ClassMethods
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                      def delegate_message_methods(msg_class, message_name)
         
     | 
| 
       14 
     | 
    
         
            -
                        msg_class.fields.each_pair do |_, field|
         
     | 
| 
       15 
     | 
    
         
            -
                          define_method field.name do
         
     | 
| 
       16 
     | 
    
         
            -
                            send(message_name).public_send field.name
         
     | 
| 
       17 
     | 
    
         
            -
                          end
         
     | 
| 
       18 
     | 
    
         
            -
                        end
         
     | 
| 
       19 
     | 
    
         
            -
                      end
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                      def delivery_message_output(consumer, formatter)
         
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
                        define_method :output do
         
     | 
| 
       24 
     | 
    
         
            -
                          @output ||= ""
         
     | 
| 
       25 
     | 
    
         
            -
                        end
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
                        define_method :add_to_output do |data|
         
     | 
| 
       28 
     | 
    
         
            -
                          output << data
         
     | 
| 
       29 
     | 
    
         
            -
                          logger.debug data.strip if logger.level == 0
         
     | 
| 
       30 
     | 
    
         
            -
                          delivery_output data
         
     | 
| 
       31 
     | 
    
         
            -
                        end
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                        define_method :add_command_to_output do |data|
         
     | 
| 
       34 
     | 
    
         
            -
                          add_to_output "$ #{data}"
         
     | 
| 
       35 
     | 
    
         
            -
                          add_to_output "\n"
         
     | 
| 
       36 
     | 
    
         
            -
                        end
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
                        define_method :delivery_output do |data|
         
     | 
| 
       39 
     | 
    
         
            -
                          consumer.publish send(formatter, Time.now, data)
         
     | 
| 
       40 
     | 
    
         
            -
                        end
         
     | 
| 
       41 
     | 
    
         
            -
                        private :delivery_output
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
                      end
         
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
                    end
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
                  end
         
     | 
| 
       48 
     | 
    
         
            -
                end
         
     | 
| 
       49 
     | 
    
         
            -
              end
         
     | 
| 
       50 
     | 
    
         
            -
            end
         
     | 
| 
         @@ -1,79 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'spec_helper'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'logger'
         
     | 
| 
       3 
     | 
    
         
            -
            require 'evrone/ci/message/testing'
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            class PerformMessageWrapperConsumer
         
     | 
| 
       6 
     | 
    
         
            -
              def self.publish(*args)
         
     | 
| 
       7 
     | 
    
         
            -
              end
         
     | 
| 
       8 
     | 
    
         
            -
            end
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            PerformMessageWrapperTest = Struct.new(:message) do
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
              include Evrone::CI::Common::PerformMessageWrapper
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
              delegate_message_methods Evrone::CI::Message::PerformBuild, :message
         
     | 
| 
       15 
     | 
    
         
            -
              delivery_message_output PerformMessageWrapperConsumer, :make_log_message
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
              def make_log_message(tm, data)
         
     | 
| 
       18 
     | 
    
         
            -
                Evrone::CI::Message::BuildLog.new build_id: id, tm: tm.to_i, tm_usec: tm.usec, log: data
         
     | 
| 
       19 
     | 
    
         
            -
              end
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
              def logger
         
     | 
| 
       22 
     | 
    
         
            -
                @logger ||= Logger.new(STDOUT).tap{|l| l.level = 0 }
         
     | 
| 
       23 
     | 
    
         
            -
              end
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
            end
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
            describe Evrone::CI::Common::PerformMessageWrapper do
         
     | 
| 
       28 
     | 
    
         
            -
              let(:consumer) { PerformMessageWrapperConsumer }
         
     | 
| 
       29 
     | 
    
         
            -
              let(:klass)    { PerformMessageWrapperTest }
         
     | 
| 
       30 
     | 
    
         
            -
              let(:message)  { Evrone::CI::Message::PerformBuild.test_message }
         
     | 
| 
       31 
     | 
    
         
            -
              let(:object)   { klass.new message }
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
              subject { object }
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
              it { should be }
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
              its(:output)     { should eq ''                 }
         
     | 
| 
       38 
     | 
    
         
            -
              its(:id)         { should eq message.id         }
         
     | 
| 
       39 
     | 
    
         
            -
              its(:name)       { should eq message.name       }
         
     | 
| 
       40 
     | 
    
         
            -
              its(:src)        { should eq message.src        }
         
     | 
| 
       41 
     | 
    
         
            -
              its(:sha)        { should eq message.sha        }
         
     | 
| 
       42 
     | 
    
         
            -
              its(:deploy_key) { should eq message.deploy_key }
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
              context "add_to_output" do
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                subject { object.add_to_output "line" }
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
                before do
         
     | 
| 
       49 
     | 
    
         
            -
                  mock(consumer).publish(anything) { true }
         
     | 
| 
       50 
     | 
    
         
            -
                end
         
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
                it "should delivery message" do
         
     | 
| 
       53 
     | 
    
         
            -
                  expect(subject).to be
         
     | 
| 
       54 
     | 
    
         
            -
                end
         
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
                it "should add message to output" do
         
     | 
| 
       57 
     | 
    
         
            -
                  subject
         
     | 
| 
       58 
     | 
    
         
            -
                  expect(object.output).to eq 'line'
         
     | 
| 
       59 
     | 
    
         
            -
                end
         
     | 
| 
       60 
     | 
    
         
            -
              end
         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
              context "add_command_to_output" do
         
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
                subject { object.add_command_to_output "line" }
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
                before do
         
     | 
| 
       67 
     | 
    
         
            -
                  mock(consumer).publish(anything).twice { true }
         
     | 
| 
       68 
     | 
    
         
            -
                end
         
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
                it "should delivery formatted message" do
         
     | 
| 
       71 
     | 
    
         
            -
                  expect(subject).to be
         
     | 
| 
       72 
     | 
    
         
            -
                end
         
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
                it "should add formatted message to output" do
         
     | 
| 
       75 
     | 
    
         
            -
                  subject
         
     | 
| 
       76 
     | 
    
         
            -
                  expect(object.output).to eq "$ line\n"
         
     | 
| 
       77 
     | 
    
         
            -
                end
         
     | 
| 
       78 
     | 
    
         
            -
              end
         
     | 
| 
       79 
     | 
    
         
            -
            end
         
     |