travis 1.6.15.travis.565.6 → 1.6.15.travis.566.6
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 +8 -8
 - data/README.md +6 -1
 - data/lib/travis/cli/settings.rb +32 -9
 - data/lib/travis/client/settings.rb +2 -2
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            !binary "U0hBMQ==":
         
     | 
| 
       3 
3 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       4 
     | 
    
         
            -
                 
     | 
| 
      
 4 
     | 
    
         
            +
                Y2UzZDYxMjY5OTk2ZDljYTYxOTQ0YmE5NTdhZDk3NzEzOTQxZDg4MQ==
         
     | 
| 
       5 
5 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       6 
     | 
    
         
            -
                 
     | 
| 
      
 6 
     | 
    
         
            +
                ZWVmZTFjZGQzMGQ1MzM5Y2JkMWZkODEyNjY4NTE3Yjc3ZDYxOGRiMw==
         
     | 
| 
       7 
7 
     | 
    
         
             
            SHA512:
         
     | 
| 
       8 
8 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
       10 
     | 
    
         
            -
                 
     | 
| 
       11 
     | 
    
         
            -
                 
     | 
| 
      
 9 
     | 
    
         
            +
                YzE3ZTJlZjZhMjJkM2EzNTRmY2EwZDE4Y2NkMTg3MDdhODY4Y2I3ZjA5YTdm
         
     | 
| 
      
 10 
     | 
    
         
            +
                ZjNiNmVlYWRhNDA2NjA3YjYzZDE3ZjIyMDExZDIyNDk0NGY3ZTY2MzA1ZjFj
         
     | 
| 
      
 11 
     | 
    
         
            +
                YjQ2YWEzMGUyY2NmOTBkYzI5NDM3ZmVjYjY3OGFhMmY1ODBiNWI=
         
     | 
| 
       12 
12 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       13 
     | 
    
         
            -
                 
     | 
| 
       14 
     | 
    
         
            -
                 
     | 
| 
       15 
     | 
    
         
            -
                 
     | 
| 
      
 13 
     | 
    
         
            +
                ZmZjZWZlMWM4MDAzMzAyZmQ5ZWRkNmNlMGRiYWUzZTExZmU1NWM0YmI4ZjI4
         
     | 
| 
      
 14 
     | 
    
         
            +
                MmM2Y2I3ZWQyMzQzYmYyYzNhZTA0NmUyNDUwOTVkZWU0NGY2MDBmYWU5NDky
         
     | 
| 
      
 15 
     | 
    
         
            +
                YzU5OThkZDNiZDZlYWVmMDVlOWFkYzI3Y2FiOWM5NDMyMDkzMTc=
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -892,6 +892,7 @@ Certain repository settings can be read via the CLI: 
     | 
|
| 
       892 
892 
     | 
    
         
             
                [-] builds_only_with_travis_yml    Only run builds with a .travis.yml
         
     | 
| 
       893 
893 
     | 
    
         
             
                [+] build_pushes                   Build pushes
         
     | 
| 
       894 
894 
     | 
    
         
             
                [+] build_pull_requests            Build pull requests
         
     | 
| 
      
 895 
     | 
    
         
            +
                [-] maximum_number_of_builds       Maximum number of concurrent builds
         
     | 
| 
       895 
896 
     | 
    
         | 
| 
       896 
897 
     | 
    
         
             
            You can also filter the settings by passing them in as arguments:
         
     | 
| 
       897 
898 
     | 
    
         | 
| 
         @@ -900,11 +901,14 @@ You can also filter the settings by passing them in as arguments: 
     | 
|
| 
       900 
901 
     | 
    
         
             
                [+] build_pushes                   Build pushes
         
     | 
| 
       901 
902 
     | 
    
         
             
                [+] build_pull_requests            Build pull requests
         
     | 
| 
       902 
903 
     | 
    
         | 
