Skip to content

Commit

Permalink
rename.. fix.. clean
Browse files Browse the repository at this point in the history
  • Loading branch information
nofxx committed Dec 7, 2008
1 parent 941197f commit ddcaf4b
Show file tree
Hide file tree
Showing 54 changed files with 573 additions and 762 deletions.
85 changes: 85 additions & 0 deletions app/controllers/builds_controller.rb
@@ -0,0 +1,85 @@
class BuildsController < ApplicationController
# GET /builds
# GET /builds.xml
def index
@builds = Build.find(:all)

respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @builds }
end
end

# GET /builds/1
# GET /builds/1.xml
def show
@build = Build.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @build }
end
end

# GET /builds/new
# GET /builds/new.xml
def new
@build = Build.new

respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @build }
end
end

# GET /builds/1/edit
def edit
@build = Build.find(params[:id])
end

# POST /builds
# POST /builds.xml
def create
@build = Build.new(params[:build])

respond_to do |format|
if @build.save
flash[:notice] = 'Build was successfully created.'
format.html { redirect_to(@build) }
format.xml { render :xml => @build, :status => :created, :location => @build }
else
format.html { render :action => "new" }
format.xml { render :xml => @build.errors, :status => :unprocessable_entity }
end
end
end

# PUT /builds/1
# PUT /builds/1.xml
def update
@build = Build.find(params[:id])

respond_to do |format|
if @build.update_attributes(params[:build])
flash[:notice] = 'Build was successfully updated.'
format.html { redirect_to(@build) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @build.errors, :status => :unprocessable_entity }
end
end
end

# DELETE /builds/1
# DELETE /builds/1.xml
def destroy
@build = Build.find(params[:id])
@build.destroy

respond_to do |format|
format.html { redirect_to(builds_url) }
format.xml { head :ok }
end
end
end
85 changes: 0 additions & 85 deletions app/controllers/installs_controller.rb

This file was deleted.

16 changes: 9 additions & 7 deletions app/controllers/users_controller.rb
@@ -1,15 +1,17 @@
class UsersController < ApplicationController

# Be sure to include AuthenticationSystem in Application Controller instead
include AuthenticatedSystem

# Protect these actions behind an admin login
# before_filter :admin_required, :only => [:suspend, :unsuspend, :destroy, :purge]
before_filter :find_user, :only => [:suspend, :unsuspend, :destroy, :purge]


# render new.rhtml
def new
@user = User.new
end

def create
logout_keeping_session!
@user = User.new(params[:user])
Expand All @@ -35,19 +37,19 @@ def activate
when params[:activation_code].blank?
flash[:error] = "The activation code was missing. Please follow the URL from your email."
redirect_back_or_default('/')
else
else
flash[:error] = "We couldn't find a user with that activation code -- check your email? Or maybe you've already activated -- try signing in."
redirect_back_or_default('/')
end
end

def suspend
@user.suspend!
@user.suspend!
redirect_to users_path
end

def unsuspend
@user.unsuspend!
@user.unsuspend!
redirect_to users_path
end

Expand All @@ -60,7 +62,7 @@ def purge
@user.destroy
redirect_to users_path
end

# There's no page here to update or destroy a user. If you add those, be
# smart -- make sure you check that the visitor is authorized to do so, that they
# supply their old password along with a new one to update it, etc.
Expand Down
2 changes: 2 additions & 0 deletions app/helpers/builds_helper.rb
@@ -0,0 +1,2 @@
module BuildsHelper
end
2 changes: 0 additions & 2 deletions app/helpers/installs_helper.rb

This file was deleted.

22 changes: 22 additions & 0 deletions app/models/build.rb
@@ -0,0 +1,22 @@
class Build < ActiveRecord::Base
belongs_to :repo, :counter_cache => true
belongs_to :user, :counter_cache => true
belongs_to :pkg, :counter_cache => true

validates_presence_of :repo
validates_presence_of :pkg

end

# == Schema Info
# Schema version: 20081122103124
#
# Table name: builds
#
# id :integer not null, primary key
# pkg_id :integer not null
# repo_id :integer not null
# user_id :integer
# code :boolean not null
# created_at :datetime
# updated_at :datetime
15 changes: 0 additions & 15 deletions app/models/install.rb

This file was deleted.

9 changes: 6 additions & 3 deletions app/models/karma.rb
@@ -1,8 +1,11 @@
class Karma < ActiveRecord::Base
belongs_to :pkg
belongs_to :repo
belongs_to :user


validates_presence_of :user
validates_presence_of :pkg
validates_presence_of :version
validates_presence_of :repo

validates_presence_of :value

end
Expand Down
2 changes: 1 addition & 1 deletion app/models/pkg.rb
Expand Up @@ -49,9 +49,9 @@ def after_create
# owner_id :integer
# arch :integer
# build_date :datetime
# builds_count :integer
# desc :text not null
# dl_size :integer
# installs_count :integer
# license :string(255)
# logo_content_type :string(255)
# logo_file_name :string(255)
Expand Down
19 changes: 10 additions & 9 deletions app/models/repo.rb
Expand Up @@ -8,14 +8,15 @@ class Repo < ActiveRecord::Base

has_many :comments, :as => :commentable, :dependent => :destroy
has_many :karmas, :dependent => :destroy
has_many :installs, :dependent => :destroy
has_many :builds, :dependent => :destroy

validates_presence_of :pkg
validates_presence_of :user
# validates_presence_of :path
#validates_uniqueness_of :path

named_scope :system, :conditions => { :user_id => nil }
named_scope :system, :conditions => { :user_id => nil }
#named_scope :system, :conditions => { :user_id => nil }


def after_create
Expand Down Expand Up @@ -137,10 +138,10 @@ def commit! msg = ""
#
# Table name: repos
#
# id :integer not null, primary key
# pkg_id :integer not null
# user_id :integer
# path :string(255) not null
# created_at :datetime
# updated_at :datetime

# id :integer not null, primary key
# pkg_id :integer not null
# user_id :integer
# builds_count :integer
# path :string(255) not null
# created_at :datetime
# updated_at :datetime

0 comments on commit ddcaf4b

Please sign in to comment.