releaseable 0.0.2
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.
- data/.gitignore +35 -0
 - data/VERSION +1 -0
 - data/lib/releaseable/extensions.rb +71 -0
 - data/lib/releaseable/github.rb +176 -0
 - data/lib/releaseable/sound.rb +50 -0
 - data/lib/releaseable/version.rb +8 -0
 - data/lib/releaseable.rb +6 -0
 - metadata +136 -0
 
    
        data/.gitignore
    ADDED
    
    | 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ## MAC OS
         
     | 
| 
      
 2 
     | 
    
         
            +
            .DS_Store
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            ## TEXTMATE
         
     | 
| 
      
 5 
     | 
    
         
            +
            *.tmproj
         
     | 
| 
      
 6 
     | 
    
         
            +
            tmtags
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            ## EMACS
         
     | 
| 
      
 9 
     | 
    
         
            +
            *~
         
     | 
| 
      
 10 
     | 
    
         
            +
            \#*
         
     | 
| 
      
 11 
     | 
    
         
            +
            .\#*
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            ## VIM
         
     | 
| 
      
 14 
     | 
    
         
            +
            *.swp
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            ## Idea
         
     | 
| 
      
 17 
     | 
    
         
            +
            .idea
         
     | 
| 
      
 18 
     | 
    
         
            +
            .bundle
         
     | 
| 
      
 19 
     | 
    
         
            +
            .rakeTasks
         
     | 
| 
      
 20 
     | 
    
         
            +
            *.iml
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            ## PROJECT::GENERAL
         
     | 
| 
      
 23 
     | 
    
         
            +
            coverage
         
     | 
| 
      
 24 
     | 
    
         
            +
            config
         
     | 
| 
      
 25 
     | 
    
         
            +
            data
         
     | 
| 
      
 26 
     | 
    
         
            +
            rdoc
         
     | 
| 
      
 27 
     | 
    
         
            +
            pkg
         
     | 
| 
      
 28 
     | 
    
         
            +
            log
         
     | 
| 
      
 29 
     | 
    
         
            +
            tmp
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            ## PROJECT::SPECIFIC
         
     | 
| 
      
 32 
     | 
    
         
            +
            *.db
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            # Yard cache files - used for the autogenerated documentation
         
     | 
| 
      
 35 
     | 
    
         
            +
            .yardoc
         
     | 
    
        data/VERSION
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            0.0.2
         
     | 
| 
         @@ -0,0 +1,71 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'logger'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'logglier'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'java'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            # Avoid OpenSSL failures
         
     | 
| 
      
 6 
     | 
    
         
            +
            OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            # Logger extensions
         
     | 
| 
      
 9 
     | 
    
         
            +
            class Logger
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              attr_accessor :config
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              def self.sound_alarm beeps = 3
         
     | 
| 
      
 14 
     | 
    
         
            +
                beeps.times do
         
     | 
| 
      
 15 
     | 
    
         
            +
                  java.awt.Toolkit.getDefaultToolkit.beep
         
     | 
| 
      
 16 
     | 
    
         
            +
                  sleep 0.5
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              def sound_alarm beeps = @config[:beeps]
         
     | 
| 
      
 21 
     | 
    
         
            +
                self.class.sound_alarm beeps
         
     | 
| 
      
 22 
     | 
    
         
            +
              end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
              alias old_fatal fatal
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              def fatal *args
         
     | 
| 
      
 27 
     | 
    
         
            +
                if @config && @config[:fatal]
         
     | 
| 
      
 28 
     | 
    
         
            +
                  entry = args.first
         
     | 
| 
      
 29 
     | 
    
         
            +
                  case entry
         
     | 
| 
      
 30 
     | 
    
         
            +
                    when Exception
         
     | 
| 
      
 31 
     | 
    
         
            +
                      @config[:fatal].fatal "#{entry.class}: '#{entry.message}' at #{caller.join(', ')}"
         
     | 
| 
      
 32 
     | 
    
         
            +
                    else
         
     | 
| 
      
 33 
     | 
    
         
            +
                      @config[:fatal].info *args
         
     | 
| 
      
 34 
     | 
    
         
            +
                  end
         
     | 
| 
      
 35 
     | 
    
         
            +
                end
         
     | 
