Class: Super::PackagedAsset
- Inherits:
-
Object
- Object
- Super::PackagedAsset
- Defined in:
- lib/super/packaged_asset.rb
Constant Summary collapse
- VERSION_BEGINNING =
/\A\d+\.\d+.\d+/.freeze
Class Attribute Summary collapse
-
.warning_message ⇒ Object
Returns the value of attribute warning_message.
Class Method Summary collapse
Instance Method Summary collapse
- #comparable_version ⇒ Object
- #full_version ⇒ Object
-
#initialize(package_json_path) ⇒ PackagedAsset
constructor
A new instance of PackagedAsset.
Constructor Details
#initialize(package_json_path) ⇒ PackagedAsset
Returns a new instance of PackagedAsset.
25 26 27 |
# File 'lib/super/packaged_asset.rb', line 25 def initialize(package_json_path) @package_json_path = package_json_path end |
Class Attribute Details
.warning_message ⇒ Object
Returns the value of attribute warning_message.
8 9 10 |
# File 'lib/super/packaged_asset.rb', line 8 def @warning_message end |
Class Method Details
.comparable_super_version ⇒ Object
11 12 13 |
# File 'lib/super/packaged_asset.rb', line 11 def self.comparable_super_version ::Super::VERSION[VERSION_BEGINNING] end |
.version_matches_gem?(package_json_path) ⇒ Boolean
15 16 17 18 19 20 21 22 23 |
# File 'lib/super/packaged_asset.rb', line 15 def self.version_matches_gem?(package_json_path) return true if ENV.key?("SUPER_IGNORE_PACKAGE_JSON_VERSION") asset = new(package_json_path) return true if !asset.comparable_version asset.comparable_version == comparable_super_version end |
Instance Method Details
#comparable_version ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/super/packaged_asset.rb', line 39 def comparable_version if instance_variable_defined?(:@asset_version) return @asset_version end @asset_version = full_version[VERSION_BEGINNING] rescue @asset_version = nil end |
#full_version ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/super/packaged_asset.rb', line 29 def full_version if instance_variable_defined?(:@full_version) return @full_version end @full_version = JSON.parse(@package_json_path.read).dig("dependencies", "@superadministration/super") rescue @full_version = nil end |