Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
1,852 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
class Comment < ActiveRecord::Base | ||
belongs_to :pkg | ||
belongs_to :user | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
class Install < ActiveRecord::Base | ||
belongs_to :pkg | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
class Karma < ActiveRecord::Base | ||
belongs_to :pkg | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
class Pkg < ActiveRecord::Base | ||
belongs_to :maitainer, :foreign_key => :mainteiner_id, :class_name => "User" | ||
has_many :versions, :dependent => :destroy | ||
has_many :installs, :dependent => :destroy | ||
has_many :comments, :dependent => :destroy | ||
has_many :karmas, :dependent => :destroy | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
class Version < ActiveRecord::Base | ||
belongs_to :pkg | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
:backgroundrb: | ||
:ip: 0.0.0.0 | ||
:port: 11006 | ||
:log: foreground # foreground mode,print log messages on console | ||
# :environment: production | ||
|
||
:development: | ||
:backgroundrb: | ||
:log: foreground | ||
# turn this off if your application doesn't use backgroundrb's persistent/enqueued tasks system | ||
:persistent_disabled: false | ||
# the time (seconds) between | ||
:persistent_delay: 20 | ||
# foreground mode,print log messages on console | ||
|
||
:production: | ||
:backgroundrb: | ||
# :port: 22222 # use port 22222 | ||
:lazy_load: true # do not load models eagerly | ||
:debug_log: false # disable log workers and other logging | ||
|
||
:schedules: | ||
:fetch_worker: | ||
:arch: | ||
:trigger_args: * * */1 * * * * | ||
|
||
# :backgroundrb: | ||
# :ip: 0.0.0.0 #ip on which backgroundrb server is running | ||
# :port: 11006 #port on which backgroundrb server is running | ||
# :environment: production # rails environment loaded, defaults to development | ||
# :debug_log: true # whether to print debug logs to a seperate worker, defaults to true | ||
# :log: foreground # will print log messages to STDOUT, defaults to seperate log worker | ||
# :result_storage: memcache # store results in a mecache cluster, you also need to specify location of your memcache clusters in next section | ||
# | ||
# :memcache: "10.0.0.1:11211,10.0.0.2:11211" #=> location of mecache clusters seperated by comma | ||
# | ||
# # following section is totally optional, and only useful if you are trying to cluster of backgroundrb server | ||
# # if you do not specify this section backgroundrb will assume that, from rails you are connecting to the | ||
# # backgroundrb server which has been specified in previous section | ||
# :client: "10.0.0.1:11006,10.0.0.2:11007" | ||
# | ||
# # You specify your worker schedules here | ||
# :schedules: | ||
# :foo_worker: # worker name | ||
# :barbar: #worker method | ||
# :trigger_args: */5 * * * * * * #worker schedule | ||
# cheduling section |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
db/migrate/20081119131136_create_backgroundrb_queue_table.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
class CreateBackgroundrbQueueTable < ActiveRecord::Migration | ||
def self.up | ||
create_table :bdrb_job_queues do |t| | ||
t.column :args, :binary | ||
t.column :worker_name, :string | ||
t.column :worker_method, :string | ||
t.column :job_key, :string | ||
t.column :taken, :int | ||
t.column :finished, :int | ||
t.column :timeout, :int | ||
t.column :priority, :int | ||
t.column :submitted_at, :datetime | ||
t.column :started_at, :datetime | ||
t.column :finished_at, :datetime | ||
t.column :archived_at, :datetime | ||
t.column :tag, :string | ||
t.column :submitter_info, :string | ||
t.column :runner_info, :string | ||
t.column :worker_key, :string | ||
t.column :scheduled_at, :datetime | ||
end | ||
end | ||
|
||
def self.down | ||
drop_table :bdrb_job_queues | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# | ||
# Pacman fetcher.... simple thing that could work? | ||
# | ||
|
||
module Arch | ||
module Fetcher | ||
|
||
def self.get_list | ||
text_list = system("pacman -Sl") | ||
|
||
end | ||
|
||
|
||
|
||
|
||
end | ||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
class FetchWorker < BackgrounDRb::MetaWorker | ||
set_worker_name :fetch_worker | ||
def create(args = nil) | ||
# this method is called, when worker is loaded for the first time | ||
end | ||
|
||
|
||
def update_pkgs(pkgs) | ||
|
||
for pkg in pkgs | ||
|
||
Pkg.create!(:name => pkg[:name]) | ||
|
||
|
||
end | ||
|
||
|
||
|
||
end | ||
|
||
|
||
|
||
def arch | ||
update_pkgs(Arch::Fetcher.run!) | ||
end | ||
|
||
|
||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class GitWorker < BackgrounDRb::MetaWorker | ||
set_worker_name :git_worker | ||
def create(args = nil) | ||
# this method is called, when worker is loaded for the first time | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env ruby | ||
|
||
RAILS_HOME = File.expand_path(File.join(File.dirname(__FILE__),"..")) | ||
BDRB_HOME = File.join(RAILS_HOME,"vendor","plugins","backgroundrb") | ||
WORKER_ROOT = File.join(RAILS_HOME,"lib","workers") | ||
WORKER_LOAD_ENV = File.join(RAILS_HOME,"script","load_worker_env") | ||
|
||
["server","server/lib","lib","lib/backgroundrb"].each { |x| $LOAD_PATH.unshift(BDRB_HOME + "/#{x}")} | ||
$LOAD_PATH.unshift(WORKER_ROOT) | ||
|
||
require "rubygems" | ||
require "yaml" | ||
require "erb" | ||
require "logger" | ||
require "packet" | ||
require "optparse" | ||
|
||
require "bdrb_config" | ||
require RAILS_HOME + "/config/boot" | ||
require "active_support" | ||
|
||
BackgrounDRb::Config.parse_cmd_options ARGV | ||
BDRB_CONFIG = BackgrounDRb::Config.read_config("#{RAILS_HOME}/config/backgroundrb.yml") | ||
|
||
require RAILS_HOME + "/config/environment" | ||
require "bdrb_job_queue" | ||
require "backgroundrb_server" | ||
|
||
PID_FILE = "#{RAILS_HOME}/tmp/pids/backgroundrb_#{BDRB_CONFIG[:backgroundrb][:port]}.pid" | ||
SERVER_LOGGER = "#{RAILS_HOME}/log/backgroundrb_debug_#{BDRB_CONFIG[:backgroundrb][:port]}.log" | ||
|
||
daemon = BackgrounDRb::StartStop.new | ||
|
||
case ARGV[0] | ||
when 'start'; daemon.start | ||
when 'stop'; daemon.stop() | ||
else; BackgrounDRb::MasterProxy.new() | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env ruby | ||
|
||
RAILS_HOME = File.expand_path(File.join(File.dirname(__FILE__),"..")) | ||
BDRB_HOME = File.join(RAILS_HOME,"vendor","plugins","backgroundrb") | ||
|
||
["server","server/lib","lib","lib/backgroundrb"].each { |x| $LOAD_PATH.unshift(BDRB_HOME + "/#{x}")} | ||
|
||
$LOAD_PATH.unshift(File.join(RAILS_HOME,"lib","workers")) | ||
|
||
require "yaml" | ||
require "erb" | ||
require "logger" | ||
require "optparse" | ||
require "bdrb_config" | ||
require RAILS_HOME + "/config/boot" | ||
require "active_support" | ||
|
||
BDRB_CONFIG = BackgrounDRb::Config.read_config("#{RAILS_HOME}/config/backgroundrb.yml") | ||
|
||
if !(::Packet::WorkerRunner::WORKER_OPTIONS[:worker_env] == false) | ||
require RAILS_HOME + "/config/environment" | ||
ActiveRecord::Base.allow_concurrency = true | ||
end | ||
require "backgroundrb_server" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--colour | ||
--loadby random | ||
--format progress | ||
--reverse | ||
--diff |
Oops, something went wrong.