| 
      
 36 
     | 
    
         
            +
                old_fatal *args
         
     | 
| 
      
 37 
     | 
    
         
            +
              end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
              def configure config, &formatter
         
     | 
| 
      
 40 
     | 
    
         
            +
                @config = config
         
     | 
| 
      
 41 
     | 
    
         
            +
                @config[:beeps] ||= 0
         
     | 
| 
      
 42 
     | 
    
         
            +
                @config[:time_format] ||= @config[:time] || '%M:%S.%N'
         
     | 
| 
      
 43 
     | 
    
         
            +
                @config[:input] ||= 'b9a22025-b148-4dfe-8355-ce5dba40b6a2' #non-default
         
     | 
| 
      
 44 
     | 
    
         
            +
                @config[:domain] ||= 'logs.loggly.com'
         
     | 
| 
      
 45 
     | 
    
         
            +
                unless @config[:ignore]
         
     | 
| 
      
 46 
     | 
    
         
            +
                  @config[:fatal] ||= Logglier.new "https://#{@config[:domain]}/inputs/#{@config[:input]}"
         
     | 
| 
      
 47 
     | 
    
         
            +
                end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                self.level = @config[:level] || Logger::INFO
         
     | 
| 
      
 50 
     | 
    
         
            +
                self.formatter = formatter || proc do |level, time, prog, msg|
         
     | 
| 
      
 51 
     | 
    
         
            +
                  "#{time.strftime(@config[:time_format])} #{msg}\n"
         
     | 
| 
      
 52 
     | 
    
         
            +
                end
         
     | 
| 
      
 53 
     | 
    
         
            +
              end
         
     | 
| 
      
 54 
     | 
    
         
            +
            end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            # Object#raise extensions
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            alias old_raise raise
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
            # Sound alarm before raising error
         
     | 
| 
      
 61 
     | 
    
         
            +
            def raise error
         
     | 
| 
      
 62 
     | 
    
         
            +
              ex = error.kind_of?(String) ? RuntimeError.new(error) : error.exception
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
              if defined?(log) && log.config
         
     | 
| 
      
 65 
     | 
    
         
            +
                log.sound_alarm
         
     | 
| 
      
 66 
     | 
    
         
            +
                log.fatal ex
         
     | 
| 
      
 67 
     | 
    
         
            +
              else
         
     | 
| 
      
 68 
     | 
    
         
            +
                Logger.sound_alarm
         
     | 
| 
      
 69 
     | 
    
         
            +
              end
         
     | 
| 
      
 70 
     | 
    
         
            +
              #old_raise ex #, ex.message, caller #ex.backtrace
         
     | 
| 
      
 71 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,176 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #require 'httpclient'
         
     | 
| 
      
 2 
     | 
    
         
            +
            #require 'net/http'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'xmlsimple'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'faraday'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'faraday_middleware'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require 'json'
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            module Releaseable
         
     | 
| 
      
 9 
     | 
    
         
            +
              module GitHub
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                #OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                def self.connection
         
     | 
| 
      
 14 
     | 
    
         
            +
                  Faraday.new(:ssl => {:verify => false}) do |connection|
         
     | 
| 
      
 15 
     | 
    
         
            +
                    connection.use Faraday::Request::UrlEncoded
         
     | 
| 
      
 16 
     | 
    
         
            +
                    connection.use Faraday::Response::Logger
         
     | 
| 
      
 17 
     | 
    
         
            +
                    connection.adapter(Faraday.default_adapter)
         
     | 
| 
      
 18 
     | 
    
         
            +
                  end
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                #def self.get address #, data
         
     | 
| 
      
 22 
     | 
    
         
            +
                #  connection.get address
         
     | 
| 
      
 23 
     | 
    
         
            +
                #end
         
     | 
| 
      
 24 
     | 
    
         
            +
                #
         
     | 
| 
      
 25 
     | 
    
         
            +
                #def self.post address, data
         
     | 
| 
      
 26 
     | 
    
         
            +
                #  connection.post address, data
         
     | 
| 
      
 27 
     | 
    
         
            +
                #end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                def self.post address, data
         
     | 
| 
      
 30 
     | 
    
         
            +
                  require 'net/http'
         
     | 
