rakelib/support.rb
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 20 Jan 2020 11:34:02 +0000
changeset 286 c08455e14746
parent 169 f9f519bb10b6
child 288 2986b947d89f
permissions -rw-r--r--
Rakefiles: add support for manual dependency definitions Normally, pacjage dependencies are extracted automatically from package definition but eXept sometimes get dependencies wrong. As we (still, sigh) use some packages form eXept's CVS tree, this commit introduces `dependencies.rbspec` that has these manually fixed. This commit also includes fix for an issue with `stx:goodies/communication`
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
     1
require 'net/http'
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
     2
require 'net/https'
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
     3
require 'json'
6
abb35e8d97a7 Add `bin` directory to PATH so build scripts may use scripts located there
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
     4
require 'rakelib/extensions.rb'
abb35e8d97a7 Add `bin` directory to PATH so build scripts may use scripts located there
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
     5
require 'rakelib/rbspec.rb'
60
57c963e85a00 Cleanup: Renamed `vcs.rb` & `Rake::StX::VCS` to `scm.rb` and `Rake::StX::SCM`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 29
diff changeset
     6
require 'rakelib/scm.rb'
6
abb35e8d97a7 Add `bin` directory to PATH so build scripts may use scripts located there
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
     7
2
d5cd0cfb84d5 Use regexp matching to parse NAME=VALUE pairs given as command line arguments
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 0
diff changeset
     8
# Following hack is required to allow passing variable
d5cd0cfb84d5 Use regexp matching to parse NAME=VALUE pairs given as command line arguments
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 0
diff changeset
     9
# values in `make` style, i.e., to allow for
d5cd0cfb84d5 Use regexp matching to parse NAME=VALUE pairs given as command line arguments
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 0
diff changeset
    10
#
d5cd0cfb84d5 Use regexp matching to parse NAME=VALUE pairs given as command line arguments
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 0
diff changeset
    11
#  rake PROJECT=stx:jv-branch compile
d5cd0cfb84d5 Use regexp matching to parse NAME=VALUE pairs given as command line arguments
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 0
diff changeset
    12
#
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
    13
ARGV.each do |arg|
2
d5cd0cfb84d5 Use regexp matching to parse NAME=VALUE pairs given as command line arguments
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 0
diff changeset
    14
  name_and_value = /^([A-Za-z_]+)\w*=(.*)/.match(arg)
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
    15
  self.class.const_set(name_and_value[1], name_and_value[2]) if name_and_value
2
d5cd0cfb84d5 Use regexp matching to parse NAME=VALUE pairs given as command line arguments
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 0
diff changeset
    16
end
d5cd0cfb84d5 Use regexp matching to parse NAME=VALUE pairs given as command line arguments
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 0
diff changeset
    17
23
7dad21b22558 Added support to build under MSYS2 environment
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 11
diff changeset
    18
# Update PATH for build so build scripts may access  scripts and programs 
7dad21b22558 Added support to build under MSYS2 environment
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 11
diff changeset
    19
# in `bin` directory. This is required especially on Windows as Windows do 
7dad21b22558 Added support to build under MSYS2 environment
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 11
diff changeset
    20
# not ship with some basic tools (e.g. zip) by default. As a courtesy to the
7dad21b22558 Added support to build under MSYS2 environment
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 11
diff changeset
    21
# user, provide our own. 
7dad21b22558 Added support to build under MSYS2 environment
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 11
diff changeset
    22
# NOTE that this MUST be the first entry in the PATH to be able to override
7dad21b22558 Added support to build under MSYS2 environment
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 11
diff changeset
    23
# MINGW/MSYS make.exe with Borland's ancient make.exe (sigh, St/X still deals
7dad21b22558 Added support to build under MSYS2 environment
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 11
diff changeset
    24
# with dinosaurs)
7dad21b22558 Added support to build under MSYS2 environment
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 11
diff changeset
    25
ENV['PATH'] = "#{File.expand_path('bin')};#{File::PATH_SEPARATOR}#{ENV['PATH']}"
0
f46260ba26b1 Initial shot of "new" rake-based builder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
10
cb3e0e3ca28f Fixed repository specifications to allow anonymous checkout.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 9
diff changeset
    27
# Return true if running under Jenkins, false otherwise
cb3e0e3ca28f Fixed repository specifications to allow anonymous checkout.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 9
diff changeset
    28
def jenkins?
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
    29
  (ENV.has_key? 'WORKSPACE' and
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
    30
      ENV.has_key? 'JOB_NAME' and
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
    31
      ENV.has_key? 'BUILD_ID')
