Skip to content

Commit

Permalink
[api] write initial configuration to the backend.
Browse files Browse the repository at this point in the history
* delayed job for updaters
* rake writeconfiguration for new installations
  • Loading branch information
adrianschroeter committed Jun 19, 2013
1 parent c3b018f commit 5c3bb1b
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dist/README.SETUP
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,10 @@ available after adding the SDK to the available installation repositories.

cd /srv/www/obs/api/
sudo RAILS_ENV="production" rake db:setup
sudo RAILS_ENV="production" ruby writeconfiguration
sudo chown -R wwwrun.www log tmp


cd /srv/www/obs/webui/
sudo RAILS_ENV="production" rake db:setup
sudo chown -R wwwrun.www log tmp
Expand Down Expand Up @@ -271,7 +273,8 @@ Create the reference project pointing to the openSUSE.org build service.
This will allow you to reuse the base distributions from there and avoids
further manual setup.

You can do this via clicking on the "Setup OBS" link in your web interface.
You can do this via clicking on the "Configuration" link in your web interface
on the main page. Only Admin users do see that link.

The alternative manual way is to call the following command:

Expand Down
3 changes: 3 additions & 0 deletions src/api/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ task(:updateissues => :environment) { Delayed::Job.enqueue UpdateIssuesJob.new }
require 'workers/update_package_meta_job.rb'
task(:updatepackagemeta => :environment) { u=UpdatePackageMetaJob.new; u.perform }

require 'workers/write_configuration.rb'
task(:writeconfiguration => :environment) { i=WriteConfigurationJob.new; i.perform }

require 'workers/import_requests.rb'
#task(:importrequests => :environment) { Delayed::Job.enqueue ImportRequestsDelayedJob.new }
task(:importrequests => :environment) { i=ImportRequestsDelayedJob.new; i.perform }
Expand Down
2 changes: 2 additions & 0 deletions src/api/app/models/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'opensuse/backend'

class Configuration < ActiveRecord::Base
attr_accessible :title, :description, :name

Expand Down
14 changes: 14 additions & 0 deletions src/api/db/migrate/20130619083665_write_configuration.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'delayed_job'
require File.join(Rails.root, 'lib/workers/write_configuration.rb')

class WriteConfiguration < ActiveRecord::Migration

def self.up
Delayed::Job.enqueue WriteConfigurationJob.new
end

def self.down
end

end

2 changes: 2 additions & 0 deletions src/api/db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,8 @@ INSERT INTO schema_migrations (version) VALUES ('20130612151549');

INSERT INTO schema_migrations (version) VALUES ('20130618083665');

INSERT INTO schema_migrations (version) VALUES ('20130619083665');

INSERT INTO schema_migrations (version) VALUES ('21');

INSERT INTO schema_migrations (version) VALUES ('22');
Expand Down
13 changes: 13 additions & 0 deletions src/api/lib/workers/write_configuration.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class WriteConfigurationJob

def initialize
end

def perform
@configuration = ::Configuration.first
@configuration.save!
end

end


0 comments on commit 5c3bb1b

Please sign in to comment.