| 
      
 31 
     | 
    
         
            +
                  p uri = URI(address) #'https://secure.example.com/some_path?query=string')
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  #Net::HTTP.start(uri.host, uri.port,
         
     | 
| 
      
 34 
     | 
    
         
            +
                  #                :use_ssl => uri.scheme == 'https',
         
     | 
| 
      
 35 
     | 
    
         
            +
                  #                :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
         
     | 
| 
      
 36 
     | 
    
         
            +
                  #  #request = Net::HTTP::Get.new uri.request_uri
         
     | 
| 
      
 37 
     | 
    
         
            +
                  #  request = Net::HTTP::Post.new uri.path
         
     | 
| 
      
 38 
     | 
    
         
            +
                  #  request.set_form_data(data)
         
     | 
| 
      
 39 
     | 
    
         
            +
                  #
         
     | 
| 
      
 40 
     | 
    
         
            +
                  #  p response = http.request(request) # Net::HTTPResponse object
         
     | 
| 
      
 41 
     | 
    
         
            +
                  #end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                  server = Net::HTTP.new(uri.host, uri.port)
         
     | 
| 
      
 44 
     | 
    
         
            +
                  server.use_ssl = (uri.scheme == 'https')
         
     | 
| 
      
 45 
     | 
    
         
            +
                  server.verify_mode = OpenSSL::SSL::VERIFY_NONE if server.use_ssl?
         
     | 
| 
      
 46 
     | 
    
         
            +
                  server.start do |http|
         
     | 
| 
      
 47 
     | 
    
         
            +
                    req = Net::HTTP::Post.new(uri.path)
         
     | 
| 
      
 48 
     | 
    
         
            +
                    case data
         
     | 
| 
      
 49 
     | 
    
         
            +
                      when Hash
         
     | 
| 
      
 50 
     | 
    
         
            +
                        req.form_data = data
         
     | 
| 
      
 51 
     | 
    
         
            +
                      when Array
         
     | 
| 
      
 52 
     | 
    
         
            +
                        req.body = data
         
     | 
| 
      
 53 
     | 
    
         
            +
                        req.content_type = 'multipart/form-data'
         
     | 
| 
      
 54 
     | 
    
         
            +
                    end
         
     | 
| 
      
 55 
     | 
    
         
            +
                    http.request(req)
         
     | 
| 
      
 56 
     | 
    
         
            +
                  end
         
     | 
| 
      
 57 
     | 
    
         
            +
                  #rescue => err
         
     | 
| 
      
 58 
     | 
    
         
            +
                  #  p err
         
     | 
| 
      
 59 
     | 
    
         
            +
                end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                def self.upload info = {}
         
     | 
| 
      
 62 
     | 
    
         
            +
                  info[:login] ||= `git config github.user`.chomp
         
     | 
| 
      
 63 
     | 
    
         
            +
                  info[:token] ||= `git config github.token`.chomp
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
                  raise "login or token is empty" if info[:login].empty? or info[:token].empty?
         
     | 
| 
      
 66 
     | 
    
         
            +
                  raise "required repository name" unless info[:repos]
         
     | 
| 
      
 67 
     | 
    
         
            +
                  raise "required file to upload" unless info[:file]
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
                  info[:repos] = info[:login] + '/' + info[:repos] unless info[:repos].include? '/'
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                  if info[:file]
         
     | 
| 
      
 72 
     | 
    
         
            +
                    file = info[:file]
         
     | 
| 
      
 73 
     | 
    
         
            +
                    raise "bad file #{info[:file]}" unless File.exist?(file) && File.readable?(file)
         
     | 
| 
      
 74 
     | 
    
         
            +
                    info[:name] ||= File.basename(file) + rand(1000).to_s
         
     | 
| 
      
 75 
     | 
    
         
            +
                  end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                  raise "required name for filename with data parameter" unless info[:name]
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
                  info[:content_type] ||= 'application/octet-stream'
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
                  response = post "https://github.com/#{info[:repos]}/downloads",
         
     | 
| 
      
 82 
     | 
    
         
            +
                                  'file_size' => File.stat(info[:file]).size,
         
     | 
| 
      
 83 
     | 
    
         
            +
                                  'content_type' => info[:content_type],
         
     | 
| 
      
 84 
     | 
    
         
            +
                                  'file_name' => info[:name],
         
     | 
