Sha256: b7a862abb0c00e8a1412de6bc584d1bc0780a2eec49802e7e3eb5faae523bf43

Contents?: true

Size: 1.38 KB

Versions: 66

Compression:

Stored size: 1.38 KB

Contents

require "git"
require "fileutils"
require "logger"
require "pathname"


class GetCatalog
    def initialize ()
        @log = Logger.new(Canzea::config[:logging_root] + '/plans.log')
    end
    def do(tag = nil)
        catalogLocation = Canzea::config[:catalog_location]
        FileUtils.rm_rf "#{catalogLocation}"
        FileUtils.mkdir_p "#{catalogLocation}"
        catalogLocation = Pathname.new(catalogLocation).parent().realpath
        g = Git.clone(Canzea::config[:catalog_git], "catalog", :path => catalogLocation)
        if (tag != nil)
            puts "-- (RESET) For tag #{tag}"
            g.checkout(tag)
        else
            g.checkout(g.branch(Canzea::config[:catalog_branch]))
        end
        branch = g.current_branch
        puts "-- (RESET) Branch '#{branch}' Commit #{g.log[0]}"
        puts "-- (RESET) Source #{catalogLocation}/catalog"
    end

    def state()
        g = Git.open(Canzea::config[:catalog_location])

        branch = g.current_branch
        commit = g.log[0]
        g.tags.each do | c |
            # Doesn't seem to link tag to the branch so excluding for now
            # ENV.store('CATALOG_TAG', c.name)
            # puts "-- Tag #{c.name}"
        end

        ENV.store('CATALOG_BRANCH', branch)
        ENV.store('CATALOG_COMMIT', "#{g.log[0]}")

        # puts "-- Branch '#{ENV['CATALOG_BRANCH']}' Commit #{ENV['CATALOG_COMMIT']}"

    end

end

Version data entries

66 entries across 66 versions & 2 rubygems

Version Path
canzea-0.1.172 lib/commands/get-catalog.rb
canzea-0.1.171 lib/commands/get-catalog.rb
canzea-0.1.170 lib/commands/get-catalog.rb
canzea-0.1.169 lib/commands/get-catalog.rb
canzea-0.1.167 lib/commands/get-catalog.rb
canzea-0.1.166 lib/commands/get-catalog.rb
canzea-0.1.165 lib/commands/get-catalog.rb
escli-1.0.3 lib/canzea/commands/get-catalog.rb
escli-1.0.2 lib/canzea/commands/get-catalog.rb
escli-1.0.1 lib/canzea/commands/get-catalog.rb
escli-1.0.0 lib/canzea/commands/get-catalog.rb
canzea-0.1.160 lib/commands/get-catalog.rb
canzea-0.1.159 lib/commands/get-catalog.rb
canzea-0.1.158 lib/commands/get-catalog.rb
canzea-0.1.157 lib/commands/get-catalog.rb
canzea-0.1.156 lib/commands/get-catalog.rb
canzea-0.1.155 lib/commands/get-catalog.rb
canzea-0.1.154 lib/commands/get-catalog.rb
canzea-0.1.153 lib/commands/get-catalog.rb
canzea-0.1.152 lib/commands/get-catalog.rb