The basic challenge of distributing Free Software is compiling that awesome open source code into machine code for different Linux distributions so it's easily consumable for users. Sounds simple, but it isn't. If you look at the dependencies of a typical Free Software project you will find thousands of other projects in the stack. They build on top of each other, have functional dependencies, sometimes they are interdependent, they conflict with each other and what not. In short: Building Free Software is like herding cats. And rightfully users of the software expect a steady, well behaved, streamlined herd of cats! The Open Build Service (OBS) is the tool which makes this possible, it helps Free Software distributors to **automatically and consi
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 is to speed up secure Project.find | |
def self.forbidden_project_ids | |
# Admins don't have forbidden projects | |
return [0] if User.current && User.current.is_admin? | |
# This will cache and return an array: | |
# [ Project1_id, Project2_id, Project3_id ] | |
forbidden_projects = Rails.cache.fetch('forbidden_projects') do | |
# We use project_user_cache to calculate this... | |
Rails.cache.delete('allowed_forbidden_projects_by_user') |
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
def get_build_flags | |
build_flags = Hash.new | |
build_flags['all'] = Array.new | |
flag = main_object.flags.with_repositories(nil).with_architectures(nil).first | |
if flag | |
build_flags['all'] << flag | |
else | |
build_flags['all'] << main_object.flags.new( flag: 'build', status: Flag.default_state('build') ) | |
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
diff --git a/src/api/config/routes.rb b/src/api/config/routes.rb | |
index 66861c4..7383057 100644 | |
--- a/src/api/config/routes.rb | |
+++ b/src/api/config/routes.rb | |
@@ -263,7 +263,7 @@ OBSApi::Application.routes.draw do | |
post 'user/register' => :register | |
get 'user/register_user' => :register_user | |
- get 'user/login' => :login | |
+ get 'user/login' => :login, constraints: cons |
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
diff --git a/src/api/config/routes.rb b/src/api/config/routes.rb | |
index 66861c4..3127aea 100644 | |
--- a/src/api/config/routes.rb | |
+++ b/src/api/config/routes.rb | |
@@ -281,7 +281,7 @@ OBSApi::Application.routes.draw do | |
get 'user/autocomplete' => :autocomplete | |
get 'user/tokens' => :tokens | |
- post 'user/do_login' => :do_login | |
+ post 'user/do_login' => :do_login, constraints: cons |
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
module ActiveRecord | |
module Scoping | |
class ScopeRegistry # :nodoc: | |
def self.value_for(scope_type, variable_name) | |
instance.value_for(scope_type, variable_name) | |
end | |
def self.set_value_for(scope_type, variable_name, value) | |
instance.set_value_for(scope_type, variable_name, value) |
I hereby claim:
- I am hennevogel on github.
- I am henne (https://keybase.io/henne) on keybase.
- I have a public key whose fingerprint is 0008 8762 102E 19D1 DE7F EFEA 9D61 64C2 955F ADE0
To claim this, I am signing this object:
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
roles = %w(participant admin organizer) | |
users = %w(hans fred fritz) | |
conferences = %w(osc13 dsp14 lala) | |
roles.each do |role| | |
users.each do |user| | |
conferences.each do |conf| | |
if role == "organizer" || role == 'admin' | |
puts "YO YO YO" | |
else |
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
def get_registrations_per_week | |
result = [] | |
reg = registrations.group(:week).count | |
result = calculate_items_per_week(21, 6, reg) | |
end | |
result | |
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
#!/usr/bin/env ruby | |
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment')) | |
mapping = { | |
"kVYMYCvraFSdnKu_qEugfg" => "jFrqHgk2258", | |
"5vA7x02ejJY2hfGs3tmA8w" => "dpzVjFuKwyo" } | |
mapping.each do |guid, yid| | |
event = Event.find_by_guid(guid) |