nailed 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 62065482b202db7a593d6a2cd6d53e8b562abaac
4
- data.tar.gz: 156454d961ad7cd6afb1aa77579cc7672b95ae2f
3
+ metadata.gz: ce2404c40672c72f705429cb68a1c19e869373d9
4
+ data.tar.gz: 9bf34170e942c1c7eb8e94c5f693dbf1b2726697
5
5
  SHA512:
6
- metadata.gz: c31d0eed612c744f457aa0cceed17dc359442be1b9ad62598a01f28480e9bb4c1a8c2c7fd2bc10cc3e2849b6f562b86dc4723c23412360056c0b6d54439645d3
7
- data.tar.gz: 92d3d50f5392ab49bc3036c5818924b2209f6961112b1bb431beed82f94e9663354db2a346f9897c49e21d445d427252515d65bead0e5109206637f4ac5f4863
6
+ metadata.gz: ab2f21d36218a247cf1faac6a037e0ad493b4761382aea20a8ac760ba27b9253fde6b062f749d07c415142ee98de30ae0e935427cdeadfbecc054c89ec0b66a1
7
+ data.tar.gz: adaa596a312b6d07d8c0f18f80d16cefab2b3e0c462f19f5a1b9c554be2ef2fef15e010bdf6976ec5261fb18e6db797ffa6a73a37b38103ee40995c5e410fc50
data/README.md CHANGED
@@ -19,7 +19,7 @@ Options:
19
19
  --upgrade, -u: Upgrade database
20
20
  --bugzilla, -b: Refresh bugzilla database records
21
21
  --github, -g: Refresh github database records
22
- --l3, -l: Refresh l3 trend database records
22
+ --list, -l <s>: List github repositories within organization
23
23
  --server, -s: Start a dashboard webinterface
24
24
  --help, -h: Show this message
25
25
  ```
@@ -55,10 +55,9 @@ products:
55
55
  # Array of Bugzilla products (typically different versions of one product)
56
56
  # Exact names have to be given, as they appear in Bugzilla (can not be arbitrary)
57
57
  organization: # here goes the organization name (under which your repos are hosted) as it appears in GitHub
58
- # just leave it blank if your repo isn't hosted under an organizational umbrella
59
58
  repos:
60
59
  # Array of GitHub repository names, as they appear in GitHub
61
- # If there are no associated repos for the product, just leave it blank
60
+ # query available repos with nailed -l <organization>
62
61
  # continue adding more products here
63
62
 
64
63
  ```
@@ -73,7 +72,6 @@ nailed --upgrade
73
72
  ```
74
73
  nailed --bugzilla
75
74
  nailed --github
76
- nailed --l3
77
75
  ```
78
76
  * restart the webserver
79
77
 
data/README.rdoc CHANGED
@@ -19,7 +19,7 @@ Alternatively run it directly from the git directory
19
19
  --upgrade, -u: Upgrade database
20
20
  --bugzilla, -b: Refresh bugzilla database records
21
21
  --github, -g: Refresh github database records
22
- --l3, -l: Refresh l3 trend database records
22
+ --list, -l <s>: List github repositories within organization
23
23
  --server, -s: Start a dashboard webinterface
24
24
  --help, -h: Show this message
25
25
 
@@ -51,10 +51,9 @@ All configuration is read from +config/products.yml+
51
51
  # Array of Bugzilla products (typically different versions of one product)
52
52
  # Exact names have to be given, as they appear in Bugzilla (can not be arbitrary)
53
53
  organization: # here goes the organization name (under which your repos are hosted) as it appears in GitHub
54
- # just leave it blank if your repo isn't hosted under an organizational umbrella
55
54
  repos:
56
55
  # Array of GitHub repository names, as they appear in GitHub
57
- # If there are no associated repos for the product, just leave it blank
56
+ # query available repos with nailed -l <organization>
58
57
  # continue adding more products here
59
58
 
60
59
  == Changes in production
@@ -64,7 +63,6 @@ All configuration is read from +config/products.yml+
64
63
  * make sure to fetch new data with
65
64
  nailed --bugzilla
66
65
  nailed --github
67
- nailed --l3
68
66
  * restart the webserver
69
67
 
70
68
  == Run
data/bin/app CHANGED
@@ -45,7 +45,7 @@ class App < Sinatra::Base
45
45
  }
46
46
 
47
47
  before do
48
- @products = Nailed::PRODUCTS["products"].map{|p,v| v["versions"]}.flatten
48
+ @products = Nailed::PRODUCTS["products"].map{|p,v| v["versions"]}.flatten.compact
49
49
  @product_query = @products.join('&product=')
