Finally , got this book from National Library (PNM) last month. It tells us about how to deploy Ruby and Rails Application by using Mongrel , Rake , Capistrano installation and deploy it in rails.The keys to using Subversion with Rails are maintaining the right structure. You want to keep the right stuff under source control and keep the wrong stuff out. Setting up your application’s repository right the first time will save you time and frustration. A number of items in a Rails application do not belong in source control. Many a new Rails developer has clobbered his team’s database.yml file or checked in a 5MB log file. Both of these problems are with the Subversion setup, not with Rails or even the Rails developer. In an optimal setup, each developer would have their own database.yml file and log files. Each development or production instance of your application will have its own version of these files, so they need to stay out of the code repository. You might already have a Subversion repository already, but I’ll assume you don’t and walk you through the entire process from scratch.
Many simple applications simply run off the trunk. Others will feel more comfortable deploying from a stable branch. Several great books address this topic better than I possibly could, but I do want you to get a feel for what’s involved. For detailed information on this topic, you should read Pragmatic Version Control [Mas05].
The changes you do on trunk might not be fully tested, or you could be in the middle of a major refactoring when an urgent bug report comes in. You need to have the ability to deploy a fixed version of the application without having to deploy the full set of changes since the last deployment. In Subversion, you can copy a branch of development to another name, and you can set up Capistrano to deploy from your stable branch instead of your development branch. Developers call this technique stable branch deployment. Let’s create the stable branch, which will be a copy of trunk:
$ svn copy –message “Create the stable branch” ֓
Committed revision 234.
When you are ready to merge a set of changes to the stable branch, check the last commit message on the branch to know which revisions you need to merge:
$ svn log –revision HEAD:1 –limit 1 ֓
r422 | ezra | 2007-05-30 21:30:27 -0500 (30 may 2007) | 1 line
Merged r406:421 from trunk/
Using the information in the log message, you can now merge all the changes to the branch:
$ svn merge –revision 422:436 ֓
Finally, commit and deploy:
$ svn commit –message “Merged r422:436 from trunk/”
Transmitting file data ….
Committed revision 437.
$ cap deploy_with_migrations
You now have a good Subversion repository, and you can use it to
deploy. You’ve ignored the files that will break your developers’ will or just your application, and you’ve used common Rails conventions. Still, you should know a few things about developing with Subversion with successful deployment in mind.
You need to install Capistrano only on your development machine, not the server, because Capistrano runs commands on the server with a regular SSH session. If you’ve installed Rails, you probably already have RubyGems on your system. To install Capistrano, issue this command on your local machine:
local$ sudo gem install capistrano
Attempting local installation of ‘capistrano’
Local gem file not found: capistrano*.gem
Attempting remote installation of ‘capistrano’
Successfully installed capistrano-2.0.0
Successfully installed net-ssh-1.1.1
Successfully installed net-sftp-1.1.0
Installing ri documentation for net-ssh-1.1.1…
Installing ri documentation for net-sftp-1.1.0…
Installing RDoc documentation for net-ssh-1.1.1…
Installing RDoc documentation for net-sftp-1.1.0…
While you are installing gems, install the termios gem as well. (Sorry, termios is not readily available for Windows.) By default, Capistrano echoes your password to the screen when you deploy. Installing the termios gem keeps your password hidden from wandering eyes.
p/s:- This is a good book to read when a user or a programmer wants to deploy ruby and rails in their server or production machine. Some of these excerpt are taken from the book Deploying Rails Application – A Step By Step Guide written by Ezra Zygmuntowicz , Bruce Tate and Clinton Begin , publish by The Pragmatic Bookshelf.
The Ultimate CSS Reference.
Got this book from National Library (PNM) last month. It tells us about the usage , syntax and implementation of CSS in HTML website design and website programming. In XML documents, including XHTML served as XML, an external style sheet can be referenced using a processing instruction (PI). Such processing instructions are normally part of the XML prologue, coming after the XML declaration, but before the doctype declaration (if there is one) and the root element’s start tag. This example shows an XML prologue with a persistent style sheet (base.css), a preferred style sheet (default.css), and an alternative style sheet (custom.css):
<?xml version=”1.0″ encoding=”utf-8″?>
<?xml-stylesheet type=”text/css” href=”/base.css”?>
<?xml-stylesheet type=”text/css” href=”/default.css”
<?xml-stylesheet type=”text/css” href=”/custom.css”
An external style sheet can’t contain SGML comments (<!– … –>) or HTML tags (including <style> and <style>). Nor can it use SGML character references (such as ©) or character entity references (such as ©). If you need to use special characters in an external style sheet, and they can’t be represented through the style sheet’s character encoding, specify them with CSS escape
■ The content type of the style element type in HTML is CDATA, which means that character references (numeric character references or character entity references) in an internal style sheet aren’t parsed. If you need to use special characters in an internal style sheet, and they can’t be represented with the document’s character encoding, specify them with CSS escape notation (p. 43).
In XHTML, the content type is #PCDATA, which means that character references are parsed, but only if the document’s served as XML.
■ Unlike in style elements, character references are parsed in style attributes, even in HTML.
Some of the early browser implementations of CSS were fraught with problems—they only supported parts of the specification, and in some cases, the implementation of certain CSS features didn’t comply with the specification. Today’s browsers generally provide excellent support for the latest CSS specification, even incorporating features that aren’t yet in the official specification, but will likely appear in the next version. Due to the implementation deficiencies in early browsers, many old style sheets were written to work with the then-contemporary browsers rather than to comply.
So how does doctype sniffing work? Which declarations trigger standards mode, quirks mode, and almost standards mode? The document type definition reference, for HTML and XHTML, consists of the string PUBLIC followed by a formal public identifier (FPI), optionally followed by a formal system identifier (FSI), which is the URL for the DTD.
Here’s an example of a doctype declaration that contains both an FPI and an FSI:
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01//EN”
This example contains only the FPI:
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
Doctype sniffing works by detecting which of these parts are present in the doctype declaration. If an FPI is present, but an FSI isn’t, browsers generally choose quirks mode, since this was the common way of writing doctype declarations in the old days. Browsers also choose quirks mode if the doctype declaration is missing altogether—which used to be very common—or is malformed.
The @import at-rule is a mechanism for importing one style sheet into another. It should be followed by a URI value and a semicolon, but it’s possible to use a string value instead of the URI value. Where relative URIs are used, they’re interpreted as being relative to the importing style sheet. You can also specify one or more media types to which the imported style sheet applies—simply append a comma-separated list of media types to the URI.
Here’s an example of a media type specification:
@import url(/css/screen.css) screen, projection;
The @import rules in a style sheet must precede all rule sets. An @import rule that follows one or more rule sets will be ignored. As such, the example below shows an incorrect usage; because it appears after a rule set, the following @import rule will be ignored:
/* The following rule will be ignored */
p/s:- There are lots of CSS syntax and CSS programming language that we can learn from. The book tells us some part of the CSS syntax and language that we can implement in HTML website coding. Some of the articles above is an excerpt from the book -The Ultimate CSS Reference written by Tommy Olsen and Paul O`Brien published by SitePoint Pty Ltd.