Module: OR2D::Version
Overview
Instance Method Summary collapse
-
#build ⇒ Object
Get the build version of the current framework.
-
#get_metadata(project_id = '1682916324129.346000') ⇒ Object
Get the version of the current framework.
-
#major ⇒ Object
Get the major version of the current framework.
-
#minor ⇒ Object
Get the minor version of the current framework.
-
#patch ⇒ Object
Get the patch version of the current framework.
-
#version ⇒ Object
Get the version of the current framework.
Instance Method Details
#build ⇒ Object
Get the build version of the current framework.
26 27 28 29 30 |
# File 'lib/or2d/version.rb', line 26 def build if !OR2D.const_defined?(:Metadata) || OR2D::Metadata.nil? OR2D::Metadata['build'] end |
#get_metadata(project_id = '1682916324129.346000') ⇒ Object
Get the version of the current framework.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/or2d/version.rb', line 40 def (project_id = '1682916324129.346000') result = Net::HTTP.get_response(URI("http://api.repos.pw/v1/projects/#{project_id}")) OR2D.const_set(:Metadata, if result.is_a?(Net::HTTPOK) JSON.parse(result.body)['data'].freeze else { 'build' => 'unknown-canary', 'major' => 0, 'minor' => 0, 'patch' => 0, 'version' => '0.0.0' }.freeze end) rescue StandardError => e puts "Failed to update version: #{e}", e. end |
#major ⇒ Object
Get the major version of the current framework.
5 6 7 8 9 |
# File 'lib/or2d/version.rb', line 5 def major if !OR2D.const_defined?(:Metadata) || OR2D::Metadata.nil? OR2D::Metadata['major'] end |
#minor ⇒ Object
Get the minor version of the current framework.
12 13 14 15 16 |
# File 'lib/or2d/version.rb', line 12 def minor if !OR2D.const_defined?(:Metadata) || OR2D::Metadata.nil? OR2D::Metadata['minor'] end |