| 
      
 85 
     | 
    
         
            +
                                  'description' => info[:description] || '',
         
     | 
| 
      
 86 
     | 
    
         
            +
                                  'login' => info[:login],
         
     | 
| 
      
 87 
     | 
    
         
            +
                                  'token' => info[:token]
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
                  raise "Failed to post file info" unless response.code.to_i == 200 #status == 200
         
     | 
| 
      
 90 
     | 
    
         
            +
             
     | 
| 
      
 91 
     | 
    
         
            +
                  puts upload = JSON.parse(response.body)
         
     | 
| 
      
 92 
     | 
    
         
            +
                  upload.each { |k, v| print "#{k}:"; p v }
         
     | 
| 
      
 93 
     | 
    
         
            +
                  p upload['expirationdate']
         
     | 
| 
      
 94 
     | 
    
         
            +
                  p Time.utc *upload['expirationdate'].split(/[-T:]/)
         
     | 
| 
      
 95 
     | 
    
         
            +
                  sec = Time.utc(*upload['expirationdate'].split(/[-T:]/)).to_i
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
                  f = File.open(info[:file], 'rb')
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
                  ##stat = HTTPClient.post("http://github.s3.amazonaws.com/", [
         
     | 
| 
      
 100 
     | 
    
         
            +
                  response = post "http://github.s3.amazonaws.com/",
         
     | 
| 
      
 101 
     | 
    
         
            +
                                  'key' => upload['path'], #.gsub(/\//, '%2F'),
         
     | 
| 
      
 102 
     | 
    
         
            +
                                  'acl' => upload['acl'], #"public-read", #
         
     | 
| 
      
 103 
     | 
    
         
            +
                                  'success_action_status' => 201,
         
     | 
| 
      
 104 
     | 
    
         
            +
                                  'Filename' => info[:name],
         
     | 
| 
      
 105 
     | 
    
         
            +
                                  'AWSAccessKeyId' => upload['accesskeyid'],
         
     | 
| 
      
 106 
     | 
    
         
            +
                                  'Policy' => upload['policy'],
         
     | 
| 
      
 107 
     | 
    
         
            +
                                  #'policy' => upload['policy'],
         
     | 
| 
      
 108 
     | 
    
         
            +
                                  #'signature' => upload['signature'],
         
     | 
| 
      
 109 
     | 
    
         
            +
                                  'Signature' => upload['signature'],
         
     | 
| 
      
 110 
     | 
    
         
            +
                                  'Expires' => 1483421360, #sec, #upload['expirationdate'],
         
     | 
| 
      
 111 
     | 
    
         
            +
                                  'Content-Type' => upload['mime_type'] || 'application/octet-stream',
         
     | 
| 
      
 112 
     | 
    
         
            +
                                  'file' => f
         
     | 
| 
      
 113 
     | 
    
         
            +
                  #response = post "http://github.s3.amazonaws.com/",
         
     | 
| 
      
 114 
     | 
    
         
            +
                  #                'Filename' => info[:name],
         
     | 
| 
      
 115 
     | 
    
         
            +
                  #                'policy' => upload['policy'],
         
     | 
| 
      
 116 
     | 
    
         
            +
                  #                'success_action_status' => 201,
         
     | 
| 
      
 117 
     | 
    
         
            +
                  #                'key' => upload['path'].gsub(/\//, '%2F'),
         
     | 
| 
      
 118 
     | 
    
         
            +
                  #                'AWSAccessKeyId' => upload['accesskeyid'],
         
     | 
| 
      
 119 
     | 
    
         
            +
                  #                'Content-Type' => upload['mime_type'] || 'application/octet-stream',
         
     | 
| 
      
 120 
     | 
    
         
            +
                  #                'signature' => upload['signature'],
         
     | 
| 
      
 121 
     | 
    
         
            +
                  #                'acl' => upload['acl'],   #"public-read", #
         
     | 
| 
      
 122 
     | 
    
         
            +
                  #                'file' => f
         
     | 
| 
      
 123 
     | 
    
         
            +
             
     | 
| 
      
 124 
     | 
    
         
            +
                  #stat = HTTPClient.post("http://github.s3.amazonaws.com/", [
         
     | 
