Sha256: 3cfb19d8824ba26f9f0239d13a7f245ca3c17116d13a6a66fee913694f88c515

Contents?: true

Size: 1.66 KB

Versions: 1

Compression:

Stored size: 1.66 KB

Contents

module QCloudHive
  class GITURLDecoder
      attr_reader :originURL
      attr_reader :projectName
      attr_reader :name

      def initialize(originURL)
        @originURL = originURL
        if @originURL == nil
          raise NameError("改地址为空!!!")
        end
        uri = URI(originURL)
        uriPath = uri.path.split(".").first
        if uriPath.start_with?("/")
          uriPath= uriPath[1..uriPath.length]
        end
        name = uriPath.split("/").last
        @projectName = uriPath
        @name = name
      end
      def validate?()
        if @originURL == nil
          return false
        end
        if @name == nil
          return false
        end
        if @projectName == nil
          return false
        end
        return true
      end
  end
end
module Git
  class Base
    def clean?()
      begin
      if status.changed.count > 0
        L.info("****************************")
        L.info("changed #{status.changed}")
        return false
      end
      if status.untracked.count >0
        L.info("****************************")
        L.info("untracked #{status.untracked}")
        return false
      end

      if status.deleted.count > 0
        L.info("****************************")
        L.info("deleted #{status.deleted}")
        return false
      end

      if status.added.count > 0
        L.info("****************************")
        L.info("added #{status.added}")
        return false
      end
      rescue => err
        puts "读取Git数据失败#{err}"
        return false
      end
    return true
    end
  end

  class Branch
    def local?
      full.start_with?("remotes") == false
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
qcloudhive-0.1.0 lib/qcloudhive/git_helper.rb