ride 0.1.1

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.
Files changed (52) hide show
  1. data/History.txt +4 -0
  2. data/License.txt +20 -0
  3. data/Manifest.txt +49 -0
  4. data/PostInstall.txt +21 -0
  5. data/README.txt +62 -0
  6. data/Rakefile +4 -0
  7. data/app_generators/ride/USAGE +5 -0
  8. data/app_generators/ride/ride_generator.rb +101 -0
  9. data/app_generators/ride/templates/.vim/ftdetect/ruby.vim +26 -0
  10. data/app_generators/ride/templates/.vim/ftplugin/ruby/ruby.vim +6 -0
  11. data/app_generators/ride/templates/.vim/plugin/taglist.vim +4248 -0
  12. data/app_generators/ride/templates/.vim/syntax/eruby.vim +42 -0
  13. data/app_generators/ride/templates/History.txt +4 -0
  14. data/app_generators/ride/templates/License.txt +20 -0
  15. data/app_generators/ride/templates/README.txt +62 -0
  16. data/app_generators/ride/templates/Rakefile +4 -0
  17. data/app_generators/ride/templates/config/.screenrc.code.erb +15 -0
  18. data/app_generators/ride/templates/config/code_template.erb +14 -0
  19. data/app_generators/ride/templates/script/console +10 -0
  20. data/app_generators/ride/templates/script/ride +149 -0
  21. data/app_generators/ride/templates/tasks/ride.rake +6 -0
  22. data/app_generators/ride/templates/tasks/rspec.rake +21 -0
  23. data/bin/ride +17 -0
  24. data/config/hoe.rb +74 -0
  25. data/config/requirements.rb +15 -0
  26. data/lib/ride/version.rb +9 -0
  27. data/lib/ride.rb +6 -0
  28. data/script/console +10 -0
  29. data/script/destroy +14 -0
  30. data/script/generate +14 -0
  31. data/script/txt2html +82 -0
  32. data/setup.rb +1585 -0
  33. data/spec/generator_spec_helper.rb +136 -0
  34. data/spec/ride_generator_spec.rb +81 -0
  35. data/spec/spec.opts +1 -0
  36. data/spec/spec_generator_helper.rb +35 -0
  37. data/spec/spec_helper.rb +10 -0
  38. data/tasks/deployment.rake +34 -0
  39. data/tasks/environment.rake +7 -0
  40. data/tasks/ride.rake +6 -0
  41. data/tasks/rspec.rake +21 -0
  42. data/tasks/website.rake +17 -0
  43. data/test/test_generator_helper.rb +29 -0
  44. data/test/test_helper.rb +2 -0
  45. data/test/test_ride.rb +11 -0
  46. data/test/test_ride_generator.rb +43 -0
  47. data/website/index.html +11 -0
  48. data/website/index.txt +83 -0
  49. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  50. data/website/stylesheets/screen.css +138 -0
  51. data/website/template.html.erb +48 -0
  52. metadata +165 -0
