bard 0.64.1 → 0.65.0
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/lib/bard/config.rb +3 -5
 - data/lib/bard/data.rb +1 -1
 - data/lib/bard/ping.rb +5 -3
 - data/lib/bard/version.rb +1 -1
 - data/lib/bard.rb +4 -5
 - metadata +1 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 846754c2ad0d14dc0df687db107e05ecad69a9122540fba07b2362b83ff7b4a0
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 04da3c9f2faa9d2d698d6d08442360a69bbe114e0333b6730257bc9b3ff18e35
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: e742ede7bf2afc73dd8e68e60991ef1b13a819df55b0adea253b58ba70e5102a0139bdb26fcd10e2fe51574cd7a69262224484f6b6855794d930e57bd6739ab1
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 17de7f6f053b646ccdf948197846f0890c2d765e86098a8b41b23d9063bfb376e16dd42bb912b7ad7ce65fc0fcfb84514b43fcac67dd187750f49d280f5c992e
         
     | 
    
        data/lib/bard/config.rb
    CHANGED
    
    | 
         @@ -81,12 +81,10 @@ module Bard 
     | 
|
| 
       81 
81 
     | 
    
         
             
                  setting :ssh, :path, :ping, :gateway, :ssh_key, :env
         
     | 
| 
       82 
82 
     | 
    
         | 
| 
       83 
83 
     | 
    
         
             
                  def ping(*args)
         
     | 
| 
       84 
     | 
    
         
            -
                    if args.length ==  
     | 
| 
       85 
     | 
    
         
            -
                       
     | 
| 
       86 
     | 
    
         
            -
                    elsif args.length == 0
         
     | 
| 
       87 
     | 
    
         
            -
                      normalize_ping(super())
         
     | 
| 
      
 84 
     | 
    
         
            +
                    if args.length == 0
         
     | 
| 
      
 85 
     | 
    
         
            +
                      (super() || [nil]).map(&method(:normalize_ping))
         
     | 
| 
       88 
86 
     | 
    
         
             
                    else
         
     | 
| 
       89 
     | 
    
         
            -
                       
     | 
| 
      
 87 
     | 
    
         
            +
                      self.ping = args
         
     | 
| 
       90 
88 
     | 
    
         
             
                    end
         
     | 
| 
       91 
89 
     | 
    
         
             
                  end
         
     | 
| 
       92 
90 
     | 
    
         | 
    
        data/lib/bard/data.rb
    CHANGED
    
    | 
         @@ -3,7 +3,7 @@ class Bard::CLI < Thor 
     | 
|
| 
       3 
3 
     | 
    
         
             
                def call
         
     | 
| 
       4 
4 
     | 
    
         
             
                  if to == "production"
         
     | 
| 
       5 
5 
     | 
    
         
             
                    server = bard.instance_variable_get(:@config).servers[to.to_sym]
         
     | 
| 
       6 
     | 
    
         
            -
                    url = server.ping
         
     | 
| 
      
 6 
     | 
    
         
            +
                    url = server.ping.first
         
     | 
| 
       7 
7 
     | 
    
         
             
                    puts bard.yellow("WARNING: You are about to push data to production, overwriting everything that is there!")
         
     | 
| 
       8 
8 
     | 
    
         
             
                    answer = bard.ask("If you really want to do this, please type in the full HTTPS url of the production server:")
         
     | 
| 
       9 
9 
     | 
    
         
             
                    if answer != url
         
     | 
    
        data/lib/bard/ping.rb
    CHANGED
    
    | 
         @@ -8,9 +8,11 @@ module Bard 
     | 
|
| 
       8 
8 
     | 
    
         
             
                end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
                def call
         
     | 
| 
       11 
     | 
    
         
            -
                   
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 11 
     | 
    
         
            +
                  server.ping.reject do |url|
         
     | 
| 
      
 12 
     | 
    
         
            +
                    next true if url == false
         
     | 
| 
      
 13 
     | 
    
         
            +
                    response = get_response_with_redirect(url) rescue nil
         
     | 
| 
      
 14 
     | 
    
         
            +
                    response.is_a?(Net::HTTPSuccess)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  end
         
     | 
| 
       14 
16 
     | 
    
         
             
                end
         
     | 
| 
       15 
17 
     | 
    
         | 
| 
       16 
18 
     | 
    
         
             
                private
         
     | 
    
        data/lib/bard/version.rb
    CHANGED
    
    
    
        data/lib/bard.rb
    CHANGED
    
    | 
         @@ -138,7 +138,7 @@ class Bard::CLI < Thor 
     | 
|
| 
       138 
138 
     | 
    
         
             
              def open server=nil
         
     | 
| 
       139 
139 
     | 
    
         
             
                server ||= @config.servers.key?(:production) ? :production : :staging
         
     | 
| 
       140 
140 
     | 
    
         
             
                server = @config.servers[server.to_sym]
         
     | 
| 
       141 
     | 
    
         
            -
                exec "xdg-open #{server. 
     | 
| 
      
 141 
     | 
    
         
            +
                exec "xdg-open #{server.ping.first}"
         
     | 
| 
       142 
142 
     | 
    
         
             
              end
         
     | 
| 
       143 
143 
     | 
    
         | 
| 
       144 
144 
     | 
    
         
             
              desc "hurt", "reruns a command until it fails"
         
     | 
| 
         @@ -208,10 +208,9 @@ class Bard::CLI < Thor 
     | 
|
| 
       208 
208 
     | 
    
         
             
              desc "ping [SERVER=production]", "hits the server over http to verify that its up."
         
     | 
| 
       209 
209 
     | 
    
         
             
              def ping server=:production
         
     | 
| 
       210 
210 
     | 
    
         
             
                server = @config.servers[server.to_sym]
         
     | 
| 
       211 
     | 
    
         
            -
                 
     | 
| 
       212 
     | 
    
         
            -
             
     | 
| 
       213 
     | 
    
         
            -
             
     | 
| 
       214 
     | 
    
         
            -
                end
         
     | 
| 
      
 211 
     | 
    
         
            +
                down_urls = Bard::Ping.call(server)
         
     | 
| 
      
 212 
     | 
    
         
            +
                down_urls.each { |url| puts "#{url} is down!" }
         
     | 
| 
      
 213 
     | 
    
         
            +
                exit 1 if down_urls.any?
         
     | 
| 
       215 
214 
     | 
    
         
             
              end
         
     | 
| 
       216 
215 
     | 
    
         | 
| 
       217 
216 
     | 
    
         
             
              desc "master_key --from=production --to=local", "copy master key from from to to"
         
     |