Class: Stool::LibInfo

Inherits:
BaseObj show all
Includes:
Git_util
Defined in:
lib/stool/Core/LibInfo.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Git_util

#git_checkout, #git_commit_all, #git_st, #git_stash, #git_stash_pop, #git_up

Methods inherited from BaseObj

#doCacheByYAML, fromFile, fromYAML, #initialize

Constructor Details

This class inherits a constructor from Stool::BaseObj

Instance Attribute Details

#cacheTypeObject

本地缓存类型(Framework or code)



51
52
53
# File 'lib/stool/Core/LibInfo.rb', line 51

def cacheType
  @cacheType
end

#nameObject

lib的name



47
48
49
# File 'lib/stool/Core/LibInfo.rb', line 47

def name
  @name
end

#pathObject

本地路径



45
46
47
# File 'lib/stool/Core/LibInfo.rb', line 45

def path
  @path
end

#versionObject

lib的版本



49
50
51
# File 'lib/stool/Core/LibInfo.rb', line 49

def version
  @version
end

Class Method Details

.loadFromPath(path) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/stool/Core/LibInfo.rb', line 55

def self.loadFromPath (path)
  Dir.chdir(path)
  podspec = Dir.glob('*.podspec')[0]
  if podspec
    info = LibInfo.new()
    info.path = path
    info.name = podspec.split('.')[0]
    info.dsl_podspec(path + "/#{podspec}")
  end

  info
end

Instance Method Details

#dsl_podspec(path) ⇒ Object



77
78
79
80
81
# File 'lib/stool/Core/LibInfo.rb', line 77

def dsl_podspec(path)
  spec = Pod::Spec.fromFile(path)
  @name = spec.name
  @version = spec.version
end

#gitUpObject



83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/stool/Core/LibInfo.rb', line 83

def gitUp
  if @path
    Dir.chdir(@path)
    puts "*** git处理<#{@name}>"
    git_st
    result = git_stash
    git_up
    if result['Saved working']
      git_stash_pop
    else
      puts "no stash to pop"
    end
  end
end

#info_tosObject



68
69
70
71
72
73
74
75
# File 'lib/stool/Core/LibInfo.rb', line 68

def info_tos
  puts ''
  puts "**lib info of <#{self.name}>"
  puts "-- name: #{self.name}"
  puts "-- path: #{self.path}"
  puts "-- version: #{self.version}"
  puts ''
end