diff options
author | Alex Legler <alex@a3li.li> | 2011-08-14 14:35:09 +0200 |
---|---|---|
committer | Alex Legler <alex@a3li.li> | 2011-08-14 14:35:09 +0200 |
commit | 2504a90a05f83eaede3bf2d888fce48ae715f920 (patch) | |
tree | e5b8b96c4b305b78f5e55ea74882ea1a35d4ef5c | |
parent | Update to rails 2.3.12 and use Bundler (diff) | |
download | glsamaker-2504a90a05f83eaede3bf2d888fce48ae715f920.tar.gz glsamaker-2504a90a05f83eaede3bf2d888fce48ae715f920.tar.bz2 glsamaker-2504a90a05f83eaede3bf2d888fce48ae715f920.zip |
First set of rails3 updates
.rails2 backups are still there, to be merged and removed on completion.
54 files changed, 1387 insertions, 487 deletions
@@ -11,4 +11,6 @@ public/javascripts/all.js /.loadpath /MYTODO coverage -.idea
\ No newline at end of file +.idea +.rvmrc +*.tmproj @@ -1,11 +1,42 @@ source :rubygems -gem "rails", "2.3.12" -gem "json" +gem 'rails', '3.1.0.rc5' + +# Bundle edge Rails instead: +# gem 'rails', :git => 'git://github.com/rails/rails.git' + +gem 'mysql2' + +gem 'json' + +# Gems used only for assets and not required +# in production environments by default. +group :assets do + gem 'sass-rails', "~> 3.1.0.rc" + gem 'coffee-rails', "~> 3.1.0.rc" + gem 'uglifier' +end + +gem 'jquery-rails' + +# Use unicorn as the web server +# gem 'unicorn' + +# Deploy with Capistrano +gem 'capistrano' + +# To use debugger +# gem 'ruby-debug' + gem "mechanize" gem "fastercsv" gem "diff-lcs", :require => "diff/lcs" gem "nokogiri" -gem "ci_reporter" -gem "rspec" -gem "rdoc"
\ No newline at end of file + +# gem "rdoc" + +group :test do + gem "ci_reporter" + gem "rspec" + +end
\ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 7489816..db4640e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,38 +1,114 @@ GEM remote: http://rubygems.org/ specs: - actionmailer (2.3.12) - actionpack (= 2.3.12) - actionpack (2.3.12) - activesupport (= 2.3.12) - rack (~> 1.1.0) - activerecord (2.3.12) - activesupport (= 2.3.12) - activeresource (2.3.12) - activesupport (= 2.3.12) - activesupport (2.3.12) + actionmailer (3.1.0.rc5) + actionpack (= 3.1.0.rc5) + mail (~> 2.3.0) + actionpack (3.1.0.rc5) + activemodel (= 3.1.0.rc5) + activesupport (= 3.1.0.rc5) + builder (~> 3.0.0) + erubis (~> 2.7.0) + i18n (~> 0.6) + rack (~> 1.3.1) + rack-cache (~> 1.0.2) + rack-mount (~> 0.8.1) + rack-test (~> 0.6.0) + sprockets (~> 2.0.0.beta.12) + activemodel (3.1.0.rc5) + activesupport (= 3.1.0.rc5) + bcrypt-ruby (~> 2.1.4) + builder (~> 3.0.0) + i18n (~> 0.6) + activerecord (3.1.0.rc5) + activemodel (= 3.1.0.rc5) + activesupport (= 3.1.0.rc5) + arel (~> 2.1.4) + tzinfo (~> 0.3.29) + activeresource (3.1.0.rc5) + activemodel (= 3.1.0.rc5) + activesupport (= 3.1.0.rc5) + activesupport (3.1.0.rc5) + multi_json (~> 1.0) + arel (2.1.4) + bcrypt-ruby (2.1.4) builder (3.0.0) + capistrano (2.8.0) + highline + net-scp (>= 1.0.0) + net-sftp (>= 2.0.0) + net-ssh (>= 2.0.14) + net-ssh-gateway (>= 1.1.0) ci_reporter (1.6.5) builder (>= 2.1.2) + coffee-rails (3.1.0.rc.5) + actionpack (~> 3.1.0.rc1) + coffee-script (>= 2.2.0) + railties (~> 3.1.0.rc1) + sprockets (>= 2.0.0.beta.9) + coffee-script (2.2.0) + coffee-script-source + execjs + coffee-script-source (1.1.2) diff-lcs (1.1.2) + erubis (2.7.0) + execjs (1.2.4) + multi_json (~> 1.0) fastercsv (1.5.4) + highline (1.6.2) + hike (1.2.0) + i18n (0.6.0) + jquery-rails (1.0.12) + railties (~> 3.0) + thor (~> 0.14) json (1.5.3) + mail (2.3.0) + i18n (>= 0.4.0) + mime-types (~> 1.16) + treetop (~> 1.4.8) mechanize (2.0.1) net-http-digest_auth (~> 1.1, >= 1.1.1) net-http-persistent (~> 1.8) nokogiri (~> 1.4) webrobots (~> 0.0, >= 0.0.9) + mime-types (1.16) + multi_json (1.0.3) + mysql2 (0.3.6) net-http-digest_auth (1.1.1) net-http-persistent (1.8.1) + net-scp (1.0.4) + net-ssh (>= 1.99.1) + net-sftp (2.0.5) + net-ssh (>= 2.0.9) + net-ssh (2.1.4) + net-ssh-gateway (1.1.0) + net-ssh (>= 1.99.1) nokogiri (1.5.0) - rack (1.1.2) - rails (2.3.12) - actionmailer (= 2.3.12) - actionpack (= 2.3.12) - activerecord (= 2.3.12) - activeresource (= 2.3.12) - activesupport (= 2.3.12) - rake (>= 0.8.3) + polyglot (0.3.2) + rack (1.3.2) + rack-cache (1.0.2) + rack (>= 0.4) + rack-mount (0.8.2) + rack (>= 1.0.0) + rack-ssl (1.3.2) + rack + rack-test (0.6.1) + rack (>= 1.0) + rails (3.1.0.rc5) + actionmailer (= 3.1.0.rc5) + actionpack (= 3.1.0.rc5) + activerecord (= 3.1.0.rc5) + activeresource (= 3.1.0.rc5) + activesupport (= 3.1.0.rc5) + bundler (~> 1.0) + railties (= 3.1.0.rc5) + railties (3.1.0.rc5) + actionpack (= 3.1.0.rc5) + activesupport (= 3.1.0.rc5) + rack-ssl (~> 1.3.2) + rake (>= 0.8.7) + rdoc (~> 3.4) + thor (~> 0.14.6) rake (0.9.2) rdoc (3.9.1) rspec (2.6.0) @@ -43,19 +119,43 @@ GEM rspec-expectations (2.6.0) diff-lcs (~> 1.1.2) rspec-mocks (2.6.0) - webrobots (0.0.10) + sass (3.1.7) + sass-rails (3.1.0.rc.5) + actionpack (~> 3.1.0.rc1) + railties (~> 3.1.0.rc1) + sass (>= 3.1.4) + sprockets (>= 2.0.0.beta.9) + sprockets (2.0.0.beta.13) + hike (~> 1.2) + rack (~> 1.0) + tilt (!= 1.3.0, ~> 1.1) + thor (0.14.6) + tilt (1.3.2) + treetop (1.4.10) + polyglot + polyglot (>= 0.3.1) + tzinfo (0.3.29) + uglifier (1.0.0) + execjs (>= 0.3.0) + multi_json (>= 1.0.2) + webrobots (0.0.11) nokogiri (>= 1.4.4) PLATFORMS ruby DEPENDENCIES + capistrano ci_reporter + coffee-rails (~> 3.1.0.rc) diff-lcs fastercsv + jquery-rails json mechanize + mysql2 nokogiri - rails (= 2.3.12) - rdoc + rails (= 3.1.0.rc5) rspec + sass-rails (~> 3.1.0.rc) + uglifier @@ -1,13 +1,7 @@ +#!/usr/bin/env rake # 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 'rdoc/task' - -require 'tasks/rails' - -gem 'ci_reporter' -require 'ci/reporter/rake/test_unit' +Glsamaker::Application.load_tasks diff --git a/app/assets/images/rails.png b/app/assets/images/rails.png Binary files differnew file mode 100644 index 0000000..d5edc04 --- /dev/null +++ b/app/assets/images/rails.png diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js new file mode 100644 index 0000000..37c7bfc --- /dev/null +++ b/app/assets/javascripts/application.js @@ -0,0 +1,9 @@ +// This is a manifest file that'll be compiled into including all the files listed below. +// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically +// be included in the compiled file accessible from http://example.com/assets/application.js +// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the +// the compiled file. +// +//= require jquery +//= require jquery_ujs +//= require_tree . diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css new file mode 100644 index 0000000..fc25b57 --- /dev/null +++ b/app/assets/stylesheets/application.css @@ -0,0 +1,7 @@ +/* + * This is a manifest file that'll automatically include all the stylesheets available in this directory + * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at + * the top of the compiled file, but it's generally better to create a new file per style scope. + *= require_self + *= require_tree . +*/
\ No newline at end of file diff --git a/app/assets/stylesheets/screen.css b/app/assets/stylesheets/screen.css new file mode 100644 index 0000000..b0347af --- /dev/null +++ b/app/assets/stylesheets/screen.css @@ -0,0 +1,551 @@ +body { + border-left: 6px solid #5B4A73; + height: 100% !important; + margin: 0; + padding: 0; + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: .85em; + color: #333; +} + +html { + margin: 0; + padding: 0; + background: url(/images/line.png) repeat-y; + background-repeat: repeat-y; +} + +a img { + border: none !important; +} + +a, a:visited { + color: #4C3E61; +} + +a:hover { + color: #609317; +} + +/* Menu */ +#top-menu { + background-color: #4C3E61; + font-size: 10px; + position: relative; + padding: 0; + height: 21px; + margin-left: -7px; + padding-left: 7px; +} + +#top-menu li, #top-menu #loggedas { + color: #ddd; + line-height: 21px; + margin-right: 4px; +} + +#top-menu li { + float: left; + list-style-type: none; + margin: 0; + padding: 0; + white-space: nowrap; +} + +#top-menu li a { + color: #999; + font-weight: normal; + padding:4px 5px; +} + +#top-menu li a:hover { + color: #fff; + text-decoration: none; +} + +#top-menu ul { + margin: 0; + padding: 0; +} + +#top-menu a { + color: #fff; + margin-right: 8px; + font-weight: bold; +} + +#top-menu #loggedas { + float: right; + margin-right: 0.5em; + color: #fff; +} + +#menu li a { + background-color: #5B4A73; + font-weight: normal; + padding:4px 8px 6px; + opacity: 0.6; +} + +div#menu li { + float:left; + list-style-type:none; + margin: 0px 2px 0px 0px; + padding: 0px 0px 0px 0px; + white-space:nowrap; +} + +div#menu li a { + display: block; + color: #fff; + text-decoration: none; + font-weight: bold; + margin: 0; + padding: 4px 10px 4px 10px; +} + +#menu li a:hover { + background: #5B4A73; + color: #fff; + opacity: 1; +} + +#menu li a.selected, +body#new #menu li a.new, +body#requests #menu li a.requests, +body#drafts #menu li a.drafts, +body#archive #menu li a.archive, +body#secunia #menu li a.secunia, +body#cve #menu li a.cve { + background: #fff; + color: #555; + opacity: 1; +} + +div#menu { + height: 42px; + background: #4C3E61 url(/images/menubg.png) repeat-x; + position: relative; + bborder-bottom: 3px solid #4C3E61; +} + +div#menu img.logo { + float: right; + border: 0 !important; +} + +div#menu ul { + position: absolute; + bottom: 0; + margin: 0; + padding: 0; + padding-left: 1em; + margin-right: 260px; + list-style: none; +} + +div#menu #search { + position: absolute; + right: 200px; + font-size: 80%; + margin-top: 17px; +} + +div#menu #search input { + font-size: 80%; +} + +/* Infobar */ +div#infobar { + background-color: #D3CFE5; + color: #4C3E61; + font-size: 95%; + padding: 0.2em; + padding-left: 1.5em; + border-bottom: 1px solid #8875B0; +} + +div#infobar span { + padding-right: 3em; +} + +/* Flash notice stuff */ +div#flash.notice { + padding: 0.2em; + font-size: 95%; + padding-left: 1.5em; + background-color: #729FCF; + border-bottom: 1px solid #1F3F7E; + color: #1F3F7E; +} + +div#flash.error { + padding: 0.2em; + font-size: 95%; + padding-left: 1.5em; + margin: 0; + background-color: #A40000; + border: none; + border-bottom: 1px solid #A40000; + color: white; +} + +/* Sidebar */ +div#right { + float: right; + width: 252px; + /*dbackground: #FCAF3E url(img/orangebg.png) repeat-y;*/ + cursor: default; +} + +br.clear { + clear: both; +} + +/* Content */ +div#content { + padding: 1em; + border-right: 1px solid #B2AAC2; + padding-bottom: 40px; +} + +div#content h1 { + margin-top: -.3em; + margin-left: -.2em; + margin-bottom: .3em; + color: #4C3E61; + font-size: 15pt; +} + +h2 { + color: #3E3550; + font-size: 13pt; +} + +.red { + color: #A40000; +} + +/* Floating */ +img.left, div.left, span.left { + float: left; +} + +.oneemright { + margin-right: 1em; +} + +.oneembottom { + margin-bottom: 1em; +} + +div#footer { + border-left: 6px solid #5B4A73; + + color: #4C3E61; + border-top: 3px solid #5B4A73; + background-color: #D3CFE5; + + position: fixed; + bottom: 0; + height: 1.5em; + + font-size: 85%; + margin-top: .3em; + margin-left: -6px; + width: 100%; + padding: 0.4em; +} + +div#footer a { + color: #4C3E61; +} + +div#footer span { + padding-right: 1.5em; +} + +span.hspacer { + padding-right: 3em; +} + +ul#commentslist { + list-style-type: none; + padding-left: 1em; +} + +ul#commentslist li { + margin-bottom: 8px; +} + +/** Tables **/ +table { + border-spacing: 0; + width: 100%; +} + +tr { + border-spacing: .3em; +} + +tr.odd, p.odd { + background-color: #D3CFE5; +} + +td { + margin: 0; + border: none; + padding: .2em; +} + +table#bugtable, table.list { + font-size: 80%; +} + +table#bugtable td, table.list td { + border-bottom: 1px solid #8875B0; + background-color: #DEDBEF; +} + +/** boxes **/ +div.box, div.legend { + padding: .4em; + background-color: #D3CFE5; + border-bottom: 1px solid #8875B0; + margin-bottom: 0.5em; +} + +div.error { + border: 1px solid #A40000; + padding: .5em; + margin: .5em; + color: #A40000; + background-color: white; +} + +div.error .actions { + border-top: 1px solid #A40000; + padding: .25em; + margin-top: .5em; + text-align: right; + padding-bottom: 0; +} + +div.error .actions form.button-to div { + display: inline; +} + +div.legend { + margin-top: 1em; +} + +div.legend img { + vertical-align: middle; +} + +div.legend h3 { + margin: 0; +} + +div.box h2 { + color: #3E3550; + font-size: 11pt; + margin: 0; +} + +div.box span.toolbar { + float: right; + margin-right: 5px; + margin-top: 2px; +} + +div.box p { + margin: 0; +} + +div.box .box-actions { + margin-top: 1em; + padding: .25em; + border-top: 1px solid #8875B0; + text-align: right; +} + +.pmargin p { + margin-bottom: .5em !important; +} + +.w40em { + width: 40em; +} + +.w100p { + width: 100%; +} + +/** leftright **/ +div#right { + width: 40%; + position: fixed; + top: 100px; + right: 10px; +} + +div#left { + width: 55%; +} + +table.padcells td { + padding: 0.3em; + padding-left: 0.5em; + padding-right: 0.5em; +} + +table.swap .odd { + background-color: #E6E5EE; +} + +table.centercells th { + text-align: center; +} + +tr.addbug { + background-color: #D2DEBF; +} + +tr.delbug { + background-color: #AD9095; +} + +div.progress { + display: none; + position: absolute; + top: 10%; + left: 45%; +} + +/** Buttons **/ +div.buttons { + padding: 0.5em; + background-color: #D3CFE5; + border-bottom: 1px solid #8875B0; + margin-bottom: 0.5em; +} + +a.button, input.button { + border-top: 1px solid #8875B0; + border-left: 1px solid #8875B0; + border-right: 1px solid #5B4A73; + border-bottom: 1px solid #5B4A73; + padding: .2em; + background: #4C3E61 url(/images/menubg.png) repeat-x; + font-size: 90%; + color: white; + text-decoration: none; + margin: .4em; + margin-right: .5em; +} + +a.button:hover { + color: #2B1C4A; +} + +a.button:active { + border-right: 1px solid #8875B0; + border-bottom: 1px solid #8875B0; + border-top: 1px solid #5B4A73; + border-left: 1px solid #5B4A73; +} + +a.button img { + vertical-align: top; +} + +/** Form controls **/ +form p, form ul#commentslist { + padding: .5em; + margin-bottom: .3em; + margin-top: .3em; +} + +form.l label { + width: 15em; + float: left; +} + +input.text { + border: 1px solid #4C3E61; + /*background-color: #D3CFE5;*/ +} + +textarea.nice, input.nice { + border: 1px solid #4C3E61; + width: 100%; +} + +.largetext { + font-size: 150%; +} + +.hugetext { + font-size: 180%; +} + +.floatright { + float: right; +} + +.greytext { + color: #555753; +} + +.smalltext { + font-size: 80%; +} + +/** diff **/ +.diff_in, .diff_out { + padding: 0.1em; +} + +.diff_in { + background-color: #A54F5D; +} + +.diff_out { + background-color: #7E9557; +} + +.docked-right { + position: fixed; + top: 40px; + right: 1em; + bottom: 40px; + width: inherit; + margin-left: 1em; +} + +/** tables **/ + +table.glsa-list { + +} + +table.glsa-list th { + border-bottom: 2px solid #4C3E61; + border-right: 1px dotted #4C3E61; + padding: .5em; +} + +table.glsa-list tr.restricted, table.glsa-list tr.restricted a, .legend .red { + color: #a40000 !important; +} + +table.glsa-list td { + padding: .5em; + padding-top: .4em; + padding-bottom: .4em; + border-right: 1px dotted #4C3E61; + border-bottom: 1px solid #4C3E61; +} + +/*@import url("/stylesheets/screen.css");*/ diff --git a/app/controllers/tools_controller.rb b/app/controllers/tools_controller.rb index bc26acc..d257428 100644 --- a/app/controllers/tools_controller.rb +++ b/app/controllers/tools_controller.rb @@ -11,15 +11,59 @@ # Tools controller class ToolsController < ApplicationController - def buginfo -# bug = Bugzilla::Bug.load_from_id(params[:id]) + layout false + + # Provides information for the 'file new request' page + def file_req_ajax_info + if params[:bugs] == nil + render :text => "No bug given", :status => 500 + return + end + + bug_ids = Bugzilla::Bug.str2bugIDs(params[:bugs]) + + @bugs = [] + bug_ids.each do |bug_id| + begin + @bugs << Bugzilla::Bug.load_from_id(bug_id.to_i) + rescue Exception => e + @bugs << "Ignoring #{bug_id} #{e.message}" + end + end + + buginfo = render_to_string :template => 'tools/ajaxbugs', :layout => false - str = "<dev-ruby/rails-2.2.2: XSS (CVE 2009-5607)" + # Generating a description + @bugs.delete_if {|i| i.is_a? String} + suggestion = nil - respond_to do |format| - format.html { } - format.ajax { render :text => "text to render...", :status => 1 } + if @bugs.length == 1 + @text = @bugs[0].summary + suggestion = render_to_string :template => 'tools/ajaxdescr', :layout => false + else + @atoms = [] + @bugs.each do |bug| + matchdata = /([\w-]+)\/([\w-]+)(-([\w.]+))?/.match(bug.summary) + + unless matchdata.nil? + category = matchdata[1] + package = matchdata[2].gsub(/-+?$/, '') + + @atoms << "#{category}/#{package}" + end + end + + @atoms.uniq! + + if @atoms.length > 0 + @text = @atoms.join(', ') + ": Multiple vulnerabilities" + suggestion = render_to_string :template => 'tools/ajaxdescr', :layout => false + end end + + suggestion ||= "(no suggestion available)" + + render :json => {"buginfo" => buginfo, "title" => suggestion} end def ajaxbugs diff --git a/app/mailers/.gitkeep b/app/mailers/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/app/mailers/.gitkeep diff --git a/app/models/.gitkeep b/app/models/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/app/models/.gitkeep diff --git a/app/views/glsa/new-request.html.erb b/app/views/glsa/new-request.html.erb index bd6df24..2753c41 100644 --- a/app/views/glsa/new-request.html.erb +++ b/app/views/glsa/new-request.html.erb @@ -1,20 +1,20 @@ <h1>New GLSA request</h1> -<% form_tag(:action => "create") do %> +<%= form_tag(:action => "create") do %> <div class="box w40em"> <input type="hidden" name="what" value="request" /> <h2 style="margin-top: 0;"><img src="/images/icons/bug.png" alt="bug" /> Bugs</h2> <p><label for="bugs">Please enter the relevant bug ID(s), separate more than one bug with a comma:</label></p> <p><input type="text" name="bugs" id="bugs" class="hugetext nice" value="<%= h params[:bugs] %>"/></p> - <%= observe_field :bugs, :url => { :controller => 'tools', :action => 'ajaxbugs' }, - :frequency => 2, - :update => :ajaxbugs, - :with => 'bugs' %> - <%= observe_field :bugs, :url => { :controller => 'tools', :action => 'ajaxdescr' }, - :frequency => 2, - :update => :suggesteddescr, - :with => 'bugs' %> + <script language="javascript"> + $("#bugs").change(function() { + $.post("<%= url_for :controller => 'tools', :action => 'file_req_ajax_info' %>", { bugs: $("#bugs").val() }, function (data) { + $('#ajaxbugs').html(data.buginfo); + $('#suggesteddescr').html(data.title); + }, 'json'); + }); + </script> <div id="ajaxbugs"></div> </div> <br /> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index a2f5349..b485d16 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -5,10 +5,13 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title><%= @pageTitle + " — "if @pageTitle%>GLSAMaker 2</title> - <%= stylesheet_link_tag "screen", :cache => false %> +<!-- <%= stylesheet_link_tag "screen", :cache => false %> <%= stylesheet_link_tag "admin", :cache => false %> <%= stylesheet_link_tag "modalbox", :cache => false %> - <%= javascript_include_tag :all, :cache => false %> + <%= javascript_include_tag :all, :cache => false %>--> + <%= stylesheet_link_tag "application" %> + <%= javascript_include_tag "application" %> + <%= csrf_meta_tags %> </head> <body id="<%= h @pageID if @pageID %>"> <div id="top-menu"> diff --git a/app/views/tools/ajaxbugs.html.erb b/app/views/tools/ajaxbugs.html.erb index 678c7cb..1af2b3c 100644 --- a/app/views/tools/ajaxbugs.html.erb +++ b/app/views/tools/ajaxbugs.html.erb @@ -1,10 +1,10 @@ <ul class="ajaxbugs"> <% @bugs.each do |bug| %> <% if bug.is_a?(String) %> - <li class="ajaxbugs-error"><%= h bug %></li> + <li class="ajaxbugs-error"><%= bug %></li> <% else %> - <li><%= link_to_function h(bug.bug_id), "buginfo('#{h bug.bug_id}')" %>: - <%= truncate(h(bug.summary), :length => 50) %></li> + <li><%= link_to_function bug.bug_id, "buginfo('#{h bug.bug_id}')" %>: + <%= truncate(bug.summary, :length => 50) %></li> <% end %> <% end %> </ul>
\ No newline at end of file diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..1afbd55 --- /dev/null +++ b/config.ru @@ -0,0 +1,4 @@ +# This file is used by Rack-based servers to start the application. + +require ::File.expand_path('../config/environment', __FILE__) +run Glsamaker::Application diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 0000000..22fae9f --- /dev/null +++ b/config/application.rb @@ -0,0 +1,44 @@ +require File.expand_path('../boot', __FILE__) + +require 'rails/all' + +# If you have a Gemfile, require the default gems, the ones in the +# current environment and also include :assets gems if in development +# or test environments. +Bundler.require *Rails.groups(:assets) if defined?(Bundler) + +module Glsamaker + class Application < Rails::Application + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Custom directories with classes and modules you want to be autoloadable. + # config.autoload_paths += %W(#{config.root}/extras) + config.autoload_paths += Dir["#{config.root}/lib/**/"] + + # Only load the plugins named here, in the order given (default is alphabetical). + # :all can be used as a placeholder for all plugins not explicitly named. + # config.plugins = [ :exception_notification, :ssl_requirement, :all ] + + # Activate observers that should always be running. + # config.active_record.observers = :cacher, :garbage_collector, :forum_observer + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. + # config.time_zone = 'Central Time (US & Canada)' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] + # config.i18n.default_locale = :de + + # Configure the default encoding used in templates for Ruby 1.9. + config.encoding = "utf-8" + + # Configure sensitive parameters which will be filtered from the log file. + config.filter_parameters += [:password] + + # Enable the asset pipeline + config.assets.enabled = true + end +end diff --git a/config/boot.rb b/config/boot.rb index 6686664..4489e58 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,114 +1,6 @@ -# Don't change this file! -# Configure your app in config/environment.rb and config/environments/*.rb +require 'rubygems' -RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) +# Set up gems listed in the Gemfile. +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -module Rails - class << self - def boot! - unless booted? - preinitialize - pick_boot.run - end - end - - def booted? - defined? Rails::Initializer - end - - def pick_boot - (vendor_rails? ? VendorBoot : GemBoot).new - end - - def vendor_rails? - File.exist?("#{RAILS_ROOT}/vendor/rails") - end - - def preinitialize - load(preinitializer_path) if File.exist?(preinitializer_path) - end - - def preinitializer_path - "#{RAILS_ROOT}/config/preinitializer.rb" - end - end - - class Boot - def run - load_initializer - Rails::Initializer.run(:set_load_path) - end - end - - class VendorBoot < Boot - def load_initializer - require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" - Rails::Initializer.run(:install_gem_spec_stubs) - Rails::GemDependency.add_frozen_gem_path - end - end - - class GemBoot < Boot - def load_initializer - self.class.load_rubygems - load_rails_gem - require 'initializer' - end - - def load_rails_gem - if version = self.class.gem_version - gem 'rails', version - else - gem 'rails' - end - rescue Gem::LoadError => load_error - if load_error.message =~ /Could not find RubyGem rails/ - STDERR.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.) - exit 1 - else - raise - end - end - - class << self - def rubygems_version - Gem::RubyGemsVersion rescue nil - end - - def gem_version - if defined? RAILS_GEM_VERSION - RAILS_GEM_VERSION - elsif ENV.include?('RAILS_GEM_VERSION') - ENV['RAILS_GEM_VERSION'] - else - parse_gem_version(read_environment_rb) - end - end - - def load_rubygems - min_version = '1.3.2' - require 'rubygems' - unless rubygems_version >= min_version - $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.) - exit 1 - end - - rescue LoadError - $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org) - exit 1 - end - - def parse_gem_version(text) - $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/ - end - - private - def read_environment_rb - File.read("#{RAILS_ROOT}/config/environment.rb") - end - end - end -end - -# All that for this: -Rails.boot! +require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) diff --git a/config/database.yml.mysql b/config/database.yml.mysql index 62869bd..7b9e75e 100644 --- a/config/database.yml.mysql +++ b/config/database.yml.mysql @@ -1,40 +1,42 @@ # MySQL. Versions 4.1 and 5.0 are recommended. +# +# Install the MYSQL driver +# gem install mysql2 # +# Ensure the MySQL gem is defined in your Gemfile +# gem 'mysql2' +# +# And be sure to use new-style password hashing: +# http://dev.mysql.com/doc/refman/5.0/en/old-client.html development: - adapter: mysql + adapter: mysql2 encoding: utf8 + reconnect: false database: glsamaker_development pool: 5 - username: glsamaker - password: -# socket: /var/run/mysqld/mysqld.sock -# ^ or v -# host: 127.0.0.1 -# port: 3306 + username: root + password: + socket: /tmp/mysql.sock # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: - adapter: mysql + adapter: mysql2 encoding: utf8 + reconnect: false database: glsamaker_test pool: 5 - username: glsamaker + username: root password: -# socket: /var/run/mysqld/mysqld.sock -# ^ or v -# host: 127.0.0.1 -# port: 3306 + socket: /tmp/mysql.sock production: - adapter: mysql + adapter: mysql2 encoding: utf8 + reconnect: false database: glsamaker_production pool: 5 - username: glsamaker + username: root password: -# socket: /var/run/mysqld/mysqld.sock -# ^ or v -# host: 127.0.0.1 -# port: 3306 + socket: /tmp/mysql.sock diff --git a/config/environment.rb b/config/environment.rb index e416e83..fdd1354 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,52 +1,9 @@ -# Be sure to restart your server when you modify this file +# Load the rails application +require File.expand_path('../application', __FILE__) -# Specifies gem version of Rails to use when vendor/rails is not present -RAILS_GEM_VERSION = '2.3.12' unless defined? RAILS_GEM_VERSION - -# Bootstrap the Rails environment, frameworks, and default configuration -require File.join(File.dirname(__FILE__), 'boot') - -Rails::Initializer.run do |config| - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. - - # Add additional load paths for your own custom dirs - # config.load_paths += %W( #{RAILS_ROOT}/extras ) - - # Specify gems that this application depends on and have them installed with rake gems:install - # config.gem "bj" - # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" - # config.gem "sqlite3-ruby", :lib => "sqlite3" - # config.gem "aws-s3", :lib => "aws/s3" - config.gem 'json' - config.gem 'mechanize' - config.gem 'fastercsv' - # actionmailer vendors this gem. uncommented to avoid lots of warnings - # config.gem 'text-format', :lib => 'text/format' - config.gem 'diff-lcs', :lib => 'diff/lcs' - - # Only load the plugins named here, in the order given (default is alphabetical). - # :all can be used as a placeholder for all plugins not explicitly named - # config.plugins = [ :exception_notification, :ssl_requirement, :all ] - - # Skip frameworks you're not going to use. To use Rails without a database, - # you must remove the Active Record framework. - # config.frameworks -= [ :active_record, :active_resource, :action_mailer ] - - # Activate observers that should always be running - # config.active_record.observers = :cacher, :garbage_collector, :forum_observer - - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. - config.time_zone = 'UTC' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')] - # config.i18n.default_locale = :de - config.action_controller.session_store = :active_record_store -end +# Initialize the rails application +Glsamaker::Application.initialize! GLSAMAKER_VERSION="1.9-git" -require 'digest/md5' +require 'digest/md5'
\ No newline at end of file diff --git a/config/environment.rb.rails2 b/config/environment.rb.rails2 new file mode 100644 index 0000000..e416e83 --- /dev/null +++ b/config/environment.rb.rails2 @@ -0,0 +1,52 @@ +# Be sure to restart your server when you modify this file + +# Specifies gem version of Rails to use when vendor/rails is not present +RAILS_GEM_VERSION = '2.3.12' unless defined? RAILS_GEM_VERSION + +# Bootstrap the Rails environment, frameworks, and default configuration +require File.join(File.dirname(__FILE__), 'boot') + +Rails::Initializer.run do |config| + # Settings in config/environments/* take precedence over those specified here. + # Application configuration should go into files in config/initializers + # -- all .rb files in that directory are automatically loaded. + + # Add additional load paths for your own custom dirs + # config.load_paths += %W( #{RAILS_ROOT}/extras ) + + # Specify gems that this application depends on and have them installed with rake gems:install + # config.gem "bj" + # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" + # config.gem "sqlite3-ruby", :lib => "sqlite3" + # config.gem "aws-s3", :lib => "aws/s3" + config.gem 'json' + config.gem 'mechanize' + config.gem 'fastercsv' + # actionmailer vendors this gem. uncommented to avoid lots of warnings + # config.gem 'text-format', :lib => 'text/format' + config.gem 'diff-lcs', :lib => 'diff/lcs' + + # Only load the plugins named here, in the order given (default is alphabetical). + # :all can be used as a placeholder for all plugins not explicitly named + # config.plugins = [ :exception_notification, :ssl_requirement, :all ] + + # Skip frameworks you're not going to use. To use Rails without a database, + # you must remove the Active Record framework. + # config.frameworks -= [ :active_record, :active_resource, :action_mailer ] + + # Activate observers that should always be running + # config.active_record.observers = :cacher, :garbage_collector, :forum_observer + + # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. + # Run "rake -D time" for a list of tasks for finding time zone names. + config.time_zone = 'UTC' + + # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. + # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')] + # config.i18n.default_locale = :de + config.action_controller.session_store = :active_record_store +end + +GLSAMAKER_VERSION="1.9-git" + +require 'digest/md5' diff --git a/config/environments/development.rb b/config/environments/development.rb index f161881..c52639a 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,19 +1,27 @@ -# Settings specified here will take precedence over those in config/environment.rb +Glsamaker::Application.configure do + # Settings specified here will take precedence over those in config/application.rb -# In the development environment your application's code is reloaded on -# every request. This slows down response time but is perfect for development -# since you don't have to restart the webserver when you make code changes. -config.cache_classes = false + # In the development environment your application's code is reloaded on + # every request. This slows down response time but is perfect for development + # since you don't have to restart the web server when you make code changes. + config.cache_classes = false -# Log error messages when you accidentally call methods on nil. -config.whiny_nils = true + # Log error messages when you accidentally call methods on nil. + config.whiny_nils = true -# Show full error reports and disable caching -config.action_controller.consider_all_requests_local = true -config.action_view.debug_rjs = true -config.action_controller.perform_caching = false + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false -config.action_mailer.delivery_method = :sendmail + # Don't care if the mailer can't send + config.action_mailer.raise_delivery_errors = false -# Don't care if the mailer can't send -config.action_mailer.raise_delivery_errors = false + # Print deprecation notices to the Rails logger + config.active_support.deprecation = :log + + # Only use best-standards-support built into browsers + config.action_dispatch.best_standards_support = :builtin + + # Do not compress assets + config.assets.compress = false +end diff --git a/config/environments/development.rb.rails2 b/config/environments/development.rb.rails2 new file mode 100644 index 0000000..f161881 --- /dev/null +++ b/config/environments/development.rb.rails2 @@ -0,0 +1,19 @@ +# Settings specified here will take precedence over those in config/environment.rb + +# In the development environment your application's code is reloaded on +# every request. This slows down response time but is perfect for development +# since you don't have to restart the webserver when you make code changes. +config.cache_classes = false + +# Log error messages when you accidentally call methods on nil. +config.whiny_nils = true + +# Show full error reports and disable caching +config.action_controller.consider_all_requests_local = true +config.action_view.debug_rjs = true +config.action_controller.perform_caching = false + +config.action_mailer.delivery_method = :sendmail + +# Don't care if the mailer can't send +config.action_mailer.raise_delivery_errors = false diff --git a/config/environments/production.rb b/config/environments/production.rb index dd0a591..62e5397 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,35 +1,55 @@ -# Settings specified here will take precedence over those in config/environment.rb +Glsamaker::Application.configure do + # Settings specified here will take precedence over those in config/application.rb -# The production environment is meant for finished, "live" apps. -# Code is not reloaded between requests -config.cache_classes = true + # Code is not reloaded between requests + config.cache_classes = true -# Full error reports are disabled and caching is turned on -config.action_controller.consider_all_requests_local = false -config.action_controller.perform_caching = true -config.action_view.cache_template_loading = true + # Full error reports are disabled and caching is turned on + config.consider_all_requests_local = false + config.action_controller.perform_caching = true -# See everything in the log (default is :info) -# config.log_level = :debug + # Disable Rails's static asset server (Apache or nginx will already do this) + config.serve_static_assets = false -# Use a different logger for distributed setups -# config.logger = SyslogLogger.new -# FIXME: This doesn't work quite yet -#config.logger = SyslogLogger.new('glsamaker2') + # Compress JavaScripts and CSS + config.assets.compress = true -# Use a different cache store in production -# config.cache_store = :mem_cache_store + # Specifies the header that your server uses for sending files + # (comment out if your front-end server doesn't support this) + config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx -# Enable serving of images, stylesheets, and javascripts from an asset server -# config.action_controller.asset_host = "http://assets.example.com" + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + # config.force_ssl = true -# Disable delivery errors, bad email addresses will be ignored -# config.action_mailer.raise_delivery_errors = false + # See everything in the log (default is :info) + # config.log_level = :debug -# We care about email errors -config.action_mailer.raise_delivery_errors = true -config.action_mailer.delivery_method = :sendmail -config.action_mailer.sendmail_settings = { :location => '/usr/sbin/sendmail', :arguments => '-i -t -f glsamaker@gentoo.org' } + # Use a different logger for distributed setups + # config.logger = SyslogLogger.new -# Enable threaded mode -#config.threadsafe! + # Use a different cache store in production + # config.cache_store = :mem_cache_store + + # Enable serving of images, stylesheets, and JavaScripts from an asset server + # config.action_controller.asset_host = "http://assets.example.com" + + # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) + # config.assets.precompile += %w( search.js ) + + # Disable delivery errors, bad email addresses will be ignored + config.action_mailer.raise_delivery_errors = true + + # Other Sendmail config + config.action_mailer.delivery_method = :sendmail + config.action_mailer.sendmail_settings = { :location => '/usr/sbin/sendmail', :arguments => '-i -t -f glsamaker@gentoo.org' } + + # Enable threaded mode + # config.threadsafe! + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation can not be found) + config.i18n.fallbacks = true + + # Send deprecation notices to registered listeners + config.active_support.deprecation = :notify +end diff --git a/config/environments/production.rb.rails2 b/config/environments/production.rb.rails2 new file mode 100644 index 0000000..dd0a591 --- /dev/null +++ b/config/environments/production.rb.rails2 @@ -0,0 +1,35 @@ +# Settings specified here will take precedence over those in config/environment.rb + +# The production environment is meant for finished, "live" apps. +# Code is not reloaded between requests +config.cache_classes = true + +# Full error reports are disabled and caching is turned on +config.action_controller.consider_all_requests_local = false +config.action_controller.perform_caching = true +config.action_view.cache_template_loading = true + +# See everything in the log (default is :info) +# config.log_level = :debug + +# Use a different logger for distributed setups +# config.logger = SyslogLogger.new +# FIXME: This doesn't work quite yet +#config.logger = SyslogLogger.new('glsamaker2') + +# Use a different cache store in production +# config.cache_store = :mem_cache_store + +# Enable serving of images, stylesheets, and javascripts from an asset server +# config.action_controller.asset_host = "http://assets.example.com" + +# Disable delivery errors, bad email addresses will be ignored +# config.action_mailer.raise_delivery_errors = false + +# We care about email errors +config.action_mailer.raise_delivery_errors = true +config.action_mailer.delivery_method = :sendmail +config.action_mailer.sendmail_settings = { :location => '/usr/sbin/sendmail', :arguments => '-i -t -f glsamaker@gentoo.org' } + +# Enable threaded mode +#config.threadsafe! diff --git a/config/environments/test.rb b/config/environments/test.rb index 3cae1a7..f97b70b 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,28 +1,39 @@ -# Settings specified here will take precedence over those in config/environment.rb - -# The test environment is used exclusively to run your application's -# test suite. You never need to work with it otherwise. Remember that -# your test database is "scratch space" for the test suite and is wiped -# and recreated between test runs. Don't rely on the data there! -config.cache_classes = true - -# Log error messages when you accidentally call methods on nil. -config.whiny_nils = true - -# Show full error reports and disable caching -config.action_controller.consider_all_requests_local = true -config.action_controller.perform_caching = false -config.action_view.cache_template_loading = true - -# Disable request forgery protection in test environment -config.action_controller.allow_forgery_protection = false - -# Tell Action Mailer not to deliver emails to the real world. -# The :test delivery method accumulates sent emails in the -# ActionMailer::Base.deliveries array. -config.action_mailer.delivery_method = :test - -# Use SQL instead of Active Record's schema dumper when creating the test database. -# This is necessary if your schema can't be completely dumped by the schema dumper, -# like if you have constraints or database-specific column types -# config.active_record.schema_format = :sql +Glsamaker::Application.configure do + # Settings specified here will take precedence over those in config/application.rb + + # The test environment is used exclusively to run your application's + # test suite. You never need to work with it otherwise. Remember that + # your test database is "scratch space" for the test suite and is wiped + # and recreated between test runs. Don't rely on the data there! + config.cache_classes = true + + # Configure static asset server for tests with Cache-Control for performance + config.serve_static_assets = true + config.static_cache_control = "public, max-age=3600" + + # Log error messages when you accidentally call methods on nil + config.whiny_nils = true + + # Show full error reports and disable caching + config.consider_all_requests_local = true + config.action_controller.perform_caching = false + + # Raise exceptions instead of rendering exception templates + config.action_dispatch.show_exceptions = false + + # Disable request forgery protection in test environment + config.action_controller.allow_forgery_protection = false + + # Tell Action Mailer not to deliver emails to the real world. + # The :test delivery method accumulates sent emails in the + # ActionMailer::Base.deliveries array. + config.action_mailer.delivery_method = :test + + # Use SQL instead of Active Record's schema dumper when creating the test database. + # This is necessary if your schema can't be completely dumped by the schema dumper, + # like if you have constraints or database-specific column types + # config.active_record.schema_format = :sql + + # Print deprecation notices to the stderr + config.active_support.deprecation = :stderr +end diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index 370315d..59385cd 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -3,5 +3,5 @@ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } -# You can also remove all the silencers if you're trying do debug a problem that might steem from framework code. +# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. # Rails.backtrace_cleaner.remove_silencers! diff --git a/config/initializers/bundler_ext.rb b/config/initializers/bundler_ext.rb index 0f897ec..954d9b7 100644 --- a/config/initializers/bundler_ext.rb +++ b/config/initializers/bundler_ext.rb @@ -1,27 +1,27 @@ -module ActionView - module TemplateHandlers - class BuilderOptions - cattr_accessor :margin, :indent - end - end -end - -module ActionView - module TemplateHandlers - class Builder < TemplateHandler - - def compile(template) - "_set_controller_content_type(Mime::XML);" + - "xml = ::Builder::XmlMarkup.new(" + - ":indent => #{ActionView::TemplateHandlers::BuilderOptions.indent}, " + - ":margin => #{ActionView::TemplateHandlers::BuilderOptions.margin});" + - "self.output_buffer = xml.target!;" + - template.source + - ";xml.target!;" - end - end - end -end - -ActionView::TemplateHandlers::BuilderOptions.margin = 0 -ActionView::TemplateHandlers::BuilderOptions.indent = 2 +# module ActionView +# module TemplateHandlers +# class BuilderOptions +# cattr_accessor :margin, :indent +# end +# end +# end +# +# module ActionView +# module TemplateHandlers +# class Builder < TemplateHandler +# +# def compile(template) +# "_set_controller_content_type(Mime::XML);" + +# "xml = ::Builder::XmlMarkup.new(" + +# ":indent => #{ActionView::TemplateHandlers::BuilderOptions.indent}, " + +# ":margin => #{ActionView::TemplateHandlers::BuilderOptions.margin});" + +# "self.output_buffer = xml.target!;" + +# template.source + +# ";xml.target!;" +# end +# end +# end +# end +# +# ActionView::TemplateHandlers::BuilderOptions.margin = 0 +# ActionView::TemplateHandlers::BuilderOptions.indent = 2 diff --git a/config/initializers/glsamaker-global.rb b/config/initializers/glsamaker-global.rb index 87b7e13..1fc8450 100644 --- a/config/initializers/glsamaker-global.rb +++ b/config/initializers/glsamaker-global.rb @@ -1,2 +1,2 @@ # window stuff needed first -ActionView::Helpers::AssetTagHelper::register_javascript_include_default 'modalbox' +# ActionView::Helpers::AssetTagHelper::register_javascript_include_default 'modalbox' diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index d531b8b..9e8b013 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,6 +1,6 @@ # Be sure to restart your server when you modify this file. -# Add new inflection rules using the following format +# Add new inflection rules using the following format # (all these examples are active by default): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index 225703f..72aca7e 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -1,4 +1,5 @@ +# Be sure to restart your server when you modify this file. + # Add new mime types for use in respond_to blocks: -Mime::Type.register "text/plain", :txt -# TODO: Change to something that downloads -# Mime::Type.register "text/plain", :xml +# Mime::Type.register "text/richtext", :rtf +# Mime::Type.register_alias "text/html", :iphone diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb new file mode 100644 index 0000000..697d8ce --- /dev/null +++ b/config/initializers/secret_token.rb @@ -0,0 +1,7 @@ +# Be sure to restart your server when you modify this file. + +# Your secret key for verifying the integrity of signed cookies. +# If you change this key, all old signed cookies will become invalid! +# Make sure the secret is at least 30 characters and all random, +# no regular words or you'll be exposed to dictionary attacks. +Glsamaker::Application.config.secret_token = '1cda0326aacd7d0e7c9e2feec468ff86f4ade897c17a1bfe9f7b820457c4bc1eaf2888fcfe4baa48fbd4e7fd32bd20a8abbe6b4d681c56c561390003aabc6979' diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index d9d0f70..6c9bd0a 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,15 +1,8 @@ # Be sure to restart your server when you modify this file. -# Your secret key for verifying cookie session data integrity. -# If you change this key, all old sessions will become invalid! -# Make sure the secret is at least 30 characters and all random, -# no regular words or you'll be exposed to dictionary attacks. -ActionController::Base.session = { - :key => '_glsamaker_session', - :secret => '2501f0c5921570d17b2b6d3094a3f7f933615d70527d9831591e6eae118ef556086ad2afc68f0af79c3c2e5fbf440008696f47a85eb3480bc7c12bf83a4c6492' -} +Glsamaker::Application.config.session_store :cookie_store, :key => '_glsamaker_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information -# (create the session table with "rake db:sessions:create") -# ActionController::Base.session_store = :active_record_store +# (create the session table with "rails generate session_migration") +# Glsamaker::Application.config.session_store :active_record_store diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb new file mode 100644 index 0000000..71b88b0 --- /dev/null +++ b/config/initializers/wrap_parameters.rb @@ -0,0 +1,12 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains settings for ActionController::ParamsWrapper which +# is enabled by default. + +# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. +ActionController::Base.wrap_parameters :format => [:json] + +# Disable root element in JSON by default. +if defined?(ActiveRecord) + ActiveRecord::Base.include_root_in_json = false +end diff --git a/config/locales/en.yml b/config/locales/en.yml index f265c06..179c14c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1,5 +1,5 @@ # Sample localization file for English. Add more files in this directory for other locales. -# See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. +# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. en: - hello: "Hello world"
\ No newline at end of file + hello: "Hello world" diff --git a/config/routes.rb b/config/routes.rb index 9b250f5..632fb9e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,66 +1,84 @@ -ActionController::Routing::Routes.draw do |map| - # The priority is based upon order of creation: first created -> highest priority. +Glsamaker::Application.routes.draw do + + match 'bug/:id' => 'bug#bug', :as => :bug + match 'bug/:id/history' => 'bug#history', :as => :bughistory + match 'tools/bug/:id/:what' => 'tools#bugzie', :as => :bugzie + + match 'glsa/:id/addcomment' => 'glsa#addcomment', :as => :addcomment + match 'glsa/:id/addcomment/save' => 'glsa#addcommentsave', :as => :addcommentsave + + match 'glsa/requests' => 'glsa#requests', :as => :requests + match 'glsa/drafts' => 'glsa#drafts', :as => :drafts + match 'glsa/archive' => 'glsa#archive', :as => :sent + + match 'glsa/diff/:id/rev/:from/to/:to' => 'glsa#diff', :as => :diff + + match 'glsa/new/:what' => 'glsa#new', :as => :newglsa + match 'glsa/show/:id.:format' => 'glsa#show', :as => :showglsa + + match 'cve/list.:format' => 'cve#list', :as => :cve + + match 'admin' => 'admin#index' + + # The priority is based upon order of creation: + # first created -> highest priority. # Sample of regular route: - # map.connect 'products/:id', :controller => 'catalog', :action => 'view' + # match 'products/:id' => 'catalog#view' # Keep in mind you can assign values other than :controller and :action # Sample of named route: - # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase' + # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase # This route can be invoked with purchase_url(:id => product.id) # Sample resource route (maps HTTP verbs to controller actions automatically): - # map.resources :products + # resources :products # Sample resource route with options: - # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get } + # resources :products do + # member do + # get 'short' + # post 'toggle' + # end + # + # collection do + # get 'sold' + # end + # end # Sample resource route with sub-resources: - # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller - + # resources :products do + # resources :comments, :sales + # resource :seller + # end + # Sample resource route with more complex sub-resources - # map.resources :products do |products| - # products.resources :comments - # products.resources :sales, :collection => { :recent => :get } + # resources :products do + # resources :comments + # resources :sales do + # get 'recent', :on => :collection + # end # end # Sample resource route within a namespace: - map.namespace :admin do |admin| - admin.resources :users + # namespace :admin do + # # Directs /admin/products/* to Admin::ProductsController + # # (app/controllers/admin/products_controller.rb) + # resources :products + # end + + namespace :admin do + resources :users end - # You can have the root of your site routed with map.root -- just remember to delete public/index.html. - map.root :controller => "index" + # You can have the root of your site routed with "root" + # just remember to delete public/index.html. + root :to => 'index#index' # See how all your routes lay out with "rake routes" - # Install the default routes as the lowest priority. - # Note: These default routes make all actions in every controller accessible via GET requests. You should - # consider removing the them or commenting them out if you're using named routes and resources. - - # Bugzilla interface - map.bug '/bug/:id', :controller => 'bug', :action => 'bug' - map.bughistory '/bug/:id/history', :controller => 'bug', :action => 'history' - - # Adding a comment to a GLSA - map.addcomment '/glsa/:id/addcomment', :controller => 'glsa', :action => 'addcomment' - map.addcommentsave '/glsa/:id/addcomment/save', :controller => 'glsa', :action => 'addcommentsave' - - map.requests '/glsa/requests', :controller => 'glsa', :action => 'requests' - map.drafts '/glsa/drafts' , :controller => 'glsa', :action => 'drafts' - map.sent '/glsa/archive' , :controller => 'glsa', :action => 'archive' - - map.diff '/glsa/diff/:id/rev/:from/to/:to', :controller => 'glsa', :action => 'diff' - - map.newglsa '/glsa/new/:what', :controller => 'glsa', :action => 'new' - map.showglsa '/glsa/show/:id.:format', :controller => 'glsa', :action => 'show' - - map.bugzie '/tools/bug/:id/:what', :controller => 'tools', :action => 'bugzie' - - map.cve '/cve/list.:format', :controller => 'cve', :action => 'list' - - map.connect 'admin', :controller => 'admin/index', :action => 'index' - - map.connect ':controller/:action/:id' - map.connect ':controller/:action/:id.:format' + # This is a legacy wild controller route that's not recommended for RESTful applications. + # Note: This route will make all actions in every controller accessible via GET requests. + match ':controller(/:action(/:id(.:format)))' + # end diff --git a/config/routes.rb.rails2 b/config/routes.rb.rails2 new file mode 100644 index 0000000..9b250f5 --- /dev/null +++ b/config/routes.rb.rails2 @@ -0,0 +1,66 @@ +ActionController::Routing::Routes.draw do |map| + # The priority is based upon order of creation: first created -> highest priority. + + # Sample of regular route: + # map.connect 'products/:id', :controller => 'catalog', :action => 'view' + # Keep in mind you can assign values other than :controller and :action + + # Sample of named route: + # map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase' + # This route can be invoked with purchase_url(:id => product.id) + + # Sample resource route (maps HTTP verbs to controller actions automatically): + # map.resources :products + + # Sample resource route with options: + # map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get } + + # Sample resource route with sub-resources: + # map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller + + # Sample resource route with more complex sub-resources + # map.resources :products do |products| + # products.resources :comments + # products.resources :sales, :collection => { :recent => :get } + # end + + # Sample resource route within a namespace: + map.namespace :admin do |admin| + admin.resources :users + end + + # You can have the root of your site routed with map.root -- just remember to delete public/index.html. + map.root :controller => "index" + + # See how all your routes lay out with "rake routes" + + # Install the default routes as the lowest priority. + # Note: These default routes make all actions in every controller accessible via GET requests. You should + # consider removing the them or commenting them out if you're using named routes and resources. + + # Bugzilla interface + map.bug '/bug/:id', :controller => 'bug', :action => 'bug' + map.bughistory '/bug/:id/history', :controller => 'bug', :action => 'history' + + # Adding a comment to a GLSA + map.addcomment '/glsa/:id/addcomment', :controller => 'glsa', :action => 'addcomment' + map.addcommentsave '/glsa/:id/addcomment/save', :controller => 'glsa', :action => 'addcommentsave' + + map.requests '/glsa/requests', :controller => 'glsa', :action => 'requests' + map.drafts '/glsa/drafts' , :controller => 'glsa', :action => 'drafts' + map.sent '/glsa/archive' , :controller => 'glsa', :action => 'archive' + + map.diff '/glsa/diff/:id/rev/:from/to/:to', :controller => 'glsa', :action => 'diff' + + map.newglsa '/glsa/new/:what', :controller => 'glsa', :action => 'new' + map.showglsa '/glsa/show/:id.:format', :controller => 'glsa', :action => 'show' + + map.bugzie '/tools/bug/:id/:what', :controller => 'tools', :action => 'bugzie' + + map.cve '/cve/list.:format', :controller => 'cve', :action => 'list' + + map.connect 'admin', :controller => 'admin/index', :action => 'index' + + map.connect ':controller/:action/:id' + map.connect ':controller/:action/:id.:format' +end diff --git a/db/schema.rb b/db/schema.rb index 0815938..7e10a34 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,10 +1,11 @@ -# This file is auto-generated from the current state of the database. Instead of editing this file, -# please use the migrations feature of Active Record to incrementally modify your database, and -# then regenerate this schema definition. +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. # -# Note that this schema.rb definition is the authoritative source for your database schema. If you need -# to create the application database on another system, you should be using db:schema:load, not running -# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended to check this file into your version control system. diff --git a/db/seeds.rb b/db/seeds.rb new file mode 100644 index 0000000..d34dfa0 --- /dev/null +++ b/db/seeds.rb @@ -0,0 +1,7 @@ +# This file should contain all the record creation needed to seed the database with its default values. +# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). +# +# Examples: +# +# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) +# Mayor.create(:name => 'Emanuel', :city => cities.first) diff --git a/lib/assets/.gitkeep b/lib/assets/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/lib/assets/.gitkeep diff --git a/lib/authentication.rb b/lib/authentication.rb index 5982201..ea0a2b4 100644 --- a/lib/authentication.rb +++ b/lib/authentication.rb @@ -15,7 +15,7 @@ module Authentication # Login filter to be applied to *all* pages on GLSAMaker def login_required # Production authentication via REMOTE_USER - if RAILS_ENV == "production" or GLSAMAKER_FORCE_PRODUCTION_AUTH + if Rails.env.production? or GLSAMAKER_FORCE_PRODUCTION_AUTH # REMOTE_USER should be there in FCGI or Passenger env_user_name = user_name diff --git a/lib/tasks/.gitkeep b/lib/tasks/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/lib/tasks/.gitkeep diff --git a/public/404.html b/public/404.html index eff660b..9a48320 100644 --- a/public/404.html +++ b/public/404.html @@ -1,23 +1,19 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - +<!DOCTYPE html> +<html> <head> - <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <title>The page you were looking for doesn't exist (404)</title> - <style type="text/css"> - body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; } - div.dialog { - width: 25em; - padding: 0 4em; - margin: 4em auto 0 auto; - border: 1px solid #ccc; - border-right-color: #999; - border-bottom-color: #999; - } - h1 { font-size: 100%; color: #f00; line-height: 1.5em; } - </style> + <style type="text/css"> + body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; } + div.dialog { + width: 25em; + padding: 0 4em; + margin: 4em auto 0 auto; + border: 1px solid #ccc; + border-right-color: #999; + border-bottom-color: #999; + } + h1 { font-size: 100%; color: #f00; line-height: 1.5em; } + </style> </head> <body> @@ -27,4 +23,4 @@ <p>You may have mistyped the address or the page may have moved.</p> </div> </body> -</html>
\ No newline at end of file +</html> diff --git a/public/422.html b/public/422.html index b54e4a3..83660ab 100644 --- a/public/422.html +++ b/public/422.html @@ -1,23 +1,19 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - +<!DOCTYPE html> +<html> <head> - <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <title>The change you wanted was rejected (422)</title> - <style type="text/css"> - body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; } - div.dialog { - width: 25em; - padding: 0 4em; - margin: 4em auto 0 auto; - border: 1px solid #ccc; - border-right-color: #999; - border-bottom-color: #999; - } - h1 { font-size: 100%; color: #f00; line-height: 1.5em; } - </style> + <style type="text/css"> + body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; } + div.dialog { + width: 25em; + padding: 0 4em; + margin: 4em auto 0 auto; + border: 1px solid #ccc; + border-right-color: #999; + border-bottom-color: #999; + } + h1 { font-size: 100%; color: #f00; line-height: 1.5em; } + </style> </head> <body> @@ -27,4 +23,4 @@ <p>Maybe you tried to change something you didn't have access to.</p> </div> </body> -</html>
\ No newline at end of file +</html> diff --git a/public/500.html b/public/500.html index ec3bbf0..b80307f 100644 --- a/public/500.html +++ b/public/500.html @@ -1,23 +1,19 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - +<!DOCTYPE html> +<html> <head> - <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <title>We're sorry, but something went wrong (500)</title> - <style type="text/css"> - body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; } - div.dialog { - width: 25em; - padding: 0 4em; - margin: 4em auto 0 auto; - border: 1px solid #ccc; - border-right-color: #999; - border-bottom-color: #999; - } - h1 { font-size: 100%; color: #f00; line-height: 1.5em; } - </style> + <style type="text/css"> + body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; } + div.dialog { + width: 25em; + padding: 0 4em; + margin: 4em auto 0 auto; + border: 1px solid #ccc; + border-right-color: #999; + border-bottom-color: #999; + } + h1 { font-size: 100%; color: #f00; line-height: 1.5em; } + </style> </head> <body> diff --git a/script/rails b/script/rails new file mode 100755 index 0000000..f8da2cf --- /dev/null +++ b/script/rails @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby +# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. + +APP_PATH = File.expand_path('../../config/application', __FILE__) +require File.expand_path('../../config/boot', __FILE__) +require 'rails/commands' diff --git a/test/fixtures/.gitkeep b/test/fixtures/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/fixtures/.gitkeep diff --git a/test/functional/.gitkeep b/test/functional/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/functional/.gitkeep diff --git a/test/integration/.gitkeep b/test/integration/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/integration/.gitkeep diff --git a/test/performance/browsing_test.rb b/test/performance/browsing_test.rb index 4b60558..3fea27b 100644 --- a/test/performance/browsing_test.rb +++ b/test/performance/browsing_test.rb @@ -1,8 +1,11 @@ require 'test_helper' -require 'performance_test_help' +require 'rails/performance_test_help' + +class BrowsingTest < ActionDispatch::PerformanceTest + # Refer to the documentation for all available options + # self.profile_options = { :runs => 5, :metrics => [:wall_time, :memory] + # :output => 'tmp/performance', :formats => [:flat] } -# Profiling results for each test method are written to tmp/performance. -class BrowsingTest < ActionController::PerformanceTest def test_homepage get '/' end diff --git a/test/test_helper.rb b/test/test_helper.rb index c91a0c6..8bf1192 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,35 +1,8 @@ ENV["RAILS_ENV"] = "test" -require File.expand_path(File.dirname(__FILE__) + "/../config/environment") -require 'test_help' +require File.expand_path('../../config/environment', __FILE__) +require 'rails/test_help' class ActiveSupport::TestCase - # Transactional fixtures accelerate your tests by wrapping each test method - # in a transaction that's rolled back on completion. This ensures that the - # test database remains unchanged so your fixtures don't have to be reloaded - # between every test method. Fewer database queries means faster tests. - # - # Read Mike Clark's excellent walkthrough at - # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting - # - # Every Active Record database supports transactions except MyISAM tables - # in MySQL. Turn off transactional fixtures in this case; however, if you - # don't care one way or the other, switching from MyISAM to InnoDB tables - # is recommended. - # - # The only drawback to using transactional fixtures is when you actually - # need to test transactions. Since your test is bracketed by a transaction, - # any transactions started in your code will be automatically rolled back. - self.use_transactional_fixtures = true - - # Instantiated fixtures are slow, but give you @david where otherwise you - # would need people(:david). If you don't want to migrate your existing - # test cases which use the @david style and don't mind the speed hit (each - # instantiated fixtures translates to a database query per test method), - # then set this back to true. - self.use_instantiated_fixtures = false - - set_fixture_class :cves => 'CVE' - # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # # Note: You'll currently still have to declare fixtures explicitly in integration tests diff --git a/test/test_helper.rb.rails2 b/test/test_helper.rb.rails2 new file mode 100644 index 0000000..c91a0c6 --- /dev/null +++ b/test/test_helper.rb.rails2 @@ -0,0 +1,40 @@ +ENV["RAILS_ENV"] = "test" +require File.expand_path(File.dirname(__FILE__) + "/../config/environment") +require 'test_help' + +class ActiveSupport::TestCase + # Transactional fixtures accelerate your tests by wrapping each test method + # in a transaction that's rolled back on completion. This ensures that the + # test database remains unchanged so your fixtures don't have to be reloaded + # between every test method. Fewer database queries means faster tests. + # + # Read Mike Clark's excellent walkthrough at + # http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting + # + # Every Active Record database supports transactions except MyISAM tables + # in MySQL. Turn off transactional fixtures in this case; however, if you + # don't care one way or the other, switching from MyISAM to InnoDB tables + # is recommended. + # + # The only drawback to using transactional fixtures is when you actually + # need to test transactions. Since your test is bracketed by a transaction, + # any transactions started in your code will be automatically rolled back. + self.use_transactional_fixtures = true + + # Instantiated fixtures are slow, but give you @david where otherwise you + # would need people(:david). If you don't want to migrate your existing + # test cases which use the @david style and don't mind the speed hit (each + # instantiated fixtures translates to a database query per test method), + # then set this back to true. + self.use_instantiated_fixtures = false + + set_fixture_class :cves => 'CVE' + + # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. + # + # Note: You'll currently still have to declare fixtures explicitly in integration tests + # -- they do not yet inherit this setting + fixtures :all + + # Add more helper methods to be used by all tests here... +end diff --git a/test/unit/.gitkeep b/test/unit/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/unit/.gitkeep diff --git a/vendor/assets/stylesheets/.gitkeep b/vendor/assets/stylesheets/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/vendor/assets/stylesheets/.gitkeep diff --git a/vendor/plugins/.gitkeep b/vendor/plugins/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/vendor/plugins/.gitkeep |