jenkins2-api 0.0.2 → 0.0.3
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/bin/jenkins2api +27 -0
- data/lib/{jenkins2-api/client.rb → client.rb} +0 -0
- data/lib/commands/build.rb +16 -0
- data/lib/commands/job.rb +9 -0
- data/lib/commands/node.rb +28 -0
- data/lib/{jenkins2-api/endpoints → endpoints}/artifact.rb +0 -0
- data/lib/{jenkins2-api/endpoints → endpoints}/build.rb +0 -0
- data/lib/{jenkins2-api/endpoints → endpoints}/job.rb +0 -0
- data/lib/{jenkins2-api/endpoints → endpoints}/node.rb +0 -0
- data/lib/jenkins2-api.rb +8 -2
- data/lib/thor_command.rb +15 -0
- data/lib/{jenkins2-api/version.rb → version.rb} +1 -1
- metadata +30 -10
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 50a66d046cf1b80d6157faa6ee3b5dd688f15801
         | 
| 4 | 
            +
              data.tar.gz: 3e3772fca9cfba891cf35c6cb90db613eaf98821
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: fbc0008f7d0f0be707e920794e5ea1a0b758b191b1e72922bb40b130092c779b86364ffcbf0a56488281a825ce39c66379390704bc98cf575278c02d999e6e14
         | 
| 7 | 
            +
              data.tar.gz: 904a2d34054ff7ebfa7239315ee18db4802c7fb8dfc941585d87f683093978874bae9e2ba968624f971a37153af37e526bfc49681b907403c26d4ab83691b9d7
         | 
    
        data/bin/jenkins2api
    ADDED
    
    | @@ -0,0 +1,27 @@ | |
| 1 | 
            +
            #!/usr/bin/env ruby
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'thor'
         | 
| 4 | 
            +
            require 'jenkins2-api'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            module Jenkins2API
         | 
| 7 | 
            +
              module CLI
         | 
| 8 | 
            +
                class Jenkins2 < Thor
         | 
| 9 | 
            +
                  class_option :password, :desc => "Password", :aliases => "-p", :required => true
         | 
| 10 | 
            +
                  class_option :username, :desc => "Username", :aliases => "-u", :required => true
         | 
| 11 | 
            +
                  class_option :server, :desc => "Server path", :aliases => "-s", :required => true
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                  map %w[--version -v] => :__print_version
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  desc "--version, -v", "print the version"
         | 
| 16 | 
            +
                  def __print_version
         | 
| 17 | 
            +
                    puts Jenkins2API::VERSION
         | 
| 18 | 
            +
                  end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                  register(Jenkins2API::Command::Job, 'job', 'job <command>', 'Job related commands')
         | 
| 21 | 
            +
                  register(Jenkins2API::Command::Build, 'build', 'build <command>', 'Build related commands')
         | 
| 22 | 
            +
                  register(Jenkins2API::Command::Node, 'node', 'node <command>', 'Node related commands')
         | 
| 23 | 
            +
                end
         | 
| 24 | 
            +
              end
         | 
| 25 | 
            +
            end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            Jenkins2API::CLI::Jenkins2.start
         | 
| 
            File without changes
         | 
| @@ -0,0 +1,16 @@ | |
| 1 | 
            +
            require 'thor'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Jenkins2API
         | 
| 4 | 
            +
              module Command
         | 
| 5 | 
            +
                class Build < Jenkins2API::ThorCommand
         | 
| 6 | 
            +
                  desc 'slave-name JOB_NAME BUILD_ID', 'Get Node name where a specific build was running'
         | 
| 7 | 
            +
                  method_option :ec2id, :default => false, :type => :boolean
         | 
| 8 | 
            +
                  def slave_name(name, build_id)
         | 
| 9 | 
            +
                    slave_name = client.build.slave_name(name, build_id)
         | 
| 10 | 
            +
                    slave_name = slave_name.match(/(i-[0-9a-zA-Z]+)/).captures.first if options[:ec2id]
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                    puts slave_name
         | 
| 13 | 
            +
                  end
         | 
| 14 | 
            +
                end
         | 
| 15 | 
            +
              end
         | 
| 16 | 
            +
            end
         | 
    
        data/lib/commands/job.rb
    ADDED
    
    
| @@ -0,0 +1,28 @@ | |
| 1 | 
            +
            require 'thor'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Jenkins2API
         | 
| 4 | 
            +
              module Command
         | 
| 5 | 
            +
                class Node < Jenkins2API::ThorCommand
         | 
| 6 | 
            +
                  desc :all, "List all nodes"
         | 
| 7 | 
            +
                  def all
         | 
| 8 | 
            +
                    nodes = client.node.all
         | 
| 9 | 
            +
                    nodes['computer'].each do |computer|
         | 
| 10 | 
            +
                      type = 'slave'
         | 
| 11 | 
            +
                      type = 'master' if computer['_class'] == 'hudson.model.Hudson$MasterComputer'
         | 
| 12 | 
            +
                      puts "[%5s] #{computer['displayName']}" % [type]
         | 
| 13 | 
            +
                    end
         | 
| 14 | 
            +
                  end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                  desc :slaves, "List all slave nodes"
         | 