| 
      
 125 
     | 
    
         
            +
                  #    ['Filename', info[:name]],
         
     | 
| 
      
 126 
     | 
    
         
            +
                  #    ['policy', upload_info['policy']],
         
     | 
| 
      
 127 
     | 
    
         
            +
                  #    ['success_action_status', 201],
         
     | 
| 
      
 128 
     | 
    
         
            +
                  #    ['key', upload_info['path']],
         
     | 
| 
      
 129 
     | 
    
         
            +
                  #    ['AWSAccessKeyId', upload_info['accesskeyid']],
         
     | 
| 
      
 130 
     | 
    
         
            +
                  #    ['Content-Type', upload_info['content_type'] || 'application/octet-stream'],
         
     | 
| 
      
 131 
     | 
    
         
            +
                  #    ['signature', upload_info['signature']],
         
     | 
| 
      
 132 
     | 
    
         
            +
                  #    ['acl', upload_info['acl']],
         
     | 
| 
      
 133 
     | 
    
         
            +
                  #    ['file', f]
         
     | 
| 
      
 134 
     | 
    
         
            +
                  #])
         
     | 
| 
      
 135 
     | 
    
         
            +
             
     | 
| 
      
 136 
     | 
    
         
            +
                  #url = 'https://github.s3.amazonaws.com/'
         
     | 
| 
      
 137 
     | 
    
         
            +
                  #form = {
         
     | 
| 
      
 138 
     | 
    
         
            +
                  #    'key': 'downloads/octocat/Hello-World/new_file.jpg',
         
     | 
| 
      
 139 
     | 
    
         
            +
                  #    'acl': 'public-read',
         
     | 
| 
      
 140 
     | 
    
         
            +
                  #    'file': '@new_file.jpg'
         
     | 
| 
      
 141 
     | 
    
         
            +
                  #}
         
     | 
| 
      
 142 
     | 
    
         
            +
                  #
         
     | 
| 
      
 143 
     | 
    
         
            +
                  #r = requests.post(url, data=form)
         
     | 
| 
      
 144 
     | 
    
         
            +
             
     | 
| 
      
 145 
     | 
    
         
            +
                  # curl \
         
     | 
| 
      
 146 
     | 
    
         
            +
                  #   -F "key=downloads/octocat/Hello-World/new_file.jpg" \
         
     | 
| 
      
 147 
     | 
    
         
            +
                  #   -F "acl=public-read" \
         
     | 
| 
      
 148 
     | 
    
         
            +
                  #   -F "success_action_status=201" \
         
     | 
| 
      
 149 
     | 
    
         
            +
                  #   -F "Filename=new_file.jpg" \
         
     | 
| 
      
 150 
     | 
    
         
            +
                  #   -F "AWSAccessKeyId=1ABCDEF..." \
         
     | 
| 
      
 151 
     | 
    
         
            +
                  #   -F "Policy=ewogIC..." \
         
     | 
| 
      
 152 
     | 
    
         
            +
                  #   -F "Signature=mwnF..." \
         
     | 
| 
      
 153 
     | 
    
         
            +
                  #   -F "Content-Type=image/jpeg" \
         
     | 
| 
      
 154 
     | 
    
         
            +
                  #   -F "file=@new_file.jpg" \
         
     | 
| 
      
 155 
     | 
    
         
            +
                  #https://github.s3.amazonaws.com/
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
             
     | 
| 
      
 158 
     | 
    
         
            +
                  f.close
         
     | 
| 
      
 159 
     | 
    
         
            +
             
     | 
| 
      
 160 
     | 
    
         
            +
                  analyze_aws_response response
         
     | 
| 
      
 161 
     | 
    
         
            +
                end
         
     | 
| 
      
 162 
     | 
    
         
            +
             
     | 
| 
      
 163 
     | 
    
         
            +
                private
         
     | 
| 
      
 164 
     | 
    
         
            +
             
     | 
| 
      
 165 
     | 
    
         
            +
                def self.analyze_aws_response response
         
     | 
| 
      
 166 
     | 
    
         
            +
                  p message = XmlSimple.xml_in(response.body)
         
     | 
| 
      
 167 
     | 
    
         
            +
                  if response.code.to_i == 201
         
     | 
