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)



89
90
91
# File 'lib/stool/Core/LibInfo.rb', line 89

def cacheType
  @cacheType
end

#homepageObject

Returns the value of attribute homepage.



92
93
94
# File 'lib/stool/Core/LibInfo.rb', line 92

def homepage
  @homepage
end

#nameObject

lib的name



85
86
87
# File 'lib/stool/Core/LibInfo.rb', line 85

def name
  @name
end

#pathObject

本地路径



83
84
85
# File 'lib/stool/Core/LibInfo.rb', line 83

def path
  @path
end

#summaryObject

简介



91
92
93
# File 'lib/stool/Core/LibInfo.rb', line 91

def summary
  @summary
end

#versionObject

lib的版本



87
88
89
# File 'lib/stool/Core/LibInfo.rb', line 87

def version
  @version
end

Class Method Details

.loadFromPath(path) ⇒ Object



96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/stool/Core/LibInfo.rb', line 96

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



118
119
120
121
122
123
124
# File 'lib/stool/Core/LibInfo.rb', line 118

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

#gitUpObject



126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/stool/Core/LibInfo.rb', line 126

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



109
110
111
112
113
114
115
116
# File 'lib/stool/Core/LibInfo.rb', line 109

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