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.
180 181 182 183 184 185 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 180 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.
186 187 188 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 186 def @options end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
186 187 188 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 186 def version @version end |
Instance Method Details
#each(&block) ⇒ Object
199 200 201 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 199 def each(&block) self.to_a.each(&block) end |
#files ⇒ Object Also known as: to_a
192 193 194 195 196 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 192 def files @files ||= @data["files"].map { |file| JDKInstallerFile.new(self, file, @options) } end |
#find_by_platform(platform) ⇒ Object
203 204 205 206 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 203 def find_by_platform(platform) platform = platform.to_s self.find { |f| f.platform == platform } end |
#inner_version ⇒ Object
237 238 239 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 237 def inner_version @inner_version ||= version_info[0] # e.g. "1.7.0" end |
#licpath ⇒ Object Also known as: license_path
208 209 210 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 208 def licpath @licpath ||= @data["licpath"] end |
#lictitle ⇒ Object Also known as: license_title
213 214 215 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 213 def lictitle @lictitle ||= @data["lictitle"] end |
#logger ⇒ Object
188 189 190 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 188 def logger @logger ||= Logger.new(STDOUT) end |
#major_version ⇒ Object
241 242 243 244 245 246 247 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 241 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
249 250 251 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 249 def minor_version @minor_version ||= version_info[2] # e.g. "0" end |
#name ⇒ Object Also known as: to_s
218 219 220 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 218 def name @name ||= @data["name"] end |
#title ⇒ Object
223 224 225 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 223 def title @title ||= @data["title"] end |
#update_number ⇒ Object
253 254 255 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 253 def update_number @update_number ||= version_info[3] # e.g. "6" end |
#version_info ⇒ Object
227 228 229 230 231 232 233 234 235 |
# File 'lib/capistrano-jdk-installer/jdk-installer.rb', line 227 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 |