Class: Jax::Plugin::Manifest
- Inherits:
-
ActiveSupport::HashWithIndifferentAccess
- Object
- ActiveSupport::HashWithIndifferentAccess
- Jax::Plugin::Manifest
- Defined in:
- lib/jax/plugin/manifest.rb
Class Method Summary collapse
Instance Method Summary collapse
- #defaults ⇒ Object
- #description ⇒ Object
- #description=(n) ⇒ Object
-
#initialize(plugin_name) ⇒ Manifest
constructor
A new instance of Manifest.
- #load ⇒ Object
- #load_from(path) ⇒ Object
- #name ⇒ Object
- #name=(n) ⇒ Object
- #path ⇒ Object
- #save ⇒ Object
- #save_to(path) ⇒ Object
- #version ⇒ Object
- #version=(n) ⇒ Object
Constructor Details
#initialize(plugin_name) ⇒ Manifest
Returns a new instance of Manifest.
11 12 13 14 15 |
# File 'lib/jax/plugin/manifest.rb', line 11 def initialize(plugin_name) super() self[:name] = plugin_name defaults end |
Class Method Details
.find(name) ⇒ Object
5 6 7 8 |
# File 'lib/jax/plugin/manifest.rb', line 5 def find(name) man = new name man.load end |
Instance Method Details
#defaults ⇒ Object
66 67 68 69 70 |
# File 'lib/jax/plugin/manifest.rb', line 66 def defaults self[:description] ||= "" self[:version] ||= "0.0.1" self end |
#description ⇒ Object
33 34 35 |
# File 'lib/jax/plugin/manifest.rb', line 33 def description self[:description] end |
#description=(n) ⇒ Object
37 38 39 |
# File 'lib/jax/plugin/manifest.rb', line 37 def description=(n) self[:description] = n end |
#load ⇒ Object
41 42 43 |
# File 'lib/jax/plugin/manifest.rb', line 41 def load load_from path end |
#load_from(path) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/jax/plugin/manifest.rb', line 45 def load_from(path) yml = YAML::load(File.read(path)) yml.each do |key, value| self[key] = value end self end |
#name ⇒ Object
17 18 19 |
# File 'lib/jax/plugin/manifest.rb', line 17 def name self[:name] end |
#name=(n) ⇒ Object
21 22 23 |
# File 'lib/jax/plugin/manifest.rb', line 21 def name=(n) self[:name] = n end |
#path ⇒ Object
62 63 64 |
# File 'lib/jax/plugin/manifest.rb', line 62 def path File.join(Jax.root, "vendor/plugins", name, "manifest.yml") end |
#save ⇒ Object
53 54 55 |
# File 'lib/jax/plugin/manifest.rb', line 53 def save save_to path end |
#save_to(path) ⇒ Object
57 58 59 60 |
# File 'lib/jax/plugin/manifest.rb', line 57 def save_to(path) File.open(path, "w") { |f| f.print to_yaml } self end |
#version ⇒ Object
25 26 27 |
# File 'lib/jax/plugin/manifest.rb', line 25 def version self[:version] end |
#version=(n) ⇒ Object
29 30 31 |
# File 'lib/jax/plugin/manifest.rb', line 29 def version=(n) self[:version] = n end |