ride 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -15,7 +15,9 @@ app_generators/ride/templates/RIDE_License.txt
15
15
  app_generators/ride/templates/RIDE_README.txt
16
16
  app_generators/ride/templates/.irbrc
17
17
  app_generators/ride/templates/config/.screenrc.code.erb
18
- app_generators/ride/templates/config/code_template.erb
18
+ app_generators/ride/templates/config/code_template_ruby.erb
19
+ app_generators/ride/templates/config/code_template_rails.erb
20
+ app_generators/ride/templates/config/code_template_ramaze.erb
19
21
  app_generators/ride/templates/script/console
20
22
  app_generators/ride/templates/script/ride
21
23
  app_generators/ride/templates/tasks/ride.rake
@@ -3,19 +3,36 @@ class RideGenerator < RubiGen::Base
3
3
  DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
4
4
  Config::CONFIG['ruby_install_name'])
5
5
 
6
- default_options :author => nil, :language => "ruby", :shell => 'bash', :editor => 'vim', :console_debugger => 'script/ride-console'
6
+ # These get passed into options
7
+ default_options :author => nil, :language => "ruby", :shell => 'bash', :template_type => 'ramaze', :editor => 'vim', :console_debugger => 'script/ride-console'
7
8
 
8
- attr_reader :name, :main_lib, :shell, :editor, :template, :language, :screen_name, :console_debugger
9
+ attr_reader :name, :main_lib, :shell, :editor, :template_type, :language, :screen_name, :console_debugger
9
10
 
10
11
  def initialize(runtime_args, runtime_options = {})
11
12
  super
12
13
  usage if args.empty?
13
- @destination_root = File.expand_path(args.shift)
14
+ puts 'Args left: ' + args.inspect
15
+ @destination_root = File.expand_path(args.last)
14
16
  @name = base_name
15
17
  extract_options
16
18
  if @language == 'ruby'
17
19
  @main_lib ||= File.basename(@destination_root)
18
20
  end
21
+ ramaze_defaults = { :helper_base => "/lib/", :controller_base => "/controller/", :view_base => "/view/", :model_base => "/model/", :test_base => "/spec/" }
22
+ rails_defaults = { :helper_base => "/app/helpers/", :controller_base => "/app/controllers/", :view_base => "/app/views/", :model_base => "/app/models/", :test_base => "/test/" }
23
+ ruby_defaults = { :controller_base => nil, :view_base => nil, :model_base => nil, :test_base => "/spec/" }
24
+ puts "Options: " + options.inspect
25
+ puts 'template: ' + @template_type.to_s
26
+ defaults = case @template_type
27
+ when "ramaze"
28
+ ramaze_defaults
29
+ when "rails"
30
+ rails_defaults
31
+ else
32
+ @template_type = "ruby"
33
+ ruby_defaults
34
+ end
35
+ defaults.each_pair { |k,v| options[k] = v }
19
36
  @screen_name ||= @name
20
37
  end
21
38
 
@@ -25,20 +42,23 @@ class RideGenerator < RubiGen::Base
25
42
  m.directory ''
26
43
  BASEDIRS.each { |path| m.directory path }
27
44
 
45
+ # create the test directory
46
+ m.directory options[:test_base].sub(%r|^/|,"").sub(%r|/$|,"")
47
+
28
48
  # Create stubs
29
49
  # m.template "template.rb", "some_file_after_erb.rb"
30
50
  # m.template_copy_each ["template.rb", "template2.rb"]
31
51
  # m.file "file", "some_file_copied"
32
52
  # m.file_copy_each ["path/to/file", "path/to/file2"]
33
53
 
34
- m.dependency "install_rubigen_scripts", [destination_root, 'ride'],
35
- :shebang => options[:shebang], :collision => :force
54
+ #m.dependency "install_rubigen_scripts", [destination_root, 'ride'],
55
+ # :shebang => options[:shebang], :collision => :force
36
56
  m.file_copy_each %w{RIDE_History.txt RIDE_License.txt RIDE_README.txt .irbrc}
37
57
  m.file_copy_each [%w{ftplugin ruby ruby.vim}, %w{plugin taglist.vim}, %w{syntax eruby.vim}, %w{ftdetect ruby.vim}].map { |vimfile| File.join(".vim", *vimfile) }
38
58
  script_options = { :chmod => 0755, :shebang => options[:shebang] == RideGenerator::DEFAULT_SHEBANG ? nil : options[:shebang] }
39
59
  m.file_copy_each %w{tasks/rspec.rake tasks/ride.rake}
