volley 0.1.19 → 0.1.20
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/CHANGELOG.md +5 -0
- data/conf/common.volleyfile +9 -20
- data/lib/volley/publisher/base.rb +55 -18
- data/lib/volley/version.rb +1 -1
- data/spec/publisher_spec.rb +2 -8
- metadata +3 -3
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/conf/common.volleyfile
    CHANGED
    
    | @@ -52,6 +52,11 @@ project :volley do | |
| 52 52 | 
             
                  p = args.project
         | 
| 53 53 | 
             
                  pub = Volley::Dsl.publisher
         | 
| 54 54 | 
             
                  r = pub.latest_release(p)
         | 
| 55 | 
            +
                  list = pub.versions(p, "release")
         | 
| 56 | 
            +
                  list.each do |v|
         | 
| 57 | 
            +
                    f = pub.released_from(p, v) || "unknown" rescue "unknown"
         | 
| 58 | 
            +
                    puts "  #{v} <= #{f}"
         | 
| 59 | 
            +
                  end
         | 
| 55 60 |  | 
| 56 61 | 
             
                  puts "latest '#{p}' release: #{r}"
         | 
| 57 62 | 
             
                end
         | 
| @@ -133,30 +138,14 @@ project :volley do | |
| 133 138 |  | 
| 134 139 | 
             
              plan :release do
         | 
| 135 140 | 
             
                argument :version, required: true
         | 
| 136 | 
            -
                localfile = nil
         | 
| 137 | 
            -
                reldesc = nil
         | 
| 138 | 
            -
                tmpdir = "/var/tmp/volley-%d-%d-%05d" % [Time.now.to_i, $$, rand(99999)]
         | 
| 139 141 | 
             
                pub = Volley::Dsl.publisher
         | 
| 140 142 |  | 
| 141 | 
            -
                 | 
| 142 | 
            -
                  FileUtils.mkdir_p(tmpdir)
         | 
| 143 | 
            -
                  Dir.chdir(tmpdir)
         | 
| 144 | 
            -
                end
         | 
| 145 | 
            -
                action :download do
         | 
| 143 | 
            +
                default do
         | 
| 146 144 | 
             
                  desc = args.descriptor
         | 
| 147 145 | 
             
                  to = args.version
         | 
| 148 | 
            -
                   | 
| 149 | 
            -
                   | 
