fir 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,9 @@
1
- Fir Isn't Rails
2
- ===============
1
+ Fir
2
+ ===
3
3
 
4
- Fir Isn't Rails is a minimalist Ruby framework for small, static sites. It's Rack-based, so it runs on Phusion Passenger.
4
+ Fir is a minimalist Ruby framework for small, mostly-static sites. It provides an optimized workflow for sites where a CMS would be overkill, but static HTML would be like a return to the dark ages.
5
+
6
+ It's Rack-based, so it runs on Phusion Passenger. But even if your web host doesn't support Ruby, fear not! Fir allows you to export static HTML to a live server with a single command. That means it works with every web host that supports SSH and mod_rewrite.
5
7
 
6
8
  Warning: Alpha Release
7
9
  ======================
@@ -98,19 +100,42 @@ Most of us will be perfectly happy managing content by editing the files in the
98
100
 
99
101
  Fir isn't a CMS. Instead, it exposes a minimal, RESTful API for managing content. The idea is that content should be managed with specially-designed Fir clients, rather than through Fir itself. You can see how this works by downloading the [example app](http://github.com/jarrett/fir-example), booting it, and visiting `/manage-content.html` in your browser. The source of that page is available [on GitHub](http://github.com/jarrett/fir-example/blob/master/public/manage-content.html).
100
102
 
103
+ As of yet, no Fir client exists, though one is in development. And anyone can make one.
104
+
101
105
  Fir's API uses HTTP basic authentication. The users list is stored in `users.yml`. To create a user or change an existing user's password, run:
102
106
 
103
107
  rake users:add user=username pass=password
104
108
 
105
- ## Exporting to HTML ##
109
+ ## Exporting HTML to a Remote Server ##
106
110
 
107
- You can export your whole site to static HTML. If you deploy that, the only thing you'll need on your server is mod_rewrite. To export:
111
+ If your web host doesn't support Passenger, you can still enjoy (almost) all the goodness of Fir. Fir makes it dead-simple to export your entire site to static HTML on a remote server.
108
112
 
109
- rake export dir=~/sites/exported_example
113
+ To make this work, you'll need rsync and ssh. Make sure they're in your path. In other words, you must be able to run `rsync` and `ssh` from the command line. You don't need to know how to use them; they just need to be installed.
114
+
115
+ Setup `deploy.yml` in the root directory of your Fir project. It should look something like this:
116
+
117
+ # deploy.yaml
118
+ host: example.com
119
+ user: your_username
120
+ path: /home/your_username/public_html
121
+
122
+ Now you can run this convenient Rake task to deploy a static version of your site to the server:
123
+
124
+ rake export_to_server
110
125
 
111
- The export task boots a Rackup server and accesses each page to generate the cache. It then copies the cache and the rest of the public folder to the output directory. By default, Rackup runs on port 9292. You can make it use a different port like this:
126
+ You can also skip `deploy.yml` and run the Rake task like this:
112
127
 
113
- rake export dir=~/sites/exported_example port=3000
128
+ rake export_to_server dest=your_username@example.com:/home/your_username/public_html
129
+
130
+ Behind the scenes, the export task accesses each page to generate the cache. It copies the cache and the rest of the public files to your server using rsync.
131
+
132
+ There's one obvious downside to this approach: you'll lose any dynamic features you may have built in, as well as Fir's admin API.
133
+
134
+ ## Exporting to HTML Locally ##
135
+
136
+ You can also export your whole site to static HTML on your local machine. If you To export:
137
+
138
+ rake export dir=~/sites/exported_example
114
139
 
115
140
  Webserver Support
116
141
  =================
data/bin/fir CHANGED
@@ -1,17 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $:.unshift '/Users/jarrettcolby/apps/fir/lib'
3
+ # When developing the gem, we want to be able to run this executable using the
4
+ # source in our development directory instead of the installed gem. The tests must
5
+ # run "export TESTING_FIR_BIN=1" before invoking this executable.
6
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib') if ENV['TESTING_FIR_BIN'] == '1'
7
+
4
8
  require 'rubygems'
