├── test └── test_rg.rb ├── template.txt ├── test.rb ├── spec ├── rg_spec.rb └── spec_helper.rb ├── History.txt ├── lib ├── rg │ ├── scm │ │ ├── svn.rb │ │ └── git.rb │ ├── store.rb │ ├── generator.rb │ └── runner.rb ├── builtin │ ├── bort.rb │ ├── entp.rb │ └── thoughtbot.rb └── rg.rb ├── bin └── rg ├── Manifest.txt ├── Rakefile ├── rg.gemspec └── README.txt /test/test_rg.rb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /template.txt: -------------------------------------------------------------------------------- 1 | template(:awesome) do 2 | puts "DUDE" 3 | end 4 | -------------------------------------------------------------------------------- /test.rb: -------------------------------------------------------------------------------- 1 | unless STDIN.read == nil 2 | puts STDIN.read 3 | else 4 | puts "eff" 5 | end 6 | -------------------------------------------------------------------------------- /spec/rg_spec.rb: -------------------------------------------------------------------------------- 1 | 2 | require File.join(File.dirname(__FILE__), %w[spec_helper]) 3 | 4 | describe Rg do 5 | end 6 | 7 | # EOF 8 | -------------------------------------------------------------------------------- /History.txt: -------------------------------------------------------------------------------- 1 | == 0.2.0 / 2008-10-21 2 | 3 | * 1 major enhancement 4 | * Birthday! 5 | * New feature: awesomeness. 6 | * It is now feature complete! (Lies.) 7 | -------------------------------------------------------------------------------- /lib/rg/scm/svn.rb: -------------------------------------------------------------------------------- 1 | module Rg 2 | class Svn 3 | def self.checkout(repos, branch = nil) 4 | `svn checkout #{repos}/#{branch || "trunk"}` 5 | end 6 | end 7 | end -------------------------------------------------------------------------------- /bin/rg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require File.expand_path( 4 | File.join(File.dirname(__FILE__), %w[.. lib rg])) 5 | 6 | if ARGV[0] == "-i" 7 | Rg::Store.install(ARGV, STDIN) 8 | else 9 | Rg::Generator.new.run(ARGV.pop, ARGV) 10 | end 11 | 12 | # EOF 13 | -------------------------------------------------------------------------------- /lib/rg/scm/git.rb: -------------------------------------------------------------------------------- 1 | module Rg 2 | class Git 3 | def self.clone(repos, branch=nil) 4 | `git clone #{repos}` 5 | 6 | if branch 7 | `cd #{repos.split('/').last}/` 8 | `git checkout #{branch}` 9 | end 10 | end 11 | end 12 | end -------------------------------------------------------------------------------- /Manifest.txt: -------------------------------------------------------------------------------- 1 | History.txt 2 | Manifest.txt 3 | README.txt 4 | Rakefile 5 | bin/rg 6 | lib/rg.rb 7 | lib/rg/generator.rb 8 | lib/rg/runner.rb 9 | lib/rg/store.rb 10 | lib/rg/scm/git.rb 11 | lib/rg/scm/svn.rb 12 | lib/builtin/bort.rb 13 | lib/builtin/entp.rb 14 | lib/builtin/thoughtbot.rb 15 | spec/rg_spec.rb 16 | spec/spec_helper.rb 17 | test/test_rg.rb 18 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | 2 | require File.expand_path( 3 | File.join(File.dirname(__FILE__), %w[.. lib rg])) 4 | 5 | Spec::Runner.configure do |config| 6 | # == Mock Framework 7 | # 8 | # RSpec uses it's own mocking framework by default. If you prefer to 9 | # use mocha, flexmock or RR, uncomment the appropriate line: 10 | # 11 | # config.mock_with :mocha 12 | # config.mock_with :flexmock 13 | # config.mock_with :rr 14 | end 15 | 16 | # EOF 17 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Look in the tasks/setup.rb file for the various options that can be 2 | # configured in this Rakefile. The .rake files in the tasks directory 3 | # are where the options are used. 4 | 5 | begin 6 | require 'bones' 7 | Bones.setup 8 | rescue LoadError 9 | load 'tasks/setup.rb' 10 | end 11 | 12 | ensure_in_path 'lib' 13 | require 'rg' 14 | 15 | task :default => 'spec:run' 16 | 17 | PROJ.name = 'rg' 18 | PROJ.authors = 'Jeremy McAnally' 19 | PROJ.email = 'jeremy@entp.com' 20 | PROJ.url = 'http://www.omgbloglol.com/' 21 | PROJ.version = Rg::VERSION 22 | PROJ.rubyforge.name = 'rg' 23 | 24 | PROJ.gem.dependencies << ['ruby2ruby', '> 0.0.0'] 25 | 26 | PROJ.spec.opts << '--color' 27 | 28 | # EOF 29 | -------------------------------------------------------------------------------- /lib/builtin/bort.rb: -------------------------------------------------------------------------------- 1 | template(:bort) do 2 | plugin 'rspec', :git => 'git://github.com/dchelimsky/rspec.git' 3 | plugin 'rspec-rails', :git => 'git://github.com/dchelimsky/rspec-rails.git' 4 | plugin 'exception_notifier', :git => 'git://github.com/rails/exception_notification.git' 5 | plugin 'open_id_authentication', :git => 'git://github.com/rails/open_id_authentication.git' 6 | plugin 'asset_packager', :git => 'http://synthesis.sbecker.net/pages/asset_packager' 7 | plugin 'role_requirement', :git => 'git://github.com/timcharper/role_requirement.git' 8 | plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git' 9 | 10 | gem 'will-paginate', :git => 'git://github.com/mislav/will_paginate.git' 11 | gem 'rubyist-aasm' 12 | gem 'ruby-openid' 13 | 14 | generate("authenticated", "user session") 15 | generate("rspec") 16 | end -------------------------------------------------------------------------------- /lib/builtin/entp.rb: -------------------------------------------------------------------------------- 1 | template(:entp) do 2 | plugin 'rspec', :git => 'git://github.com/dchelimsky/rspec.git' 3 | plugin 'rspec-rails', :git => 'git://github.com/dchelimsky/rspec-rails.git' 4 | plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git' 5 | plugin 'open_id_authentication', :git => 'git://github.com/rails/open_id_authentication.git' 6 | plugin 'exception_notifier', :git => 'git://github.com/rails/exception_notification.git' 7 | 8 | gem 'will-paginate', :git => 'git://github.com/mislav/will_paginate.git' 9 | gem 'ruby-openid' 10 | gem 'rubyist-aasm' 11 | 12 | rakefile "bootstrap.rake" do 13 | namespace :app do 14 | task :bootstrap do 15 | end 16 | 17 | task :seed do 18 | end 19 | end 20 | end 21 | 22 | generate("authenticated", "user session") 23 | generate("rspec") 24 | end -------------------------------------------------------------------------------- /lib/builtin/thoughtbot.rb: -------------------------------------------------------------------------------- 1 | template(:thoughtbot) do 2 | gem 'mislav-will_paginate' 3 | gem 'RedCloth' 4 | gem 'mocha' 5 | gem 'thoughtbot-factory_girl' 6 | gem 'thoughtbot-shoulda' 7 | gem 'quietbacktrace' 8 | 9 | plugin 'squirrel', :git => 'git://github.com/thoughtbot/squirrel.git' 10 | plugin 'hoptoad_notifier', :git => 'git://github.com/thoughtbot/hoptoad_notifier.git' 11 | plugin 'limerick_rake', :git => 'git://github.com/thoughtbot/limerick_rake.git' 12 | plugin 'mile_marker', :git => 'git://github.com/thoughtbot/mile_marker.git' 13 | 14 | initializer 'hoptoad.rb' do 15 | HoptoadNotifier.configure do |config| 16 | config.api_key = 'HOPTOAD-KEY' 17 | end 18 | end 19 | 20 | initializer 'action_mailer_configs.rb' do 21 | ActionMailer::Base.smtp_settings = { 22 | :address => "smtp.thoughtbot.com", 23 | :port => 25, 24 | :domain => "thoughtbot.com" 25 | } 26 | end 27 | 28 | initializer 'requires.rb' do 29 | require 'redcloth' 30 | 31 | Dir[File.join(RAILS_ROOT, 'lib', 'extensions', '*.rb')].each do |f| 32 | require f 33 | end 34 | 35 | Dir[File.join(RAILS_ROOT, 'lib', '*.rb')].each do |f| 36 | require f 37 | end 38 | 39 | # Rails 2 doesn't like mocks 40 | 41 | Dir[File.join(RAILS_ROOT, 'test', 'mocks', RAILS_ENV, '*.rb')].each do |f| 42 | require f 43 | end 44 | end 45 | 46 | initializer 'time_formats.rb' do 47 | # Example time formats 48 | { :short_date => "%x", :long_date => "%a, %b %d, %Y" }.each do |k, v| 49 | ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.update(k => v) 50 | end 51 | end 52 | end -------------------------------------------------------------------------------- /lib/rg.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | 3 | begin 4 | require 'ruby2ruby' 5 | rescue 6 | puts "** Ruby2Ruby not installed! You can't use the fancy syntax stuff. FAIL." 7 | end 8 | 9 | module Rg 10 | 11 | # :stopdoc: 12 | VERSION = '0.0.5' 13 | LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR 14 | PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR 15 | # :startdoc: 16 | 17 | # Returns the version string for the library. 18 | # 19 | def self.version 20 | VERSION 21 | end 22 | 23 | # Returns the library path for the module. If any arguments are given, 24 | # they will be joined to the end of the libray path using 25 | # File.join. 26 | # 27 | def self.libpath( *args ) 28 | args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten) 29 | end 30 | 31 | # Returns the lpath for the module. If any arguments are given, 32 | # they will be joined to the end of the path using 33 | # File.join. 34 | # 35 | def self.path( *args ) 36 | args.empty? ? PATH : ::File.join(PATH, args.flatten) 37 | end 38 | 39 | # Utility method used to rquire all files ending in .rb that lie in the 40 | # directory below this file that has the same name as the filename passed 41 | # in. Optionally, a specific _directory_ name can be passed in such that 42 | # the _filename_ does not have to be equivalent to the directory. 43 | # 44 | def self.require_all_libs_relative_to( fname, dir = nil ) 45 | dir ||= ::File.basename(fname, '.*') 46 | search_me = ::File.expand_path( 47 | ::File.join(::File.dirname(fname), dir, '*.rb')) 48 | 49 | Dir.glob(search_me).sort.each {|rb| require rb} 50 | end 51 | 52 | end # module Rg 53 | 54 | Rg.require_all_libs_relative_to(__FILE__) 55 | 56 | # EOF 57 | -------------------------------------------------------------------------------- /rg.gemspec: -------------------------------------------------------------------------------- 1 | Gem::Specification.new do |s| 2 | s.name = %q{rg} 3 | s.version = "0.0.5" 4 | 5 | s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= 6 | s.authors = ["Jeremy McAnally"] 7 | s.date = %q{2008-10-23} 8 | s.default_executable = %q{rg} 9 | s.description = %q{Generate Rails applications from your own template!} 10 | s.email = %q{jeremy@entp.com} 11 | s.executables = ["rg"] 12 | s.extra_rdoc_files = ["History.txt", "README.txt", "bin/rg"] 13 | s.files = ["History.txt", "Manifest.txt", "README.txt", "Rakefile", "bin/rg", "lib/builtin/bort.rb", "lib/builtin/entp.rb", "lib/builtin/thoughtbot.rb", "lib/rg.rb", "lib/rg/generator.rb", "lib/rg/runner.rb", "lib/rg/scm/git.rb", "lib/rg/scm/svn.rb", "lib/rg/store.rb", "spec/rg_spec.rb", "spec/spec_helper.rb", "tasks/ann.rake", "tasks/bones.rake", "tasks/gem.rake", "tasks/git.rake", "tasks/manifest.rake", "tasks/notes.rake", "tasks/post_load.rake", "tasks/rdoc.rake", "tasks/rubyforge.rake", "tasks/setup.rb", "tasks/spec.rake", "tasks/svn.rake", "tasks/test.rake", "test/test_rg.rb"] 14 | s.has_rdoc = true 15 | s.homepage = %q{http://www.omgbloglol.com/} 16 | s.rdoc_options = ["--main", "README.txt"] 17 | s.require_paths = ["lib"] 18 | s.rubyforge_project = %q{rg} 19 | s.rubygems_version = %q{1.2.0} 20 | s.summary = %q{Generate Rails applications from your own template!} 21 | s.test_files = ["test/test_rg.rb"] 22 | 23 | if s.respond_to? :specification_version then 24 | current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION 25 | s.specification_version = 2 26 | 27 | if current_version >= 3 then 28 | s.add_runtime_dependency(%q, ["> 0.0.0"]) 29 | s.add_development_dependency(%q, [">= 2.1.1"]) 30 | else 31 | s.add_dependency(%q, ["> 0.0.0"]) 32 | s.add_dependency(%q, [">= 2.1.1"]) 33 | end 34 | else 35 | s.add_dependency(%q, ["> 0.0.0"]) 36 | s.add_dependency(%q, [">= 2.1.1"]) 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /lib/rg/store.rb: -------------------------------------------------------------------------------- 1 | require 'fcntl' 2 | require 'open-uri' 3 | 4 | module Rg 5 | # Keeps track of user-specific rgfiles. Gives us an easy interface for installing 6 | # and managing them. This files lives in ~/.rgfile ($HOMEPATH/rg.file on Windows). 7 | class Store 8 | class < "git://www.github.com/dudette/thing.git") 25 | 26 | # Vendor some gems 27 | gem("name") 28 | gem("name", :git => "git://github.com/dude/name.git") 29 | 30 | lib("path/to/file.rb") do 31 | put_some_code(:here) 32 | end 33 | 34 | task :thing do 35 | # blah 36 | end 37 | 38 | rakefile "file.rake" do 39 | desc "blah" 40 | task :hoohah do 41 | puts "hi" 42 | end 43 | end 44 | 45 | generate("migration", "add_field_to_table thing:string") 46 | end 47 | 48 | == REQUIREMENTS: 49 | 50 | * ruby2ruby if you want to use the built-in templates and/or the fancy code block dumping 51 | 52 | == INSTALL: 53 | 54 | * sudo gem install jeremymcanally-rg 55 | 56 | == LICENSE: 57 | 58 | (The MIT License) 59 | 60 | Copyright (c) 2008 FIXME (different license?) 61 | 62 | Permission is hereby granted, free of charge, to any person obtaining 63 | a copy of this software and associated documentation files (the 64 | 'Software'), to deal in the Software without restriction, including 65 | without limitation the rights to use, copy, modify, merge, publish, 66 | distribute, sublicense, and/or sell copies of the Software, and to 67 | permit persons to whom the Software is furnished to do so, subject to 68 | the following conditions: 69 | 70 | The above copyright notice and this permission notice shall be 71 | included in all copies or substantial portions of the Software. 72 | 73 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 74 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 75 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 76 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 77 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 78 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 79 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 80 | -------------------------------------------------------------------------------- /lib/rg/runner.rb: -------------------------------------------------------------------------------- 1 | require File.dirname(__FILE__) + '/scm/git' 2 | require File.dirname(__FILE__) + '/scm/svn' 3 | 4 | module Rg 5 | class Runner 6 | attr_reader :behavior, :description 7 | 8 | def initialize(root) # :nodoc: 9 | @root = root 10 | end 11 | 12 | # Create a new rg template. Name is required, description is optional. 13 | # 14 | # ==== Example 15 | # 16 | # template(:rg) do 17 | # # template logic here... 18 | # end 19 | # 20 | # template(:awesome, "I'm awesome!") do 21 | # # template logic here... 22 | # end 23 | # 24 | def template(name, description=nil, &block) 25 | Generator.templates[name.to_sym] = [description, block] 26 | end 27 | 28 | # Create a new file in the Rails project folder. Specify the 29 | # relative path from RAILS_ROOT. Code can be specified in a block 30 | # or a data string can be given. 31 | # 32 | # ==== Examples 33 | # 34 | # file("lib/fun_party.rb") do 35 | # have_fun_party! 36 | # self.go_home! 37 | # end 38 | # 39 | # file("config/apach.conf", "your apache config") 40 | # 41 | def file(filename, data=nil) 42 | puts "creating file #{filename}" 43 | in_root(File.dirname(filename)) do 44 | File.open("#{folder}/#{filename}", "w") do |f| 45 | if block_given? 46 | f.write(code_for(block)) 47 | else 48 | f.write(data) 49 | end 50 | end 51 | end 52 | end 53 | 54 | # Install a plugin. You must provide either an svn url or git url. 55 | # 56 | # ==== Examples 57 | # 58 | # plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git' 59 | # plugin 'restful-authentication', :svn => 'svn://svnhub.com/technoweenie/restful-authentication/trunk' 60 | # 61 | def plugin(name, options) 62 | puts "installing plugin #{name}" 63 | in_root do 64 | if options[:svn] || options[:git] 65 | `script/plugin install #{options[:svn] || options[:git]}` 66 | else 67 | puts "! no git or svn provided for #{name}. skipping..." 68 | end 69 | end 70 | end 71 | 72 | # Install a gem into vendor/gems. You can install a gem in one of three ways: 73 | # 74 | # 1. Provide a git repository URL... 75 | # 76 | # gem 'will-paginate', :git => 'git://github.com/mislav/will_paginate.git' 77 | # 78 | # 2. Provide a subversion repository URL... 79 | # 80 | # gem 'will-paginate', :svn => 'svn://svnhub.com/mislav/will_paginate/trunk' 81 | # 82 | # 3. Provide a gem name and use your system sources to install and unpack it. 83 | # 84 | # gem 'ruby-openid' 85 | # 86 | def gem(name, options={}) 87 | puts "vendoring gem #{name}" 88 | if options[:git] 89 | in_root("vendor/gems") do 90 | Git.clone(options[:git], options[:branch]) 91 | end 92 | elsif options[:svn] 93 | in_root("vendor/gems") do 94 | Svn.checkout(options[:svn], options[:branch]) 95 | end 96 | else 97 | # TODO: Gem dependencies. Split output on \n, iterate lines looking for Downloaded... 98 | in_root("vendor/gems") do 99 | # Filename may be different than gem name 100 | filename = (`gem fetch #{name}`).chomp.gsub(/Downloaded /, '') 101 | 102 | `gem unpack #{filename}.gem` 103 | File.delete("#{filename}.gem") 104 | end 105 | end 106 | end 107 | 108 | # Create a new file in the vendor/ directory. Code can be specified 109 | # in a block or a data string can be given. 110 | # 111 | # ==== Examples 112 | # 113 | # vendor("borrowed.rb") do 114 | # self.steal_code! 115 | # self.place_in_vendor 116 | # end 117 | # 118 | # vendor("foreign.rb", "# Foreign code is fun") 119 | # 120 | def vendor(filename, data=nil, &block) 121 | puts "vendoring file #{filename}" 122 | in_root("vendor") do |folder| 123 | File.open("#{folder}/#{filename}", "w") do |f| 124 | if block_given? 125 | f.write(code_for(block)) 126 | else 127 | f.write(data) 128 | end 129 | end 130 | end 131 | end 132 | 133 | # Create a new file in the lib/ directory. Code can be specified 134 | # in a block or a data string can be given. 135 | # 136 | # ==== Examples 137 | # 138 | # lib("borrowed.rb") do 139 | # self.steal_code! 140 | # self.place_in_vendor 141 | # end 142 | # 143 | # lib("foreign.rb", "# Foreign code is fun") 144 | # 145 | def lib(filename, data=nil) 146 | puts "add lib file #{filename}" 147 | in_root("lib") do |folder| 148 | File.open("#{folder}/#{filename}", "w") do |f| 149 | if block_given? 150 | f.write(code_for(block)) 151 | else 152 | f.write(data) 153 | end 154 | end 155 | end 156 | end 157 | 158 | # Create a new Rake task in the lib/tasks/application.rake file. 159 | # Code can be specified in a block or a data string can be given. 160 | # 161 | # ==== Examples 162 | # 163 | # task(:whatever) do 164 | # puts "hi from rake" 165 | # end 166 | # 167 | # task(:go_away, "puts 'be gone!'") 168 | # 169 | def task(name, description=nil, &block) 170 | puts "adding task :#{name}" 171 | in_root("lib/tasks") do |folder| 172 | File.open("#{folder}/application.rake", "a+") do |f| 173 | if block_given? 174 | f.write(code_for(block)) 175 | else 176 | f.write(data) 177 | end 178 | end 179 | end 180 | end 181 | 182 | # Create a new Rakefile with the provided code (either in a block or a string). 183 | # 184 | # ==== Examples 185 | # 186 | # rakefile("bootstrap.rake") do 187 | # task :bootstrap do 188 | # puts "i like boots!" 189 | # end 190 | # end 191 | # 192 | # rakefile("seed.rake", "puts 'im plantin ur seedz'") 193 | # 194 | def rakefile(filename, data=nil, &block) 195 | puts "adding rakefile #{filename}" 196 | in_root("lib/tasks") do |folder| 197 | File.open("#{folder}/#{filename}", "w") do |f| 198 | if block_given? 199 | f.write(code_for(block)) 200 | else 201 | f.write(data) 202 | end 203 | end 204 | end 205 | end 206 | 207 | # Create a new initializer with the provided code (either in a block or a string). 208 | # 209 | # ==== Examples 210 | # 211 | # initializer("globals.rb") do 212 | # BEST_COMPANY_EVAR = :entp 213 | # end 214 | # 215 | # initializer("api.rb", "API_KEY = '123456'") 216 | # 217 | def initializer(filename, data=nil, &block) 218 | puts "adding initializer #{filename}" 219 | in_root("config/initializers") do |folder| 220 | File.open("#{folder}/#{filename}", "w") do |f| 221 | if block_given? 222 | f.write(code_for(block)) 223 | else 224 | f.write(data) 225 | end 226 | end 227 | end 228 | end 229 | 230 | # Generate something using a generator from Rails or a plugin. 231 | # The second parameter is the argument string that is passed to 232 | # the generator or an Array that is joined. 233 | # 234 | # ==== Example 235 | # 236 | # generate(:authenticated, "user session") 237 | # 238 | def generate(what, args=nil) 239 | puts "generating #{what}" 240 | if args.class == Array 241 | args = args.join(" ") 242 | end 243 | 244 | in_root do 245 | `script/generate --quiet #{what} #{args}` 246 | end 247 | end 248 | 249 | protected 250 | # Do something in the root of the Rails application or 251 | # a provided subfolder; the full path is yielded to the block you provide. 252 | # The path is set back to the previous path when the method exits. 253 | def in_root(subfolder=nil) 254 | folder = "#{@root}#{'/' + subfolder if subfolder}" 255 | 256 | Dir.mkdir(folder) unless File.exist?(folder) 257 | 258 | old_path = Dir.pwd 259 | Dir.chdir(folder) 260 | yield folder 261 | Dir.chdir(old_path) 262 | end 263 | 264 | # Massage the ruby2ruby output a little bit. 265 | def code_for(behavior) 266 | code = behavior.to_ruby 267 | code = code.gsub(/^proc \{/, '') 268 | code = code.gsub(/\}$/, '') 269 | 270 | # TODO_VERY_SOON: Remove spaces and junk from lines 271 | 272 | # TODO: Maybe one day switch all the {} procs 273 | # to do/end if they're multi-line 274 | 275 | code 276 | end 277 | end 278 | end --------------------------------------------------------------------------------