Permalink
Browse files

Related to #89 - Adding the ability to override global settings with …

…labels
  • Loading branch information...
1 parent 1dd0e62 commit 2a53f6d0a6bba081e5e4d91b44e48407aefb6047 @rauhryan rauhryan committed Oct 16, 2012
Showing with 28 additions and 1 deletion.
  1. +28 −1 stint/stint/lib/stint/pebble.rb
@@ -1,5 +1,7 @@
require 'time'
require 'json'
+require 'yaml'
+
module Stint
class Pebble
attr_accessor :github
@@ -14,14 +16,39 @@ def build_board(user_name, repo)
label
end
- all_labels[0][:issues] = (issues_by_label["__nil__"] || []).concat(all_labels[0][:issues]).sort_by { |i| i["_data"]["order"] || i["number"].to_f} unless all_labels.empty?
+ if settings(user_name, repo)[:show_all]
+ all_labels[0][:issues] = (issues_by_label["__nil__"] || []).concat(all_labels[0][:issues]).sort_by { |i| i["_data"]["order"] || i["number"].to_f} unless all_labels.empty?
+ end
{
labels: all_labels,
milestones: milestones(user_name, repo)
}
end
+ def settings(user_name, repo)
+ defaults = {
+ :show_all => true
+ }
+
+ labels = github.labels user_name, repo
+
+ r = /@huboard:(.*)/
+ settings = labels
+ .select{|l| r.match l["name"]}
+ .map do |l|
+ match = r.match l["name"]
+ begin
+ YAML.load(match[1])
+ rescue
+ return {}
+ end
+ end.reduce(:merge)
+
+ defaults.merge(settings || {})
+
+ end
+
def board(user_name, repo)
board = build_board(user_name, repo)

0 comments on commit 2a53f6d

Please sign in to comment.