| 17 | 
            +
                  def slaves
         | 
| 18 | 
            +
                    nodes = client.node.all
         | 
| 19 | 
            +
                    nodes['computer'].each do |computer|
         | 
| 20 | 
            +
                      next if computer['_class'] == 'hudson.model.Hudson$MasterComputer'
         | 
| 21 | 
            +
                      puts computer['displayName']
         | 
| 22 | 
            +
                    end
         | 
| 23 | 
            +
                  end
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
              end
         | 
| 26 | 
            +
            end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
             | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
    
        data/lib/jenkins2-api.rb
    CHANGED
    
    | @@ -1,2 +1,8 @@ | |
| 1 | 
            -
            require_relative ' | 
| 2 | 
            -
            require_relative ' | 
| 1 | 
            +
            require_relative 'version'
         | 
| 2 | 
            +
            require_relative 'client'
         | 
| 3 | 
            +
            require_relative 'thor_command'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            path = File.join(File.dirname(__FILE__), 'commands', '*.rb')
         | 
| 6 | 
            +
            Dir.glob(path).each do |file|
         | 
| 7 | 
            +
              require file
         | 
| 8 | 
            +
            end
         | 
    
        data/lib/thor_command.rb
    ADDED
    
    | @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            require 'thor'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Jenkins2API
         | 
| 4 | 
            +
              class ThorCommand < Thor
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                private
         | 
| 7 | 
            +
                def client
         | 
| 8 | 
            +
                  @client ||= Jenkins2API::Client.new(
         | 
| 9 | 
            +
                    :server   => options[:server],
         | 
| 10 | 
            +
                    :username => options[:username],
         | 
| 11 | 
            +
                    :password => options[:password]
         | 
| 12 | 
            +
                  )
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
              end
         | 
| 15 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: jenkins2-api
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Balazs Nadasdi
         | 
| @@ -9,22 +9,42 @@ autorequire: | |
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 11 | 
             
            date: 2017-04-06 00:00:00.000000000 Z
         | 
| 12 | 
            -
            dependencies: | 
| 12 | 
            +
            dependencies:
         | 
| 13 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            +
              name: thor
         | 
| 15 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 | 
            +
                requirements:
         | 
| 17 | 
            +
                - - "~>"
         | 
| 18 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            +
                    version: '0.19'
         | 
| 20 | 
            +
              type: :runtime
         | 
| 21 | 
            +
              prerelease: false
         | 
| 22 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 | 
            +
                requirements:
         | 
| 24 | 
            +
                - - "~>"
         | 
| 25 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            +
                    version: '0.19'
         | 
| 13 27 | 
             
            description: API client for Jenkins 2.
         | 
| 14 28 | 
             
            email: balazs.nadasdi@cheppers.com
         | 
| 15 | 
            -
            executables: | 
| 29 | 
            +
            executables:
         | 
| 30 | 
            +
            - jenkins2api
         | 
| 16 31 | 
             
            extensions: []
         | 
| 17 32 | 
             
            extra_rdoc_files: []
         | 
| 18 33 | 
             
            files:
         | 
| 19 34 | 
             
            - LICENSE
         | 
| 20 35 | 
             
            - README.md
         | 
| 36 | 
            +
            - bin/jenkins2api
         | 
| 37 | 
            +
            - lib/client.rb
         | 
| 38 | 
            +
            - lib/commands/build.rb
         | 
| 39 | 
            +
            - lib/commands/job.rb
         | 
| 40 | 
            +
            - lib/commands/node.rb
         | 
| 41 | 
            +
            - lib/endpoints/artifact.rb
         | 
| 42 | 
            +
            - lib/endpoints/build.rb
         | 
| 43 | 
            +
            - lib/endpoints/job.rb
         | 
| 44 | 
            +
            - lib/endpoints/node.rb
         | 
| 21 45 | 
             
            - lib/jenkins2-api.rb
         | 
| 22 | 
            -
            - lib/ | 
| 23 | 
            -
            - lib/ | 
| 24 | 
            -
            - lib/jenkins2-api/endpoints/build.rb
         | 
| 25 | 
            -
            - lib/jenkins2-api/endpoints/job.rb
         | 
| 26 | 
            -
            - lib/jenkins2-api/endpoints/node.rb
         | 
| 27 | 
            -
            - lib/jenkins2-api/version.rb
         | 
| 46 | 
            +
            - lib/thor_command.rb
         | 
| 47 | 
            +
            - lib/version.rb
         | 
| 28 48 | 
             
            homepage: https://github.com/Yitsushi/jenkins2-api
         | 
| 29 49 | 
             
            licenses:
         | 
| 30 50 | 
             
            - MIT
         | 
| @@ -45,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 45 65 | 
             
                  version: '0'
         | 
| 46 66 | 
             
            requirements: []
         | 
| 47 67 | 
             
            rubyforge_project: 
         | 
| 48 | 
            -
            rubygems_version: 2. | 
| 68 | 
            +
            rubygems_version: 2.5.1
         | 
| 49 69 | 
             
            signing_key: 
         | 
| 50 70 | 
             
            specification_version: 4
         | 
| 51 71 | 
             
            summary: API client for Jenkins 2.
         |