** Parasite
Camping app developers no longer have any reason to envy their Ruby on Rails friends: Parasite brings generators, environments, and other Rails-y goodness to the world of Camping app development.
Parasite is currently at version 0.2. The Parasite package is composed of two gems: parasite and the camping_generator. The first provides a way to hook into the Rails development environment, while the second provides a generator for creating Camping apps quickly and painlessly.
*** Installation
To install parasite and the camping_generator fire up a terminal and:
$ sudo gem install parasite
parasite will require the camping_generator, along with Rails and Camping. More details on installing those packages can be found at their project pages.
If you are installing Camping for the first time, I would encourage you to install the camping-omnibus gem:
$ sudo gem install camping-omnibus --source http://code.whytheluckystiff.net
If you wish to install the camping_generator without the parasite gem, you can install it directly with:
$ sudo gem install camping_generator
Usage
**** Parasite
The parasite package consists of an executable and a set of Rake templates to facilitate the building of Camping apps. Using the executable, you can latch on to a “host” Rails project. Just run the executable in an existing Rails environment.
$ rails example_project
create
create app/controllers
...
$ cd example_project/
$ ls
README components doc public tmp
Rakefile config lib script vendor
app db log test
$ parasite
/path/to/parasite/parasite-0.2.0/bin/../templates/
/path/to/parasiteparasite-0.2.0/bin/../templates/server.rake
Installed parasite to ./vendor/plugins/parasite
$ ls -R vendor/plugins/parasite/
tasks
vendor/plugins/parasite//tasks:
server.rake
$
To see a description of the installed rake tasks,
$ rake -T
rake camping:server # Run the camping server with specified files or all .rb files in the apps directory
...
Now you’re ready to start creating camping apps, using the camping_generator.
**** Camping Generator
The camping_generator adds a generator for creating templated Camping apps. If you’re not familiar with the structure of single file Camping apps, see The Camping Short, Short Example. To see the usage,
$ script/generate camping
Usage: script/generate camping CampingName [options]
Options:
--scaffold Generate controllers and views
--session Add session support
--stylesheet Include a dynamic style sheet
Rails Info:
-v, --version Show the Rails version number and quit.
-h, --help Show this help message and quit.
General Options:
-p, --pretend Run but do not make any changes.
-f, --force Overwrite files that already exist.
-s, --skip Skip files that already exist.
-q, --quiet Suppress normal output.
-t, --backtrace Debugging: show backtrace on errors.
-c, --svn Modify files with subversion. (Note: svn must be in path)
Description:
The camping generator creates a new camping app in a single file in the /app
directory.
Example:
./script/generate camping --scaffold Blog Post User
This will create a Blog app with models (Posts and Users), views,
controllers, and the appropriate pre-amble and post-amble.
For example, let’s create the canonical jukebox app using the generator:
$ script/generate camping Jukebox Artist Record Track --scaffold --stylesheet
exists app/
create app/jukebox.rb
$ cat app/jukebox.rb
#!/usr/bin/env ruby
require 'camping'
Camping.goes :Jukebox
module Jukebox
end
module Jukebox::Models
class Artist < Base; end
class Record < Base; end
class Track < Base; end
...
Closer investigation of the jukebox app is left as an exercise to the reader.
*** Support
The best place for getting support is on #camping on irc.freenode.net. Just ask for mfredrickson. Also, you can file bugs and patches on Parasite project page on RubyForge.
*** Links
http://rubyforge.org/projects/parasite
http://rubyonrails.com/
http://code.whytheluckystiff.net/camping
Camping app developers no longer have any reason to envy their Ruby on Rails friends: Parasite brings generators, environments, and other Rails-y goodness to the world of Camping app development.
Parasite is currently at version 0.2. The Parasite package is composed of two gems: parasite and the camping_generator. The first provides a way to hook into the Rails development environment, while the second provides a generator for creating Camping apps quickly and painlessly.
*** Installation
To install parasite and the camping_generator fire up a terminal and:
$ sudo gem install parasite
parasite will require the camping_generator, along with Rails and Camping. More details on installing those packages can be found at their project pages.
If you are installing Camping for the first time, I would encourage you to install the camping-omnibus gem:
$ sudo gem install camping-omnibus --source http://code.whytheluckystiff.net
If you wish to install the camping_generator without the parasite gem, you can install it directly with:
$ sudo gem install camping_generator
Usage
**** Parasite
The parasite package consists of an executable and a set of Rake templates to facilitate the building of Camping apps. Using the executable, you can latch on to a “host” Rails project. Just run the executable in an existing Rails environment.
$ rails example_project
create
create app/controllers
...
$ cd example_project/
$ ls
README components doc public tmp
Rakefile config lib script vendor
app db log test
$ parasite
/path/to/parasite/parasite-0.2.0/bin/../templates/
/path/to/parasiteparasite-0.2.0/bin/../templates/server.rake
Installed parasite to ./vendor/plugins/parasite
$ ls -R vendor/plugins/parasite/
tasks
vendor/plugins/parasite//tasks:
server.rake
$
To see a description of the installed rake tasks,
$ rake -T
rake camping:server # Run the camping server with specified files or all .rb files in the apps directory
...
Now you’re ready to start creating camping apps, using the camping_generator.
**** Camping Generator
The camping_generator adds a generator for creating templated Camping apps. If you’re not familiar with the structure of single file Camping apps, see The Camping Short, Short Example. To see the usage,
$ script/generate camping
Usage: script/generate camping CampingName [options]
Options:
--scaffold Generate controllers and views
--session Add session support
--stylesheet Include a dynamic style sheet
Rails Info:
-v, --version Show the Rails version number and quit.
-h, --help Show this help message and quit.
General Options:
-p, --pretend Run but do not make any changes.
-f, --force Overwrite files that already exist.
-s, --skip Skip files that already exist.
-q, --quiet Suppress normal output.
-t, --backtrace Debugging: show backtrace on errors.
-c, --svn Modify files with subversion. (Note: svn must be in path)
Description:
The camping generator creates a new camping app in a single file in the /app
directory.
Example:
./script/generate camping --scaffold Blog Post User
This will create a Blog app with models (Posts and Users), views,
controllers, and the appropriate pre-amble and post-amble.
For example, let’s create the canonical jukebox app using the generator:
$ script/generate camping Jukebox Artist Record Track --scaffold --stylesheet
exists app/
create app/jukebox.rb
$ cat app/jukebox.rb
#!/usr/bin/env ruby
require 'camping'
Camping.goes :Jukebox
module Jukebox
end
module Jukebox::Models
class Artist < Base; end
class Record < Base; end
class Track < Base; end
...
Closer investigation of the jukebox app is left as an exercise to the reader.
*** Support
The best place for getting support is on #camping on irc.freenode.net. Just ask for mfredrickson. Also, you can file bugs and patches on Parasite project page on RubyForge.
*** Links
http://rubyforge.org/projects/parasite
http://rubyonrails.com/
http://code.whytheluckystiff.net/camping