Skip to content

Commit

Permalink
First pass of moving to rail3 and hobo 1.3
Browse files Browse the repository at this point in the history
rake cookbook tasks working and rails server runs but not all views work yet.
  • Loading branch information
bsleys committed Jun 13, 2011
1 parent 35146d0 commit b8b7aee
Show file tree
Hide file tree
Showing 89 changed files with 4,622 additions and 2,287 deletions.
9 changes: 6 additions & 3 deletions .gitignore
@@ -1,9 +1,12 @@
log
tmp
.DS_Store
.bundle
db/*.sqlite3
log/*.log
tmp/

.DS_Store
vendor/plugins/footnotes-edge
tmtags
app/views/taglibs/auto
public/img/*
rails3app
.idea/
1 change: 1 addition & 0 deletions .rvmrc
@@ -1 +1,2 @@
rvm ruby-1.8.7@hobocookbook

38 changes: 38 additions & 0 deletions Gemfile
@@ -0,0 +1,38 @@
source 'http://rubygems.org'

gem 'rails', '3.0.8'
gem 'rake', '0.8.7'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'
gem 'mysql'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'
gem 'yard'

# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'

# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'

# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
# gem 'webrat'
# end

gem 'maruku'

gem "hobo", "1.3.0.RC"
96 changes: 96 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,96 @@
GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
actionmailer (3.0.8)
actionpack (= 3.0.8)
mail (~> 2.2.19)
actionpack (3.0.8)
activemodel (= 3.0.8)
activesupport (= 3.0.8)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.5.0)
rack (~> 1.2.1)
rack-mount (~> 0.6.14)
rack-test (~> 0.5.7)
tzinfo (~> 0.3.23)
activemodel (3.0.8)
activesupport (= 3.0.8)
builder (~> 2.1.2)
i18n (~> 0.5.0)
activerecord (3.0.8)
activemodel (= 3.0.8)
activesupport (= 3.0.8)
arel (~> 2.0.10)
tzinfo (~> 0.3.23)
activeresource (3.0.8)
activemodel (= 3.0.8)
activesupport (= 3.0.8)
activesupport (3.0.8)
arel (2.0.10)
builder (2.1.2)
dryml (1.3.0.RC)
actionpack (~> 3.0.0)
hobo_support (= 1.3.0.RC)
erubis (2.6.6)
abstract (>= 1.0.0)
hobo (1.3.0.RC)
dryml (= 1.3.0.RC)
hobo_fields (= 1.3.0.RC)
hobo_support (= 1.3.0.RC)
will_paginate (>= 3.0.pre)
hobo_fields (1.3.0.RC)
hobo_support (= 1.3.0.RC)
hobo_support (1.3.0.RC)
rails (~> 3.0.0)
i18n (0.5.0)
mail (2.2.19)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
maruku (0.6.0)
syntax (>= 1.0.0)
mime-types (1.16)
mysql (2.8.1)
polyglot (0.3.1)
rack (1.2.3)
rack-mount (0.6.14)
rack (>= 1.0.0)
rack-test (0.5.7)
rack (>= 1.0)
rails (3.0.8)
actionmailer (= 3.0.8)
actionpack (= 3.0.8)
activerecord (= 3.0.8)
activeresource (= 3.0.8)
activesupport (= 3.0.8)
bundler (~> 1.0)
railties (= 3.0.8)
railties (3.0.8)
actionpack (= 3.0.8)
activesupport (= 3.0.8)
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.8.7)
sqlite3 (1.3.3)
syntax (1.0.0)
thor (0.14.6)
treetop (1.4.9)
polyglot (>= 0.3.1)
tzinfo (0.3.27)
will_paginate (3.0.pre2)
yard (0.7.1)

PLATFORMS
ruby

DEPENDENCIES
hobo (= 1.3.0.RC)
maruku
mysql
rails (= 3.0.8)
rake (= 0.8.7)
sqlite3
yard
25 changes: 17 additions & 8 deletions Rakefile
@@ -1,14 +1,23 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require(File.join(File.dirname(__FILE__), 'config', 'boot'))

require 'thread'
require File.expand_path('../config/application', __FILE__)
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'

require 'tasks/rails'
Hobocookbook::Application.load_tasks



require(File.join(File.dirname(__FILE__), 'config', 'boot'))

# from previous version

require 'vlad'
Vlad.load(:app => nil, :scm => :git)
#require 'thread'
#require 'rake'
#require 'rake/testtask'
#require 'rake/rdoctask'
#
#require 'tasks/rails'
#
#require 'vlad'
#Vlad.load(:app => nil, :scm => :git)
14 changes: 5 additions & 9 deletions app/controllers/application_controller.rb
@@ -1,23 +1,19 @@
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
protect_from_forgery

# helper :all # include all helpers, all the time


protect_from_forgery # :secret => 'fa42ca8790f4b08ffbaf2b0b854bdbcc'

before_filter :login_required, :only => [:new, :edit]

private

def last_update(filename)
Dir.chdir(File.open("#{RAILS_ROOT}/git-path").read.chomp) do
head = File.open("#{RAILS_ROOT}/git-version").read.chomp
commit = `git rev-list #{head} #{filename} | head -n 1`
commit = `git rev-list #{head} #{filename} | head -n 1`
date_s = `git show --pretty=format:%cD #{commit} | head -n 1`
date_s ? Date.parse(date_s) : ""
end
end


end
9 changes: 5 additions & 4 deletions app/controllers/manual_controller.rb
@@ -1,5 +1,5 @@
class ManualController < ApplicationController

caches_page :manual_section, :manual_subsection

def self.create_ordered_hash(llist)
Expand All @@ -9,7 +9,7 @@ def self.create_ordered_hash(llist)
end
hash
end

TITLES = self.create_ordered_hash([# ['to-do', "To Do List"],
['toc', "Table of Contents"],
['download', "Download and Install"],
Expand Down Expand Up @@ -72,7 +72,7 @@ def manual_section
filename = "manual/#{section}.markdown"
@title = TITLES[section]
@subtitles = SUBTITLES[section]
@content = HoboFields::MarkdownString.new(File.read("#{RAILS_ROOT}/#{filename}"))
@content = HoboFields::Types::MarkdownString.new(File.read("#{RAILS_ROOT}/#{filename}"))
@last_update = last_update filename
end

Expand All @@ -83,7 +83,7 @@ def manual_subsection
@title = TITLES[section]
@subtitles = SUBTITLES[section]
@current_subtitle = SUBTITLES[section][subsection]
@content = HoboFields::MarkdownString.new(File.read("#{RAILS_ROOT}/#{filename}"))
@content = HoboFields::Types::MarkdownString.new(File.read("#{RAILS_ROOT}/#{filename}"))
@last_update = last_update filename
end

Expand All @@ -92,3 +92,4 @@ def index
end

end

1 change: 0 additions & 1 deletion app/helpers/application_helper.rb
@@ -1,3 +1,2 @@
# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper
end
4 changes: 3 additions & 1 deletion app/models/api_tag_def.rb
Expand Up @@ -31,7 +31,9 @@ def to_param
has_many :comments, :class_name => "ApiTagComment", :dependent => :destroy

named_scope :no_for_type, :conditions => "for_type is null"


children :comments

def def_line
"<#{extension? ? 'extend' : 'def'} tag='#{tag}'#{' polymorphic' if polymorphic?}#{' for=\'' + for_type + '\'' if for_type}>"
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/guest.rb
@@ -1,4 +1,4 @@
class Guest < Hobo::Guest
class Guest < Hobo::Model::Guest

def can_update?(obj, field)
false
Expand Down
4 changes: 3 additions & 1 deletion app/models/question.rb
Expand Up @@ -11,7 +11,9 @@ class Question < ActiveRecord::Base

has_many :answers, :dependent => :destroy
has_many :recipes, :through => :answers, :uniq => true


children :answers

include OwnedModel

end
4 changes: 3 additions & 1 deletion app/models/recipe.rb
Expand Up @@ -12,7 +12,9 @@ class Recipe < ActiveRecord::Base
has_many :images, :dependent => :destroy
has_many :answers, :dependent => :destroy
has_many :questions, :through => :answers, :uniq => true


children :comments, :images

set_default_order "updated_at desc"

# has_many :taggings
Expand Down
5 changes: 3 additions & 2 deletions app/models/user.rb
Expand Up @@ -11,9 +11,10 @@ class User < ActiveRecord::Base

# This gives admin rights to the first sign-up.
# Just remove it if you don't want that
before_create { |user| user.administrator = true if count == 0 }

before_create { |user| user.administrator = true if user.class.count == 0 }

children :recipes, :questions, :answers

# --- Signup lifecycle --- #

lifecycle do
Expand Down
6 changes: 3 additions & 3 deletions app/rich_types/optional_markdown.rb
@@ -1,4 +1,4 @@
class HoboFields::MarkdownString < HoboFields::RawMarkdownString
class HoboFields::Types::MarkdownString < HoboFields::Types::RawMarkdownString

def to_html(xmldoctype = true)
return "" if blank?
Expand All @@ -19,12 +19,12 @@ def to_html(xmldoctype = true)

end

class OptionalMarkdown < HoboFields::Text
class OptionalMarkdown < HoboFields::Types::Text

HoboFields.register_type(:optional_markdown, self)

def to_html_from_markdown
HoboFields::MarkdownString.new(self).to_html
HoboFields::Types::MarkdownString.new(self).to_html
end

end
7 changes: 0 additions & 7 deletions app/viewhints/answer_hints.rb

This file was deleted.

5 changes: 0 additions & 5 deletions app/viewhints/api_tag_comment_hints.rb

This file was deleted.

5 changes: 0 additions & 5 deletions app/viewhints/api_tag_def_hints.rb

This file was deleted.

4 changes: 0 additions & 4 deletions app/viewhints/api_taglib_hints.rb

This file was deleted.

4 changes: 0 additions & 4 deletions app/viewhints/comment_hints.rb

This file was deleted.

4 changes: 0 additions & 4 deletions app/viewhints/image_hints.rb

This file was deleted.

5 changes: 0 additions & 5 deletions app/viewhints/question_hints.rb

This file was deleted.

5 changes: 0 additions & 5 deletions app/viewhints/recipe_hints.rb

This file was deleted.

4 changes: 0 additions & 4 deletions app/viewhints/tag_hints.rb

This file was deleted.

4 changes: 0 additions & 4 deletions app/viewhints/tagging_hints.rb

This file was deleted.

5 changes: 0 additions & 5 deletions app/viewhints/user_hints.rb

This file was deleted.

0 comments on commit b8b7aee

Please sign in to comment.