| 
       903 
     | 
    
         
            -
            It is also possible to change these settings via `--enable` and `-- 
     | 
| 
      
 904 
     | 
    
         
            +
            It is also possible to change these settings via `--enable`, `--disable` and `--set`:
         
     | 
| 
       904 
905 
     | 
    
         | 
| 
       905 
906 
     | 
    
         
             
                $ travis settings build_pushes --disable
         
     | 
| 
       906 
907 
     | 
    
         
             
                Settings for travis-ci/travis.rb:
         
     | 
| 
       907 
908 
     | 
    
         
             
                [-] build_pushes                   Build pushes
         
     | 
| 
      
 909 
     | 
    
         
            +
                $ travis setting maximum_number_of_builds --set 1
         
     | 
| 
      
 910 
     | 
    
         
            +
                Settings for travis-ci/travis.rb:
         
     | 
| 
      
 911 
     | 
    
         
            +
                  1 maximum_number_of_builds       Maximum number of concurrent builds
         
     | 
| 
       908 
912 
     | 
    
         | 
| 
       909 
913 
     | 
    
         
             
            Or, alternatively, you can use `-c` to configure the settings interactively:
         
     | 
| 
       910 
914 
     | 
    
         | 
| 
         @@ -913,6 +917,7 @@ Or, alternatively, you can use `-c` to configure the settings interactively: 
     | 
|
| 
       913 
917 
     | 
    
         
             
                Only run builds with a .travis.yml? |yes| no
         
     | 
| 
       914 
918 
     | 
    
         
             
                Build pushes? |no| yes
         
     | 
| 
       915 
919 
     | 
    
         
             
                Build pull requests? |yes|
         
     | 
| 
      
 920 
     | 
    
         
            +
                Maximum number of concurrent builds: |1| 5
         
     | 
| 
       916 
921 
     | 
    
         | 
| 
       917 
922 
     | 
    
         
             
            #### `setup`
         
     | 
| 
       918 
923 
     | 
    
         | 
    
        data/lib/travis/cli/settings.rb
    CHANGED
    
    | 
         @@ -7,14 +7,16 @@ module Travis 
     | 
|
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                  description "access repository settings"
         
     | 
| 
       9 
9 
     | 
    
         
             
                  on('--keys', 'always use setting key instead of description')
         
     | 
| 
       10 
     | 
    
         
            -
                  on('-t', '--enable',  'enable  
     | 
| 
       11 
     | 
    
         
            -
                  on('-f', '--disable', 'disable  
     | 
| 
      
 10 
     | 
    
         
            +
                  on('-t', '--enable',  'enable boolean setting(s)')  { |c  | c.setting = true  }
         
     | 
| 
      
 11 
     | 
    
         
            +
                  on('-f', '--disable', 'disable boolean setting(s)') { |c  | c.setting = false }
         
     | 
| 
      
 12 
     | 
    
         
            +
                  on('-s', '--set VALUE', 'set to given value')       { |c,v| c.setting = v     }
         
     | 
| 
       12 
13 
     | 
    
         
             
                  on('-c', '--configure', 'change settings interactively')
         
     | 
| 
       13 
14 
     | 
    
         | 
| 
       14 
15 
     | 
    
         
             
                  DESCRIPTIONS = {
         
     | 
| 
       15 
16 
     | 
    
         
             
                    :builds_only_with_travis_yml => "Only run builds with a .travis.yml",
         
     | 
| 
       16 
17 
     | 
    
         
             
                    :build_pushes                => "Build pushes",
         
     | 
| 
       17 
     | 
    
         
            -
                    :build_pull_requests         => "Build pull requests"
         
     | 
| 
      
 18 
     | 
    
         
            +
                    :build_pull_requests         => "Build pull requests",
         
     | 
| 
      
 19 
     | 
    
         
            +
                    :maximum_number_of_builds    => "Maximum number of concurrent builds"
         
     | 
| 
       18 
20 
     | 
    
         
             
                  }
         
     | 
| 
       19 
21 
     | 
    
         | 
| 
       20 
22 
     | 
    
         
             
                  def run(*keys)
         
     | 
| 
         @@ -24,19 +26,40 @@ module Travis 
     | 
|
| 
       24 
26 
     | 
    
         
             
                    repository.settings.to_h.each do |key, value|
         
     | 
| 
       25 
27 
     | 
    
         
             
                      next unless keys.empty? or keys.include? key
         
     | 
| 
       26 
28 
     | 
    
         
             
                      if configure?
         
     | 
| 
       27 
     | 
    
         
            -
                         
     | 
| 
       28 
     | 
    
         
            -
                           
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
      
 29 
     | 
    
         
            +
                        if boolean? key
         
     | 
| 
      
 30 
     | 
    
         
            +
                          repository.settings[key] = agree("#{describe(key, "enable #{key}")}? ") do |q|
         
     | 
| 
      
 31 
     | 
    
         
            +
                            default   = setting.nil? ? value : setting
         
     | 
| 
      
 32 
     | 
    
         
            +
                            q.default = default ? "yes" : "no"
         
     | 
| 
      
 33 
     | 
    
         
            +
                          end
         
     | 
| 
      
 34 
     | 
    
         
            +
                        else
         
     | 
| 
      
 35 
     | 
    
         
            +
                          repository.settings[key] = ask("#{describe(key,  "Value for #{key}")}: ", Integer) do |q|
         
     | 
| 
      
 36 
     | 
    
         
            +
                            default   = setting.to_i if setting and setting.respond_to? :to_i
         
     | 
| 
      
 37 
     | 
    
         
            +
                            default ||= value
         
     | 
| 
      
 38 
     | 
    
         
            +
                            default ||= 0
         
     | 
| 
      
 39 
     | 
    
         
            +
                            q.default = default
         
     | 
| 
      
 40 
     | 
    
         
            +
                          end
         
     | 
| 
       30 
41 
     | 
    
         
             
                        end
         
     | 
| 
       31 
42 
     | 
    
         
             
                      else
         
     | 
| 
       32 
     | 
    
         
            -
                        value 
     | 
| 
       33 
     | 
    
         
            -
                        descr 
     | 
| 
       34 
     | 
    
         
            -
                        say  
     | 
| 
      
 43 
     | 
    
         
            +
                        value  = repository.settings[key] = setting unless setting.nil?
         
     | 
| 
      
 44 
     | 
    
         
            +
                        descr  = color(describe(key, color(key, :info)) { |s| key.ljust(30) + " " + color(s, [:reset, :bold]) }, :info)
         
     | 
| 
      
 45 
     | 
    
         
            +
                        say format_value(value) << " " << descr
         
     | 
| 
       35 
46 
     | 
    
         
             
                      end
         
     | 
| 
       36 
47 
     | 
    
         
             
                    end
         
     | 
| 
       37 
48 
     | 
    
         
             
                    repository.settings.save if configure? or !setting.nil?
         
     | 
| 
       38 
49 
     | 
    
         
             
                  end
         
     | 
| 
       39 
50 
     | 
    
         | 
| 
      
 51 
     | 
    
         
            +
                  def boolean?(key)
         
     | 
| 
      
 52 
     | 
    
         
            +
                    key.to_sym != :maximum_number_of_builds
         
     | 
| 
      
 53 
     | 
    
         
            +
                  end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                  def format_value(value)
         
     | 
| 
      
 56 
     | 
    
         
            +
                    case value
         
     | 
| 
      
 57 
     | 
    
         
            +
                    when false, nil then color("[-]", [ :bold, :red   ])
         
     | 
| 
      
 58 
     | 
    
         
            +
                    when true       then color("[+]", [ :bold, :green ])
         
     | 
| 
      
 59 
     | 
    
         
            +
                    else color(value.to_s.rjust(3),    [ :bold, :blue  ])
         
     | 
| 
      
 60 
     | 
    
         
            +
                    end
         
     | 
| 
      
 61 
     | 
    
         
            +
                  end
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
       40 
63 
     | 
    
         
             
                  def all_settings?
         
     | 
| 
       41 
64 
     | 
    
         
             
                    agree("Really #{setting ? "enable" : "disable"} all settings? ") do |q|
         
     | 
| 
       42 
65 
     | 
    
         
             
                      q.default = "no"
         
     | 
| 
         @@ -5,8 +5,8 @@ module Travis 
     | 
|
| 
       5 
5 
     | 
    
         
             
              module Client
         
     | 
| 
       6 
6 
     | 
    
         
             
                class Settings < WeakEntity
         
     | 
| 
       7 
7 
     | 
    
         
             
                  attr_accessor :repository
         
     | 
| 
       8 
     | 
    
         
            -
                  # @!parse attr_reader :builds_only_with_travis_yml, :build_pushes, :build_pull_requests
         
     | 
| 
       9 
     | 
    
         
            -
                  attributes :builds_only_with_travis_yml, :build_pushes, :build_pull_requests
         
     | 
| 
      
 8 
     | 
    
         
            +
                  # @!parse attr_reader :builds_only_with_travis_yml, :build_pushes, :build_pull_requests, :maximum_number_of_builds
         
     | 
| 
      
 9 
     | 
    
         
            +
                  attributes :builds_only_with_travis_yml, :build_pushes, :build_pull_requests, :maximum_number_of_builds
         
     | 
| 
       10 
10 
     | 
    
         
             
                  one :settings
         
     | 
| 
       11 
11 
     | 
    
         
             
                  many :settings
         
     | 
| 
       12 
12 
     | 
    
         |