40
60
  m.template "config/.screenrc.code.erb", "config/.screenrc.code.erb"
41
- m.template "config/code_template.erb", "config/code_template.erb"
61
+ m.template "config/code_template_#{@template_type}.erb", "config/code_template.erb"
42
62
  m.template "script/ride", "script/ride", script_options
43
63
  m.file "script/console", "script/ride-console", script_options
44
64
  end
@@ -62,7 +82,7 @@ EOS
62
82
  # "Some comment about this option",
63
83
  # "Default: none") { |options[:author]| }
64
84
  opts.on("-l", "--language", String, "Language to develop in" "Default: ruby") { |options[:language]| }
65
- opts.on("-t", "--template", String, "Project template" "Default: rails") { |options[:template]| options[:language] = 'ruby' if options[:template] == 'rails' }
85
+ opts.on("-t", "--template", String, "Project template" "Default: ramaze (ramaze, rails, newgem are supported)") { |options[:template_type]| }
66
86
  opts.on("-e", "--editor", String, "Editor to use" "Default: vim") { |options[:editor]| }
67
87
  opts.on("-s", "--shell", String, "Shell to use" "Default: bash") { |options[:shell]| }
68
88
  opts.on("-n", "--name", String, "What to name the screen session" "Default: #{@name}") { |options[:screen_name]| }
@@ -75,6 +95,7 @@ EOS
75
95
  # Templates can access these value via the attr_reader-generated methods, but not the
76
96
  # raw instance variable value.
77
97
  # @author = options[:author]
98
+ @template_type = options[:template_type]
78
99
  @language = options[:language]
79
100
  @main_dir = options[:main_dir]
80
101
  @shell = options[:shell]
@@ -89,7 +110,6 @@ EOS
89
110
  log
90
111
  script
91
112
  config
92
- test
93
113
  tasks
94
114
  tmp
95
115
  .vim
@@ -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 lib 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,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
@@ -6,22 +6,22 @@ $home = ENV['PWD']
6
6
  ENV['HOME'] = $home
7
7
  ENV['REAL_HOME'] = $old_home
8
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 %>"
9
+ :directory => $home,
10
+ :environment => "development",
11
+ :public => $home + "/public/",
12
+ :controllers_base => $home + "<%= options[:controller_base] -%>",
13
+ :views_base => $home + "<%= options[:view_base] -%>",
14
+ :models_base => $home + "<%= options[:model_base] -%>",
15
+ :reports_base => $home + "/vendor/reports/",
16
+ :helpers_base => $home + "<%= options[:helper_base] -%>",
17
+ :apis_base => $home + "/app/api/",
18
+ :test_base => $home + "<%= options[:test_base] -%>",
19
+ :debugger => "<%= console_debugger %>"
20
20
  }
21
21
  _orig = OPTIONS.dup
22
22
  def screen_color(color)
23
- return color[0,1].capitalize unless color == 'black'
24
- 'K'
23
+ return color[0,1].capitalize unless color == 'black'
24
+ 'K'
25
25
  end
26
26
 
27
27
  # Parse options
@@ -31,40 +31,40 @@ ARGV.options do |opts|
31
31
 
32
32
  opts.separator ""
33
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]| }
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
39
  end
40
40
 
41
41
  opts.separator ""
42
42
 
43
43
  opts.on("-S shell", "--shell=SHELL",String,
44
- "Shell to use for command line","Default: bash") { |OPTIONS[:shell]| }
44
+ "Shell to use for command line","Default: bash") { |OPTIONS[:shell]| }
45
45
  opts.on("-M", "--multiuser","Allow other users to access this screen?","Default: no") { |OPTIONS[:multiuser]| }
46
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(',') }
47
+ "Add comma-separated list of trusted users to be able to access this screen","Default: none") { |users| OPTIONS[:usernames] = users.split(',') }
48
48
  opts.on("-C component", "--component_base=component",String,
49
49
  "Use dirs for this component","Default: ''") { |OPTIONS[:component_base]| }
50
50
  opts.separator ""