50
50
  @github_repos = Pullrequest.all(:order => [:created_at.desc]).map(&:repository_rname).uniq
51
51
  end
@@ -85,6 +85,7 @@ class App < Sinatra::Base
85
85
  # define sinatra routes
86
86
  get '/' do
87
87
  @l3trend = get_trends(:l3, nil)
88
+ @allpulls = repository(:default).adapter.select("SELECT COUNT(repository_rname) AS open, repository_rname AS label FROM pullrequests GROUP BY repository_rname")
88
89
 
89
90
  @bugtop = []
90
91
  Nailed::PRODUCTS["products"].each do |product,values|
@@ -92,10 +93,16 @@ class App < Sinatra::Base
92
93
  p = Product.get(version)
93
94
  open = Bugreport.count(:product_name => p.name, :is_open => true)
94
95
  @bugtop << {label: p.name, value: open} unless open == 0
95
- end
96
+ end unless values["versions"].nil?
96
97
  end
97
98
  @bugtop = @bugtop.to_json
98
99
 
100
+ @pulltop = []
101
+ @allpulls.each do |donut_bite|
102
+ @pulltop << {label: donut_bite.label, value: donut_bite.open}
103
+ end
104
+ @pulltop = @pulltop.to_json
105
+
99
106
  haml :index
100
107
  end
101
108
 
@@ -121,11 +128,11 @@ class App < Sinatra::Base
121
128
 
122
129
  haml :bugzilla
123
130
  end
124
- end
131
+ end unless values["versions"].nil?
125
132
  end
126
133
 
127
- @github_repos = Pullrequest.all(:order => [:created_at.desc]).map(&:repository_rname).uniq
128
- @github_repos.each do |repo|
134
+ github_repos = Pullrequest.all(:order => [:created_at.desc]).map(&:repository_rname).uniq
135
+ github_repos.each do |repo|
129
136
  get "/github/#{repo}" do
130
137
  @repo = repo
131
138
  @org = Repository.get(repo).organization_oname
data/bin/nailed CHANGED
@@ -12,7 +12,7 @@ opts = Trollop::options do
12
12
  opt :upgrade, "Upgrade database", :short => 'u'
13
13
  opt :bugzilla, "Refresh bugzilla database records", :short => 'b'
14
14
  opt :github, "Refresh github database records", :short => 'g'
15
- opt :l3, "Refresh l3 trend database records", :short => 'l'
15
+ opt :list, "List github repositories within organization", :type => :string, :short => 'l'
16
16
  opt :server, "Start a dashboard webinterface", :short => 's'
17
17
  end
18
18
 
@@ -73,15 +73,19 @@ opts.each_pair do |key,val|
73
73
  if val
74
74
  bugzilla_client.get_bugs
75
75
  bugzilla_client.write_bug_trends
76
+ bugzilla_client.write_l3_trends
76
77
  end
77
78
  when :github
78
79
  if val
79
80
  github_client.update_pull_states
80
81
  github_client.get_open_pulls
81
82
  end
82
- when :l3
83
+ when :list
83
84
  if val
84
- bugzilla_client.write_l3_trends
85
+ begin
86
+ Nailed.list_org_repos(github_client.client, val)
87
+ rescue
88
+ end
85
89
  end
86
90
  end
87
91
  end
data/config/products.yml CHANGED
@@ -1,41 +1,13 @@
1
1
  ---
2
2
  bugzilla:
3
- url: https://bugzilla.novell.com
3
+ url: # Url of your Bugzilla instance
4
4
  products:
5
- cloud:
5
+ example_product: # Just a a short key/name for the product (can be arbitrary)
6
6
  versions:
7
- - SUSE Cloud 3
8
- - SUSE Cloud 4
9
- - SUSE Cloud 5
10
- organization: crowbar
7
+ # Array of Bugzilla products (typically different versions of one product)
8
+ # Exact names have to be given, as they appear in Bugzilla (can not be arbitrary)
9
+ organization: # here goes the organization name (under which your repos are hosted) as it appears in GitHub
11
10
  repos:
