Class: Capistrano::JDKInstaller::JDKInstallerRelease
- Inherits:
-
Object
- Object
- Capistrano::JDKInstaller::JDKInstallerRelease
- Includes:
- Enumerable
- Defined in:
- lib/capistrano-jdk-installer/jdk-installer.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #files ⇒ Object (also: #to_a)
- #find_by_platform(platform) ⇒ Object
-
#initialize(version, data, options = {}) ⇒ JDKInstallerRelease
constructor
A new instance of JDKInstallerRelease.
- #inner_version ⇒ Object
- #licpath ⇒ Object (also: #license_path)
- #lictitle ⇒ Object (also: #license_title)
- #logger ⇒ Object
- #major_version ⇒ Object
- #minor_version ⇒ Object
- #name ⇒ Object (also: #to_s)
- #title ⇒ Object
- #update_number ⇒ Object
- #version_info ⇒ Object
Constructor Details
#initialize(version, data, options = {}) ⇒ JDKInstallerRelease
Returns a new instance of JDKInstallerRelease.
179 180 181 182 183 184 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 179 def initialize(version, data, ={}) @version = version @data = data @options = .dup @logger = @options[:logger] end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
185 186 187 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 185 def @options end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
185 186 187 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 185 def version @version end |
Instance Method Details
#each(&block) ⇒ Object
198 199 200 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 198 def each(&block) self.to_a.each(&block) end |
#files ⇒ Object Also known as: to_a
191 192 193 194 195 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 191 def files @files ||= @data["files"].map { |file| JDKInstallerFile.new(self, file, @options) } end |
#find_by_platform(platform) ⇒ Object
202 203 204 205 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 202 def find_by_platform(platform) platform = platform.to_s self.find { |f| f.platform == platform } end |
#inner_version ⇒ Object
236 237 238 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 236 def inner_version @inner_version ||= version_info[0] # e.g. "1.7.0" end |
#licpath ⇒ Object Also known as: license_path
207 208 209 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 207 def licpath @licpath ||= @data["licpath"] end |
#lictitle ⇒ Object Also known as: license_title
212 213 214 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 212 def lictitle @lictitle ||= @data["lictitle"] end |
#logger ⇒ Object
187 188 189 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 187 def logger @logger ||= Logger.new(STDOUT) end |
#major_version ⇒ Object
240 241 242 243 244 245 246 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 240 def major_version @major_version ||= version_info[1] # e.g. "7" if @major_version != version.major_version raise(JDKInstallerParseError.new("Major version mismatch (got=#{@major_version}, expected=#{version.major_version})")) end @major_version end |
#minor_version ⇒ Object
248 249 250 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 248 def minor_version @minor_version ||= version_info[2] # e.g. "0" end |
#name ⇒ Object Also known as: to_s
217 218 219 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 217 def name @name ||= @data["name"] end |
#title ⇒ Object
222 223 224 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 222 def title @title ||= @data["title"] end |
#update_number ⇒ Object
252 253 254 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 252 def update_number @update_number ||= version_info[3] # e.g. "6" end |
#version_info ⇒ Object
226 227 228 229 230 231 232 233 234 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 226 def version_info @version_info ||= case name when /j2sdk-(1\.4\.(\d+))(?:[_u]([0-9]+))?/ then [ $1, "1.4", $2, $3 ] when /jdk-(1\.5\.(\d+))(?:[_u]([0-9]+))?/ then [ $1, "5", $2, $3 ] when /jdk-(\d+)(?:u(\d+))?/ then [ "1.#{$1}.0", $1, 0, $2 ] else raise(JDKInstallerParseError.new("Could not parse JDK release name: #{name}")) end end |