51
51
  opts.on("-Fforeground_color", "--fgcolor=COLOR",String,
52
- "Foreground Color of Status Line Text","Default: red") { |color| OPTIONS[:foreground_color] = screen_color(color) }
52
+ "Foreground Color of Status Line Text","Default: red") { |color| OPTIONS[:foreground_color] = screen_color(color) }
53
53
  opts.on("-Hhighlight_color", "--hilight=COLOR",String,
54
- "Foreground Color of Active Window Text","Default: green") { |color| OPTIONS[:highlight_color] = screen_color(color) }
54
+ "Foreground Color of Active Window Text","Default: green") { |color| OPTIONS[:highlight_color] = screen_color(color) }
55
55
  opts.on("-Bbackground_color", "--bgcolor=COLOR",String,
56
- "Background Color of Status Line","Default: transparent (default)") { |color| OPTIONS[:background_color] = screen_color(color) }
56
+ "Background Color of Status Line","Default: transparent (default)") { |color| OPTIONS[:background_color] = screen_color(color) }
57
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) }
58
+ "Background Color of Caption Line (when screen is split)","Default: transparent (default)") { |color| OPTIONS[:caption_background_color] = screen_color(color) }
59
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) }
60
+ "Foreground Color of Caption Line Text","Default: cyan") { |color| OPTIONS[:caption_foreground_color] = screen_color(color) }
61
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) }
62
+ "Foreground Color of Caption line Active Window Text","Default: red") { |color| OPTIONS[:caption_highlight_color] = screen_color(color) }
63
63
  opts.separator "Available colors are black, red, green, yellow, blue, magenta, cyan, white, and default (transparent)"
64
64
  opts.on("-Nname", "--name=NAME",String,
65
- "Name to use for screen session","Default: Rails") { |OPTIONS[:screen_name]| }
65
+ "Name to use for screen session","Default: Rails") { |OPTIONS[:screen_name]| }
66
66
  opts.on("-Echar", "--escape=CHARACTER",String,
67
- "Escape Key to use for screen session","Default: C-a") { |OPTIONS[:screen_escape]| }
67
+ "Escape Key to use for screen session","Default: C-a") { |OPTIONS[:screen_escape]| }
68
68
  opts.on("-?", "--help",
69
69
  "Show this help message.") { puts opts; exit }
70
70
  opts.parse!
@@ -83,67 +83,67 @@ OPTIONS[:screen_escape] ||= "^Aa"
83
83
 
84
84
  begin
85
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])
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
143
 
144
144
  rescue => e
145
- require "pp"
146
- pp OPTIONS
147
- puts e
145
+ require "pp"
146
+ pp OPTIONS
147
+ puts e
148
148
  end
149
149
 
@@ -2,7 +2,7 @@ require 'fileutils'
2
2
  include FileUtils
3
3
 
4
4
  require 'rubygems'
5
- %w[rake hoe newgem rubigen].each do |req_gem|
5
+ %w[rake hoe echoe cucumber newgem rubigen].each do |req_gem|
6
6
  begin
7
7
  require req_gem
8
8
  rescue LoadError
data/lib/ride/version.rb CHANGED
@@ -2,7 +2,7 @@ module Ride
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 4
5
- TINY = 2
5
+ TINY = 3
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -18,7 +18,8 @@ end
18
18
 
19
19
  # Time to add your specs!
20
20
  # http://rspec.info/
21
- describe "Ride Generator", "when application is generated" do
21
+ describe "Ride Rails Generator", "when rails application is generated" do
22
+ # {{{
22
23
  include RideGeneratorSpecHelper
23
24
  before(:all) do
24
25
  bare_setup
@@ -44,10 +45,10 @@ describe "Ride Generator", "when application is generated" do
44
45
  File.exists?(full_path(file_path)).should == true
45
46
  end
46
47
 
47
- %w{destroy generate}.each do |file|
48
- it "should create #{script_path = File.join("script", file)}" do
49
- File.exists?(full_path(script_path)).should == true
50
- FileTest.executable?(full_path(script_path)).should == true
48
+ %w{destroy generate console}.each do |file|
49
+ it "should not create #{script_path = File.join("script", file)}" do
50
+ File.exists?(full_path(script_path)).should_not == true
51
+ FileTest.executable?(full_path(script_path)).should_not == true
51
52
  end
52
53
  end
53
54
 
@@ -65,6 +66,7 @@ describe "Ride Generator", "when application is generated" do
65
66
  file_path = File.join("script", "ride")
66
67
  File.exists?(full_path(file_path)).should == true
67
68
  FileTest.executable?(full_path(file_path)).should == true
69
+ File.read(full_path(file_path)).match(/app\/models/).should_not == nil
68
70
  end
69
71
 
70
72
  it "should create the script/ride-console file (executable)" do
@@ -80,8 +82,79 @@ describe "Ride Generator", "when application is generated" do
80
82
  end
81
83
 
82
84
  after(:all) do
83
- # bare_teardown
85
+ bare_teardown
84
86
  end