| 
      
 168 
     | 
    
         
            +
                    message['PostResponse']['Location']
         
     | 
| 
      
 169 
     | 
    
         
            +
                  else
         
     | 
| 
      
 170 
     | 
    
         
            +
                    #error = message['Error']
         
     | 
| 
      
 171 
     | 
    
         
            +
                    raise "Failed to upload" +
         
     | 
| 
      
 172 
     | 
    
         
            +
                              (" due to #{message['Code']} (#{message['Message']})" rescue '')
         
     | 
| 
      
 173 
     | 
    
         
            +
                  end
         
     | 
| 
      
 174 
     | 
    
         
            +
                end
         
     | 
| 
      
 175 
     | 
    
         
            +
              end
         
     | 
| 
      
 176 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,50 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "java"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # Sound snippets from everywhere (JRuby-only!):
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            def sound_alarm beeps = 3
         
     | 
| 
      
 6 
     | 
    
         
            +
              beeps.times do
         
     | 
| 
      
 7 
     | 
    
         
            +
                java.awt.Toolkit.getDefaultToolkit.beep
         
     | 
| 
      
 8 
     | 
    
         
            +
                sleep 0.5
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
            end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            ; 3.times {java.awt.Toolkit.getDefaultToolkit.beep; p "oo"; sleep 1}
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            # Sound snippets from everywhere (JRuby-only!):
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            java_import javax.sound.sampled.AudioSystem
         
     | 
| 
      
 17 
     | 
    
         
            +
            java_import javax.sound.sampled.Clip
         
     | 
| 
      
 18 
     | 
    
         
            +
            java_import javax.sound.sampled.DataLine
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            class Sound
         
     | 
| 
      
 21 
     | 
    
         
            +
              attr_accessor :clip
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              def self.load_sound(file_name)
         
     | 
| 
      
 24 
     | 
    
         
            +
                sound = new
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                url = java.net.URL.new("file://" + ASSETS_DIR + file_name) # nasty little hack due to borked get_resource (means applet won't be easy..)
         
     | 
| 
      
 27 
     | 
    
         
            +
                ais = AudioSystem.get_audio_input_stream(url)
         
     | 
| 
      
 28 
     | 
    
         
            +
                info = DataLine::Info.new(Clip.java_class, ais.format)
         
     | 
| 
      
 29 
     | 
    
         
            +
                clip = AudioSystem.get_line(info)
         
     | 
| 
      
 30 
     | 
    
         
            +
                clip.open(ais)
         
     | 
| 
      
 31 
     | 
    
         
            +
                clip.extend JRuby::Synchronized
         
     | 
| 
      
 32 
     | 
    
         
            +
                sound.clip = clip
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                sound
         
     | 
| 
      
 35 
     | 
    
         
            +
              end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
              def play
         
     | 
| 
      
 38 
     | 
    
         
            +
                if clip
         
     | 
| 
      
 39 
     | 
    
         
            +
                  Thread.new do
         
     | 
| 
      
 40 
     | 
    
         
            +
                    clip.stop
         
     | 
| 
      
 41 
     | 
    
         
            +
                    clip.frame_position = 0
         
     | 
| 
      
 42 
     | 
    
         
            +
                    clip.start
         
     | 
| 
      
 43 
     | 
    
         
            +
                  end
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
              %w{altar bosskill click1 click2 hit hurt hurt2 kill death splash key pickup roll shoot treasure crumble slide cut thud ladder potion}.each do |name|
         
     | 
| 
      
 48 
     | 
    
         
            +
                const_set name.upcase, load_sound("/snd/#{name}.wav")
         
     | 
| 
      
 49 
     | 
    
         
            +
              end
         
     | 
| 
      
 50 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/releaseable.rb
    ADDED
    
    
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,136 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification 
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: releaseable
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version 
         
     | 
| 
      
 4 
     | 
    
         
            +
              prerelease: 
         
     | 
| 
      
 5 
     | 
    
         
            +
              version: 0.0.2
         
     | 
| 
      
 6 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 7 
     | 
    
         
            +
            authors: 
         
     | 
| 
      
 8 
     | 
    
         
            +
              - arvicco
         
     | 
| 
      
 9 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 10 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 11 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2012-01-28 00:00:00 Z
         
     | 
