.0040755000076500007650000000000010553754672006150 5ustar00test0040755000076500007650000000000010552545166006765 5ustar00test/unit0040755000076500007650000000000010552545166007744 5ustar00test/specs0040755000076500007650000000000010552545166010102 5ustar00script0040755000076500007650000000000010552545166007312 5ustar00script/stop_merb0100755000076500007650000000040310552541306011273 0ustar00#!/usr/bin/env ruby require 'fileutils' pids=[] port_or_star = ARGV[0] || '*' Dir[File.dirname(__FILE__)+"/../log/merb.#{port_or_star}.pid"].each do |f| pid = IO.read(f).chomp.to_i puts "killing PID: #{pid}" Process.kill(9, pid) FileUtils.rm f end script/new_migration0100755000076500007650000000102510552541306012144 0ustar00#!/usr/bin/env ruby require 'rubygems' require 'merb' TMPL = < < ActiveRecord::Migration def self.up end def self.down end end EOF class_name = ARGV[0] highest_migration = Dir[Dir.pwd+'/dist/schema/migrations/*'].map{|f| File.basename(f) =~ /^(\d+)/; $1}.max filename = format("%03d_%s", (highest_migration.to_i+1), class_name.snake_case) File.open(Dir.pwd+"/dist/schema/migrations/#{filename}.rb", 'w+') do |file| file.write Erubis::Eruby.new(TMPL).result(binding) endRakefile0100755000076500007650000000375310552541306007532 0ustar00require 'rake' require 'rake/rdoctask' require 'rake/testtask' require 'code_statistics' require 'fileutils' require 'rubygems' require 'merb' require MERB_FRAMEWORK_ROOT+'/merb_tasks' MERB_ROOT = File.dirname(__FILE__) include FileUtils #desc "Packages up Merb." #task :default => [:package] desc "load merb_init.rb" task :merb_init do require 'merb' require File.dirname(__FILE__)+'/dist/conf/merb_init.rb' end desc "Load db schema" task :load_schema => [:merb_init] do require File.dirname(__FILE__)+'/dist/schema/schema.rb' end task :uninstall => [:clean] do sh %{sudo gem uninstall #{NAME}} end desc 'Run unit tests' Rake::TestTask.new('test_unit') do |t| t.libs << 'test' t.pattern = 'test/unit/*_test.rb' t.verbose = true end desc 'Run functional tests' Rake::TestTask.new('test_functional') do |t| t.libs << 'test' t.pattern = 'test/functional/*_test.rb' t.verbose = true end desc 'Run all tests' Rake::TestTask.new('test') do |t| t.libs << 'test' t.pattern = 'test/**/*_test.rb' t.verbose = true end desc 'Run all tests, specs and finish with rcov' task :aok do sh %{rake rcov} sh %{rake spec} end ############################################################################## # Statistics ############################################################################## STATS_DIRECTORIES = [ %w(Code lib/), %w(Unit\ tests test/unit), %w(Functional\ tests test/functional) ].collect { |name, dir| [ name, "./#{dir}" ] }.select { |name, dir| File.directory?(dir) } desc "Report code statistics (KLOCs, etc) from the application" task :stats do #require 'extra/stats' verbose = true CodeStatistics.new(*STATS_DIRECTORIES).to_s end ############################################################################## # SVN ############################################################################## desc "Add new files to subversion" task :svn_add do system "svn status | grep '^\?' | sed -e 's/? *//' | sed -e 's/ /\ /g' | xargs svn add" endlog0040755000076500007650000000000010552545166006567 5ustar00dist0040755000076500007650000000000010552545166006751 5ustar00dist/schema0040755000076500007650000000000010552545166010211 5ustar00dist/schema/migrations0040755000076500007650000000000010552550204012352 5ustar00dist/schema/migrations/001_add_sessions_table.rb0100644000076500007650000000060110607303670017161 0ustar00class AddSessionsTable < ActiveRecord::Migration def self.up create_table :sessions, :force => true do |t| t.column :session_id, :string, :limit => 32 t.column :created_at, :datetime t.column :data, :text end add_index "sessions", ["session_id"], :name => "session_id_index" end def self.down drop_table :sessions end end dist/public0040755000076500007650000000000010552545166010227 5ustar00dist/public/stylesheets0040755000076500007650000000000010552545166012603 5ustar00dist/public/javascripts0040755000076500007650000000000010552550416012552 5ustar00dist/public/images0040755000076500007650000000000010552545166011474 5ustar00dist/plugins0040755000076500007650000000000010552545166010432 5ustar00dist/lib0040755000076500007650000000000010552545166007517 5ustar00dist/conf0040755000076500007650000000000010552545166007676 5ustar00dist/conf/upload.conf0100755000076500007650000000021410552546775012114 0ustar00# upload progress conf --- #:drb: true # uncomment for drb UploadProgress if you run a merb cluster :path_info: /files/upload :frequency: 2dist/conf/router.rb0100755000076500007650000000156210606333776011630 0ustar00# Merb::RouteMatcher is the request routing mapper for the merb framework. # You can define placeholder parts of the url with the :smbol notation. # so r.add '/foo/:bar/baz/:id', :class => 'Bar', :method => 'foo' # will match against a request to /foo/123/baz/456. It will then # use the class Bar as your merb controller and call the foo method on it. # the foo method will recieve a hash with {:bar => '123', :id => '456'} # as the content. So the :placeholders sections of your routes become # a hash of arguments to your controller methods. # The default route is installed puts "Compiling routes.." Merb::RouteMatcher.prepare do |r| # restfull routes # r.resources :posts # default route, usually you don't want to change this r.default_routes # change this for your home page to be avaiable at / #r.add '/', :controller => 'whatever', :action =>'index' enddist/conf/merb_init.rb0100755000076500007650000000135710552550071012247 0ustar00puts "merb init called" require 'active_record' ActiveRecord::Base.verification_timeout = 14400 ActiveRecord::Base.logger = MERB_LOGGER Dir[DIST_ROOT+"/app/helpers/*.rb"].each { |m| require m } require DIST_ROOT+"/app/controllers/application.rb" Dir[DIST_ROOT+"/app/controllers/*.rb"].each { |m| require m } Dir[DIST_ROOT+"/app/models/*.rb"].each { |m| require m } Dir[DIST_ROOT+"/lib/**/*.rb"].each { |m| require m } Dir[DIST_ROOT+"/plugins/*/init.rb"].each { |m| require m } # set your db info here ActiveRecord::Base.establish_connection( :adapter => 'mysql', :username => 'root', :password => 'xxxxx', :database => 'merb' ) # add your own ruby code here for app specific stuff. This file gets loaded # after the framework is loaded.dist/conf/merb.yml0100755000076500007650000000337510552550053011424 0ustar00--- # hostname or IP to bind to. :host: 127.0.0.1 # port merb runs on or starting port for merb cluster. :port: "4000" # in development mode your controler classes get reloaded every request # and templates are parsed each time and not cached # in production mode templates are cached, as well as all your classes :environment: development # uncomment for memory sessions. This only works when # you are running 1 merb at a time. ANd sessions do not persist # between restarts. # :memory_session: true # This turns on the ActiveRecord sessions with rails parasite # mode if active_support gem is installed. Skeleton app comes with a # migration to create the sessions table. Or you can point merb to # the same sessions table that your rails app uses to share sessions # between merb and rails. :sql_session: true # uncomment to use the merb upload progress #:config: dist/conf/upload.conf # uncomment to cache templates in dev mode. # templates are cached automatically in production mode. #:cache_templates: true # uncomment and set this is you want to run a drb # server for upload progress or other drb services. #:drb_server_port: 32323 # If you want to protect some or all of your app with # HTTP basic auth then uncomment the folowing and fill # in your credentials you want it to use. Then you need # to set a before filter in a controller: # before :basic_authentication #:basic_auth: # :username: ezra # :password: test # :domain: localhost # uncomment this if you want merb to daemonize when you start it # you can also just use merb -d for the same effect. Don't uncomment # this if you use the cluster option #:daemonize: true # uncomment this to set the number of members in your merb cluster # don't set this and :daemonize: at the same time. #:cluster: 3dist/app0040755000076500007650000000000010552545166007531 5ustar00dist/app/views0040755000076500007650000000000010554050055010654 5ustar00dist/app/views/layout0040755000076500007650000000000010552545166012203 5ustar00dist/app/views/layout/application.herb0100755000076500007650000000056710552541306015427 0ustar00 Fresh Merb App
<%= catch_content :layout %>
dist/app/models0040755000076500007650000000000010552545166011014 5ustar00dist/app/helpers0040755000076500007650000000000010552545166011173 5ustar00dist/app/helpers/global_helper.rb0100755000076500007650000000014410552541306014365 0ustar00module Merb module GlobalHelper # helpers deinfed here available to all views. end end dist/app/controllers0040755000076500007650000000000010552545166012077 5ustar00dist/app/controllers/application.rb0100755000076500007650000000016510552546716015012 0ustar00# all your other controllers should inherit from this one to share code.ß class Application < Merb::Controller end