85
87
 
86
88
  end
89
+ # }}}
90
+
91
+ describe "Ride Ramaze Generator", "when ramaze application is generated" do
92
+ include RideGeneratorSpecHelper
93
+ before(:all) do
94
+ bare_setup
95
+ run_generator('ride', [APP_ROOT], sources, {:console_debugger => 'irb', :template => 'ramaze', :shell => 'bash', :editor => 'vim'})
96
+ end
97
+
98
+ RideGenerator::BASEDIRS.each do |dir|
99
+ it "should create #{dir}" do
100
+ File.directory?(full_path(dir)).should == true
101
+ end
102
+ end
87
103
 
104
+ %w{RIDE_History.txt RIDE_License.txt RIDE_README.txt .irbrc}.each do |file|
105
+ it "should create #{file}" do
106
+ File.exists?(full_path(file)).should == true
107
+ end
108
+ end
109
+
110
+ it "should put our rake tasks in place" do
111
+ file_path = File.join("tasks", "ride.rake")
112
+ File.exists?(full_path(file_path)).should == true
113
+ file_path = File.join("tasks", "rspec.rake")
114
+ File.exists?(full_path(file_path)).should == true
115
+ end
116
+
117
+ %w{destroy generate console}.each do |file|
118
+ it "should not create #{script_path = File.join("script", file)}" do
119
+ File.exists?(full_path(script_path)).should_not == true
120
+ FileTest.executable?(full_path(script_path)).should_not == true
121
+ end
122
+ end
123
+
124
+ it "should create the config/.screenrc.code.erb file" do
125
+ file_path = File.join("config", ".screenrc.code.erb")
126
+ File.exists?(full_path(file_path)).should == true
127
+ end
128
+
129
+ it "should create the config/code_template.erb file" do
130
+ file_path = File.join("config", "code_template.erb")
131
+ File.exists?(full_path(file_path)).should == true
132
+ end
133
+
134
+ it "should create the script/ride file (executable)" do
135
+ file_path = File.join("script", "ride")
136
+ File.exists?(full_path(file_path)).should == true
137
+ FileTest.executable?(full_path(file_path)).should == true
138
+ File.read(full_path(file_path)).match(/app\/models/).should == nil
139
+ File.read(full_path(file_path)).match(/\/model\//).should_not == nil
140
+ File.read(full_path(file_path)).match(%r| :controllers_base => [^\s]+ \+ "/controller/",|).should_not == nil
141
+ File.read(full_path(file_path)).match(%r| :models_base\s+=>\s[^\s]+\s+\+\s+"/model/",|).should_not == nil
142
+ end
143
+
144
+ it "should create the script/ride-console file (executable)" do
145
+ file_path = File.join("script", "ride-console")
146
+ File.exists?(full_path(file_path)).should == true
147
+ FileTest.executable?(full_path(file_path)).should == true
148
+ end
149
+
150
+ [%w{ftplugin ruby ruby.vim}, %w{plugin taglist.vim}, %w{syntax eruby.vim}, %w{ftdetect ruby.vim}].each do |vimfile|
151
+ it "Should create #{vim_path = File.join(".vim", *vimfile)}" do
152
+ File.exists?(full_path(vim_path)).should == true
153
+ end
154
+ end
155
+
156
+
157
+ after(:all) do
158
+ # bare_teardown
159
+ end
160
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ride
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - TJ Vanderpoel
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-14 00:00:00 -05:00
12
+ date: 2009-01-09 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -77,7 +77,9 @@ files:
77
77
  - app_generators/ride/templates/RIDE_README.txt
78
78
  - app_generators/ride/templates/.irbrc
79
79
  - app_generators/ride/templates/config/.screenrc.code.erb
80
- - app_generators/ride/templates/config/code_template.erb
80
+ - app_generators/ride/templates/config/code_template_ruby.erb
81
+ - app_generators/ride/templates/config/code_template_rails.erb
82
+ - app_generators/ride/templates/config/code_template_ramaze.erb
81
83
  - app_generators/ride/templates/script/console
82
84
  - app_generators/ride/templates/script/ride
83
85
  - app_generators/ride/templates/tasks/ride.rake
@@ -155,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
157
  requirements: []
156
158
 
157
159
  rubyforge_project: ride
158
- rubygems_version: 1.2.0
160
+ rubygems_version: 1.3.1
159
161
  signing_key:
160
162
  specification_version: 2
161
163
  summary: A Multi-User Console Interactive Development Environment Based On GNUScreen