endymion-ginsu 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +20 -0
- data/README.textile +77 -0
- data/Rakefile +40 -0
- data/VERSION +1 -0
- data/ginsu.gemspec +48 -0
- data/init.rb +1 -0
- data/install.rb +1 -0
- data/lib/ginsu.rb +1 -0
- data/tasks/ginsu_tasks.rake +4 -0
- data/test/ginsu_test.rb +8 -0
- data/test/test_helper.rb +3 -0
- data/uninstall.rb +1 -0
- metadata +65 -0
data/MIT-LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2009 [name of plugin creator]
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.textile
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
h1. Ginsu
|
|
2
|
+
|
|
3
|
+
Rails applications are not always born as Rails applications. Sometimes graphic designers create web designs using tools like Dreamweaver and then pass them off to software developers for implementation as web applications
|
|
4
|
+
|
|
5
|
+
But Rails has a different model for a web site than a tool like BBEdit. Rails thinks in terms of routes that lead to actions that render from templates that can use layouts, but Rapidweaver thinks in terms of pages. Every page includes the whole layout.
|
|
6
|
+
|
|
7
|
+
Ginsu manages the transition of a web project, from a static web site to the final implementation as a Rails application. Ginsu creates hybrid web sites with some sections served as static content and some sections powered by dynamic Rails actions.
|
|
8
|
+
|
|
9
|
+
h2. The Problem
|
|
10
|
+
|
|
11
|
+
You work in a high-volume web shop. Your job is the nerd stuff: programming the dynamic parts of web projects and dealing with site implementation and hosting. A producer gives you a .zip file and tells you that the deadline to get the site hosted is that afternoon. The .zip file contains static .html, .css, image and Flash files from a Dreamweaver project that a graphic designer developed. Then, the punchline: "Only pages X and Y need to be dynamic, leave the rest static. We're still designing it. Oh and we'll be updating this part of page X and this part of page Y once a week."
|
|
12
|
+
|
|
13
|
+
You don't want to work with a graphic designer every week to update your .erb or .haml files because that makes updates very expensive, which is not very agile. You don't want to configure your web server to serve only a few routes from your Rails app because making changes is hard and so that's also not very agile. You can't implement a CMS back-end for making it all irrelevant because you work in a high-volume shop and you only have an hour.
|
|
14
|
+
|
|
15
|
+
You need a way to bring your graphic designer into the agile process, so that you and the designer can both make updates to your respective areas of the project.
|
|
16
|
+
|
|
17
|
+
h2. The Solution
|
|
18
|
+
|
|
19
|
+
cd yourapp
|
|
20
|
+
mkdir static
|
|
21
|
+
|
|
22
|
+
Copy your static web into your Rails application's new "static" directory. If your static web site has a root index file called "index.html", then your Rails app should have a file called "static/index.html".
|
|
23
|
+
|
|
24
|
+
Configure Ginsu to slice sections of pages from the static web site into partial templates in your Rails application by adding slicing instructions to your config/initializers/ginsu.rb:
|
|
25
|
+
|
|
26
|
+
<pre><code># Create a 'header' partial by plucking header HTML from static/index.html using a CSS selector.
|
|
27
|
+
slice :css => 'h3.r a.l', :static => 'index.html', :partial => 'header'
|
|
28
|
+
|
|
29
|
+
# Create a 'header' partial by plucking header HTML from static/index.html using an xpath selector.
|
|
30
|
+
slice :xpath => '//h3/a[@class="l"]', :static => 'index.html', :partial => 'header'
|
|
31
|
+
|
|
32
|
+
# Just use the 'search' parameter to use either CSS or xpath.
|
|
33
|
+
slice :search => 'h3.r a.l', :static => 'index.html', :partial => 'header'
|
|
34
|
+
slice :search => '//h3/a[@class="m"]', :static => 'index.html', :partial => 'header'</pre></code>
|
|
35
|
+
|
|
36
|
+
Now when you run:
|
|
37
|
+
|
|
38
|
+
rake ginsu:update
|
|
39
|
+
|
|
40
|
+
...Ginsu will find the header in your static/index.html file and create a partial in app/views/_header.html.erb with the contents of the HTML element that it locates using your CSS or xpath selector.
|
|
41
|
+
|
|
42
|
+
Using this technique does not require your graphic designer to make any changes to the Dreamweaver project. You don't have to tag the section that you want to slice out, you simply describe where it's located and Ginsu will find it and slice it out.
|
|
43
|
+
|
|
44
|
+
h2. Installation
|
|
45
|
+
|
|
46
|
+
Install the Ginsu gem in your Rails application by adding this to your config/environment.rb:
|
|
47
|
+
|
|
48
|
+
config.gem "endymion-ginsu",
|
|
49
|
+
:lib => 'ginsu',
|
|
50
|
+
:source => 'http://gems.github.com',
|
|
51
|
+
:version => '>=0.0.0'
|
|
52
|
+
|
|
53
|
+
Make sure that you have the gem:
|
|
54
|
+
|
|
55
|
+
rake gems:install
|
|
56
|
+
|
|
57
|
+
Create your initializer, for configuring Ginsu:
|
|
58
|
+
|
|
59
|
+
rake ginsu:setup
|
|
60
|
+
|
|
61
|
+
Optionally, you can vendor the gem:
|
|
62
|
+
|
|
63
|
+
rake gems:unpack
|
|
64
|
+
|
|
65
|
+
h2. Configure
|
|
66
|
+
|
|
67
|
+
The Ginsu configuration is in the initializer file config/initializers/ginsu.rb:
|
|
68
|
+
|
|
69
|
+
h2. Features
|
|
70
|
+
|
|
71
|
+
h3. slice
|
|
72
|
+
|
|
73
|
+
A slice is the content of an HTML element that Ginsu will slice out of a static HTML document and drop into a Rails partial template.
|
|
74
|
+
|
|
75
|
+
h3. link
|
|
76
|
+
|
|
77
|
+
A link is a page or a folder that you want to be entirely served as static content. Ginsu will create symbolic links in your Rails application's public/ directory for each link.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
require 'rake/testtask'
|
|
3
|
+
require 'rake/rdoctask'
|
|
4
|
+
|
|
5
|
+
desc 'Default: run unit tests.'
|
|
6
|
+
task :default => :test
|
|
7
|
+
|
|
8
|
+
desc 'Test the ginsu plugin.'
|
|
9
|
+
Rake::TestTask.new(:test) do |t|
|
|
10
|
+
t.libs << 'lib'
|
|
11
|
+
t.libs << 'test'
|
|
12
|
+
t.pattern = 'test/**/*_test.rb'
|
|
13
|
+
t.verbose = true
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
desc 'Generate documentation for the ginsu plugin.'
|
|
17
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
18
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
19
|
+
rdoc.title = 'Ginsu'
|
|
20
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
|
21
|
+
rdoc.rdoc_files.include('README')
|
|
22
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
begin
|
|
26
|
+
require 'jeweler'
|
|
27
|
+
Jeweler::Tasks.new do |gemspec|
|
|
28
|
+
gemspec.name = 'ginsu'
|
|
29
|
+
gemspec.summary = 'A Ruby on Rails plugin for carving partials out of static web sites.'
|
|
30
|
+
gemspec.email = 'rap@endymion.com'
|
|
31
|
+
# gemspec.homepage = "http://github.com/technicalpickles/the-perfect-gem"
|
|
32
|
+
gemspec.description = <<-EOF
|
|
33
|
+
Ginsu is a Ruby on Rails plugin for carving partials out of static web sites, for including
|
|
34
|
+
graphic designers in the agile process for developing a web project.
|
|
35
|
+
EOF
|
|
36
|
+
gemspec.authors = ["Ryan Porter"]
|
|
37
|
+
end
|
|
38
|
+
rescue LoadError
|
|
39
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
|
40
|
+
end
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.0.0
|
data/ginsu.gemspec
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |s|
|
|
4
|
+
s.name = %q{ginsu}
|
|
5
|
+
s.version = "0.0.0"
|
|
6
|
+
|
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
8
|
+
s.authors = ["Ryan Porter"]
|
|
9
|
+
s.date = %q{2009-05-22}
|
|
10
|
+
s.description = %q{Ginsu is a Ruby on Rails plugin for carving partials out of static web sites, for including graphic designers in the agile process for developing a web project.}
|
|
11
|
+
s.email = %q{rap@endymion.com}
|
|
12
|
+
s.extra_rdoc_files = [
|
|
13
|
+
"README.textile"
|
|
14
|
+
]
|
|
15
|
+
s.files = [
|
|
16
|
+
"MIT-LICENSE",
|
|
17
|
+
"README.textile",
|
|
18
|
+
"Rakefile",
|
|
19
|
+
"VERSION",
|
|
20
|
+
"ginsu.gemspec",
|
|
21
|
+
"init.rb",
|
|
22
|
+
"install.rb",
|
|
23
|
+
"lib/ginsu.rb",
|
|
24
|
+
"tasks/ginsu_tasks.rake",
|
|
25
|
+
"test/ginsu_test.rb",
|
|
26
|
+
"test/test_helper.rb",
|
|
27
|
+
"uninstall.rb"
|
|
28
|
+
]
|
|
29
|
+
s.has_rdoc = true
|
|
30
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
|
31
|
+
s.require_paths = ["lib"]
|
|
32
|
+
s.rubygems_version = %q{1.3.1}
|
|
33
|
+
s.summary = %q{A Ruby on Rails plugin for carving partials out of static web sites.}
|
|
34
|
+
s.test_files = [
|
|
35
|
+
"test/ginsu_test.rb",
|
|
36
|
+
"test/test_helper.rb"
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
if s.respond_to? :specification_version then
|
|
40
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
41
|
+
s.specification_version = 2
|
|
42
|
+
|
|
43
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
|
44
|
+
else
|
|
45
|
+
end
|
|
46
|
+
else
|
|
47
|
+
end
|
|
48
|
+
end
|
data/init.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Include hook code here
|
data/install.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Install hook code here
|
data/lib/ginsu.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Ginsu
|
data/test/ginsu_test.rb
ADDED
data/test/test_helper.rb
ADDED
data/uninstall.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Uninstall hook code here
|
metadata
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: endymion-ginsu
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Ryan Porter
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
|
|
12
|
+
date: 2009-05-22 00:00:00 -07:00
|
|
13
|
+
default_executable:
|
|
14
|
+
dependencies: []
|
|
15
|
+
|
|
16
|
+
description: Ginsu is a Ruby on Rails plugin for carving partials out of static web sites, for including graphic designers in the agile process for developing a web project.
|
|
17
|
+
email: rap@endymion.com
|
|
18
|
+
executables: []
|
|
19
|
+
|
|
20
|
+
extensions: []
|
|
21
|
+
|
|
22
|
+
extra_rdoc_files:
|
|
23
|
+
- README.textile
|
|
24
|
+
files:
|
|
25
|
+
- MIT-LICENSE
|
|
26
|
+
- README.textile
|
|
27
|
+
- Rakefile
|
|
28
|
+
- VERSION
|
|
29
|
+
- ginsu.gemspec
|
|
30
|
+
- init.rb
|
|
31
|
+
- install.rb
|
|
32
|
+
- lib/ginsu.rb
|
|
33
|
+
- tasks/ginsu_tasks.rake
|
|
34
|
+
- test/ginsu_test.rb
|
|
35
|
+
- test/test_helper.rb
|
|
36
|
+
- uninstall.rb
|
|
37
|
+
has_rdoc: true
|
|
38
|
+
homepage:
|
|
39
|
+
post_install_message:
|
|
40
|
+
rdoc_options:
|
|
41
|
+
- --charset=UTF-8
|
|
42
|
+
require_paths:
|
|
43
|
+
- lib
|
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
45
|
+
requirements:
|
|
46
|
+
- - ">="
|
|
47
|
+
- !ruby/object:Gem::Version
|
|
48
|
+
version: "0"
|
|
49
|
+
version:
|
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: "0"
|
|
55
|
+
version:
|
|
56
|
+
requirements: []
|
|
57
|
+
|
|
58
|
+
rubyforge_project:
|
|
59
|
+
rubygems_version: 1.2.0
|
|
60
|
+
signing_key:
|
|
61
|
+
specification_version: 2
|
|
62
|
+
summary: A Ruby on Rails plugin for carving partials out of static web sites.
|
|
63
|
+
test_files:
|
|
64
|
+
- test/ginsu_test.rb
|
|
65
|
+
- test/test_helper.rb
|