11
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    32
end
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    33
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    34
# Returns true if and only if this is machine of one of the core developers
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    35
# (currently only JV). 
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
    36
# Indeed this is a feeble check and can be easily bypassed by changing the
11
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    37
# code or by setting a proper environment variable. But this should not hurt 
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    38
# much as in that case, unauthorized person wouldn't be able to connect to 
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    39
# stc and librun repository so the build will fail. 
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    40
def core_developer?
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    41
  # JV's box: jv@..., vranyj1@...
102
fc572bd895f2 Cleanup: treat stx:stc & stx:librun as normal packages
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 88
diff changeset
    42
  user = ENV['USER'] || ENV['USERNAME']
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
    43
  (user == 'jv') or (user == 'vranyj1') ? true : false
11
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    44
end
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    45
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    46
# A super simple API for Jenkins used to download pre-built stc and librun.
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    47
module Jenkins
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    48
  # Return an a Jenkins build with pre-built stc and librun. 
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    49
  # Used to download pre-build stc and librun
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
    50
  def self.smalltalkx_jv_branch_build
169
f9f519bb10b6 Use GNU target triplets to specify build targets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 137
diff changeset
    51
    return Jenkins::Build.new(%Q{https://swing.fit.cvut.cz/jenkins/job/stx_jv/lastStableBuild})
11
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    52
  end
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    53
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    54
  class Artifact
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    55
    attr_reader :name
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    56
    attr_reader :uri
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    57
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    58
    def initialize(name, uri)
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    59
      @name = name
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    60
      @uri = uri
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    61
    end
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    62
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
    63
    def download_to(destination)
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
    64
      if !File.exist? destination
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
    65
        raise Exception.new("Invalid destination for download: #{destination}") unless File.directory? File.dirname(destination)
11
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    66
      else
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
    67
        if !File.directory? destination
11
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    68
          raise Exception.new("Invalid destination for download: #{destination}")
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    69
        else
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    70
          destination = File.join(destination, @name)
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    71
        end
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    72
      end
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
    73
      Jenkins::get(@uri) do |response|
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
    74
        File.open(destination, 'wb') do |file|
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
    75
          response.read_body {|part| file.write part}
11
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    76
        end
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    77
      end
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    78
    end
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    79
  end
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    80
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    81
  class Build
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    82
    attr_reader :data
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    83
    attr_reader :uri
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    84
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    85
    def initialize(uri)
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    86
      @uri = uri
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    87
      @data = JSON.parse(Jenkins::get(URI(uri.to_s + '/api/json')))
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    88
    end
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    89
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    90
    # Return a list of artifacts (as instances of `Jenkins::Artifact`) 
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    91
    # associated with this build. 
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
    92
    def artifacts
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
    93
      unless @artifacts
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
    94
        @artifacts = @data['artifacts'].collect {|each| Artifact.new(each['fileName'], URI(@uri.to_s + '/artifact/' + each['relativePath']))}
11
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    95
      end
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
    96
      @artifacts
11
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    97
    end
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    98
  end
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
    99
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
   100
  # A private method to GET data over HTTP(S)  
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
   101
  def self.get(uri, &block)
11
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
   102
    # http parameters       
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
   103
    http_host = Net::HTTP.new(uri.host, uri.port)
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
   104
    http_host.use_ssl = (uri.scheme == 'https') # simple true enough
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
   105
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
   106
    if false # host verification not used (yet)
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
   107
      http_host.verify_mode = OpenSSL::SSL::VERIFY_PEER
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
   108
      http_host.cert_store = OpenSSL::X509::Store.new
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
   109
      http_host.cert_store.set_default_paths
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
   110
      http_host.cert_store.add_file('cacert.pem') # file downloaded from curl.haxx.se/ca/cacert.pem
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
   111
    else
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
   112
      http_host.verify_mode = OpenSSL::SSL::VERIFY_NONE
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
   113
    end
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
   114
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
   115
    # actual download
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
   116
    body = nil
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
   117
    http_host.start do |http|
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
   118
      http.request_get(uri) {|response| block ? (yield response) : (body = response.body)}
11
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
   119
    end
137
e665031cade7 Cleaning up code and having it more rubyish
Patrik Svestka <patrik.svestka@gmail.com>
parents: 102
diff changeset
   120
    body
11
f7dc950d8df8 Automatically download pre-built librun and stc when sources are not available.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 10
diff changeset
   121
  end
10
cb3e0e3ca28f Fixed repository specifications to allow anonymous checkout.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 9
diff changeset
   122
end