RailsEditor 0.0.21
Sign up to get free protection for your applications and to get access to all the features.
- data/INSTALL +20 -0
- data/README.rails-editor +41 -0
- data/bin/RailsEditor +6 -0
- data/lib/rails-editor.rb +33 -0
- data/rails/.vim/filetype.vim +1741 -0
- data/rails/.vim/syntax/eruby.vim +40 -0
- data/rails/.vimrc +8 -0
- data/rails/README.rails-editor +36 -0
- data/rails/config/.screenrc.code.erb +28 -0
- data/rails/script/editor +137 -0
- data/tests/ts_rails_editor.rb +1 -0
- metadata +66 -0
@@ -0,0 +1,40 @@
|
|
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
|
+
" vim: set ts=4 sw=4:
|
data/rails/.vimrc
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
Copyright 2005, by TJ Vanderpoel
|
2
|
+
Licensed under the Gnu Public License, which should be
|
3
|
+
included in licence/GPL.txt.
|
4
|
+
|
5
|
+
If you did not receive this licence file you can contact the author
|
6
|
+
for a copy at bougy dot man at gmail dot com, or see the latest
|
7
|
+
version at http://www.gnu.org/copyleft/gpl.html.
|
8
|
+
|
9
|
+
This is a little command wrapper for screen + vim to give
|
10
|
+
you a nice IDE session for rails development. Console junkies
|
11
|
+
should like it, but through the use of Escreen it can be
|
12
|
+
GUI friendly as well.
|
13
|
+
|
14
|
+
./script/editor -? for usage (from a RAILS_ROOT).
|
15
|
+
|
16
|
+
BASIC USAGE
|
17
|
+
|
18
|
+
This is most likely only useful for console junkies, but may help for
|
19
|
+
any vim user in a pinch that has to make console edits (ssh or what-not).
|
20
|
+
|
21
|
+
On startup you'll have a variety of windows set up for rails development.
|
22
|
+
Many will have VIM sessions in File Browser mode, others will be shells dedicated
|
23
|
+
to a certain task. In Screen 1 you'll have a ./script/console session that
|
24
|
+
will restart itself on exit. The ide gets more powerful for experienced 'screen'
|
25
|
+
users with split screen modes and other goodies.
|
26
|
+
|
27
|
+
Screen bindkey is default here (ctrl-a), so (ctrl-a 1) will get to screen 1 (irb)
|
28
|
+
ctrl-a ? will list all your bindings. man screen for more information.
|
29
|
+
|
30
|
+
SPLIT SCREEN
|
31
|
+
|
32
|
+
A new caption line will appear when you split screens in 'screen' (ctrl-a S). At
|
33
|
+
this time there is no way to remove the hardstatus global statusline automatically,
|
34
|
+
so i've bound F8 and F9 to turning on and off (respectively) the hardstatus line
|
35
|
+
to avoid duplicate statusbars.
|
36
|
+
|
@@ -0,0 +1,28 @@
|
|
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 %>
|
16
|
+
screen -t logs bash -c 'umask 002;while true;do cd <%= $home %>/log; <%= OPTIONS[:shell] %>;sleep 1;done'
|
17
|
+
screen -t irb bash -c 'umask 002;while true;do script/console <%= OPTIONS[:environment] %>;sleep 1;done'
|
18
|
+
screen -t ide bash -c 'umask 002;while true;do vim -c "cd <%= $home %>" -c "e .";sleep 1;done'
|
19
|
+
<% if not OPTIONS[:reports_base].nil? %>
|
20
|
+
screen -t reports bash -c 'umask 002;while true;do vim -c "cd <%= OPTIONS[:reports_base] %>" -c "e .";sleep 1;done'
|
21
|
+
<% end %>
|
22
|
+
screen -t controllers bash -c 'umask 002;while true;do vim -c "cd <%= OPTIONS[:controllers_base] %>" -c "e .";sleep 1;done'
|
23
|
+
screen -t views bash -c 'umask 002;while true;do vim -c "cd <%= OPTIONS[:views_base] %>" -c "e .";sleep 1;done'
|
24
|
+
screen -t helpers bash -c 'umask 002;while true;do vim -c "cd <%= OPTIONS[:helpers_base] %>" -c "e .";sleep 1;done'
|
25
|
+
screen -t models bash -c 'umask 002;while true;do vim -c "cd <%= OPTIONS[:models_base] %>" -c "e .";sleep 1;done'
|
26
|
+
screen -t svnwork bash -c 'umask 002;while true; do <%= OPTIONS[:shell] %>;sleep 1;done'
|
27
|
+
screen -t script bash -c 'umask 002;while true;do <%= OPTIONS[:shell] %>;sleep 2;done'
|
28
|
+
screen -t tests bash -c 'umask 002;while true;do cd <%= OPTIONS[:test_base] %>;<%= OPTIONS[:shell] %>;sleep 1;done'
|
data/rails/script/editor
ADDED
@@ -0,0 +1,137 @@
|
|
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
|
+
}
|
20
|
+
_orig = OPTIONS.dup
|
21
|
+
def screen_color(color)
|
22
|
+
return color[0,1].capitalize unless color == 'black'
|
23
|
+
'K'
|
24
|
+
end
|
25
|
+
|
26
|
+
# Parse options
|
27
|
+
ARGV.options do |opts|
|
28
|
+
script_name = File.basename($0)
|
29
|
+
opts.banner = "Usage: ruby #{script_name} [options] <template>"
|
30
|
+
|
31
|
+
opts.separator ""
|
32
|
+
OPTIONS.each do |key,opt|
|
33
|
+
s = key.to_s
|
34
|
+
f = "-" + s[0,1]
|
35
|
+
o = "--" + s[/[a-z]+/] + "=" + ( s == "environment" ? "environment" : "directory" )
|
36
|
+
d = "Rails " + s.gsub("_"," ").split.map { |a| a.capitalize }.join(" ")
|
37
|
+
opts.on(f,o,String,d,"Default: #{opt}") { |OPTIONS[key]| }
|
38
|
+
end
|
39
|
+
|
40
|
+
opts.separator ""
|
41
|
+
|
42
|
+
opts.on("-S shell", "--shell=SHELL",String,
|
43
|
+
"Shell to use for command line","Default: bash") { |OPTIONS[:shell]| }
|
44
|
+
opts.on("-M", "--multiuser","Allow other users to access this screen?","Default: no") { |OPTIONS[:multiuser]| }
|
45
|
+
opts.on("-U USERNAMES", "--usernames=USERNAMES",String,
|
46
|
+
"Add comma-separated list of trusted users to be able to access this screen","Default: none") { |users| OPTIONS[:usernames] = users.split(',') }
|
47
|
+
opts.on("-C component", "--component_base=component",String,
|
48
|
+
"Use dirs for this component","Default: ''") { |OPTIONS[:component_base]| }
|
49
|
+
opts.separator ""
|
50
|
+
opts.on("-Fforeground_color", "--fgcolor=COLOR",String,
|
51
|
+
"Foreground Color of Status Line Text","Default: red") { |color| OPTIONS[:foreground_color] = screen_color(color) }
|
52
|
+
opts.on("-Hhighlight_color", "--hilight=COLOR",String,
|
53
|
+
"Foreground Color of Active Window Text","Default: green") { |color| OPTIONS[:highlight_color] = screen_color(color) }
|
54
|
+
opts.on("-Bbackground_color", "--bgcolor=COLOR",String,
|
55
|
+
"Background Color of Status Line","Default: transparent (default)") { |color| OPTIONS[:background_color] = screen_color(color) }
|
56
|
+
opts.on("-Xcaption_bgcolor", "--caption_bgcolor=COLOR",String,
|
57
|
+
"Background Color of Caption Line (when screen is split)","Default: transparent (default)") { |color| OPTIONS[:caption_background_color] = screen_color(color) }
|
58
|
+
opts.on("-Ycaption_foreground_color", "--caption_fgcolor=COLOR",String,
|
59
|
+
"Foreground Color of Caption Line Text","Default: cyan") { |color| OPTIONS[:caption_foreground_color] = screen_color(color) }
|
60
|
+
opts.on("-Zcaption_highlight_color", "--caption_hilight=COLOR",String,
|
61
|
+
"Foreground Color of Caption line Active Window Text","Default: red") { |color| OPTIONS[:caption_highlight_color] = screen_color(color) }
|
62
|
+
opts.separator "Available colors are black, red, green, yellow, blue, magenta, cyan, white, and default (transparent)"
|
63
|
+
opts.on("-Nname", "--name=NAME",String,
|
64
|
+
"Name to use for screen session","Default: Rails") { |OPTIONS[:screen_name]| }
|
65
|
+
opts.on("-?", "--help",
|
66
|
+
"Show this help message.") { puts opts; exit }
|
67
|
+
opts.parse!
|
68
|
+
end
|
69
|
+
OPTIONS[:multiuser] ||= false
|
70
|
+
OPTIONS[:usernames] ||= []
|
71
|
+
OPTIONS[:screen_name] ||= "Rails"
|
72
|
+
OPTIONS[:foreground_color] ||= 'R'
|
73
|
+
OPTIONS[:background_color] ||= 'd'
|
74
|
+
OPTIONS[:highlight_color] ||= 'G'
|
75
|
+
OPTIONS[:caption_foreground_color] ||= 'C'
|
76
|
+
OPTIONS[:caption_background_color] ||= 'd'
|
77
|
+
OPTIONS[:caption_highlight_color] ||= 'R'
|
78
|
+
OPTIONS[:shell] ||= 'bash'
|
79
|
+
|
80
|
+
begin
|
81
|
+
|
82
|
+
# Standard erb template
|
83
|
+
erb_template = $home + "/config/.screenrc.code.erb"
|
84
|
+
|
85
|
+
# What screen template to use
|
86
|
+
template = ARGV[0] || "basic"
|
87
|
+
|
88
|
+
# Don't need report screen if we aren't working on reports
|
89
|
+
OPTIONS[:reports_base] = nil if not template == "reports"
|
90
|
+
|
91
|
+
# Add the component path to views/controllers/helpers
|
92
|
+
if c = OPTIONS[:component_base]
|
93
|
+
[:controllers_base,:views_base,:helpers_base].each do |k|
|
94
|
+
OPTIONS[k] << c if OPTIONS[k] == _orig[k]
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# Set template spefific options
|
99
|
+
case template
|
100
|
+
when "custom"
|
101
|
+
raise "Must specify full template path for custom" if not ARGV[1]
|
102
|
+
raise "Must specify full template path for custom" if not File.exists? ARGV[1]
|
103
|
+
erb_template = ARGV[1]
|
104
|
+
when "reports"
|
105
|
+
raise "Must Specify Component for reports" if not OPTIONS[:component_base]
|
106
|
+
OPTIONS[:helpers_base] = OPTIONS[:reports_base] + "helpers/" unless OPTIONS[:helpers_base] != (_orig[:helpers_base] + OPTIONS[:component_base])
|
107
|
+
OPTIONS[:views_base] << ("/" + OPTIONS[:component_base] + "_reports/") unless OPTIONS[:views_base] != (_orig[:views_base] + OPTIONS[:component_base])
|
108
|
+
end
|
109
|
+
|
110
|
+
# Check for valid directories
|
111
|
+
raise "Must Have a rails tree in #{$home}" if not FileTest.directory? $home
|
112
|
+
raise "Must Have a rails tree in #{OPTIONS[:public]}" if not FileTest.directory? OPTIONS[:public]
|
113
|
+
raise "Must Have a rails tree in #{OPTIONS[:views_base]}" if not FileTest.directory? OPTIONS[:views_base]
|
114
|
+
raise "Must Have a rails tree in #{OPTIONS[:models_base]}" if not FileTest.directory? OPTIONS[:models_base]
|
115
|
+
raise "Must Have a rails tree in #{OPTIONS[:helpers_base]}" if not FileTest.directory? OPTIONS[:helpers_base]
|
116
|
+
raise "Must Have a rails tree in #{OPTIONS[:controllers_base]}" if not FileTest.directory? OPTIONS[:controllers_base]
|
117
|
+
|
118
|
+
# Parse the template, save it as a .screenrc.code-USERNAME
|
119
|
+
erb = ERB.new(File.read(erb_template))
|
120
|
+
output = erb.result(binding)
|
121
|
+
screenfile = $home + "/.screenrc-" + (ENV['USER'] || "Bozo")
|
122
|
+
File.open(screenfile,"w+") { |file| file.puts output }
|
123
|
+
|
124
|
+
# Make symlinks
|
125
|
+
%x{ln -sf #{screenfile} #{$old_home}/.screenrc.code }
|
126
|
+
%x{ln -sf #{screenfile} #{$home}/.screenrc.code }
|
127
|
+
Dir.chdir($home)
|
128
|
+
|
129
|
+
# Start a screen with the newly linked .screenrc.code
|
130
|
+
exec("screen","-c#{File.basename(screenfile)}","-S","rails")
|
131
|
+
|
132
|
+
rescue => e
|
133
|
+
require "pp"
|
134
|
+
pp OPTIONS
|
135
|
+
puts e
|
136
|
+
end
|
137
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
require "rubyunit"
|
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.8.11
|
3
|
+
specification_version: 1
|
4
|
+
name: RailsEditor
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.0.21
|
7
|
+
date: 2005-11-17 00:00:00 -06:00
|
8
|
+
summary: A screen + vim IDE setup for editing a Rails tree
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: admins@rubyists.com
|
12
|
+
homepage: http://rubyists.com
|
13
|
+
rubyforge_project:
|
14
|
+
description:
|
15
|
+
autorequire: rails-editor
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: false
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
-
|
22
|
+
- ">"
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.0.0
|
25
|
+
version:
|
26
|
+
platform: ruby
|
27
|
+
signing_key:
|
28
|
+
cert_chain:
|
29
|
+
authors:
|
30
|
+
- Rubyists.com (bougyman,deathsyn,trey)
|
31
|
+
files:
|
32
|
+
- rails/script
|
33
|
+
- rails/config
|
34
|
+
- rails/README.rails-editor
|
35
|
+
- rails/script/editor
|
36
|
+
- bin/RailsEditor
|
37
|
+
- tests/ts_rails_editor.rb
|
38
|
+
- lib/rails-editor.rb
|
39
|
+
- rails/.vim/syntax
|
40
|
+
- rails/.vim/filetype.vim
|
41
|
+
- rails/.vim/syntax/eruby.vim
|
42
|
+
- rails/.vimrc
|
43
|
+
- rails/config/.screenrc.code.erb
|
44
|
+
- README.rails-editor
|
45
|
+
- INSTALL
|
46
|
+
test_files:
|
47
|
+
- tests/ts_rails_editor.rb
|
48
|
+
rdoc_options: []
|
49
|
+
extra_rdoc_files:
|
50
|
+
- README.rails-editor
|
51
|
+
- INSTALL
|
52
|
+
executables:
|
53
|
+
- RailsEditor
|
54
|
+
extensions: []
|
55
|
+
requirements: []
|
56
|
+
dependencies:
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: rails
|
59
|
+
version_requirement:
|
60
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
61
|
+
requirements:
|
62
|
+
-
|
63
|
+
- ">"
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 0.0.0
|
66
|
+
version:
|