Permalink
Browse files

Combine Defekts and Sauron to single project

We still want to use the project name Sauron. So we move Defekts
code here.
Change-Id: Iaadab7af46451dcfccaaa73f43dad1a840a18124
  • Loading branch information...
1 parent 4a47ca7 commit f5faf7c8b9b41662166e72c51996659dfa80941b @leoli leoli committed Jan 15, 2013
View
@@ -0,0 +1 @@
+log
View
18 Gemfile
@@ -0,0 +1,18 @@
+source "http://rubygems.org"
+
+gem "activerecord"
+gem "crack"
+gem "happymapper"
+gem "highline"
+gem "nokogiri"
+gem "nokogiri-happymapper"
+gem "pg"
+gem "pivotal-tracker"
+gem "redis"
+gem "rest-client"
+gem "sinatra"
+gem "sinatra-contrib"
+gem "thin"
+gem "yajl-ruby"
+gem "jira"
+gem "jira-ruby"
View
@@ -0,0 +1,121 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionpack (3.2.8)
+ activemodel (= 3.2.8)
+ activesupport (= 3.2.8)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ journey (~> 1.0.4)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.1.3)
+ activemodel (3.2.8)
+ activesupport (= 3.2.8)
+ builder (~> 3.0.0)
+ activerecord (3.2.8)
+ activemodel (= 3.2.8)
+ activesupport (= 3.2.8)
+ arel (~> 3.0.2)
+ tzinfo (~> 0.3.29)
+ activesupport (3.2.8)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ arel (3.0.2)
+ backports (2.6.5)
+ builder (3.0.3)
+ crack (0.3.1)
+ daemons (1.1.9)
+ erubis (2.7.0)
+ eventmachine (1.0.0)
+ happymapper (0.4.0)
+ libxml-ruby (~> 2.0)
+ highline (1.6.13)
+ hike (1.2.1)
+ i18n (0.6.1)
+ jira (0.1.0)
+ rest-client (>= 1.0.3)
+ xml-simple (>= 1.0.12)
+ jira-ruby (0.1.2)
+ activesupport
+ oauth
+ railties
+ journey (1.0.4)
+ json (1.7.6)
+ libxml-ruby (2.3.3)
+ mime-types (1.19)
+ multi_json (1.3.6)
+ nokogiri (1.5.5)
+ nokogiri-happymapper (0.5.6)
+ nokogiri (~> 1.5)
+ oauth (0.4.7)
+ pg (0.14.1)
+ pivotal-tracker (0.5.10)
+ rack (1.4.1)
+ rack-cache (1.2)
+ rack (>= 0.4)
+ rack-protection (1.2.0)
+ rack
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.2)
+ rack (>= 1.0)
+ railties (3.2.8)
+ actionpack (= 3.2.8)
+ activesupport (= 3.2.8)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (>= 0.14.6, < 2.0)
+ rake (10.0.3)
+ rdoc (3.12)
+ json (~> 1.4)
+ redis (3.0.2)
+ rest-client (1.6.7)
+ mime-types (>= 1.16)
+ sinatra (1.3.3)
+ rack (~> 1.3, >= 1.3.6)
+ rack-protection (~> 1.2)
+ tilt (~> 1.3, >= 1.3.3)
+ sinatra-contrib (1.3.2)
+ backports (>= 2.0)
+ eventmachine
+ rack-protection
+ rack-test
+ sinatra (~> 1.3.0)
+ tilt (~> 1.3)
+ sprockets (2.1.3)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ thin (1.5.0)
+ daemons (>= 1.0.9)
+ eventmachine (>= 0.12.6)
+ rack (>= 1.0.0)
+ thor (0.16.0)
+ tilt (1.3.3)
+ tzinfo (0.3.33)
+ xml-simple (1.1.2)
+ yajl-ruby (1.1.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ activerecord
+ crack
+ happymapper
+ highline
+ jira
+ jira-ruby
+ nokogiri
+ nokogiri-happymapper
+ pg
+ pivotal-tracker
+ redis
+ rest-client
+ sinatra
+ sinatra-contrib
+ thin
+ yajl-ruby
View
@@ -0,0 +1,59 @@
+sauron
+=======
+
+software defect data warehouse, extracts defects from multiple sources,
+normalizes defect information, and provides restful api to access the
+warehouse.
+
+dependencies
+------------
+
+* ruby 1.9.2-p290 or greater (not tested with 1.9.3)
+* sinatra
+* thin
+* postgresql
+* sqlite3 (for development)
+* activerecord
+* highline
+
+install
+-------
+
+1. clone the source from gerrit
+```
+ gerrit clone ssh://reviews.cloudfoundry.org/sauron
+```
+2. bundle install
+```
+ bundle install
+```
+3. create a config file
+```
+ rake config # input postgresql username and password
+```
+4. create the database
+```
+ rake db:migrate
+```
+5. set environment # default is development which uses sqlite3
+```
+ export RACK_ENV=production
+```
+6. start up the web server
+```
+ bundle exec thin start -d -p <port> # e.g. bundle exec thin start -d -p 8000
+```
+7. stop the web server
+```
+ thin stop
+```
+
+troubleshooting
+---------------
+
+* on occassion, the thin stop command fails to shutdown the server in which
+case you'll need to kill the process manually via the kill command
+```
+ kill -9 PID
+```
+
View
@@ -0,0 +1,68 @@
+require "active_record"
+require "active_record/fixtures"
+require "digest/md5"
+require "logger"
+require "securerandom"
+require "yaml"
+
+
+task :default => :help
+
+env = ENV['RACK_ENV'] || "development"
+
+namespace :db do
+
+ desc "establish connection"
+ task :environment do
+
+ @config = YAML.load_file("conf/database.yml")["#{env}"]
+ ActiveRecord::Base.establish_connection @config
+ ActiveRecord::Base.logger = Logger.new(STDOUT)
+
+ end
+
+ desc "create database"
+ task :create => :environment do
+ ActiveRecord::Base.connection.create_database @config
+ ActiveRecord::Base.establish_connection @config
+ end
+
+ desc "migrate database"
+ task :migrate => :environment do
+
+ ActiveRecord::Migration.verbose = true
+ ActiveRecord::Migrator.migrate("db/migrate")
+
+ end
+
+end
+
+desc "configuration"
+task :config do
+
+ require "highline/import"
+ require "erb"
+
+ dbfile = File.dirname(__FILE__) + "/db/defekts.db"
+ username = ask("username: ")
+ password = ask("password: ") {|q| q.echo = "*"}
+
+ config = ERB.new(File.read("./conf/database.yml.erb"))
+ contents = config.result(binding)
+
+ file = File.open( "./conf/database.yml", "w" )
+ file.write(contents)
+ file.close
+
+end
+
+desc "generate help text"
+task :help do
+
+ puts "rake"
+ puts " config"
+ puts " db:migrate"
+ puts " db:seed"
+
+end
+
View
@@ -0,0 +1,9 @@
+---
+pivotal:
+- site_url: 'https://www.pivotaltracker.com/'
+ token: token
+
+jira:
+- site_url: 'https://cloudfoundry.atlassian.net'
+ username: user
+ password: password
View
@@ -0,0 +1,13 @@
+development:
+ adapter: sqlite3
+ database: <%= dbfile %>
+ pool: 5
+ timeout: 5000
+
+production:
+ adapter: postgresql
+ encoding: utf8
+ database: defekts
+ username: <%= username %>
+ password: <%= password %>
+
View
@@ -1,31 +0,0 @@
-worker_processes 1;
-
-events {
- worker_connections 1024;
-}
-
-http {
-
- include mime.types;
- default_type application/octet-stream;
-
- server {
-
- listen 80;
- server_name %SERVER_NAME;
- root %ROOTDIR/sauron.rbcon.com;
- error_log %ROOTDIR/logs/error.log;
- access_log %ROOTDIR/logs/access.log;
-
- location / {
- index index.html index.htm;
- }
-
- location /graph {
- proxy_pass http://SERVER_NAME:4567;
- }
-
- }
-
-}
-
View
@@ -0,0 +1,3 @@
+require "./lib/defekts"
+run Sinatra::Application
+
@@ -0,0 +1,44 @@
+class InitSchema < ActiveRecord::Migration
+
+ def self.up
+
+ create_table :projects do |t|
+ t.integer :origin_id, :unique => true
+ t.string :name
+ t.timestamps
+ end
+
+ create_table :defekts do |t|
+ t.belongs_to :project
+ t.integer :origin_id, :unique => true
+ t.string :title, :null => false
+ t.text :summary
+ t.string :state
+ t.integer :severity
+ t.timestamp :creation
+ t.timestamp :accepted
+ t.date :day
+ t.string :owner
+ t.string :reporter
+ t.timestamps
+ end
+
+ create_table :projectdefekts do |t|
+ t.integer :project_id
+ t.integer :defekt_id
+ end
+
+ end
+
+ def self.down
+
+ drop_table :projects
+
+ drop_table :defekts
+
+ drop_table :projectdefekts
+
+ end
+
+end
+
Oops, something went wrong.

0 comments on commit f5faf7c

Please sign in to comment.