Class: Nailed::Bugzilla

Inherits:
Object
  • Object
show all
Defined in:
lib/nailed.rb

Instance Method Summary collapse

Constructor Details

#initializeBugzilla

Returns a new instance of Bugzilla.



13
14
15
# File 'lib/nailed.rb', line 13

def initialize
  Bicho.client = Bicho::Client.new(Nailed::PRODUCTS["bugzilla"]["url"])
end

Instance Method Details

#get_bugsObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/nailed.rb', line 17

def get_bugs
  Nailed::PRODUCTS["products"].each do |product,values|
    values["versions"].each do |version|
      Bicho::Bug.where(:product => version).each do |bug|
        attributes = {
          :bug_id => bug.id,
          :summary => bug.summary,
          :status => bug.status,
          :is_open => bug.is_open,
          :product_name => bug.product,
          :component => bug.component,
          :severity => bug.severity,
          :priority => bug.priority,
          :whiteboard => bug.whiteboard,
          :assigned_to => bug.assigned_to,
          :creation_time => "#{bug.creation_time.to_date}T#{bug.creation_time.hour}:#{bug.creation_time.min}:#{bug.creation_time.sec}+00:00",
          :last_change_time => "#{bug.last_change_time.to_date}T#{bug.last_change_time.hour}:#{bug.last_change_time.min}:#{bug.last_change_time.sec}+00:00",
          :url => bug.url.gsub(/novell.com\//,'suse.com/show_bug.cgi?id=')
        }

        db_handler = (Bugreport.get(bug.id) || Bugreport.new).update(attributes)
      end
    end
  end
end


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/nailed.rb', line 43

def write_bug_trends
  Nailed::PRODUCTS["products"].each do |product,values|
    values["versions"].each do |version|
      open = Bugreport.count(:is_open => true, :product_name => version)
      fixed = Bugreport.count(:status => "VERIFIED", :product_name => version) + \
              Bugreport.count(:status => "RESOLVED", :product_name => version)
      db_handler = Bugtrend.first_or_create(
                   :time => Time.new.strftime("%Y-%m-%d %H:%M:%S"),
                   :open => open,
                   :fixed => fixed,
                   :product_name => version
                   )

      Nailed.save_state(db_handler)
    end
  end
end


61
62
63
64
65
66
67
68
69
# File 'lib/nailed.rb', line 61

def write_l3_trends
  open = Bugreport.count(:whiteboard.like => "%openL3%", :is_open => true)
  db_handler = L3Trend.first_or_create(
               :time => Time.new.strftime("%Y-%m-%d %H:%M:%S"),
               :open => open
               )

  Nailed.save_state(db_handler)
end