Class: Skyline::Plugins::Plugin
- Inherits:
-
Object
- Object
- Skyline::Plugins::Plugin
- Defined in:
- lib/skyline/plugins/plugin.rb
Instance Attribute Summary collapse
-
#init_file ⇒ Object
readonly
Returns the value of attribute init_file.
-
#load_file ⇒ Object
readonly
Returns the value of attribute load_file.
-
#manager ⇒ Object
readonly
Returns the value of attribute manager.
-
#migration_path ⇒ Object
readonly
Returns the value of attribute migration_path.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#seed_path ⇒ Object
readonly
Returns the value of attribute seed_path.
Instance Method Summary collapse
-
#init! ⇒ Object
Initialize the plugin, this is usually done just once when the server starts.
-
#initialize(path, manager) ⇒ Plugin
constructor
A new instance of Plugin.
-
#load! ⇒ Object
Load the plugin, this will be done on every request in development only once in production mode.
Constructor Details
#initialize(path, manager) ⇒ Plugin
Returns a new instance of Plugin.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/skyline/plugins/plugin.rb', line 5 def initialize(path, manager) @manager = manager @path = Pathname.new(path) @name = @path.basename.to_s files = { :init_file => "skyline/init.rb", :load_file => "skyline/load.rb", :migration_path => "db/migrate", :seed_path => "db/fixtures" } files.each do |key, path| f = @path + path instance_variable_set("@#{key}",f) if f.exist? end end |
Instance Attribute Details
#init_file ⇒ Object (readonly)
Returns the value of attribute init_file.
3 4 5 |
# File 'lib/skyline/plugins/plugin.rb', line 3 def init_file @init_file end |
#load_file ⇒ Object (readonly)
Returns the value of attribute load_file.
3 4 5 |
# File 'lib/skyline/plugins/plugin.rb', line 3 def load_file @load_file end |
#manager ⇒ Object (readonly)
Returns the value of attribute manager.
3 4 5 |
# File 'lib/skyline/plugins/plugin.rb', line 3 def manager @manager end |
#migration_path ⇒ Object (readonly)
Returns the value of attribute migration_path.
3 4 5 |
# File 'lib/skyline/plugins/plugin.rb', line 3 def migration_path @migration_path end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/skyline/plugins/plugin.rb', line 3 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/skyline/plugins/plugin.rb', line 3 def path @path end |
#seed_path ⇒ Object (readonly)
Returns the value of attribute seed_path.
3 4 5 |
# File 'lib/skyline/plugins/plugin.rb', line 3 def seed_path @seed_path end |
Instance Method Details
#init! ⇒ Object
Initialize the plugin, this is usually done just once when the server starts
25 26 27 28 29 30 31 32 33 |
# File 'lib/skyline/plugins/plugin.rb', line 25 def init! add_routes! add_load_paths! add_view_path! add_public_path! add_locales! load(@init_file) if @init_file end |
#load! ⇒ Object
Load the plugin, this will be done on every request in development only once in production mode.
37 38 39 |
# File 'lib/skyline/plugins/plugin.rb', line 37 def load! load(@load_file) if @load_file end |