| 
      
 14 
     | 
    
         
            +
            dependencies: 
         
     | 
| 
      
 15 
     | 
    
         
            +
              - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 16 
     | 
    
         
            +
                name: bundler
         
     | 
| 
      
 17 
     | 
    
         
            +
                prerelease: false
         
     | 
| 
      
 18 
     | 
    
         
            +
                requirement: &id001 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 19 
     | 
    
         
            +
                  none: false
         
     | 
| 
      
 20 
     | 
    
         
            +
                  requirements: 
         
     | 
| 
      
 21 
     | 
    
         
            +
                    - - ">="
         
     | 
| 
      
 22 
     | 
    
         
            +
                      - !ruby/object:Gem::Version 
         
     | 
| 
      
 23 
     | 
    
         
            +
                        version: 1.0.0
         
     | 
| 
      
 24 
     | 
    
         
            +
                type: :runtime
         
     | 
| 
      
 25 
     | 
    
         
            +
                version_requirements: *id001
         
     | 
| 
      
 26 
     | 
    
         
            +
              - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 27 
     | 
    
         
            +
                name: jruby-openssl
         
     | 
| 
      
 28 
     | 
    
         
            +
                prerelease: false
         
     | 
| 
      
 29 
     | 
    
         
            +
                requirement: &id002 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 30 
     | 
    
         
            +
                  none: false
         
     | 
| 
      
 31 
     | 
    
         
            +
                  requirements: 
         
     | 
| 
      
 32 
     | 
    
         
            +
                    - - ">="
         
     | 
| 
      
 33 
     | 
    
         
            +
                      - !ruby/object:Gem::Version 
         
     | 
| 
      
 34 
     | 
    
         
            +
                        version: 0.7.5
         
     | 
| 
      
 35 
     | 
    
         
            +
                type: :runtime
         
     | 
| 
      
 36 
     | 
    
         
            +
                version_requirements: *id002
         
     | 
| 
      
 37 
     | 
    
         
            +
              - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 38 
     | 
    
         
            +
                name: logglier
         
     | 
| 
      
 39 
     | 
    
         
            +
                prerelease: false
         
     | 
| 
      
 40 
     | 
    
         
            +
                requirement: &id003 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 41 
     | 
    
         
            +
                  none: false
         
     | 
| 
      
 42 
     | 
    
         
            +
                  requirements: 
         
     | 
| 
      
 43 
     | 
    
         
            +
                    - - ">="
         
     | 
| 
      
 44 
     | 
    
         
            +
                      - !ruby/object:Gem::Version 
         
     | 
| 
      
 45 
     | 
    
         
            +
                        version: 0.2.7
         
     | 
| 
      
 46 
     | 
    
         
            +
                type: :runtime
         
     | 
| 
      
 47 
     | 
    
         
            +
                version_requirements: *id003
         
     | 
| 
      
 48 
     | 
    
         
            +
              - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 49 
     | 
    
         
            +
                name: xml-simple
         
     | 
| 
      
 50 
     | 
    
         
            +
                prerelease: false
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirement: &id004 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 52 
     | 
    
         
            +
                  none: false
         
     | 
| 
      
 53 
     | 
    
         
            +
                  requirements: 
         
     | 
| 
      
 54 
     | 
    
         
            +
                    - - ">="
         
     | 
| 
      
 55 
     | 
    
         
            +
                      - !ruby/object:Gem::Version 
         
     | 
| 
      
 56 
     | 
    
         
            +
                        version: 1.1.1
         
     | 
| 
      
 57 
     | 
    
         
            +
                type: :runtime
         
     | 
| 
      
 58 
     | 
    
         
            +
                version_requirements: *id004
         
     | 
| 
      
 59 
     | 
    
         
            +
              - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 60 
     | 
    
         
            +
                name: rspec
         
     | 
| 
      
 61 
     | 
    
         
            +
                prerelease: false
         
     | 
| 
      
 62 
     | 
    
         
            +
                requirement: &id005 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 63 
     | 
    
         
            +
                  none: false
         
     | 
| 
      
 64 
     | 
    
         
            +
                  requirements: 
         
     | 
| 
      
 65 
     | 
    
         
            +
                    - - ">="
         
     | 
