Prev | Current Page 124 | Next

Brad Ediger

"Advanced Rails"

read(File.join(File.dirname(_ _FILE_ _), 'README'))
lib/
This is the directory in which all of the plugin code is contained. Rails adds this
directory to the Ruby load path as well as the Rails Dependencies load path.
For example, assume you have a class, MyPlugin, in lib/my_plugin.rb. Since it is
in the Ruby load path, a simple require 'my_plugin' will find it. But since
Dependencies autoloads missing constants, you could also load the file simply by
referring to MyPlugin in your plugin.
MIT-LICENSE (or other license file; not shown)
All plugins, no matter how small, should include a license. Failure to include a
license can prevent people from using your software??”no matter how insignificant
the plugin may be, it is against the law for someone else to distribute your
code without your permission.
For most projects, the MIT license (under which Rails itself is released) is sufficient.
Under that license, anyone can redistribute your software freely, provided
that they include a copy of the license (preserving your copyright notice). Including
the MIT-LICENSE file in the plugin is important in this case, as it makes
compliance automatic.
Rakefile
This is the core Rake task definition file for the plugin. Usually it is used to
launch tests for the plugin itself or package the plugin for distribution.
* In Ruby 1.9, Object#send will not automatically ignore access control on the receiving object, although the
new method Object#send! will.


Pages:
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136