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,136 @@
1
+ module RubiGen
2
+ module GeneratorSpecHelper
3
+ # Runs the create command (like the command line does)
4
+ def run_generator(name, params, sources, options = {})
5
+ generator = build_generator(name, params, sources, options)
6
+ silence_generator do
7
+ generator.command(:create).invoke!
8
+ end
9
+ generator
10
+ end
11
+
12
+ # Instatiates the Generator
13
+ def build_generator(name, params, sources, options)
14
+ options.merge!(:collision => :force) # so no questions are prompted
15
+ if sources.is_a?(Symbol)
16
+ if sources == :app
17
+ RubiGen::Base.use_application_sources!
18
+ else
19
+ RubiGen::Base.use_component_sources!
20
+ end
21
+ else
22
+ RubiGen::Base.reset_sources
23
+ RubiGen::Base.prepend_sources(*sources) unless sources.blank?
24
+ end
25
+ RubiGen::Base.instance(name, params, options)
26
+ end
27
+
28
+ # Silences the logger temporarily and returns the output as a String
29
+ def silence_generator
30
+ logger_original=RubiGen::Base.logger
31
+ myout=StringIO.new
32
+ RubiGen::Base.logger=RubiGen::SimpleLogger.new(myout)
33
+ # TODO redirect $stdout to myout
34
+ yield if block_given?
35
+ RubiGen::Base.logger=logger_original
36
+ # TODO fix $stdout again
37
+ myout.string
38
+ end
39
+
40
+ # asserts that the given file was generated.
41
+ # the contents of the file is passed to a block.
42
+ def generated_file?(path)
43
+ file_exists?(path)
44
+ File.open("#{APP_ROOT}/#{path}") do |f|
45
+ yield f.read if block_given?
46
+ end
47
+ end
48
+
49
+ # asserts that the given file exists
50
+ def file_exists?(path)
51
+ File.exists?("#{APP_ROOT}/#{path}").should eql(true)
52
+ end
53
+
54
+ # asserts that the given directory exists
55
+ def directory_exists?(path)
56
+ File.directory?("#{APP_ROOT}/#{path}").should eql(true)
57
+ end
58
+
59
+ # asserts that the given class source file was generated.
60
+ # It takes a path without the <tt>.rb</tt> part and an optional super class.
61
+ # the contents of the class source file is passed to a block.
62
+ def generated_class?(path,parent=nil)
63
+ path=~/\/?(\d+_)?(\w+)$/
64
+ class_name=$2.camelize
65
+ generated_file?("#{path}.rb") do |body|
66
+ it "should define #{class_name} in #{path}.rb" do
67
+ body.should match(/class #{class_name}#{parent.nil? ? '':" < #{parent}"}/)
68
+ end
69
+ yield body if block_given?
70
+ end
71
+ end
72
+
73
+ # asserts that the given module source file was generated.
74
+ # It takes a path without the <tt>.rb</tt> part.
75
+ # the contents of the class source file is passed to a block.
76
+ def generated_module?(path)
77
+ path=~/\/?(\w+)$/
78
+ module_name=$1.camelize
79
+ generated_file?("#{path}.rb") do |body|
80
+ it "should define #{module_name} in #{path}.rb" do
81
+ body.should match(/module #{module_name}/)
82
+ end
83
+ yield body if block_given?
84
+ end
85
+ end
86
+
87
+ # asserts that the given unit test was generated.
88
+ # It takes a name or symbol without the <tt>test_</tt> part and an optional super class.
89
+ # the contents of the class source file is passed to a block.
90
+ def generated_test_for?(name, parent="Test::Unit::TestCase")
91
+ generated_class? "test/test_#{name.to_s.underscore}", parent do |body|
92
+ yield body if block_given?
93
+ end
94
+ end
95
+
96
+ # asserts that the given methods are defined in the body.
97
+ # This does assume standard rails code conventions with regards to the source code.
98
+ # The body of each individual method is passed to a block.
99
+ def has_method?(body,*methods)
100
+ methods.each do |name|
101
+ it "should define the method #{name.to_s}" do
102
+ body.should match(/^ def #{name.to_s}\n((\n| .*\n)*) end/)
103
+ end
104
+ yield( name, $1 ) if block_given?
105
+ end
106
+ end
107
+
108
+ def app_root_files
109
+ Dir[APP_ROOT + '/**/*']
110
+ end
111
+
112
+ def rubygem_folders
113
+ %w[bin examples lib test]
114
+ end
115
+
116
+ def rubygems_setup
117
+ bare_setup
118
+ rubygem_folders.each do |folder|
119
+ Dir.mkdir("#{APP_ROOT}/#{folder}") unless File.exists?("#{APP_ROOT}/#{folder}")
120
+ end
121
+ end
122
+
123
+ def rubygems_teardown
124
+ bare_teardown
125
+ end
126
+
127
+ def bare_setup
128
+ FileUtils.mkdir_p(APP_ROOT)
129
+ end
130
+
131
+ def bare_teardown
132
+ FileUtils.rm_rf TMP_ROOT || APP_ROOT
133
+ end
134
+
135
+ end
136
+ end
@@ -0,0 +1,81 @@
1
+ require File.join(File.dirname(__FILE__), '/spec_generator_helper.rb')
2
+
3
+ module RideGeneratorSpecHelper
4
+ include RubiGen::GeneratorSpecHelper
5
+ def generator_path
6
+ "app_generators"
7
+ end
8
+
9
+ def sources
10
+ [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
11
+ ]
12
+ end
13
+
14
+ def full_path(some_path)
15
+ File.join(APP_ROOT, some_path)
16
+ end
17
+ end
18
+
19
+ # Time to add your specs!
20
+ # http://rspec.info/
21
+ describe "Ride Generator", "when application is generated" do
22
+ include RideGeneratorSpecHelper
23
+ before(:all) do
24
+ bare_setup
25
+ run_generator('ride', [APP_ROOT], sources, {:console_debugger => 'irb', :template => 'rails', :shell => 'bash', :editor => 'vim'})
26
+ end
27
+
28
+ RideGenerator::BASEDIRS.each do |dir|
29
+ it "should create #{dir}" do
30
+ File.directory?(full_path(dir)).should == true
31
+ end
32
+ end
33
+
34
+ %w{Rakefile History.txt License.txt README.txt}.each do |file|
35
+ it "should create #{file}" do
36
+ File.exists?(full_path(file)).should == true
37
+ end
38
+ end
39
+
40
+ it "should put our rake tasks in place" do
41
+ file_path = File.join("tasks", "ride.rake")
42
+ File.exists?(full_path(file_path)).should == true
43
+ file_path = File.join("tasks", "rspec.rake")
44
+ File.exists?(full_path(file_path)).should == true
45
+ end
46
+
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
51
+ end
52
+ end
53
+
54
+ it "should create the config/.screenrc.code.erb file" do
55
+ file_path = File.join("config", ".screenrc.code.erb")
56
+ File.exists?(full_path(file_path)).should == true
57
+ end
58
+
59
+ it "should create the config/code_template.erb file" do
60
+ file_path = File.join("config", "code_template.erb")
61
+ File.exists?(full_path(file_path)).should == true
62
+ end
63
+
64
+ it "should create the script/ride file" do
65
+ file_path = File.join("script", "ride")
66
+ File.exists?(full_path(file_path)).should == true
67
+ FileTest.executable?(full_path(file_path)).should == true
68
+ end
69
+
70
+ [%w{ftplugin ruby ruby.vim}, %w{plugin taglist.vim}, %w{syntax eruby.vim}, %w{ftdetect ruby.vim}].each do |vimfile|
71
+ it "Should create #{vim_path = File.join(".vim", *vimfile)}" do
72
+ File.exists?(full_path(vim_path)).should == true
73
+ end
74
+ end
75
+
76
+ after(:all) do
77
+ # bare_teardown
78
+ end
79
+
80
+ end
81
+
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,35 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ gem 'rspec'
6
+ require 'spec'
7
+ end
8
+
9
+
10
+ require 'fileutils'
11
+
12
+ # Must set before requiring generator libs.
13
+ TMP_ROOT = File.dirname(__FILE__) + "/tmp" unless defined?(TMP_ROOT)
14
+ PROJECT_NAME = "ride" unless defined?(PROJECT_NAME)
15
+ app_root = File.join(TMP_ROOT, PROJECT_NAME)
16
+ if defined?(APP_ROOT)
17
+ APP_ROOT.replace(app_root)
18
+ else
19
+ APP_ROOT = app_root
20
+ end
21
+ if defined?(RAILS_ROOT)
22
+ RAILS_ROOT.replace(app_root)
23
+ else
24
+ RAILS_ROOT = app_root
25
+ end
26
+
27
+ begin
28
+ require 'rubigen'
29
+ rescue LoadError
30
+ require 'rubygems'
31
+ require 'rubigen'
32
+ end
33
+ require File.join(File.dirname(__FILE__), 'generator_spec_helper')
34
+ $:.unshift(File.dirname(__FILE__) + '/../app_generators/ride')
35
+ require 'ride_generator'
@@ -0,0 +1,10 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ gem 'rspec'
6
+ require 'spec'
7
+ end
8
+
9
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
10
+ require 'ride'
@@ -0,0 +1,34 @@
1
+ desc 'Release the website and new gem version'
2
+ task :deploy => [:check_version, :website, :release] do
3
+ puts "Remember to create SVN tag:"
4
+ puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
5
+ "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
6
+ puts "Suggested comment:"
7
+ puts "Tagging release #{CHANGES}"
8
+ end
9
+
10
+ desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
11
+ task :local_deploy => [:website_generate, :install_gem]
12
+
13
+ task :check_version do
14
+ unless ENV['VERSION']
15
+ puts 'Must pass a VERSION=x.y.z release version'
16
+ exit
17
+ end
18
+ unless ENV['VERSION'] == VERS
19
+ puts "Please update your version.rb to match the release version, currently #{VERS}"
20
+ exit
21
+ end
22
+ end
23
+
24
+ desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
25
+ task :install_gem_no_doc => [:clean, :package] do
26
+ sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
27
+ end
28
+
29
+ namespace :manifest do
30
+ desc 'Recreate Manifest.txt to include ALL files'
31
+ task :refresh do
32
+ `rake check_manifest | patch -p0 > Manifest.txt`
33
+ end
34
+ end
@@ -0,0 +1,7 @@
1
+ task :ruby_env do
2
+ RUBY_APP = if RUBY_PLATFORM =~ /java/
3
+ "jruby"
4
+ else
5
+ "ruby"
6
+ end unless defined? RUBY_APP
7
+ end
data/tasks/ride.rake ADDED
@@ -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
data/tasks/rspec.rake ADDED
@@ -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
@@ -0,0 +1,17 @@
1
+ desc 'Generate website files'
2
+ task :website_generate => :ruby_env do
3
+ (Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
4
+ sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
5
+ end
6
+ end
7
+
8
+ desc 'Upload website files to rubyforge'
9
+ task :website_upload do
10
+ host = "#{rubyforge_username}@rubyforge.org"
11
+ remote_dir = "/var/www/gforge-projects/#{PATH}/"
12
+ local_dir = 'website'
13
+ sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
14
+ end
15
+
16
+ desc 'Generate and upload website files'
17
+ task :website => [:website_generate, :website_upload, :publish_docs]
@@ -0,0 +1,29 @@
1
+ begin
2
+ require File.dirname(__FILE__) + '/test_helper'
3
+ rescue LoadError
4
+ require 'test/unit'
5
+ end
6
+ require 'fileutils'
7
+
8
+ # Must set before requiring generator libs.
9
+ TMP_ROOT = File.dirname(__FILE__) + "/tmp" unless defined?(TMP_ROOT)
10
+ PROJECT_NAME = "myproject" unless defined?(PROJECT_NAME)
11
+ app_root = File.join(TMP_ROOT, PROJECT_NAME)
12
+ if defined?(APP_ROOT)
13
+ APP_ROOT.replace(app_root)
14
+ else
15
+ APP_ROOT = app_root
16
+ end
17
+ if defined?(RAILS_ROOT)
18
+ RAILS_ROOT.replace(app_root)
19
+ else
20
+ RAILS_ROOT = app_root
21
+ end
22
+
23
+ begin
24
+ require 'rubigen'
25
+ rescue LoadError
26
+ require 'rubygems'
27
+ require 'rubigen'
28
+ end
29
+ require 'rubigen/helpers/generator_test_helper'
@@ -0,0 +1,2 @@
1
+ require 'test/unit'
2
+ require File.dirname(__FILE__) + '/../lib/ride'
data/test/test_ride.rb ADDED
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestRide < Test::Unit::TestCase
4
+
5
+ def setup
6
+ end
7
+
8
+ def test_truth
9
+ assert true
10
+ end
11
+ end
@@ -0,0 +1,43 @@
1
+ require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
+
3
+ class TestRideGenerator < Test::Unit::TestCase
4
+ include RubiGen::GeneratorTestHelper
5
+
6
+ def setup
7
+ bare_setup
8
+ end
9
+
10
+ def teardown
11
+ bare_teardown
12
+ end
13
+
14
+ # Some generator-related assertions:
15
+ # assert_generated_file(name, &block) # block passed the file contents
16
+ # assert_directory_exists(name)
17
+ # assert_generated_class(name, &block)
18
+ # assert_generated_module(name, &block)
19
+ # assert_generated_test_for(name, &block)
20
+ # The assert_generated_(class|module|test_for) &block is passed the body of the class/module within the file
21
+ # assert_has_method(body, *methods) # check that the body has a list of methods (methods with parentheses not supported yet)
22
+ #
23
+ # Other helper methods are:
24
+ # app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
25
+ # bare_setup - place this in setup method to create the APP_ROOT folder for each test
26
+ # bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
27
+
28
+ def test_generator_without_options
29
+ run_generator('ride', [APP_ROOT], sources)
30
+ assert_directory_exists "path/to/included/folder"
31
+ assert_generated_file "path/to/included/folder/some_file"
32
+ end
33
+
34
+ private
35
+ def sources
36
+ [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
37
+ ]
38
+ end
39
+
40
+ def generator_path
41
+ "app_generators"
42
+ end
43
+ end
@@ -0,0 +1,11 @@
1
+ <html>
2
+ <head>
3
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
4
+ <title>ride</title>
5
+
6
+ </head>
7
+ <body id="body">
8
+ <p>This page has not yet been created for RubyGem <code>ride</code></p>
9
+ <p>To the developer: To generate it, update website/index.txt and run the rake task <code>website</code> to generate this <code>index.html</code> file.</p>
10
+ </body>
11
+ </html>
data/website/index.txt ADDED
@@ -0,0 +1,83 @@
1
+ h1. ride
2
+
3
+ h1. &#x2192; 'ride'
4
+
5
+
6
+ h2. What
7
+
8
+
9
+ h2. Installing
10
+
11
+ <pre syntax="ruby">sudo gem install ride</pre>
12
+
13
+ h2. The basics
14
+
15
+
16
+ h2. Demonstration of usage
17
+
18
+
19
+
20
+ h2. Forum
21
+
22
+ "http://groups.google.com/group/ride":http://groups.google.com/group/ride
23
+
24
+ TODO - create Google Group - ride
25
+
26
+ h2. How to submit patches
27
+
28
+ Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/ and for section "8b: Submit patch to Google Groups":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups, use the Google Group above.
29
+
30
+ TODO - pick SVN or Git instructions
31
+
32
+ The trunk repository is <code>svn://rubyforge.org/var/svn/ride/trunk</code> for anonymous access.
33
+
34
+ OOOORRRR
35
+
36
+ You can fetch the source from either:
37
+
38
+ <% if rubyforge_project_id %>
39
+
40
+ * rubyforge: "http://rubyforge.org/scm/?group_id=<%= rubyforge_project_id %>":http://rubyforge.org/scm/?group_id=<%= rubyforge_project_id %>
41
+
42
+ <pre>git clone git://rubyforge.org/ride.git</pre>
43
+
44
+ <% else %>
45
+
46
+ * rubyforge: MISSING IN ACTION
47
+
48
+ TODO - You can not created a RubyForge project, OR have not run <code>rubyforge config</code>
49
+ yet to refresh your local rubyforge data with this projects' id information.
50
+
51
+ When you do this, this message will magically disappear!
52
+
53
+ Or you can hack website/index.txt and make it all go away!!
54
+
55
+ <% end %>
56
+
57
+ * github: "http://github.com/GITHUB_USERNAME/ride/tree/master":http://github.com/GITHUB_USERNAME/ride/tree/master
58
+
59
+ <pre>git clone git://github.com/GITHUB_USERNAME/ride.git</pre>
60
+
61
+
62
+ TODO - add "github_username: username" to ~/.rubyforge/user-config.yml and newgem will reuse it for future projects.
63
+
64
+
65
+ * gitorious: "git://gitorious.org/ride/mainline.git":git://gitorious.org/ride/mainline.git
66
+
67
+ <pre>git clone git://gitorious.org/ride/mainline.git</pre>
68
+
69
+ h3. Build and test instructions
70
+
71
+ <pre>cd ride
72
+ rake test
73
+ rake install_gem</pre>
74
+
75
+
76
+ h2. License
77
+
78
+ This code is free to use under the terms of the MIT license.
79
+
80
+ h2. Contact
81
+
82
+ Comments are welcome. Send an email to "FIXME full name":mailto:FIXME email via the "forum":http://groups.google.com/group/ride
83
+