5
9
  require 'fir'
6
- include FileUtils
7
-
8
- unless ARGV.length >= 1
9
- raise 'Usage: fir path'
10
- end
10
+ require 'fir/generator'
11
11
 
12
- fir_root = ARGV[0]
13
- if File.exists?(fir_root)
14
- raise "#{fir_root} already exists! Aborting."
15
- end
16
- cp_r FIR_SKELETON_ROOT, fir_root
17
- puts "Created new Fir site in #{fir_root}"
12
+ Fir.generate!(ARGV)
@@ -1,6 +1,9 @@
1
1
  FIR_ROOT = File.expand_path(File.dirname(__FILE__))
2
2
 
3
- #$:.unshift File.expand_path(File.join(File.dirname(__FILE__), '../lib')) # Enable this to run against the code in the parent directory instead of the intalled gem
3
+ # When developing the gem, we want to be able to run Rake tasks using the
4
+ # source in our development directory instead of the installed gem. The tests must
5
+ # run "export TESTING_FIR_TASKS=1" before invoking this executable.
6
+ $:.unshift File.expand_path(File.join(File.dirname(__FILE__), '../lib')) if ENV['TESTING_FIR_TASKS'] == '1'
4
7
  require 'rubygems'
5
8
  require 'fir'
6
9
 
