Module: OR2D::Version

Extended by:
Version
Included in:
Version
Defined in:
lib/or2d/version.rb

Overview

Since:

  • 2023-04-26

Instance Method Summary collapse

Instance Method Details

#buildObject

Get the build version of the current framework.

Since:

  • 2023-04-26



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.

Since:

  • 2023-04-26



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.message
end

#majorObject

Get the major version of the current framework.

Since:

  • 2023-04-26



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

#minorObject

Get the minor version of the current framework.

Since:

  • 2023-04-26



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

#patchObject

Get the patch version of the current framework.

Since:

  • 2023-04-26



19
20
21
22
23
# File 'lib/or2d/version.rb', line 19

def patch
   if !OR2D.const_defined?(:Metadata) || OR2D::Metadata.nil?

  OR2D::Metadata['patch']
end

#versionObject

Get the version of the current framework.

Since:

  • 2023-04-26



33
34
35
36
37
# File 'lib/or2d/version.rb', line 33

def version
   if !OR2D.const_defined?(:Metadata) || OR2D::Metadata.nil?

  OR2D::Metadata['version']
end