12
- - crowbar
13
- - barclamp-crowbar
14
- - barclamp-deployer
15
- - barclamp-dns
16
- - barclamp-ganglia
17
- - barclamp-ipmi
18
- - barclamp-logging
19
- - barclamp-nagios
20
- - barclamp-network
21
- - barclamp-ntp
22
- - barclamp-provisioner
23
- - barclamp-redhat-install
24
- - barclamp-test
25
- - barclamp-ubuntu-install
26
- - barclamp-glance
27
- - barclamp-nova
28
- - barclamp-swift
29
- - barclamp-keystone
30
- - barclamp-mysql
31
- - barclamp-kong
32
- - barclamp-nova_dashboard
33
- - barclamp-openstack
34
- - barclamp-hadoop
35
- - barclamp-hive
36
- - barclamp-pig
37
- - barclamp-zookeeper
38
- - barclamp-sqoop
39
- - barclamp-quantum
40
- - barclamp-clouderamanager
41
- - barclamp-ApacheHadoop
11
+ # Array of GitHub repository names, as they appear in GitHub
12
+ # query available repos with nailed -l <organization>
13
+ # continue adding more products here
data/lib/nailed.rb CHANGED
@@ -36,7 +36,7 @@ module Nailed
36
36
 
37
37
  db_handler = (Bugreport.get(bug.id) || Bugreport.new).update(attributes)
38
38
  end
39
- end
39
+ end unless values["versions"].nil?
40
40
  end
41
41
  end
42
42
 
@@ -54,7 +54,7 @@ module Nailed
54
54
  )
55
55
 
56
56
  Nailed.save_state(db_handler)
57
- end
57
+ end unless values["versions"].nil?
58
58
  end
59
59
  end
60
60
 
@@ -81,11 +81,7 @@ module Nailed
81
81
  organization = values["organization"]
82
82
  repos = values["repos"]
83
83
  repos.each do |repo|
84
- if organization.nil?
85
- pulls = @client.pull_requests(repo)
86
- else
87
- pulls = @client.pull_requests("#{organization}/#{repo}")
88
- end
84
+ pulls = @client.pull_requests("#{organization}/#{repo}")
89
85
  pulls.each do |pr|
