Permalink
Browse files

WIP rails3 migration

  • Loading branch information...
1 parent 933ff56 commit 017e1049b87d914af69a8eba8ce18720b1304357 @ohadlevy committed Nov 28, 2011
Showing 455 changed files with 10,770 additions and 35,616 deletions.
View
@@ -1,14 +1,10 @@
*~
+.bundle
db/*.sqlite3
+log/*.log
+tmp/
db/schema.rb
-log/*
-nbproject/*
-tmp/*
config/settings.yaml
config/email.yaml
-tftp
-public/images/active_scaffold
-public/javascripts/active_scaffold
-public/stylesheets/active_scaffold
*.sw?
-.idea/*
+.idea
View
32 Gemfile
@@ -0,0 +1,32 @@
+source 'http://rubygems.org'
+
+gem 'rails', '3.0.10'
+gem "jquery-rails"
+gem 'json'
+gem 'rest-client', :require => 'rest_client'
+gem "acts_as_audited", "2.0.0"
+gem "has_many_polymorphs", :git => "https://github.com/jystewart/has_many_polymorphs.git"
+gem "will_paginate", "~> 3.0.2"
+gem "ancestry", "~> 1.2.4"
+
+gem 'sqlite3', :require => 'sqlite3'
+
+gem 'scoped_search', '>= 2.3.4'
+#group :provisioning do
+ gem "safemode", "1.0", :git => "https://github.com/svenfuchs/safemode.git"
+ gem "ruby2ruby"
+ gem "ruby_parser"
+ gem "virt", ">= 0.2.0"
+#end
+
+group :authentication do
+ gem 'net-ldap'
+end
+
+group :test, :development do
+ # To use debugger
+ gem 'ruby-debug'
+ gem 'mocha'
+ gem 'shoulda'
+ gem 'rr'
+end
View
@@ -0,0 +1,140 @@
+GIT
+ remote: https://github.com/jystewart/has_many_polymorphs.git
+ revision: 36f15d24ca4200f657a5203d9fc0253b58477705
+ specs:
+ has_many_polymorphs (3.0.0.beta1)
+ activerecord
+
+GIT
+ remote: https://github.com/svenfuchs/safemode.git
+ revision: 77d53c3c52718ec4634bc6e71ccd230188ba6c90
+ specs:
+ safemode (1.0)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ abstract (1.0.0)
+ actionmailer (3.0.10)
+ actionpack (= 3.0.10)
+ mail (~> 2.2.19)
+ actionpack (3.0.10)
+ activemodel (= 3.0.10)
+ activesupport (= 3.0.10)
+ 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.10)
+ activesupport (= 3.0.10)
+ builder (~> 2.1.2)
+ i18n (~> 0.5.0)
+ activerecord (3.0.10)
+ activemodel (= 3.0.10)
+ activesupport (= 3.0.10)
+ arel (~> 2.0.10)
+ tzinfo (~> 0.3.23)
+ activeresource (3.0.10)
+ activemodel (= 3.0.10)
+ activesupport (= 3.0.10)
+ activesupport (3.0.10)
+ acts_as_audited (2.0.0)
+ rails (>= 3.0.3)
+ ancestry (1.2.4)
+ activerecord (>= 2.2.2)
+ arel (2.0.10)
+ builder (2.1.2)
+ columnize (0.3.4)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ i18n (0.5.0)
+ jquery-rails (1.0.16)
+ railties (~> 3.0)
+ thor (~> 0.14)
+ json (1.6.1)
+ linecache (0.46)
+ rbx-require-relative (> 0.0.4)
+ mail (2.2.19)
+ activesupport (>= 2.3.6)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.17.2)
+ mocha (0.9.12)
+ net-ldap (0.2.2)
+ polyglot (0.3.3)
+ rack (1.2.4)
+ rack-mount (0.6.14)
+ rack (>= 1.0.0)
+ rack-test (0.5.7)
+ rack (>= 1.0)
+ rails (3.0.10)
+ actionmailer (= 3.0.10)
+ actionpack (= 3.0.10)
+ activerecord (= 3.0.10)
+ activeresource (= 3.0.10)
+ activesupport (= 3.0.10)
+ bundler (~> 1.0)
+ railties (= 3.0.10)
+ railties (3.0.10)
+ actionpack (= 3.0.10)
+ activesupport (= 3.0.10)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.4)
+ rake (0.9.2.2)
+ rbx-require-relative (0.0.5)
+ rdoc (3.11)
+ json (~> 1.4)
+ rest-client (1.6.7)
+ mime-types (>= 1.16)
+ rr (1.0.2)
+ ruby-debug (0.10.4)
+ columnize (>= 0.1)
+ ruby-debug-base (~> 0.10.4.0)
+ ruby-debug-base (0.10.4)
+ linecache (>= 0.3)
+ ruby2ruby (1.3.1)
+ ruby_parser (~> 2.0)
+ sexp_processor (~> 3.0)
+ ruby_parser (2.3.1)
+ sexp_processor (~> 3.0)
+ scoped_search (2.3.5)
+ activerecord (>= 2.1.0)
+ sexp_processor (3.0.7)
+ shoulda (2.11.3)
+ sqlite3 (1.3.4)
+ thor (0.14.6)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.31)
+ virt (0.2.0)
+ will_paginate (3.0.2)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ acts_as_audited (= 2.0.0)
+ ancestry (~> 1.2.4)
+ has_many_polymorphs!
+ jquery-rails
+ json
+ mocha
+ net-ldap
+ rails (= 3.0.10)
+ rest-client
+ rr
+ ruby-debug
+ ruby2ruby
+ ruby_parser
+ safemode (= 1.0)!
+ scoped_search (>= 2.3.4)
+ shoulda
+ sqlite3
+ virt (>= 0.2.0)
+ will_paginate (~> 3.0.2)
View
@@ -1,10 +1,5 @@
-# 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 File.expand_path('../config/application', __FILE__)
require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
+include Rake::DSL
-require 'tasks/rails'
+Foreman::Application.load_tasks
@@ -1,10 +1,9 @@
-# Filters added to this controller apply to all controllers in the application.
-# Likewise, all the methods added will be available for all controllers.
+require 'foreman/controller/auto_complete_search'
class ApplicationController < ActionController::Base
protect_from_forgery # See ActionController::RequestForgeryProtection for details
rescue_from ScopedSearch::QueryNotSupported, :with => :invalid_search_query
- rescue_from Exception, :with => :generic_exception
+ #rescue_from Exception, :with => :generic_exception
rescue_from ActiveRecord::RecordNotFound, :with => :not_found
# standard layout to all controllers
@@ -60,10 +59,10 @@ def require_login
# JSON requests (REST API calls) use basic http authenitcation and should not use/store cookies
user = authenticate_or_request_with_http_basic { |u, p| User.try_to_login(u, p) }
User.current = user.is_a?(User) ? user : nil
- logger.warn("Failed authentcation from #{request.remote_ip} #{user}") if User.current.nil?
+ logger.warn("Failed authentication from #{request.remote_ip} #{user}") if User.current.nil?
return !User.current.nil?
end
- session[:original_uri] = request.request_uri # keep the old request uri that we can redirect later on
+ session[:original_uri] = request.fullpath # keep the old request uri that we can redirect later on
redirect_to login_users_path and return
else
# We assume we always have a user logged in, if authentication is disabled, the user is the build-in admin account.
@@ -76,7 +75,7 @@ def require_login
end
end
- # this method is returns the active user which gets used to puplate the audits table
+ # this method is returns the active user which gets used to populate the audits table
def current_user
User.current
end
@@ -129,6 +128,10 @@ def error error
flash[:error] = error
end
+ def warning warning
+ flash[:warning] = warning
+ end
+
# this method is used with nested resources, where obj_id is passed into the parameters hash.
# it automatically updates the search text box with the relevant relationship
# e.g. /hosts/fqdn/reports # would add host = fqdn to the search bar
@@ -174,7 +177,7 @@ def no_puppetclass_documentation_handler(exception)
if exception.message =~ /No route matches "\/puppet\/rdoc\/([^\/]+)\/classes\/(.+?)\.html/
render :template => "puppetclasses/no_route", :locals => {:environment => $1, :name => $2.gsub("/","::")}, :layout => false
else
- local_request? ? rescue_action_locally(exception) : rescue_action_in_public(exception)
+ request.local? ? request.rescue_action_locally(exception) : rescue_action_in_public(exception)
end
end
@@ -203,7 +206,7 @@ def process_error hash = {}
else
hash[:redirect] ||= eval("#{controller_name}_url")
end
- hash[:error_msg] ||= hash[:object].errors.on_base.to_a
+ hash[:error_msg] ||= hash[:object].errors[:base]
hash[:json_code] ||= :unprocessable_entity
logger.info "Failed to save: #{hash[:object].errors.full_messages.join(", ")}"
@@ -1,6 +1,4 @@
class AuthSourceLdapsController < ApplicationController
- filter_parameter_logging :account_password
-
def index
@auth_source_ldaps = AuthSourceLdap.all
respond_to do |format|
@@ -2,7 +2,7 @@ class BookmarksController < ApplicationController
before_filter :find_by_name, :only => %w{show edit update destroy}
def index
- @bookmarks = Bookmark.all.paginate(:page => params[:page])
+ @bookmarks = Bookmark.paginate(:page => params[:page])
respond_to do |format|
format.html
@@ -114,7 +114,7 @@ def build_pxe_default
# generated for
def pxe_default_combos
combos = []
- ConfigTemplate.template_kind_name_eq("provision").each do |template|
+ ConfigTemplate.joins(:template_kind).where("template_kinds.name" => "provision").each do |template|
template.template_combinations.each do |combination|
hostgroup = combination.hostgroup
if hostgroup and hostgroup.operatingsystem and hostgroup.architecture and hostgroup.medium
@@ -1,3 +1,5 @@
+require 'foreman/controller/environments'
+
class EnvironmentsController < ApplicationController
include Foreman::Controller::Environments
include Foreman::Controller::AutoCompleteSearch
@@ -8,9 +8,6 @@ class FactValuesController < ApplicationController
before_filter :set_admin_user, :only => :create
before_filter :setup_search_options, :only => :index
- # avoids storing the facts data in the log files
- filter_parameter_logging :facts
-
def index
begin
values = FactValue.no_timestamp_facts.search_for(params[:search],:order => params[:order])
@@ -1,8 +1,9 @@
+require 'foreman/controller/host_details'
+
class HostgroupsController < ApplicationController
include Foreman::Controller::HostDetails
include Foreman::Controller::AutoCompleteSearch
- filter_parameter_logging :root_pass
before_filter :find_hostgroup, :only => [:show, :edit, :update, :destroy, :clone]
def index
Oops, something went wrong.

0 comments on commit 017e104

Please sign in to comment.