| 150 | 
            -
                  ( | 
| 151 | 
            -
                  localfile = pub.pull(p, b, v)
         | 
| 152 | 
            -
                  log "downloaded: #{localfile}"
         | 
| 153 | 
            -
                end
         | 
| 154 | 
            -
                action :release do
         | 
| 155 | 
            -
                  (p, b, v) = reldesc.get
         | 
| 156 | 
            -
                  pub.release(tmpdir, localfile, p, b, v)
         | 
| 157 | 
            -
                end
         | 
| 158 | 
            -
                action :cleanup do
         | 
| 159 | 
            -
                  FileUtils.remove_entry_secure(tmpdir)
         | 
| 146 | 
            +
                  old = desc.to_s
         | 
| 147 | 
            +
                  new = "#{desc.project}@release:#{to}"
         | 
| 148 | 
            +
                  pub.release(old, new)
         | 
| 160 149 | 
             
                end
         | 
| 161 150 | 
             
              end
         | 
| 162 151 |  | 
| @@ -3,7 +3,7 @@ module Volley | |
| 3 3 | 
             
                class Base
         | 
| 4 4 | 
             
                  attr_accessor :force
         | 
| 5 5 |  | 
| 6 | 
            -
                  def initialize(options={ | 
| 6 | 
            +
                  def initialize(options={})
         | 
| 7 7 | 
             
                    @options = {
         | 
| 8 8 | 
             
                        :overwrite => false,
         | 
| 9 9 | 
             
                    }.merge(options)
         | 
| @@ -12,24 +12,24 @@ module Volley | |
| 12 12 | 
             
                    @encrypted = optional(:encrypted, false)
         | 
| 13 13 | 
             
                    @local     = optional(:local, Volley.config.directory)
         | 
| 14 14 | 
             
                    @loglevel  = @debug ? :info : :debug
         | 
| 15 | 
            -
                    @latest    = { | 
| 15 | 
            +
                    @latest    = {}
         | 
| 16 16 | 
             
                    @force     = false
         | 
| 17 17 |  | 
| 18 18 | 
             
                    load_configuration
         | 
| 19 19 | 
             
                  end
         | 
| 20 20 |  | 
| 21 21 | 
             
                  def list(&block)
         | 
| 22 | 
            -
                    hash     = { | 
| 23 | 
            -
                    unsorted = { | 
| 22 | 
            +
                    hash     = {}
         | 
| 23 | 
            +
                    unsorted = {}
         | 
| 24 24 | 
             
                    plist    = projects
         | 
| 25 25 | 
             
                    plist.each do |p|
         | 
| 26 | 
            -
                      hash[p] = { | 
| 26 | 
            +
                      hash[p] = {}
         | 
| 27 27 | 
             
                      blist   = branches(p)
         | 
| 28 28 | 
             
                      blist.each do |b|
         | 
| 29 | 
            -
                        hash[p][b] = { | 
| 29 | 
            +
                        hash[p][b] = {}
         | 
| 30 30 | 
             
                        vlist      = versions(p, b)
         | 
| 31 31 | 
             
                        vlist.each do |v|
         | 
| 32 | 
            -
                          d | 
| 32 | 
            +
                          d             = version_data(p, b, v)
         | 
| 33 33 | 
             
                          hash[p][b][v] = d
         | 
| 34 34 | 
             
                          unsorted["#{p}@#{b}:#{v}"] = d if d[:contents] && d[:contents].count > 0
         | 
| 35 35 | 
             
                        end
         | 
| @@ -82,6 +82,10 @@ module Volley | |
| 82 82 | 
             
                    pull_file(project, "latest_release")
         | 
| 83 83 | 
             
                  end
         | 
| 84 84 |  | 
| 85 | 
            +
                  def released_from(project, version)
         | 
| 86 | 
            +
                    pull_file(dir(project, "release", version), "from")
         | 
| 87 | 
            +
                  end
         | 
| 88 | 
            +
             | 
| 85 89 | 
             
                  def volleyfile(project, branch, version="latest")
         | 
| 86 90 | 
             
                    d        = dir(project, branch, version)
         | 
| 87 91 | 
             
                    contents = pull_file(d, "Volleyfile")
         | 
| @@ -125,25 +129,58 @@ module Volley | |
| 125 129 | 
             
                    "#@local/#{dir}/#{file}"
         | 
| 126 130 | 
             
                  end
         | 
| 127 131 |  | 
| 128 | 
            -
                  def release( | 
| 129 | 
            -
                     | 
| 130 | 
            -
             | 
| 131 | 
            -
             | 
| 132 | 
            +
                  def release(old, new)
         | 
| 133 | 
            +
                    odesc = Descriptor.new(old)
         | 
| 134 | 
            +
                    ndesc = Descriptor.new(new)
         | 
| 135 | 
            +
             | 
| 136 | 
            +
                    Dir.mktmpdir("volley-#{$$}", "/var/tmp") do |tmpdir|
         | 
| 137 | 
            +
                      Dir.chdir(tmpdir) do
         | 
| 138 | 
            +
                        (op, ob, ov) = odesc.get
         | 
| 139 | 
            +
                        (p, b, v)    = ndesc.get
         | 
| 140 | 
            +
             | 
| 141 | 
            +
                        Volley::Log.debug "%% #{me}#release: #{odesc} => #{ndesc} (#{tmpdir})"
         | 
| 132 142 |  | 
| 133 | 
            -
             | 
| 143 | 
            +
                        packed       = "#{b}-#{v}.tgz"
         | 
| 144 | 
            +
                        dest         = dir(p, b, v)
         | 
| 134 145 |  | 
| 135 | 
            -
             | 
| 146 | 
            +
                        local = pull(op, ob, ov)
         | 
| 147 | 
            +
                        system("tar xfz #{local}")
         | 
| 136 148 |  | 
| 137 | 
            -
             | 
| 138 | 
            -
             | 
| 139 | 
            -
             | 
| 140 | 
            -
             | 
| 141 | 
            -
             | 
| 149 | 
            +
                        files = Dir["**"]
         | 
| 150 | 
            +
                        cmd = "tar cfz #{packed} #{files.join(" ")}"
         | 
| 151 | 
            +
                        #Volley::Log.debug "-- command: #{cmd}"
         | 
| 152 | 
            +
                        system(cmd)
         | 
| 153 | 
            +
             | 
| 154 | 
            +
                        push_file(dest, packed, File.open(packed))
         | 
| 155 | 
            +
                        push_file(dest, "Volleyfile", File.open("Volleyfile")) if File.exists?("Volleyfile")
         | 
| 156 | 
            +
                        push_file(dest, "from", "#{op}/#{ob}/#{ov}")
         | 
| 157 | 
            +
                        push_file(dir(p, b), "latest", "#{p}/#{b}/#{v}")
         | 
| 158 | 
            +
                        push_file(p, "latest_release", "#{p}/#{b}/#{v}")
         | 
| 159 | 
            +
                      end
         | 
| 142 160 | 
             
                    end
         | 
| 143 161 |  | 
| 144 162 | 
             
                    true
         | 
| 145 163 | 
             
                  end
         | 
| 146 164 |  | 
| 165 | 
            +
                  #def release(tmpdir, local, p, b, v)
         | 
| 166 | 
            +
                  #  Dir.chdir(tmpdir) do
         | 
| 167 | 
            +
                  #    packed = "#{b}-#{v}.tgz"
         | 
| 168 | 
            +
                  #    dest = dir(p, b, v)
         | 
| 169 | 
            +
                  #
         | 
| 170 | 
            +
                  #    system("tar xfz #{local}")
         | 
| 171 | 
            +
                  #
         | 
| 172 | 
            +
                  #    files = Dir["**"]
         | 
| 173 | 
            +
                  #
         | 
| 174 | 
            +
                  #    system("tar cfz #{packed} #{files.join(" ")}")
         | 
| 175 | 
            +
                  #    push_file(dest, packed, File.open(packed))
         | 
| 176 | 
            +
                  #    push_file(dest, "Volleyfile", File.open("Volleyfile")) if File.exists?("Volleyfile")
         | 
| 177 | 
            +
                  #    push_file(dir(p, b), "latest", "#{p}/#{b}/#{v}")
         | 
| 178 | 
            +
                  #    push_file(p, "latest_release", "#{p}/#{b}/#{v}")
         | 
| 179 | 
            +
                  #  end
         | 
| 180 | 
            +
                  #
         | 
| 181 | 
            +
                  #  true
         | 
| 182 | 
            +
                  #end
         | 
| 183 | 
            +
             | 
| 147 184 | 
             
                  protected
         | 
| 148 185 |  | 
| 149 186 | 
             
                  def me
         | 
    
        data/lib/volley/version.rb
    CHANGED
    
    
    
        data/spec/publisher_spec.rb
    CHANGED
    
    | @@ -37,14 +37,8 @@ shared_examples_for Volley::Publisher::Base do | |
| 37 37 | 
             
              end
         | 
| 38 38 |  | 
| 39 39 | 
             
              it "should be able to release an artifact" do
         | 
| 40 | 
            -
                 | 
| 41 | 
            -
                 | 
| 42 | 
            -
                Dir.chdir(tmpdir) do
         | 
| 43 | 
            -
                  local  = @pub.pull("spec", "trunk", "1")
         | 
| 44 | 
            -
                  expect(@pub.release(tmpdir, local, "spec", "release", "v1.0")).to be(true)
         | 
| 45 | 
            -
                  expect(@pub.versions("spec", "release")).to match_array(%w{v1.0})
         | 
| 46 | 
            -
                end
         | 
| 47 | 
            -
                FileUtils.remove_entry_secure(tmpdir)
         | 
| 40 | 
            +
                expect(@pub.release("spec@trunk:1", "spec@release:v1.0")).to be(true)
         | 
| 41 | 
            +
                expect(@pub.versions("spec", "release")).to match_array(%w{v1.0})
         | 
| 48 42 | 
             
              end
         | 
| 49 43 |  | 
| 50 44 | 
             
              it "should be able to tell me the list of projects" do
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: volley
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.20
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -199,7 +199,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 199 199 | 
             
                  version: '0'
         | 
| 200 200 | 
             
                  segments:
         | 
| 201 201 | 
             
                  - 0
         | 
| 202 | 
            -
                  hash:  | 
| 202 | 
            +
                  hash: -2184208437167885640
         | 
| 203 203 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 204 204 | 
             
              none: false
         | 
| 205 205 | 
             
              requirements:
         | 
| @@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 208 208 | 
             
                  version: '0'
         | 
| 209 209 | 
             
                  segments:
         | 
| 210 210 | 
             
                  - 0
         | 
| 211 | 
            -
                  hash:  | 
| 211 | 
            +
                  hash: -2184208437167885640
         | 
| 212 212 | 
             
            requirements: []
         | 
| 213 213 | 
             
            rubyforge_project: 
         | 
| 214 214 | 
             
            rubygems_version: 1.8.24
         |