Class: QCloudHive::HiveSpec

Inherits:
Object
  • Object
show all
Defined in:
lib/qcloudhive/spec_helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = nil, path = nil) ⇒ HiveSpec

Returns a new instance of HiveSpec.



9
10
11
12
13
# File 'lib/qcloudhive/spec_helper.rb', line 9

def initialize(name=nil, path=nil)
  @name = name
  @path = path
  @podspec = nil
end

Instance Attribute Details

#branchObject

Returns the value of attribute branch.



6
7
8
# File 'lib/qcloudhive/spec_helper.rb', line 6

def branch
  @branch
end

#commitObject

Returns the value of attribute commit.



7
8
9
# File 'lib/qcloudhive/spec_helper.rb', line 7

def commit
  @commit
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/qcloudhive/spec_helper.rb', line 4

def name
  @name
end

#pathObject

Returns the value of attribute path.



5
6
7
# File 'lib/qcloudhive/spec_helper.rb', line 5

def path
  @path
end

#sourceURLObject

Returns the value of attribute sourceURL.



8
9
10
# File 'lib/qcloudhive/spec_helper.rb', line 8

def sourceURL
  @sourceURL
end

Instance Method Details

#podspecObject



15
16
17
18
19
20
# File 'lib/qcloudhive/spec_helper.rb', line 15

def podspec
  if @podspec.nil?
    @podspec = Pod::Specification.from_file(path)
  end
  return @podspec
end

#toConfigObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/qcloudhive/spec_helper.rb', line 21

def toConfig
  config = "[#{name}]\n"
  if not path.nil?
    config += "path=#{path}\n"
  end
  if not commit.nil?
    config += "commit=#{commit}\n"
  end
  if not branch.nil?
    config += "branch=#{branch}\n"
  end
  if not sourceURL.nil?
    config += "sourceURL=#{sourceURL}\n"
  end
  config
end

#writeJsonObject



38
39
40
41
42
43
# File 'lib/qcloudhive/spec_helper.rb', line 38

def writeJson
  jsonPath = @path + ".json"
  File.open("#{jsonPath}", "w") { |f|
    f.write podspec.to_json
  }
end