rails_jumpstart 1.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/History.txt +3 -0
- data/License.txt +20 -0
- data/Manifest.txt +17 -0
- data/README.txt +94 -0
- data/Rakefile +139 -0
- data/bin/jumpstart +190 -0
- data/lib/rails_jumpstart/version.rb +9 -0
- data/lib/rails_jumpstart.rb +4 -0
- data/scripts/txt2html +67 -0
- data/setup.rb +1585 -0
- data/spec/rails_jumpstart_spec.rb +6 -0
- data/spec/spec_helper.rb +2 -0
- data/website/index.html +156 -0
- data/website/index.txt +79 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +138 -0
- data/website/template.rhtml +48 -0
- metadata +67 -0
data/History.txt
ADDED
data/License.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2007 FIXME full name
|
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/Manifest.txt
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
History.txt
|
2
|
+
License.txt
|
3
|
+
Manifest.txt
|
4
|
+
README.txt
|
5
|
+
Rakefile
|
6
|
+
bin/jumpstart
|
7
|
+
lib/rails_jumpstart.rb
|
8
|
+
lib/rails_jumpstart/version.rb
|
9
|
+
scripts/txt2html
|
10
|
+
setup.rb
|
11
|
+
spec/spec_helper.rb
|
12
|
+
spec/rails_jumpstart_spec.rb
|
13
|
+
website/index.html
|
14
|
+
website/index.txt
|
15
|
+
website/javascripts/rounded_corners_lite.inc.js
|
16
|
+
website/stylesheets/screen.css
|
17
|
+
website/template.rhtml
|
data/README.txt
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
README for Rails Jumpstart
|
2
|
+
==========================
|
3
|
+
|
4
|
+
Rails Jumpstart was created because I was tired of setting up my Rails applications with plugins that
|
5
|
+
I normally used.
|
6
|
+
|
7
|
+
I keep a list of my most commonly used plugins or favorites in a text file and would have to copy
|
8
|
+
and paste the url to the repository for each one into my shell when I setup a new project.
|
9
|
+
|
10
|
+
Keeping up with the URLs, plugins, and doing the setup just got annoying. So all I have to do now is create
|
11
|
+
a "plugins.yml" file in your home directory using this format:
|
12
|
+
|
13
|
+
defaults:
|
14
|
+
haml:
|
15
|
+
name: HAML and SASS
|
16
|
+
short_description: Rails markup and templating engine
|
17
|
+
repository: http://svn.hamptoncatlin.com/haml/trunk
|
18
|
+
command: mv vendor/plugins/trunk vendor/plugins/haml
|
19
|
+
|
20
|
+
make_r:
|
21
|
+
name: Make Resourceful
|
22
|
+
short_description: Awesome development using RESTful architecture
|
23
|
+
repository: http://svn.hamptoncatlin.com/make_resourceful/trunk
|
24
|
+
command: mv vendor/plugins/trunk vendor/plugins/make_resourceful
|
25
|
+
|
26
|
+
optionals:
|
27
|
+
attachment_fu:
|
28
|
+
name: Attachment Fu
|
29
|
+
short_description: File Uploads made easy! Supports S3 and Image Processing!
|
30
|
+
repository: http://svn.techno-weenie.net/projects/plugins/attachment_fu/
|
31
|
+
|
32
|
+
The defaults are plugins that you normal load automatically and optionals are basically favorites.
|
33
|
+
|
34
|
+
After you create this plugins.yml file you just go to your rails directory and you have the following
|
35
|
+
POWERS!
|
36
|
+
|
37
|
+
# This will list your listed plugin short_names and a brief description on the commands to install them:
|
38
|
+
jumpstart
|
39
|
+
|
40
|
+
# If you want a full listing of your plugins and their descriptions (if you forget like me) then:
|
41
|
+
jumpstart descriptions
|
42
|
+
|
43
|
+
# This will install all the default plugins you have listed:
|
44
|
+
jumpstart jump
|
45
|
+
|
46
|
+
# This will install your defaults and your optional plugin if it's short_name is foo:
|
47
|
+
jumpstart jump -foo
|
48
|
+
|
49
|
+
# This is if you have your plugins with the short_names foo and bar in your defaults and don't want them
|
50
|
+
to install:
|
51
|
+
|
52
|
+
jumpstart jump --no-foo --no-bar
|
53
|
+
|
54
|
+
# You don't want to install any defaults but you do want to install some plugin
|
55
|
+
jumpstart jump --no-defaults -some_plugin
|
56
|
+
|
57
|
+
# You have the ability to also install on edge rails as well just by adding on_edge
|
58
|
+
jumpstart jump on_edge -foo
|
59
|
+
|
60
|
+
|
61
|
+
#########################################
|
62
|
+
More about "plugins.yml"
|
63
|
+
#########################################
|
64
|
+
|
65
|
+
* The short names of the yaml files are the names followed by the colon:
|
66
|
+
optionals:
|
67
|
+
[shorntname_here]:
|
68
|
+
name: Foo
|
69
|
+
short_description: Some Plugin that rocks!
|
70
|
+
repository: Repository!
|
71
|
+
|
72
|
+
* If you want to group together some plugins you use together - for instance - rspec plugin and autotest you
|
73
|
+
can add numbers under the plugin listing before the descriptons like so:
|
74
|
+
[shorntname_here]:
|
75
|
+
1:
|
76
|
+
name: Foo
|
77
|
+
short_description: Some Plugin that rocks!
|
78
|
+
repository: Repository URL
|
79
|
+
|
80
|
+
2:
|
81
|
+
name: Bar
|
82
|
+
short_descripton: Bar!
|
83
|
+
repository: Repostitory URL
|
84
|
+
|
85
|
+
* If you want to run a commmand that might do something after you plugin is installed. It will run from
|
86
|
+
the rails root directory and you just add command: [command] after your plugin description.
|
87
|
+
|
88
|
+
short_name:
|
89
|
+
name: Foo
|
90
|
+
short_description: Some Plugin that rocks!
|
91
|
+
respository: Repository URL
|
92
|
+
command: echo "Rock ON Brother!"
|
93
|
+
|
94
|
+
There will be a plugins example file in the example folders of this gem.
|
data/Rakefile
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/clean'
|
4
|
+
require 'rake/testtask'
|
5
|
+
require 'rake/packagetask'
|
6
|
+
require 'rake/gempackagetask'
|
7
|
+
require 'rake/rdoctask'
|
8
|
+
require 'rake/contrib/rubyforgepublisher'
|
9
|
+
require 'fileutils'
|
10
|
+
require 'hoe'
|
11
|
+
begin
|
12
|
+
require 'spec/rake/spectask'
|
13
|
+
rescue LoadError
|
14
|
+
puts 'To use rspec for testing you must install rspec gem:'
|
15
|
+
puts '$ sudo gem install rspec'
|
16
|
+
exit
|
17
|
+
end
|
18
|
+
|
19
|
+
include FileUtils
|
20
|
+
require File.join(File.dirname(__FILE__), 'lib', 'rails_jumpstart', 'version')
|
21
|
+
|
22
|
+
AUTHOR = 'Rahsun McAfee' # can also be an array of Authors
|
23
|
+
EMAIL = "rahsun@giantagilerobot.com"
|
24
|
+
DESCRIPTION = "This gem was created so that you can easily defined and plugins and install the ones you use on a regular into your rails aplication."
|
25
|
+
GEM_NAME = 'rails_jumpstart' # what ppl will type to install your gem
|
26
|
+
|
27
|
+
@config_file = "~/.rubyforge/user-config.yml"
|
28
|
+
@config = nil
|
29
|
+
def rubyforge_username
|
30
|
+
unless @config
|
31
|
+
begin
|
32
|
+
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
33
|
+
rescue
|
34
|
+
puts <<-EOS
|
35
|
+
ERROR: No rubyforge config file found: #{@config_file}"
|
36
|
+
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
37
|
+
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
38
|
+
EOS
|
39
|
+
exit
|
40
|
+
end
|
41
|
+
end
|
42
|
+
@rubyforge_username ||= @config["username"]
|
43
|
+
end
|
44
|
+
|
45
|
+
RUBYFORGE_PROJECT = 'rails-jumpstart' # The unix name for your project
|
46
|
+
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
47
|
+
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
48
|
+
|
49
|
+
NAME = "rails_jumpstart"
|
50
|
+
REV = nil
|
51
|
+
# UNCOMMENT IF REQUIRED:
|
52
|
+
# REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
|
53
|
+
VERS = RailsJumpstart::VERSION::STRING + (REV ? ".#{REV}" : "")
|
54
|
+
ENV['VERSION'] = VERS
|
55
|
+
CLEAN.include ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store']
|
56
|
+
RDOC_OPTS = ['--quiet', '--title', 'rails_jumpstart documentation',
|
57
|
+
"--opname", "index.html",
|
58
|
+
"--line-numbers",
|
59
|
+
"--main", "README",
|
60
|
+
"--inline-source"]
|
61
|
+
|
62
|
+
class Hoe
|
63
|
+
def extra_deps
|
64
|
+
@extra_deps.reject { |x| Array(x).first == 'hoe' }
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# Generate all the Rake tasks
|
69
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
70
|
+
hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
71
|
+
p.author = AUTHOR
|
72
|
+
p.description = DESCRIPTION
|
73
|
+
p.email = EMAIL
|
74
|
+
p.summary = DESCRIPTION
|
75
|
+
p.url = HOMEPATH
|
76
|
+
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
77
|
+
p.test_globs = ["test/**/test_*.rb"]
|
78
|
+
p.clean_globs |= CLEAN #An array of file patterns to delete on clean.
|
79
|
+
|
80
|
+
# == Optional
|
81
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
82
|
+
#p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
|
83
|
+
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
84
|
+
end
|
85
|
+
|
86
|
+
CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\n\n")
|
87
|
+
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
88
|
+
hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
89
|
+
|
90
|
+
desc 'Generate website files'
|
91
|
+
task :website_generate do
|
92
|
+
Dir['website/**/*.txt'].each do |txt|
|
93
|
+
sh %{ ruby scripts/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
desc 'Upload website files to rubyforge'
|
98
|
+
task :website_upload do
|
99
|
+
host = "#{rubyforge_username}@rubyforge.org"
|
100
|
+
remote_dir = "/var/www/gforge-projects/#{PATH}/"
|
101
|
+
local_dir = 'website'
|
102
|
+
sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
|
103
|
+
end
|
104
|
+
|
105
|
+
desc 'Generate and upload website files'
|
106
|
+
task :website => [:website_generate, :website_upload, :publish_docs]
|
107
|
+
|
108
|
+
desc 'Release the website and new gem version'
|
109
|
+
task :deploy => [:check_version, :website, :release] do
|
110
|
+
puts "Remember to create SVN tag:"
|
111
|
+
puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
|
112
|
+
"svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
|
113
|
+
puts "Suggested comment:"
|
114
|
+
puts "Tagging release #{CHANGES}"
|
115
|
+
end
|
116
|
+
|
117
|
+
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
|
118
|
+
task :local_deploy => [:website_generate, :install_gem]
|
119
|
+
|
120
|
+
task :check_version do
|
121
|
+
unless ENV['VERSION']
|
122
|
+
puts 'Must pass a VERSION=x.y.z release version'
|
123
|
+
exit
|
124
|
+
end
|
125
|
+
unless ENV['VERSION'] == VERS
|
126
|
+
puts "Please update your version.rb to match the release version, currently #{VERS}"
|
127
|
+
exit
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
desc "Run the specs under spec/models"
|
132
|
+
Spec::Rake::SpecTask.new do |t|
|
133
|
+
t.spec_opts = ['--options', "spec/spec.opts"]
|
134
|
+
t.spec_files = FileList['spec/*_spec.rb']
|
135
|
+
end
|
136
|
+
|
137
|
+
desc "Default task is to run specs"
|
138
|
+
task :default => :spec
|
139
|
+
|
data/bin/jumpstart
ADDED
@@ -0,0 +1,190 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'optparse'
|
3
|
+
require 'ostruct'
|
4
|
+
require 'yaml'
|
5
|
+
|
6
|
+
# Colorization
|
7
|
+
def colorize(text, color_code)
|
8
|
+
"#{color_code}#{text}\e[0m"
|
9
|
+
end
|
10
|
+
|
11
|
+
def red(text); colorize(text, "\e[31m"); end
|
12
|
+
def green(text); colorize(text, "\e[32m"); end
|
13
|
+
def magenta(text); colorize(text, "\e[35m"); end
|
14
|
+
|
15
|
+
# Tag Current Directory
|
16
|
+
install_path = Dir.new(Dir.pwd).path
|
17
|
+
|
18
|
+
# Load the YAML File
|
19
|
+
if File.file?("#{Dir.chdir;Dir.pwd}/plugins.yml")
|
20
|
+
file = File.open("#{Dir.chdir;Dir.pwd}/plugins.yml")
|
21
|
+
data = YAML.load(file)
|
22
|
+
file.close
|
23
|
+
else
|
24
|
+
puts "You need a plugins.yml file that list all your plugins in your home directory."
|
25
|
+
exit
|
26
|
+
end
|
27
|
+
|
28
|
+
# Defaults from YAML to HASH
|
29
|
+
defaults_hash = {}
|
30
|
+
data["defaults"].each do |p|
|
31
|
+
defaults_hash[p[0]] = true
|
32
|
+
end
|
33
|
+
|
34
|
+
# Optionals from YAML to HASH
|
35
|
+
optionals_hash = {}
|
36
|
+
data["optionals"].each do |p|
|
37
|
+
optionals_hash[p[0]] = false
|
38
|
+
end
|
39
|
+
|
40
|
+
# Setup Options
|
41
|
+
constants = OpenStruct.new({:descriptions => false, :jump => false, :edge => false})
|
42
|
+
defaults_available = OpenStruct.new(defaults_hash)
|
43
|
+
optionals_available = OpenStruct.new(optionals_hash)
|
44
|
+
|
45
|
+
|
46
|
+
OptionParser.new do |opts|
|
47
|
+
opts.banner = "\nUsage: jumpstart [ jump | description ] | [optional: on_edge] |[--no-[plugin ] | -[ plugin ]]\n example 1: jumpstart jump --no-[plugin] \n example 2: jumpstart jump -[plugin]\n example 3: jumpstart jump on_edge -[plugin]\n "
|
48
|
+
opts.separator "Default Plugins:"
|
49
|
+
|
50
|
+
opts.on("--no-defaults","Don't Install ANY Default Plugins") do |v|
|
51
|
+
defaults_available.marshal_dump.each do |k,v|
|
52
|
+
defaults_hash[k.to_s] = false
|
53
|
+
end
|
54
|
+
end
|
55
|
+
opts.separator ""
|
56
|
+
|
57
|
+
defaults_available.marshal_dump.each do |k,v|
|
58
|
+
opts.on("--no-#{k}","Don't Install #{k}") do |v|
|
59
|
+
defaults_hash[k.to_s] = v
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
opts.separator ""
|
64
|
+
opts.separator "Optional Plugins:"
|
65
|
+
|
66
|
+
optionals_available.marshal_dump.each do |k,v|
|
67
|
+
opts.on("-#{k}","Install #{k}") do |v|
|
68
|
+
optionals_hash[k.to_s] = true
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
opts.separator ""
|
73
|
+
|
74
|
+
if ARGV.length < 1
|
75
|
+
puts opts
|
76
|
+
else
|
77
|
+
if ARGV[0] == "descriptions"
|
78
|
+
constants.descriptions = true
|
79
|
+
end
|
80
|
+
|
81
|
+
if ARGV[0] == "jump"
|
82
|
+
constants.jump = true
|
83
|
+
end
|
84
|
+
|
85
|
+
if ARGV[0] == "jump" && ARGV.include?("on_edge")
|
86
|
+
constants.edge = true
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end.parse!
|
90
|
+
|
91
|
+
# Load the selected options back into the defaults and optionals availables after parsing choices
|
92
|
+
defaults_available = OpenStruct.new(defaults_hash)
|
93
|
+
optionals_available = OpenStruct.new(optionals_hash)
|
94
|
+
|
95
|
+
# Show Plugin Descriptions
|
96
|
+
if constants.descriptions
|
97
|
+
puts "List of Plugins and Descriptions"
|
98
|
+
puts "================================"
|
99
|
+
puts
|
100
|
+
puts "Defaults"
|
101
|
+
puts "================================"
|
102
|
+
data["defaults"].each do |p|
|
103
|
+
unless data["defaults"][p[0]].has_key?(1)
|
104
|
+
puts red("Name: #{data['defaults'][p[0]]['name']}")
|
105
|
+
puts magenta("Short Name: #{p[0]}")
|
106
|
+
puts "Description: #{data['defaults'][p[0]]['short_description']}"
|
107
|
+
puts "Repository: #{data['defaults'][p[0]]['repository']}"
|
108
|
+
puts
|
109
|
+
else
|
110
|
+
data["defaults"][p[0]].each do |sub|
|
111
|
+
puts red("Name: #{data['defaults'][p[0]][sub[0]]['name']}")
|
112
|
+
puts green("Group: #{p[0]}")
|
113
|
+
puts "Description: #{data['defaults'][p[0]][sub[0]]['short_description']}"
|
114
|
+
puts "Repository: #{data['defaults'][p[0]][sub[0]]['repository']}"
|
115
|
+
puts
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
puts
|
120
|
+
puts "Optionals"
|
121
|
+
puts "================================"
|
122
|
+
data["optionals"].each do |p|
|
123
|
+
unless data["optionals"][p[0]].has_key?(1)
|
124
|
+
puts red("Name: #{data['optionals'][p[0]]['name']}")
|
125
|
+
puts magenta("Short Name: #{p[0]}")
|
126
|
+
puts "Description: #{data['optionals'][p[0]]['short_description']}"
|
127
|
+
puts "Repository: #{data['optionals'][p[0]]['repository']}"
|
128
|
+
puts
|
129
|
+
else
|
130
|
+
data["optionals"][p[0]].each do |sub|
|
131
|
+
puts red("Name: #{data['optionals'][p[0]][sub[0]]['name']}")
|
132
|
+
puts green("Group: #{p[0]}")
|
133
|
+
puts "Description: #{data['optionals'][p[0]][sub[0]]['short_description']}"
|
134
|
+
puts "Repository: #{data['optionals'][p[0]][sub[0]]['repository']}"
|
135
|
+
puts
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
puts
|
140
|
+
exit
|
141
|
+
end
|
142
|
+
|
143
|
+
# Process Installs
|
144
|
+
if constants.jump
|
145
|
+
# Install Selected Defaults
|
146
|
+
defaults_available.marshal_dump.each do |k,v|
|
147
|
+
if v == true
|
148
|
+
unless data["defaults"][k.to_s].has_key?(1)
|
149
|
+
puts "install #{data['defaults'][k.to_s]['name']}..."
|
150
|
+
system "cd #{install_path}; ruby script/plugin install #{data['defaults'][k.to_s]['repository']}"
|
151
|
+
if data['defaults'][k.to_s]['command']
|
152
|
+
system "cd #{install_path}; #{data['defaults'][k.to_s]['command']}"
|
153
|
+
end
|
154
|
+
else
|
155
|
+
data["defaults"][k.to_s].each do |p|
|
156
|
+
puts "install #{data['defaults'][k.to_s][p[0]]['name']}..."
|
157
|
+
system "cd #{install_path}; ruby script/plugin install #{data['defaults'][k.to_s][p[0]]['repository']}"
|
158
|
+
if data['defaults'][k.to_s][p[0]]['command']
|
159
|
+
system "cd #{install_path}; #{data['defaults'][k.to_s][p[0]]['command']}"
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
# Install Selected Optionals
|
167
|
+
optionals_available.marshal_dump.each do |k,v|
|
168
|
+
if v == true
|
169
|
+
unless data["optionals"][k.to_s].has_key?(1)
|
170
|
+
puts "install #{data['optionals'][k.to_s]['name']}..."
|
171
|
+
system "cd #{install_path}; ruby script/plugin install #{data['optionals'][k.to_s]['repository']}"
|
172
|
+
if data['optionals'][k.to_s]['command']
|
173
|
+
system "cd #{install_path}; #{data['optionals'][k.to_s]['command']}"
|
174
|
+
end
|
175
|
+
else
|
176
|
+
data["defaults"][k.to_s].each do |p|
|
177
|
+
puts "install #{data['optionals'][k.to_s][p[0]]['name']}..."
|
178
|
+
system "cd #{install_path}; ruby script/plugin install #{data['optionals'][k.to_s][p[0]]['repository']}"
|
179
|
+
if data['optionals'][k.to_s][p[0]]['command']
|
180
|
+
system "cd #{install_path}; #{data['optionals'][k.to_s][p[0]]['command']}"
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
if constants.edge
|
189
|
+
system "cd #{install_path}; rake rails:freeze:edge"
|
190
|
+
end
|
data/scripts/txt2html
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'redcloth'
|
5
|
+
require 'syntax/convertors/html'
|
6
|
+
require 'erb'
|
7
|
+
require File.dirname(__FILE__) + '/../lib/rails_jumpstart/version.rb'
|
8
|
+
|
9
|
+
version = RailsJumpstart::VERSION::STRING
|
10
|
+
download = 'http://rubyforge.org/projects/rails_jumpstart'
|
11
|
+
|
12
|
+
class Fixnum
|
13
|
+
def ordinal
|
14
|
+
# teens
|
15
|
+
return 'th' if (10..19).include?(self % 100)
|
16
|
+
# others
|
17
|
+
case self % 10
|
18
|
+
when 1: return 'st'
|
19
|
+
when 2: return 'nd'
|
20
|
+
when 3: return 'rd'
|
21
|
+
else return 'th'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class Time
|
27
|
+
def pretty
|
28
|
+
return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def convert_syntax(syntax, source)
|
33
|
+
return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
|
34
|
+
end
|
35
|
+
|
36
|
+
if ARGV.length >= 1
|
37
|
+
src, template = ARGV
|
38
|
+
template ||= File.dirname(__FILE__) + '/../website/template.rhtml'
|
39
|
+
|
40
|
+
else
|
41
|
+
puts("Usage: #{File.split($0).last} source.txt [template.rhtml] > output.html")
|
42
|
+
exit!
|
43
|
+
end
|
44
|
+
|
45
|
+
template = ERB.new(File.open(template).read)
|
46
|
+
|
47
|
+
title = nil
|
48
|
+
body = nil
|
49
|
+
File.open(src) do |fsrc|
|
50
|
+
title_text = fsrc.readline
|
51
|
+
body_text = fsrc.read
|
52
|
+
syntax_items = []
|
53
|
+
body_text.gsub!(%r!<(pre|code)[^>]*?syntax=['"]([^'"]+)[^>]*>(.*?)</>!m){
|
54
|
+
ident = syntax_items.length
|
55
|
+
element, syntax, source = $1, $2, $3
|
56
|
+
syntax_items << "<#{element} class='syntax'>#{convert_syntax(syntax, source)}</#{element}>"
|
57
|
+
"syntax-temp-#{ident}"
|
58
|
+
}
|
59
|
+
title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
|
60
|
+
body = RedCloth.new(body_text).to_html
|
61
|
+
body.gsub!(%r!(?:<pre><code>)?syntax-temp-(d+)(?:</code></pre>)?!){ syntax_items[$1.to_i] }
|
62
|
+
end
|
63
|
+
stat = File.stat(src)
|
64
|
+
created = stat.ctime
|
65
|
+
modified = stat.mtime
|
66
|
+
|
67
|
+
$stdout << template.result(binding)
|