| 
      
 66 
     | 
    
         
            +
                      - !ruby/object:Gem::Version 
         
     | 
| 
      
 67 
     | 
    
         
            +
                        version: 2.0.0
         
     | 
| 
      
 68 
     | 
    
         
            +
                type: :development
         
     | 
| 
      
 69 
     | 
    
         
            +
                version_requirements: *id005
         
     | 
| 
      
 70 
     | 
    
         
            +
              - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 71 
     | 
    
         
            +
                name: cucumber
         
     | 
| 
      
 72 
     | 
    
         
            +
                prerelease: false
         
     | 
| 
      
 73 
     | 
    
         
            +
                requirement: &id006 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 74 
     | 
    
         
            +
                  none: false
         
     | 
| 
      
 75 
     | 
    
         
            +
                  requirements: 
         
     | 
| 
      
 76 
     | 
    
         
            +
                    - - ">="
         
     | 
| 
      
 77 
     | 
    
         
            +
                      - !ruby/object:Gem::Version 
         
     | 
| 
      
 78 
     | 
    
         
            +
                        version: "0"
         
     | 
| 
      
 79 
     | 
    
         
            +
                type: :development
         
     | 
| 
      
 80 
     | 
    
         
            +
                version_requirements: *id006
         
     | 
| 
      
 81 
     | 
    
         
            +
              - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 82 
     | 
    
         
            +
                name: my_scripts
         
     | 
| 
      
 83 
     | 
    
         
            +
                prerelease: false
         
     | 
| 
      
 84 
     | 
    
         
            +
                requirement: &id007 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 85 
     | 
    
         
            +
                  none: false
         
     | 
| 
      
 86 
     | 
    
         
            +
                  requirements: 
         
     | 
| 
      
 87 
     | 
    
         
            +
                    - - ">="
         
     | 
| 
      
 88 
     | 
    
         
            +
                      - !ruby/object:Gem::Version 
         
     | 
| 
      
 89 
     | 
    
         
            +
                        version: "0"
         
     | 
| 
      
 90 
     | 
    
         
            +
                type: :development
         
     | 
| 
      
 91 
     | 
    
         
            +
                version_requirements: *id007
         
     | 
| 
      
 92 
     | 
    
         
            +
            description: Support for non-gem package releases for JRuby (pre-alpha!).
         
     | 
| 
      
 93 
     | 
    
         
            +
            email: arvitallian@gmail.com
         
     | 
| 
      
 94 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 97 
     | 
    
         
            +
             
     | 
| 
      
 98 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
            files: 
         
     | 
| 
      
 101 
     | 
    
         
            +
              - lib/releaseable.rb
         
     | 
| 
      
 102 
     | 
    
         
            +
              - lib/releaseable/extensions.rb
         
     | 
| 
      
 103 
     | 
    
         
            +
              - lib/releaseable/github.rb
         
     | 
| 
      
 104 
     | 
    
         
            +
              - lib/releaseable/sound.rb
         
     | 
| 
      
 105 
     | 
    
         
            +
              - lib/releaseable/version.rb
         
     | 
| 
      
 106 
     | 
    
         
            +
              - VERSION
         
     | 
| 
      
 107 
     | 
    
         
            +
              - .gitignore
         
     | 
| 
      
 108 
     | 
    
         
            +
            homepage: http://github.com/arvicco/releaseable
         
     | 
| 
      
 109 
     | 
    
         
            +
            licenses: []
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 112 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
            require_paths: 
         
     | 
| 
      
 115 
     | 
    
         
            +
              - lib
         
     | 
| 
      
 116 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 117 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 118 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 119 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 120 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 121 
     | 
    
         
            +
                    version: "0"
         
     | 
| 
      
 122 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 123 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 124 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 125 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 126 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 127 
     | 
    
         
            +
                    version: "0"
         
     | 
| 
      
 128 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 129 
     | 
    
         
            +
             
     | 
| 
      
 130 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 131 
     | 
    
         
            +
            rubygems_version: 1.8.15
         
     | 
| 
      
 132 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 133 
     | 
    
         
            +
            specification_version: 3
         
     | 
| 
      
 134 
     | 
    
         
            +
            summary: Packaged releases support
         
     | 
| 
      
 135 
     | 
    
         
            +
            test_files: []
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     |