@@ -0,0 +1,3 @@
1
+ host: example.com
2
+ user: me
3
+ path: /www-root
@@ -0,0 +1,46 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml">
4
+
5
+ <head>
6
+ <title>
7
+
8
+ Acme Co.
9
+ </title>
10
+ <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
11
+
12
+
13
+ <!--[if !IE 6]><!-->
14
+ <link href="http://yui.yahooapis.com/2.8.0r4/build/reset/reset-min.css" rel="stylesheet" type="text/css">
15
+ <link href="/stylesheets/style.css" rel="stylesheet" type="text/css"/>
16
+ <!--<![endif]-->
17
+
18
+ <!--[if lte IE 6]>
19
+ <link rel="stylesheet" type="text/css" media="screen, projection" href="http://universal-ie6-css.googlecode.com/files/ie6.0.3.css" />
20
+ <![endif]-->
21
+ </head>
22
+
23
+ <body>
24
+
25
+ <div id="container">
26
+ <ul id="top_nav">
27
+
28
+ <!-- current_page is true if the menu item links to the current page, false otherwise.
29
+ It's usually not necessary, since you'll automatically get either an <a> or <span class="selected">.-->
30
+ <li><a href="/">Home</a></li>
31
+
32
+ <!-- current_page is true if the menu item links to the current page, false otherwise.
33
+ It's usually not necessary, since you'll automatically get either an <a> or <span class="selected">.-->
34
+ <li><a href="/products">Products</a></li>
35
+
36
+ <!-- current_page is true if the menu item links to the current page, false otherwise.
37
+ It's usually not necessary, since you'll automatically get either an <a> or <span class="selected">.-->
38
+ <li><a href="/contact-us">Contact Us</a></li>
39
+
40
+ </ul>
41
+
42
+ <h1>Sorry, there is nothing at this address. (404 Not Found)</h1>
43
+ </div>
44
+
45
+ </body>
46
+ </html>
@@ -0,0 +1,48 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml">
4
+
5
+ <head>
6
+ <title>
7
+
8
+ Acme Co.
9
+ </title>
10
+ <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
11
+
12
+
13
+ <!--[if !IE 6]><!-->
14
+ <link href="http://yui.yahooapis.com/2.8.0r4/build/reset/reset-min.css" rel="stylesheet" type="text/css">
15
+ <link href="/stylesheets/style.css" rel="stylesheet" type="text/css"/>
16
+ <!--<![endif]-->
17
+
18
+ <!--[if lte IE 6]>
19
+ <link rel="stylesheet" type="text/css" media="screen, projection" href="http://universal-ie6-css.googlecode.com/files/ie6.0.3.css" />
20
+ <![endif]-->
21
+ </head>
22
+
23
+ <body>
24
+
25
+ <div id="container">
26
+ <ul id="top_nav">
27
+
28
+ <!-- current_page is true if the menu item links to the current page, false otherwise.
29
+ It's usually not necessary, since you'll automatically get either an <a> or <span class="selected">.-->
30
+ <li><a href="/">Home</a></li>
31
+
32
+ <!-- current_page is true if the menu item links to the current page, false otherwise.
33
+ It's usually not necessary, since you'll automatically get either an <a> or <span class="selected">.-->
34
+ <li><a href="/products">Products</a></li>
35
+
36
+ <!-- current_page is true if the menu item links to the current page, false otherwise.
37
+ It's usually not necessary, since you'll automatically get either an <a> or <span class="selected">.-->
38
+ <li><span class="selected">Contact Us</span></li>
39
+
40
+ </ul>
41
+
42
+ <h1 id='contact_us'>Contact Us</h1>
43
+
44
+ <p>555-123-4567 98765 Runner Road Coyote, AZ</p>
45
+ </div>
46
+
47
+ </body>
48
+ </html>
@@ -0,0 +1,52 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml">
4
+
5
+ <head>
6
+ <title>
7
+
8
+ Home -
9
+
10
+ Acme Co.
11
+ </title>
12
+ <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
13
+
14
+ <meta name="description" content="Acme Co. sells all the widgets you need to capture road runners and other desert fauna"/>
15
+
16
+
17
+ <!--[if !IE 6]><!-->
18
+ <link href="http://yui.yahooapis.com/2.8.0r4/build/reset/reset-min.css" rel="stylesheet" type="text/css">
19
+ <link href="/stylesheets/style.css" rel="stylesheet" type="text/css"/>
20
+ <!--<![endif]-->
21
+
22
+ <!--[if lte IE 6]>
23
+ <link rel="stylesheet" type="text/css" media="screen, projection" href="http://universal-ie6-css.googlecode.com/files/ie6.0.3.css" />
24
+ <![endif]-->
25
+ </head>
26
+
27
+ <body>
28
+
29
+ <div id="container">
30
+ <ul id="top_nav">
31
+
32
+ <!-- current_page is true if the menu item links to the current page, false otherwise.
33
+ It's usually not necessary, since you'll automatically get either an <a> or <span class="selected">.-->
34
+ <li><a href="/">Home</a></li>
35
+
36
+ <!-- current_page is true if the menu item links to the current page, false otherwise.
37
+ It's usually not necessary, since you'll automatically get either an <a> or <span class="selected">.-->
38
+ <li><a href="/products">Products</a></li>
39
+
40
+ <!-- current_page is true if the menu item links to the current page, false otherwise.
41
+ It's usually not necessary, since you'll automatically get either an <a> or <span class="selected">.-->
42
+ <li><a href="/contact-us">Contact Us</a></li>
43
+
44
+ </ul>
45
+
46
+ <h1 id='home'>Home</h1>
47
+
48
+ <p>Welcome to Acme Company!</p>
49
+ </div>
50
+
51
+ </body>
52
+ </html>
@@ -0,0 +1,52 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml">
4
+
5
+ <head>
6
+ <title>
7
+
8
+ Acme Co.
9
+ </title>
10
+ <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
11
+
12
+
13
+ <!--[if !IE 6]><!-->
14
+ <link href="http://yui.yahooapis.com/2.8.0r4/build/reset/reset-min.css" rel="stylesheet" type="text/css">
15
+ <link href="/stylesheets/style.css" rel="stylesheet" type="text/css"/>
16
+ <!--<![endif]-->
17
+
18
+ <!--[if lte IE 6]>
19
+ <link rel="stylesheet" type="text/css" media="screen, projection" href="http://universal-ie6-css.googlecode.com/files/ie6.0.3.css" />
20
+ <![endif]-->
21
+ </head>
22
+
23
+ <body>
24
+
25
+ <div id="container">
26
+ <ul id="top_nav">
27
+
28
+ <!-- current_page is true if the menu item links to the current page, false otherwise.
29
+ It's usually not necessary, since you'll automatically get either an <a> or <span class="selected">.-->
30
+ <li><a href="/">Home</a></li>
31
+
32
+ <!-- current_page is true if the menu item links to the current page, false otherwise.
33
+ It's usually not necessary, since you'll automatically get either an <a> or <span class="selected">.-->
34
+ <li><a href="/products">Products</a></li>
35
+
36
+ <!-- current_page is true if the menu item links to the current page, false otherwise.
37
+ It's usually not necessary, since you'll automatically get either an <a> or <span class="selected">.-->
38
+ <li><a href="/contact-us">Contact Us</a></li>
39
+
40
+ </ul>
41
+
42
+ <h1>Dynamite Plus!</h1>
43
+
44
+ <p><a href="/products">Back to products</a></p>
45
+
46
+ <p>Like our popular <a href="/products/dynamite">Dynamite</a>, but even more powerful!</p>
47
+
48
+ <p>Released: Feb 1st 1956 (54 years ago)</p>
49
+ </div>
50
+
51
+ </body>
52
+ </html>
@@ -0,0 +1,52 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml">
4
+
5
+ <head>
6
+ <title>
7
+
8
+ Acme Co.
9
+ </title>
10
+ <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
11
+
12
+
13
+ <!--[if !IE 6]><!-->
14
+ <link href="http://yui.yahooapis.com/2.8.0r4/build/reset/reset-min.css" rel="stylesheet" type="text/css">
15
+ <link href="/stylesheets/style.css" rel="stylesheet" type="text/css"/>
16
+ <!--<![endif]-->
17
+
18
+ <!--[if lte IE 6]>
19
+ <link rel="stylesheet" type="text/css" media="screen, projection" href="http://universal-ie6-css.googlecode.com/files/ie6.0.3.css" />
20
+ <![endif]-->
21
+ </head>
22
+
23
+ <body>
24
+
25
+ <div id="container">
26
+ <ul id="top_nav">
27
+
28
+ <!-- current_page is true if the menu item links to the current page, false otherwise.
29
+ It's usually not necessary, since you'll automatically get either an <a> or <span class="selected">.-->
30
+ <li><a href="/">Home</a></li>
31
+
32
+ <!-- current_page is true if the menu item links to the current page, false otherwise.
33
+ It's usually not necessary, since you'll automatically get either an <a> or <span class="selected">.-->
34
+ <li><a href="/products">Products</a></li>
35
+
36
+ <!-- current_page is true if the menu item links to the current page, false otherwise.
37
+ It's usually not necessary, since you'll automatically get either an <a> or <span class="selected">.-->
38
+ <li><a href="/contact-us">Contact Us</a></li>
39
+
40
+ </ul>
41
+
42
+ <h1>Dynamite</h1>
43
+
44
+ <p><a href="/products">Back to products</a></p>
45
+
46
+ <p>Acme's most popular product! Suitable for all forms of demolition and hunting road runners.</p>
47
+
48
+ <p>Released: Jan 19th 1956 (54 years ago)</p>
49
+ </div>
50
+
51
+ </body>
52
+ </html>
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml">
4
+
5
+ <head>
6
+ <title>
7
+
8
+ Products -
9
+
10
+ Acme Co.
11
+ </title>
12
+ <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
13
+
14
+ <meta name="description" content="Acme Company's products"/>
15
+
16
+
17
+ <!--[if !IE 6]><!-->
18
+ <link href="http://yui.yahooapis.com/2.8.0r4/build/reset/reset-min.css" rel="stylesheet" type="text/css">
19
+ <link href="/stylesheets/style.css" rel="stylesheet" type="text/css"/>
20
+ <!--<![endif]-->
21
+
22
+ <!--[if lte IE 6]>
23
+ <link rel="stylesheet" type="text/css" media="screen, projection" href="http://universal-ie6-css.googlecode.com/files/ie6.0.3.css" />
24
+ <![endif]-->
25
+ </head>
26
+
27
+ <body>
28
+
29
+ <div id="container">
30
+ <ul id="top_nav">
31
+
32
+ <!-- current_page is true if the menu item links to the current page, false otherwise.
33
+ It's usually not necessary, since you'll automatically get either an <a> or <span class="selected">.-->
34
+ <li><a href="/">Home</a></li>
35
+
36
+ <!-- current_page is true if the menu item links to the current page, false otherwise.
37
+ It's usually not necessary, since you'll automatically get either an <a> or <span class="selected">.-->
38
+ <li><a href="/products">Products</a></li>
39
+
40
+ <!-- current_page is true if the menu item links to the current page, false otherwise.
41
+ It's usually not necessary, since you'll automatically get either an <a> or <span class="selected">.-->
42
+ <li><a href="/contact-us">Contact Us</a></li>
43
+
44
+ </ul>
45
+
46
+ <h1 id='products'>Products</h1>
47
+
48
+ <ul>
49
+ <li><a href='/products/dynamite'>Dynamite</a></li>
50
+
51
+ <li><a href='/products/dynamite%2B'>Dynamite Plus!</a></li>
52
+
53
+ <li><a href='/products/mouse-trap'>Mouse Trap</a></li>
54
+ </ul>
55
+ </div>
56
+
57
+ </body>
58
+ </html>
@@ -0,0 +1,52 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml">
4
+
5
+ <head>
6
+ <title>
7
+
8
+ Acme Co.
9
+ </title>
10
+ <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
11
+
12
+
13
+ <!--[if !IE 6]><!-->
14
+ <link href="http://yui.yahooapis.com/2.8.0r4/build/reset/reset-min.css" rel="stylesheet" type="text/css">
15
+ <link href="/stylesheets/style.css" rel="stylesheet" type="text/css"/>
16
+ <!--<![endif]-->
17
+
18
+ <!--[if lte IE 6]>
19
+ <link rel="stylesheet" type="text/css" media="screen, projection" href="http://universal-ie6-css.googlecode.com/files/ie6.0.3.css" />
20
+ <![endif]-->
21
+ </head>
22
+
23
+ <body>
24
+
25
+ <div id="container">
26
+ <ul id="top_nav">
27
+
28
+ <!-- current_page is true if the menu item links to the current page, false otherwise.
29
+ It's usually not necessary, since you'll automatically get either an <a> or <span class="selected">.-->
30
+ <li><a href="/">Home</a></li>
31
+
32
+ <!-- current_page is true if the menu item links to the current page, false otherwise.
33
+ It's usually not necessary, since you'll automatically get either an <a> or <span class="selected">.-->
34
+ <li><a href="/products">Products</a></li>
35
+
36
+ <!-- current_page is true if the menu item links to the current page, false otherwise.
37
+ It's usually not necessary, since you'll automatically get either an <a> or <span class="selected">.-->
38
+ <li><a href="/contact-us">Contact Us</a></li>
39
+
40
+ </ul>
41
+
42
+ <h1>Mouse Trap</h1>
43
+
44
+ <p><a href="/products">Back to products</a></p>
45
+
46
+ <p>Catch those varmints!</p>
47
+
48
+ <p>Released: May 12th 1964 (46 years ago)</p>
49
+ </div>
50
+
51
+ </body>
52
+ </html>