Sha256: 4db52c2328faadff21e62c6e09a002f57f2a9122ed3f55c47fa82c0d2ae1e21d
Contents?: true
Size: 1.73 KB
Versions: 2
Compression:
Stored size: 1.73 KB
Contents
require_all File.dirname(__FILE__) module Rails3::Assist::File module Special module Methods # application_file, environment_file [:application, :environment, :routes, :boot].each do |name| class_eval %{ def #{name}_file File.join(Rails3::Assist::Directory.config_dir, '#{name}.rb') end } end def database_file File.join(Rails3::Assist::Directory.config_dir, 'database.yml') end def seed_file File.join(Rails3::Assist::Directory.db_dir, 'seeds.rb') end def gem_file File.join(Rails3::Assist::Directory.root_dir, 'Gemfile') end # read_application_file # append_to_application_file [:application, :environment, :seed, :gem, :routes, :boot, :database].each do |name| class_eval %{ def read_#{name}_file fname = #{name}_file File.read(fname) if File.file?(fname) end def remove_#{name}_file File.delete #{name}_file end def append_to_#{name}_file content=nil, &block File.append(#{name}_file, content, &block) end def replace_in_#{name}_file options = {}, &block File.replace_content_from(#{name}_file, options, &block) end def remove_from_#{name}_file content=nil, &block File.remove_from(#{name}_file, content, &block) end } end end include Methods extend Methods include Rails3::Assist::File::Application include Rails3::Assist::File::Environment extend Rails3::Assist::File::Application extend Rails3::Assist::File::Environment end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rails3_assist-0.3.0 | lib/rails3_assist/file/special.rb |
rails3_assist-0.2.13 | lib/rails3_assist/file/special.rb |