@@ -0,0 +1,42 @@
1
+ " Vim syntax file
2
+ " Language: eruby
3
+ " Maintainer: Michael Brailsford <brailsmt@yahoo.com>
4
+ " Installation:
5
+ " To automatilcally load this file when a .rhtml file is opened, add the
6
+ " following lines to ~/.vim/filetype.vim:
7
+ "
8
+ " augroup filetypedetect
9
+ " au! BufRead,BufNewFile *.rhtml setfiletype eruby
10
+ " augroup END
11
+ "
12
+ " You will have to restart vim for this to take effect. In any case it
13
+ " is a good idea to read ":he new-filetype" so that you know what is going
14
+ " on, and why the above lines work.
15
+
16
+ if version < 600
17
+ syntax clear
18
+ elseif exists("b:current_syntax")
19
+ finish
20
+ endif
21
+
22
+ "Source the html syntax file
23
+ ru! syntax/html.vim
24
+ "Set the filetype to html to load the html ftplugins
25
+ set ft=html
26
+ unlet b:current_syntax
27
+
28
+ "Put the ruby syntax file in @rubyTop
29
+ syn include @rubyTop syntax/ruby.vim
30
+
31
+ syn region erubyBlock matchgroup=erubyRubyDelim start=#<%=\?# end=#%># keepend containedin=ALL contains=@rubyTop,erubyEnd
32
+ syn region erubyComment start=+<%#+ end=#%># keepend
33
+ syn match erubyEnd #\<end\>#
34
+
35
+ " hi erubyBlock ctermbg=Gray
36
+ hi link erubyDelim delimiter
37
+ hi link erubyComment comment
38
+ hi link erubyEnd rubyControl
39
+
40
+ iab %= <%= %><LEFT><LEFT><LEFT>
41
+ iab %% <% -%><LEFT><LEFT><LEFT><LEFT>
42
+ " vim: set ts=4 sw=4:
@@ -0,0 +1,4 @@
1
+ == 0.0.1 2008-08-19
2
+
3
+ * 1 major enhancement:
4
+ * Initial release
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 rubyists.com (TJ Vanderpoel, Jayson Vaughn, Trey Dempsey, Kevin Berry)
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.
@@ -0,0 +1,62 @@
1
+ = ride
2
+
3
+ Documentation and support can be found at:
4
+ * http://trac.rubyists.com/trac.fcgi/ride/wiki/RIDE
5
+
6
+ == DESCRIPTION:
7
+
8
+ A Ruby-based Integrated Development Environment combining GNU screen and
9
+ VIM to create a flexible environment for working on your projects. It
10
+ also allows multiple users to work together (ala pairs-coding) or work
11
+ on different pieces of a project at the same time within the same IDE.
12
+
13
+ == FEATURES/PROBLEMS:
14
+
15
+ * Uses screen to allow logical partitioning of pieces of a project, as
16
+ well as multiple users to work together in the same space.
17
+ * Uses the powerful VIM text editor to work on source files and provide
18
+ great syntax highlighting and code shortcuts (when available.)
19
+
20
+ == SYNOPSIS:
21
+
22
+ (Getting Started)
23
+ $ ride <project root>
24
+
25
+ (Getting to work)
26
+ $ script/editor
27
+
28
+ (Seeing the options)
29
+ $ script/editor --help
30
+
31
+ == REQUIREMENTS:
32
+
33
+ * screen
34
+ * vim (depends on file navigation)
35
+ * ruby (we use some ERb to make the templates work)
36
+
37
+ == INSTALL:
38
+
39
+ * FIX (sudo gem install, anything else)
40
+
41
+ == LICENSE:
42
+
43
+ Copyright (c) 2006-8 The Rubyists.
44
+
45
+ Permission is hereby granted, free of charge, to any person obtaining
46
+ a copy of this software and associated documentation files (the
47
+ 'Software'), to deal in the Software without restriction, including
48
+ without limitation the rights to use, copy, modify, merge, publish,
49
+ distribute, sublicense, and/or sell copies of the Software, and to
50
+ permit persons to whom the Software is furnished to do so, subject to
51
+ the following conditions:
52
+
53
+ The above copyright notice and this permission notice shall be
54
+ included in all copies or substantial portions of the Software.
55
+
56
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
57
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
58
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
59
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
60
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
61
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
62
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,4 @@
1
+ require 'config/requirements'
2
+ require 'config/hoe' # setup Hoe + all gem configuration
3
+
4
+ Dir['tasks/**/*.rake'].each { |rake| load rake }
@@ -0,0 +1,15 @@
1
+ bindkey -k k8 hardstatus alwayslastline
2
+ bindkey -k k9 hardstatus alwaysignore
3
+ sessionname <%%= OPTIONS[:screen_name] %>
4
+ <%% if OPTIONS[:multiuser] %>
5
+ multiuser on
6
+ <%% OPTIONS[:usernames].each do |username| %>
7
+ acladd <%%= username %>
8
+ <%% end %>
9
+ <%% end %>
10
+ hardstatus alwayslastline "%{= <%%= OPTIONS[:background_color] + OPTIONS[:foreground_color] %>} %-Lw%50>%{= <%%= OPTIONS[:background_color] + OPTIONS[:highlight_color] %>}%n%f* %{= <%%= OPTIONS[:background_color] + OPTIONS[:foreground_color] %>}%t%+Lw%<"
11
+
12
+ caption splitonly "%{= <%%= OPTIONS[:caption_background_color] + OPTIONS[:caption_foreground_color] %>} %-Lw%50>%{= <%%= OPTIONS[:caption_background_color] + OPTIONS[:caption_highlight_color] %>}%n%f* %{= <%%= OPTIONS[:caption_background_color] + OPTIONS[:caption_foreground_color] %>}%t%+Lw%<"
13
+
14
+ shell <%%= OPTIONS[:shell] %>
15
+ chdir <%%= $home %>
@@ -0,0 +1,14 @@
1
+ screen -t logs bash -c 'umask 002;while true;do cd <%%= $home %>/log; <%%= OPTIONS[:shell] %>;sleep 1;done'
2
+ screen -t debug bash -c 'umask 002;while true;do RAILS_ENV=<%%= OPTIONS[:environment] %> <%%= OPTIONS[:debugger] %>;sleep 1;done'
3
+ screen -t ide bash -c 'umask 002;while true;do vim -c "cd <%%= $home %>" -c "e .";sleep 1;done'
4
+ <%% if not OPTIONS[:reports_base].nil? %>
5
+ screen -t reports bash -c 'umask 002;while true;do vim -c "cd <%%= OPTIONS[:reports_base] %>" -c "e .";sleep 1;done'
6
+ <%% end %>
7
+ screen -t controllers bash -c 'umask 002;while true;do vim -c "cd <%%= OPTIONS[:controllers_base] %>" -c "e .";sleep 1;done'
8
+ screen -t views bash -c 'umask 002;while true;do vim -c "cd <%%= OPTIONS[:views_base] %>" -c "e .";sleep 1;done'
9
+ screen -t helpers bash -c 'umask 002;while true;do vim -c "cd <%%= OPTIONS[:helpers_base] %>" -c "e .";sleep 1;done'
10
+ screen -t models bash -c 'umask 002;while true;do vim -c "cd <%%= OPTIONS[:models_base] %>" -c "e .";sleep 1;done'
11
+ screen -t svkwork bash -c 'umask 002;while true; do SVKROOT=<%%= ENV['SVKROOT'] || (ENV['REAL_HOME'] + "/.svk") %> RAILS_ENV=<%%= OPTIONS[:environment] %> <%%= OPTIONS[:shell] %>;sleep 1;done'
12
+ screen -t script bash -c 'umask 002;while true;do RAILS_ENV=<%%= OPTIONS[:environment] %> <%%= OPTIONS[:shell] %>;sleep 2;done'
13
+ screen -t tests bash -c 'umask 002;while true;do cd <%%= OPTIONS[:test_base] %>;RAILS_ENV=<%%= OPTIONS[:environment] %> <%%= OPTIONS[:shell] %>;sleep 1;done'
14
+ select 1
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/<%= main_lib %>.rb'}"
9
+ puts "Loading ride gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
@@ -0,0 +1,149 @@
1
+ #!/usr/bin/env ruby
2
+ require "erb"
3
+ require "optparse"
4
+ $old_home = ENV['HOME']
5
+ $home = ENV['PWD']
6
+ ENV['HOME'] = $home
7
+ ENV['REAL_HOME'] = $old_home
8
+ OPTIONS = {
9
+ :directory => $home,
10
+ :environment => "development",
11
+ :public => $home + "/public/",
12
+ :controllers_base => $home + "/app/controllers/",
13
+ :views_base => $home + "/app/views/",
14
+ :models_base => $home + "/app/models/",
15
+ :reports_base => $home + "/vendor/rrvc/reports/",
16
+ :helpers_base => $home + "/app/helpers/",
17
+ :apis_base => $home + "/app/api/",
18
+ :test_base => $home + "/test/",
19
+ :debugger => "<%= console_debugger %>"
20
+ }
21
+ _orig = OPTIONS.dup
22
+ def screen_color(color)
23
+ return color[0,1].capitalize unless color == 'black'
24
+ 'K'
25
+ end
26
+
27
+ # Parse options
28
+ ARGV.options do |opts|
29
+ script_name = File.basename($0)
30
+ opts.banner = "Usage: ruby #{script_name} [options] <template>"
31
+
32
+ opts.separator ""
33
+ OPTIONS.each do |key,opt|
34
+ s = key.to_s
35
+ f = "-" + s[0,1]
36
+ o = "--" + s[/[a-z]+/] + "=" + ( s == "environment" ? "environment" : "directory" )
37
+ d = "Rails " + s.gsub("_"," ").split.map { |a| a.capitalize }.join(" ")
38
+ opts.on(f,o,String,d,"Default: #{opt}") { |OPTIONS[key]| }
39
+ end
40
+
41
+ opts.separator ""
42
+
43
+ opts.on("-S shell", "--shell=SHELL",String,
44
+ "Shell to use for command line","Default: bash") { |OPTIONS[:shell]| }
45
+ opts.on("-M", "--multiuser","Allow other users to access this screen?","Default: no") { |OPTIONS[:multiuser]| }
46
+ opts.on("-U USERNAMES", "--usernames=USERNAMES",String,
47
+ "Add comma-separated list of trusted users to be able to access this screen","Default: none") { |users| OPTIONS[:usernames] = users.split(',') }
48
+ opts.on("-C component", "--component_base=component",String,
49
+ "Use dirs for this component","Default: ''") { |OPTIONS[:component_base]| }
50
+ opts.separator ""
51
+ opts.on("-Fforeground_color", "--fgcolor=COLOR",String,
52
+ "Foreground Color of Status Line Text","Default: red") { |color| OPTIONS[:foreground_color] = screen_color(color) }
53
+ opts.on("-Hhighlight_color", "--hilight=COLOR",String,
54
+ "Foreground Color of Active Window Text","Default: green") { |color| OPTIONS[:highlight_color] = screen_color(color) }
55
+ opts.on("-Bbackground_color", "--bgcolor=COLOR",String,
56
+ "Background Color of Status Line","Default: transparent (default)") { |color| OPTIONS[:background_color] = screen_color(color) }
57
+ opts.on("-Xcaption_bgcolor", "--caption_bgcolor=COLOR",String,
58
+ "Background Color of Caption Line (when screen is split)","Default: transparent (default)") { |color| OPTIONS[:caption_background_color] = screen_color(color) }
59
+ opts.on("-Ycaption_foreground_color", "--caption_fgcolor=COLOR",String,
60
+ "Foreground Color of Caption Line Text","Default: cyan") { |color| OPTIONS[:caption_foreground_color] = screen_color(color) }
61
+ opts.on("-Zcaption_highlight_color", "--caption_hilight=COLOR",String,
62
+ "Foreground Color of Caption line Active Window Text","Default: red") { |color| OPTIONS[:caption_highlight_color] = screen_color(color) }
63
+ opts.separator "Available colors are black, red, green, yellow, blue, magenta, cyan, white, and default (transparent)"
64
+ opts.on("-Nname", "--name=NAME",String,
65
+ "Name to use for screen session","Default: Rails") { |OPTIONS[:screen_name]| }
66
+ opts.on("-Echar", "--escape=CHARACTER",String,
67
+ "Escape Key to use for screen session","Default: C-a") { |OPTIONS[:screen_escape]| }
68
+ opts.on("-?", "--help",
69
+ "Show this help message.") { puts opts; exit }
70
+ opts.parse!
71
+ end
72
+ OPTIONS[:multiuser] ||= false
73
+ OPTIONS[:usernames] ||= []
74
+ OPTIONS[:screen_name] ||= "<%= screen_name %>"
75
+ OPTIONS[:foreground_color] ||= 'R'
76
+ OPTIONS[:background_color] ||= 'd'
77
+ OPTIONS[:highlight_color] ||= 'G'
78
+ OPTIONS[:caption_foreground_color] ||= 'C'
79
+ OPTIONS[:caption_background_color] ||= 'd'
80
+ OPTIONS[:caption_highlight_color] ||= 'R'
81
+ OPTIONS[:shell] ||= "<%= shell %>"
82
+ OPTIONS[:screen_escape] ||= "^Aa"
83
+
84
+ begin
85
+
86
+ # Standard erb template
87
+ erb_template = $home + "/config/.screenrc.code.erb"
88
+
89
+ # Standard erb template
90
+ code_template = $home + "/config/code_template.erb"
91
+
92
+ # What screen template to use
93
+ template = ARGV[0] || "basic"
94
+
95
+ # Don't need report screen if we aren't working on reports
96
+ OPTIONS[:reports_base] = nil if not template == "reports"
97
+
98
+ # Add the component path to views/controllers/helpers
99
+ if c = OPTIONS[:component_base]
100
+ [:controllers_base,:views_base,:helpers_base].each do |k|
101
+ OPTIONS[k] << c if OPTIONS[k] == _orig[k]
102
+ end
103
+ end
104
+
105
+ # Set template spefific options
106
+ case template
107
+ when "custom"
108
+ raise "Must specify full template path for custom" if not ARGV[1]
109
+ raise "Must specify full template path for custom" if not File.exists? ARGV[1]
110
+ code_template = ARGV[1]
111
+ when "reports"
112
+ raise "Must Specify Component for reports" if not OPTIONS[:component_base]
113
+ OPTIONS[:helpers_base] = OPTIONS[:reports_base] + "helpers/" unless OPTIONS[:helpers_base] != (_orig[:helpers_base] + OPTIONS[:component_base])
114
+ OPTIONS[:views_base] << ("/" + OPTIONS[:component_base] + "_reports/") unless OPTIONS[:views_base] != (_orig[:views_base] + OPTIONS[:component_base])
115
+ end
116
+
117
+ # Check for valid directories
118
+ raise "Must Have a rails tree in #{$home}" if not FileTest.directory? $home
119
+ # raise "Must Have a rails tree in #{OPTIONS[:public]}" if not FileTest.directory? OPTIONS[:public]
120
+ # raise "Must Have a rails tree in #{OPTIONS[:views_base]}" if not FileTest.directory? OPTIONS[:views_base]
121
+ # raise "Must Have a rails tree in #{OPTIONS[:models_base]}" if not FileTest.directory? OPTIONS[:models_base]
122
+ # raise "Must Have a rails tree in #{OPTIONS[:helpers_base]}" if not FileTest.directory? OPTIONS[:helpers_base]
123
+ # raise "Must Have a rails tree in #{OPTIONS[:controllers_base]}" if not FileTest.directory? OPTIONS[:controllers_base]
124
+
125
+ # Parse the template, save it as a .screenrc.code-USERNAME
126
+ screen_erb = ERB.new(File.read(erb_template))
127
+ output = screen_erb.result(binding)
128
+
129
+ # Parse the template, save it as a .screenrc.code-USERNAME
130
+ code_erb = ERB.new(File.read(code_template))
131
+ output << code_erb.result(binding)
132
+
133
+ screenfile = $home + "/.screenrc-" + (ENV['USER'] || "Bozo")
134
+ File.open(screenfile,"w+") { |file| file.puts output }
135
+
136
+ # Make symlinks
137
+ %x{ln -sf #{screenfile} #{$old_home}/.screenrc.code }
138
+ %x{ln -sf #{screenfile} #{$home}/.screenrc.code }
139
+ Dir.chdir($home)
140
+
141
+ # Start a screen with the newly linked .screenrc.code
142
+ exec("screen","-c#{File.basename(screenfile)}","-S","rails","-e",OPTIONS[:screen_escape])
143
+
144
+ rescue => e
145
+ require "pp"
146
+ pp OPTIONS
147
+ puts e
148
+ end
149
+
@@ -0,0 +1,6 @@
1
+ namespace :ride do
2
+ desc "about"
3
+ task :about do
4
+ puts "Ruby Interactive Development Interface"
5
+ end
6
+ end
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ require 'spec'
6
+ end
7
+ begin
8
+ require 'spec/rake/spectask'
9
+ rescue LoadError
10
+ puts <<-EOS
11
+ To use rspec for testing you must install rspec gem:
12
+ gem install rspec
13
+ EOS
14
+ exit(0)
15
+ end
16
+
17
+ desc "Run the specs under spec/models"
18
+ Spec::Rake::SpecTask.new do |t|
19
+ t.spec_opts = ['--options', "spec/spec.opts"]
20
+ t.spec_files = FileList['spec/**/*_spec.rb']
21
+ end
data/bin/ride ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'rubigen'
5
+
6
+ if %w(-v --version).include? ARGV.first
7
+ require 'ride/version'
8
+ puts "#{File.basename($0)} #{Ride::VERSION::STRING}"
9
+ exit(0)
10
+ end
11
+
12
+ require 'rubigen/scripts/generate'
13
+ source = RubiGen::PathSource.new(:application,
14
+ File.join(File.dirname(__FILE__), "../app_generators"))
15
+ RubiGen::Base.reset_sources
16
+ RubiGen::Base.append_sources source
17
+ RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'ride')
data/config/hoe.rb ADDED
@@ -0,0 +1,74 @@
1
+ require 'ride/version'
2
+
3
+ AUTHOR = 'TJ Vanderpoel' # can also be an array of Authors
4
+ EMAIL = "bougy.man@gmail.com"
5
+ DESCRIPTION = "A Multi-User Console Interactive Development Environment Based On GNUScreen"
6
+ GEM_NAME = 'ride' # what ppl will type to install your gem
7
+ RUBYFORGE_PROJECT = 'ride' # The unix name for your project
8
+ HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
9
+ DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
10
+ EXTRA_DEPENDENCIES = [
11
+ ['rubigen', '>= 0.0.0'],
12
+ ['facets', '>= 0.0.0']
13
+ ] # An array of rubygem dependencies [name, version]
14
+
15
+ @config_file = "~/.rubyforge/user-config.yml"
16
+ @config = nil
17
+ RUBYFORGE_USERNAME = "unknown"
18
+ def rubyforge_username
19
+ unless @config
20
+ begin
21
+ @config = YAML.load(File.read(File.expand_path(@config_file)))
22
+ rescue
23
+ puts <<-EOS
24
+ ERROR: No rubyforge config file found: #{@config_file}
25
+ Run 'rubyforge setup' to prepare your env for access to Rubyforge
26
+ - See http://newgem.rubyforge.org/rubyforge.html for more details
27
+ EOS
28
+ exit
29
+ end
30
+ end
31
+ RUBYFORGE_USERNAME.replace @config["username"]
32
+ end
33
+
34
+
35
+ REV = nil
36
+ # UNCOMMENT IF REQUIRED:
37
+ # REV = YAML.load(`svn info`)['Revision']
38
+ VERS = Ride::VERSION::STRING + (REV ? ".#{REV}" : "")
39
+ RDOC_OPTS = ['--quiet', '--title', 'ride documentation',
40
+ "--opname", "index.html",
41
+ "--line-numbers",
42
+ "--main", "README",
43
+ "--inline-source"]
44
+
45
+ class Hoe
46
+ def extra_deps
47
+ @extra_deps.reject! { |x| Array(x).first == 'hoe' }
48
+ @extra_deps
49
+ end
50
+ end
51
+
52
+ # Generate all the Rake tasks
53
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
54
+ $hoe = Hoe.new(GEM_NAME, VERS) do |p|
55
+ p.developer(AUTHOR, EMAIL)
56
+ p.description = DESCRIPTION
57
+ p.summary = DESCRIPTION
58
+ p.url = HOMEPATH
59
+ p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
60
+ p.test_globs = ["test/**/test_*.rb"]
61
+ p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
62
+
63
+ # == Optional
64
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
65
+ p.extra_deps = EXTRA_DEPENDENCIES
66
+
67
+ #p.spec_extras = {} # A hash of extra values to set in the gemspec.
68
+ end
69
+
70
+ CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
71
+ PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
72
+ $hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
73
+ $hoe.rsync_args = '-av --delete --ignore-errors'
74
+ $hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
@@ -0,0 +1,15 @@
1
+ require 'fileutils'
2
+ include FileUtils
3
+
4
+ require 'rubygems'
5
+ %w[rake hoe newgem rubigen].each do |req_gem|
6
+ begin
7
+ require req_gem
8
+ rescue LoadError
9
+ puts "This Rakefile requires the '#{req_gem}' RubyGem."
10
+ puts "Installation: gem install #{req_gem} -y"
11
+ exit
12
+ end
13
+ end
14
+
15
+ $:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
@@ -0,0 +1,9 @@
1
+ module Ride
2
+ module VERSION #:nodoc:
3
+ MAJOR = 0
4
+ MINOR = 1
5
+ TINY = 1
6
+
7
+ STRING = [MAJOR, MINOR, TINY].join('.')
8
+ end
9
+ end
data/lib/ride.rb ADDED
@@ -0,0 +1,6 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ module Ride
5
+
6
+ end
data/script/console ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/ride.rb'}"
9
+ puts "Loading ride gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
data/script/destroy ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
data/script/txt2html ADDED
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ GEM_NAME = 'ride' # what ppl will type to install your gem
4
+ RUBYFORGE_PROJECT = 'ride'
5
+
6
+ require 'rubygems'
7
+ begin
8
+ require 'newgem'
9
+ require 'rubyforge'
10
+ rescue LoadError
11
+ puts "\n\nGenerating the website requires the newgem RubyGem"
12
+ puts "Install: gem install newgem\n\n"
13
+ exit(1)
14
+ end
15
+ require 'redcloth'
16
+ require 'syntax/convertors/html'
17
+ require 'erb'
18
+ require File.dirname(__FILE__) + "/../lib/#{GEM_NAME}/version.rb"
19
+
20
+ version = Ride::VERSION::STRING
21
+ download = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
22
+
23
+ def rubyforge_project_id
24
+ RubyForge.new.autoconfig["group_ids"][RUBYFORGE_PROJECT]
25
+ end
26
+
27
+ class Fixnum
28
+ def ordinal
29
+ # teens
30
+ return 'th' if (10..19).include?(self % 100)
31
+ # others
32
+ case self % 10
33
+ when 1: return 'st'
34
+ when 2: return 'nd'
35
+ when 3: return 'rd'
36
+ else return 'th'
37
+ end
38
+ end
39
+ end
40
+
41
+ class Time
42
+ def pretty
43
+ return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
44
+ end
45
+ end
46
+
47
+ def convert_syntax(syntax, source)
48
+ return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
49
+ end
50
+
51
+ if ARGV.length >= 1
52
+ src, template = ARGV
53
+ template ||= File.join(File.dirname(__FILE__), '/../website/template.html.erb')
54
+ else
55
+ puts("Usage: #{File.split($0).last} source.txt [template.html.erb] > output.html")
56
+ exit!
57
+ end
58
+
59
+ template = ERB.new(File.open(template).read)
60
+
61
+ title = nil
62
+ body = nil
63
+ File.open(src) do |fsrc|
64
+ title_text = fsrc.readline
65
+ body_text_template = fsrc.read
66
+ body_text = ERB.new(body_text_template).result(binding)
67
+ syntax_items = []
68
+ body_text.gsub!(%r!<(pre|code)[^>]*?syntax=['"]([^'"]+)[^>]*>(.*?)</\1>!m){
69
+ ident = syntax_items.length
70
+ element, syntax, source = $1, $2, $3
71
+ syntax_items << "<#{element} class='syntax'>#{convert_syntax(syntax, source)}</#{element}>"
72
+ "syntax-temp-#{ident}"
73
+ }
74
+ title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
75
+ body = RedCloth.new(body_text).to_html
76
+ body.gsub!(%r!(?:<pre><code>)?syntax-temp-(\d+)(?:</code></pre>)?!){ syntax_items[$1.to_i] }
77
+ end
78
+ stat = File.stat(src)
79
+ created = stat.ctime
80
+ modified = stat.mtime
81
+
82
+ $stdout << template.result(binding)