90
86
  db_handler = Pullrequest.first_or_create(
91
87
  :pr_number => pr.number,
@@ -144,27 +140,31 @@ module Nailed
144
140
 
145
141
  def Nailed.fill_db_after_migration(github_client)
146
142
  Nailed::PRODUCTS["products"].each do |product,values|
143
+ organization = values["organization"]
147
144
  values["versions"].each do |version|
148
145
  db_handler = Product.first_or_create(:name => version)
149
146
  Nailed.save_state(db_handler)
150
147
  end unless values["versions"].nil?
151
- if values["organization"].nil?
152
- values["repos"].each do |repo|
153
- db_handler = Repository.first_or_create(:repo => repo)
154
- Nailed.save_state(db_handler)
155
- end unless values["repos"].nil?
156
- else
157
- db_handler = Organization.first_or_create(:oname => values["organization"])
148
+ unless organization.nil?
149
+ db_handler = Organization.first_or_create(:oname => organization)
158
150
  Nailed.save_state(db_handler)
159
- org_repos = Nailed.get_org_repos(github_client, values["organization"])
160
- org_repos.each do |org_repo|
161
- db_handler = Repository.first_or_create(:rname => org_repo, :organization_oname => values["organization"])
162
- Nailed.save_state(db_handler)
151
+ org_repos_github = Nailed.get_org_repos(github_client, organization)
152
+ org_repos_yml = values["repos"]
153
+ org_repos_yml.each do |org_repo|
154
+ if org_repos_github.include?(org_repo)
155
+ db_handler = Repository.first_or_create(:rname => org_repo, :organization_oname => organization)
156
+ Nailed.save_state(db_handler)
157
+ end
163
158
  end
164
159
  end
165
160
  end
166
161
  end
167
162
 
163
+ def Nailed.list_org_repos(github_client, org)
164
+ repos = Nailed.get_org_repos(github_client, org)
165
+ repos.each {|r| puts "- #{r}"}
166
+ end
167
+
168
168
  def Nailed.save_state(db_handler)
169
169
  unless db_handler.save
170
170
  puts("ERROR: see logfile")
data/log/nailed.log CHANGED
@@ -1,22 +1,6 @@
1
- I, [2014-12-26T19:12:21.897639 #20167] INFO -- : Database migrated
2
- I, [2014-12-26T19:12:43.000427 #20209] INFO -- : SUSE Cloud 5 added to the database
3
- E, [2014-12-27T00:32:35.768870 #2179] ERROR -- : #<DataMapper::Validations::ValidationErrors:0x007eff6bb37448 @resource=#<Organization @org=nil>, @errors={:org=>["Org must not be blank"]}>
4
- E, [2014-12-27T00:35:25.850846 #2214] ERROR -- : #<DataMapper::Validations::ValidationErrors:0x007f1225081f90 @resource=#<Organization @org=nil>, @errors={:org=>["Org must not be blank"]}>
5
- E, [2014-12-27T00:36:27.669037 #2247] ERROR -- : #<DataMapper::Validations::ValidationErrors:0x007f029cbff900 @resource=#<Organization @org=nil>, @errors={:org=>["Org must not be blank"]}>
6
- I, [2014-12-27T00:36:30.550094 #2247] INFO -- : Database migrated
7
- I, [2014-12-27T00:38:37.370374 #2291] INFO -- : Database migrated
8
- I, [2014-12-27T01:19:00.149273 #2495] INFO -- : Database migrated
9
- I, [2014-12-27T01:24:19.810697 #2536] INFO -- : Database migrated
10
- I, [2014-12-27T01:31:49.308007 #2922] INFO -- : Database migrated
11
- I, [2014-12-27T11:02:23.637145 #2001] INFO -- : Database migrated
12
- I, [2014-12-27T11:14:41.706276 #2104] INFO -- : Database migrated
13
- I, [2014-12-27T11:19:14.371811 #2239] INFO -- : Database migrated
14
- I, [2014-12-27T11:19:45.941606 #2284] INFO -- : Database migrated
15
- I, [2014-12-27T11:20:26.744399 #2329] INFO -- : Database migrated
16
- I, [2014-12-27T13:03:00.951952 #1752] INFO -- : Database migrated
17
- I, [2014-12-29T15:37:45.322611 #5160] INFO -- : Database upgraded
18
- I, [2014-12-29T15:40:17.109444 #5496] INFO -- : Database upgraded
19
- I, [2014-12-31T10:30:48.046995 #2420] INFO -- : Database migrated
20
- I, [2014-12-31T10:52:19.297754 #3508] INFO -- : Database migrated
21
- I, [2014-12-31T14:28:46.717211 #5175] INFO -- : Database migrated
22
- I, [2014-12-31T14:29:26.856323 #5513] INFO -- : Database upgraded
1
+ I, [2015-01-12T21:09:16.448245 #5708] INFO -- : Database migrated
2
+ I, [2015-01-12T21:11:16.939299 #7487] INFO -- : Database upgraded
3
+ I, [2015-01-12T21:14:16.471252 #9406] INFO -- : Database upgraded
4
+ I, [2015-01-12T21:27:06.617120 #11844] INFO -- : Database migrated
5
+ I, [2015-01-12T21:31:58.597441 #13739] INFO -- : Database migrated
6
+ I, [2015-01-12T21:42:10.532078 #16032] INFO -- : Database migrated
data/nailed.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "nailed"
3
- s.version = "0.0.6"
3
+ s.version = "0.0.7"
4
4
  s.date = Time.now.strftime("%Y-%m-%d")
5
5
  s.summary = "Nailed CLI and WebUI"
6
6
  s.description = "Collect and visualize Product related data from Bugzilla and Github"
data/views/index.haml CHANGED
@@ -1,10 +1,14 @@
1
1
  !!!
2
2
  %section.main-section
3
3
  .row
4
- .large-12.columns
4
+ .large-6.columns
5
5
  %h1.title{:align => "center"}
6
6
  Open Bugs by Product
7
7
  #bug_top
8
+ .large-6.columns
9
+ %h1.title{:align => "center"}
10
+ Pullrequests by Component
11
+ #pull_top
8
12
  .large-12.columns
9
13
  %h1.title{:align => "center"}
10
14
  L3 Trend
@@ -17,6 +21,20 @@
17
21
  $(document).foundation();
18
22
  $(document).ready(function(){
19
23
  var colors = ['#B39DDB','#9FA8DA','#90CAF9','#81D4FA','#80DEEA','#80CBC4','#A5D6A7','#C5E1A5','#E6EE9C','#FFF59D','#FFE082','#FFCC80','#FFAB91','#BCAAA4','#EEEEEE'].reverse();
24
+ new Morris.Donut({
25
+ element: 'pull_top',
26
+ data: #{@pulltop},
27
+ colors: colors,
28
+ resize: true,
29
+ formatter: function(y, data){
30
+ return y;
31
+ }
32
+ }).on('click', function(i, row){
33
+ if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent))
34
+ jQuery.noop();
35
+ else
36
+ window.open("/github/"+row.label,"_self");
37
+ });
20
38
  new Morris.Donut({
21
39
  element: 'bug_top',
22
40
  data: #{@bugtop},
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nailed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maximilian Meister
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-31 00:00:00.000000000 Z
11
+ date: 2015-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
210
  version: '0'
211
211
  requirements: []
212
212
  rubyforge_project:
213
- rubygems_version: 2.2.0
213
+ rubygems_version: 2.4.5
214
214
  signing_key:
215
215
  specification_version: 4
216
216
  summary: Nailed CLI and WebUI