nailed 0.0.3

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.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/Gemfile +14 -0
  4. data/README.md +71 -0
  5. data/README.rdoc +64 -0
  6. data/bin/app +142 -0
  7. data/bin/nailed +90 -0
  8. data/config/products.yml +14 -0
  9. data/config/products.yml.example +65 -0
  10. data/db/database.rb +89 -0
  11. data/lib/nailed.rb +194 -0
  12. data/log/nailed.log +18 -0
  13. data/nailed.gemspec +25 -0
  14. data/public/images/favicon.ico +0 -0
  15. data/public/vendor/css/foundation.css +6031 -0
  16. data/public/vendor/css/foundation.min.css +1 -0
  17. data/public/vendor/css/morris.css +2 -0
  18. data/public/vendor/css/normalize.css +425 -0
  19. data/public/vendor/js/external/fastclick.js +9 -0
  20. data/public/vendor/js/external/jquery.js +26 -0
  21. data/public/vendor/js/external/modernizr.js +8 -0
  22. data/public/vendor/js/external/placeholder.js +2 -0
  23. data/public/vendor/js/foundation.min.js +10 -0
  24. data/public/vendor/js/foundation/foundation.abide.js +294 -0
  25. data/public/vendor/js/foundation/foundation.accordion.js +65 -0
  26. data/public/vendor/js/foundation/foundation.alert.js +43 -0
  27. data/public/vendor/js/foundation/foundation.clearing.js +558 -0
  28. data/public/vendor/js/foundation/foundation.dropdown.js +313 -0
  29. data/public/vendor/js/foundation/foundation.equalizer.js +74 -0
  30. data/public/vendor/js/foundation/foundation.interchange.js +344 -0
  31. data/public/vendor/js/foundation/foundation.joyride.js +915 -0
  32. data/public/vendor/js/foundation/foundation.js +625 -0
  33. data/public/vendor/js/foundation/foundation.magellan.js +189 -0
  34. data/public/vendor/js/foundation/foundation.offcanvas.js +139 -0
  35. data/public/vendor/js/foundation/foundation.orbit.js +472 -0
  36. data/public/vendor/js/foundation/foundation.reveal.js +443 -0
  37. data/public/vendor/js/foundation/foundation.slider.js +231 -0
  38. data/public/vendor/js/foundation/foundation.tab.js +167 -0
  39. data/public/vendor/js/foundation/foundation.tooltip.js +298 -0
  40. data/public/vendor/js/foundation/foundation.topbar.js +436 -0
  41. data/public/vendor/js/morris.min.js +7 -0
  42. data/public/vendor/js/morris/morris.js +1892 -0
  43. data/public/vendor/js/morris/raphael-min.js +11 -0
  44. data/public/vendor/js/morris/raphael.js +8117 -0
  45. data/views/bugzilla.haml +110 -0
  46. data/views/github.haml +63 -0
  47. data/views/index.haml +51 -0
  48. data/views/layout.haml +49 -0
  49. metadata +231 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a4c55d859f8482367000e42658d95e29b719a74b
4
+ data.tar.gz: a5e2c71830070186fadaf821cdd6bdc927e1c37f
5
+ SHA512:
6
+ metadata.gz: a7a277fd9c9f64f1d6657bcc4e855e5e0e67029f140141975c170cc254bc096eed2d5ac5ca784a0c44bbaa364a2d589c915888bf764c0212a118467e9e5c5efc
7
+ data.tar.gz: 5592d161d09ff7707d06032c30662c1683049e4f7bf84eaba4cd7c220829b314583fd582fcbf6c68a464e40c738a3592c07d27d7ea55f9868d05c41f988c2beb
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ Gemfile.lock
2
+ db/nailed.db
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "https://rubygems.org"
2
+
3
+ # back-end
4
+ gem "trollop", "2.0"
5
+ gem "bicho", "0.0.8"
6
+ gem "octokit", "3.7.0"
7
+ gem "data_mapper", "1.2.0"
8
+ gem "dm-sqlite-adapter", "1.2.0"
9
+ gem "netrc", "0.10.2"
10
+ # front-end
11
+ gem "sinatra-base", "1.4.0"
12
+ gem "sinatra-assetpack", "0.3.3"
13
+ gem "haml", "4.0.6"
14
+ gem "rerun", "0.10.0"
data/README.md ADDED
@@ -0,0 +1,71 @@
1
+ ## What is nailed?
2
+
3
+ `nailed` consists of a back-end CLI for data collection and a sinatra based web front-end for visualization of relevant development data of Products that have their bugtracker on Bugzilla and (optionally) their codebase on GitHub.
4
+
5
+ `Be aware` that the bugzilla layout (metadata) is still SUSE specific, which may not be useful for everybody.
6
+ e.g. it relies on bugs being tagged as L3. The plan is to make it optional in the future.
7
+
8
+ ## Installation
9
+ gem install 'nailed'
10
+
11
+ ## Usage
12
+
13
+ ```
14
+ $ nailed -h
15
+ Options:
16
+ --migrate, -m: Set database to pristine state
17
+ --upgrade, -u: Upgrade database
18
+ --bugzilla, -b: Refresh bugzilla database records
19
+ --github, -g: Refresh github database records
20
+ --l3, -l: Refresh l3 trend database records
21
+ --server, -s: Start a dashboard webinterface
22
+ --help, -h: Show this message
23
+ ```
24
+
25
+ ## Initial setup
26
+
27
+ * for the bugzilla API make sure you have an `.oscrc` file with your credentials in ~
28
+ * for the github API make sure you have a `.netrc` with a valid GitHub OAuth-Token in ~
29
+ ```
30
+ # example .netrc
31
+
32
+ machine api.github.com
33
+ login MaximilianMeister
34
+ password <your OAuth Token>
35
+ ```
36
+ * to setup the database run
37
+ ```
38
+ nailed --migrate
39
+ ```
40
+
41
+ ## Configuration
42
+
43
+ All configuration is read from `config/products.yml`
44
+
45
+ ``` yaml
46
+ ---
47
+ bugzilla:
48
+ url: # Url of your Bugzilla instance
49
+ products:
50
+ example_product: # Just a a short key/name for the product (can be arbitrary)
51
+ versions:
52
+ # Array of Bugzilla products (typically different versions of one product)
53
+ # Exact names have to be given, as they appear in Bugzilla (can not be arbitrary)
54
+ organization: # here goes the organization name (under which your repos are hosted) as it appears in GitHub
55
+ # just leave it blank if your repo isn't hosted under an organizational umbrella
56
+ repos:
57
+ # Array of GitHub repository names, as they appear in GitHub
58
+ # If there are no associated repos for the product, just leave it blank
59
+ # continue adding more products here
60
+
61
+ ```
62
+
63
+ * in production, after adding products/changes, to upgrade the database with the new changes run
64
+ ```
65
+ nailed --upgrade
66
+ ```
67
+
68
+ ## Run
69
+
70
+ * create a `cronjob` for automated data collection with `nailed`
71
+ * start the webserver with `nailed --server`
data/README.rdoc ADDED
@@ -0,0 +1,64 @@
1
+ = nailed
2
+ == What is nailed?
3
+
4
+ +nailed+ consists of a back-end CLI for data collection and a sinatra based web front-end for visualization of relevant development data of Products that have their bugtracker on Bugzilla and (optionally) their codebase on GitHub.
5
+
6
+ +Be+ +aware+ that the bugzilla layout (metadata) is still SUSE specific, which may not be useful for everybody.
7
+ e.g. it relies on bugs being tagged as L3. The plan is to make it optional in the future.
8
+
9
+ == Installation
10
+ gem install 'nailed'
11
+
12
+ == Usage
13
+
14
+ $ nailed -h
15
+ Options:
16
+ --migrate, -m: Set database to pristine state
17
+ --upgrade, -u: Upgrade database
18
+ --bugzilla, -b: Refresh bugzilla database records
19
+ --github, -g: Refresh github database records
20
+ --l3, -l: Refresh l3 trend database records
21
+ --server, -s: Start a dashboard webinterface
22
+ --help, -h: Show this message
23
+
24
+ == Initial setup
25
+
26
+ * for the bugzilla API make sure you have an +.oscrc+ file with your credentials in ~
27
+ * for the github API make sure you have a +.netrc+ with a valid GitHub OAuth-Token in ~
28
+
29
+ # example .netrc
30
+
31
+ machine api.github.com
32
+ login MaximilianMeister
33
+ password <your OAuth Token>
34
+
35
+ * to setup the database run
36
+ nailed --migrate
37
+
38
+ == Configuration
39
+
40
+ All configuration is read from +config/products.yml+
41
+
42
+ ---
43
+ bugzilla:
44
+ url: # Url of your Bugzilla instance
45
+ products:
46
+ example_product: # Just a a short key/name for the product (can be arbitrary)
47
+ versions:
48
+ # Array of Bugzilla products (typically different versions of one product)
49
+ # Exact names have to be given, as they appear in Bugzilla (can not be arbitrary)
50
+ organization: # here goes the organization name (under which your repos are hosted) as it appears in GitHub
51
+ # just leave it blank if your repo isn't hosted under an organizational umbrella
52
+ repos:
53
+ # Array of GitHub repository names, as they appear in GitHub
54
+ # If there are no associated repos for the product, just leave it blank
55
+ # continue adding more products here
56
+
57
+ * in production, after adding products/changes, to upgrade the database with the new changes run
58
+ nailed --upgrade
59
+
60
+ == Run
61
+
62
+ * create a +cronjob+ for automated data collection with +nailed+
63
+ * start the webserver with
64
+ nailed --server
data/bin/app ADDED
@@ -0,0 +1,142 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'sinatra/base'
4
+ require 'sinatra/assetpack'
5
+ require 'haml'
6
+ require 'json'
7
+ require 'time'
8
+ require File.join(File.expand_path("..", File.dirname(__FILE__)),"lib","nailed")
9
+ require File.join(File.expand_path("..", File.dirname(__FILE__)),"db","database")
10
+
11
+ class App < Sinatra::Base
12
+ ROOT_PATH = File.join(File.expand_path("..", File.dirname(__FILE__)))
13
+ self.set :root, File.join(ROOT_PATH, "lib")
14
+ set :public_folder, File.join(ROOT_PATH, "public")
15
+ set :views, File.join(ROOT_PATH, "views")
16
+ set :bind, '0.0.0.0'
17
+
18
+ register Sinatra::AssetPack
19
+
20
+ assets {
21
+ serve '/js', from: '../public/vendor/js'
22
+ serve '/css', from: '../public/vendor/css'
23
+ serve '/images', from: '../public/images'
24
+
25
+ js :foundation, '/js/foundation.min.js', [
26
+ '/js/external/*.js',
27
+ '/js/foundation/foundation.js',
28
+ '/js/foundation/*.js'
29
+ ]
30
+ js :morris, '/js/morris.min.js', [
31
+ '/js/morris/morris.js',
32
+ '/js/morris/raphael.js'
33
+ ]
34
+
35
+ css :foundation, '/css/foundation.min.css', [
36
+ '/css/foundation.css',
37
+ '/css/normalize.css'
38
+ ]
39
+ css :morris, '/css/morris.min.js', [
40
+ '/css/morris.css'
41
+ ]
42
+
43
+ js_compression :jsmin
44
+ css_compression :simple
45
+ }
46
+
47
+ before do
48
+ @products = Nailed::PRODUCTS["products"].map{|p,v| v["versions"]}.flatten
49
+ @product_query = @products.join('&product=')
50
+ @github_repos = Pullrequest.all(:order => [:created_at.desc]).map(&:repository_rname).uniq
51
+ end
52
+
53
+ helpers do
54
+ def get_trends(action, item)
55
+ case action
56
+ when :bug
57
+ trend = Bugtrend.all(:product_name => item)
58
+ when :pull
59
+ trend = Pulltrend.all(:repository_rname => item)
60
+ when :l3
61
+ trend = L3Trend.all
62
+ end
63
+ trend_clone = trend.clone
64
+ begin
65
+ interval = (trend.length/20.0).round
66
+ last_iter_open = trend.first.open
67
+ trend.each do |bt|
68
+ if trend.index(bt) % interval != 0
69
+ if bt != trend.last
70
+ if bt.open == last_iter_open
71
+ trend_clone.delete(bt)
72
+ end
73
+ end
74
+ else
75
+ next
76
+ end
77
+ last_iter_open = bt.open
78
+ end
79
+ rescue ZeroDivisionError
80
+ end
81
+ trend_clone.to_json
82
+ end
83
+ end
84
+
85
+ # define sinatra routes
86
+ get '/' do
87
+ @l3trend = get_trends(:l3, nil)
88
+
89
+ @bugtop = []
90
+ Nailed::PRODUCTS["products"].each do |product,values|
91
+ values["versions"].each do |version|
92
+ p = Product.get(version)
93
+ open = Bugreport.count(:product_name => p.name, :is_open => true)
94
+ @bugtop << {label: p.name, value: open} unless open == 0
95
+ end
96
+ end
97
+ @bugtop = @bugtop.to_json
98
+
99
+ haml :index
100
+ end
101
+
102
+ Nailed::PRODUCTS["products"].each do |product,values|
103
+ values["versions"].each do |version|
104
+ get "/#{version.gsub(/ /,'_')}/bugzilla" do
105
+ @product = version
106
+
107
+ @bugtrend = get_trends(:bug, version)
108
+ @allbugs = Bugreport.all(:product_name => version).to_json
109
+ @allopenbugs = (Bugreport.all(:product_name => version, :is_open => true) -
110
+ Bugreport.all(:product_name => version, :whiteboard.like => "%openL3%", :is_open => true)).sort! {|a,b| Time.parse(b.last_change_time.to_s).to_i <=> Time.parse(a.last_change_time.to_s).to_i}
111
+ @allopenl3bugs = (Bugreport.all(:product_name => version, :is_open => true, :whiteboard.like => "%openL3%")).sort! {|a,b| Time.parse(b.last_change_time.to_s).to_i <=> Time.parse(a.last_change_time.to_s).to_i}
112
+ @bugprio = []
113
+ {"P1 - Urgent" => "p1",
114
+ "P2 - High" => "p2",
115
+ "P3 - Medium" => "p3",
116
+ "P4 - Low" => "p4",
117
+ "P5 - None" => "p5"}.each_pair do |key,val|
118
+ @bugprio << {"bugprio" => key, val => Bugreport.count(:product_name => version, :priority => key, :is_open => true)}
119
+ end
120
+ @bugprio = @bugprio.to_json
121
+
122
+ haml :bugzilla
123
+ end
124
+ end
125
+ end
126
+
127
+ @github_repos = Pullrequest.all(:order => [:created_at.desc]).map(&:repository_rname).uniq
128
+ @github_repos.each do |repo|
129
+ get "/github/#{repo}" do
130
+ @repo = repo
131
+ @org = Repository.get(repo).organization_oname
132
+ @github_url_all_pulls = "https://github.com/#{@org}/#{@repo}/pulls"
133
+
134
+ @allpulls = Pullrequest.all(:repository_rname => repo).sort! {|a,b| b.pr_number <=> a.pr_number}
135
+ @pulltrend = get_trends(:pull, repo)
136
+
137
+ haml :github
138
+ end
139
+ end
140
+
141
+ run! if app_file == $0
142
+ end
data/bin/nailed ADDED
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "trollop"
4
+ require File.join(File.expand_path("..", File.dirname(__FILE__)),"lib","nailed")
5
+ require File.join(File.expand_path("..", File.dirname(__FILE__)),"db","database")
6
+
7
+ bugzilla_client = Nailed::Bugzilla.new
8
+ github_client = Nailed::Github.new
9
+
10
+ opts = Trollop::options do
11
+ opt :migrate, "Set database to pristine state", :short => 'm'
12
+ opt :upgrade, "Upgrade database", :short => 'u'
13
+ opt :bugzilla, "Refresh bugzilla database records", :short => 'b'
14
+ opt :github, "Refresh github database records", :short => 'g'
15
+ opt :l3, "Refresh l3 trend database records", :short => 'l'
16
+ opt :server, "Start a dashboard webinterface", :short => 's'
17
+ end
18
+
19
+ if opts.map{|k,v| v == false}
20
+ puts "try nailed -h"
21
+ end
22
+
23
+ if opts[:server_given]
24
+ if Nailed::PRODUCTS["products"].nil?
25
+ abort("Add some data, there is nothing to be shown")
26
+ else
27
+ begin
28
+ `#{File.join("rerun ",File.expand_path("..", File.dirname(__FILE__)),"bin","app")}`
29
+ rescue Interrupt
30
+ sleep 2
31
+ exit
32
+ end
33
+ end
34
+ end
35
+
36
+ opts.each_pair do |key,val|
37
+ case key
38
+ when :migrate
39
+ if val
40
+ print("Are you sure? This will delete all data from the database. (y/n) ")
41
+ if gets.strip == "y"
42
+ Product.auto_migrate!
43
+ Bugreport.auto_migrate!
44
+ Bugtrend.auto_migrate!
45
+ L3Trend.auto_migrate!
46
+ Organization.auto_migrate!
47
+ Repository.auto_migrate!
48
+ Pullrequest.auto_migrate!
49
+ Pulltrend.auto_migrate!
50
+ Nailed.fill_db_after_migration(github_client.client)
51
+ Nailed.log("info", "Database migrated")
52
+ abort "Database migrated"
53
+ else
54
+ abort "Aborting..."
55
+ end
56
+ end
57
+ when :upgrade
58
+ if val
59
+ print "Are you sure? This will create new tables, new columns, but not change anything existing. (y/n) "
60
+ if gets.strip == "y"
61
+ Product.auto_upgrade!
62
+ Bugreport.auto_upgrade!
63
+ Bugtrend.auto_upgrade!
64
+ L3Trend.auto_upgrade!
65
+ Organization.auto_upgrade!
66
+ Repository.auto_upgrade!
67
+ Pullrequest.auto_upgrade!
68
+ Pulltrend.auto_upgrade!
69
+ Nailed.fill_db_after_migration(github_client.client)
70
+ Nailed.log("info", "Database upgraded")
71
+ abort "Database upgraded"
72
+ end
73
+ end
74
+ when :bugzilla
75
+ if val
76
+ bugzilla_client.get_bugs
77
+ bugzilla_client.write_bug_trends
78
+ end
79
+ when :github
80
+ if val
81
+ github_client.update_pull_states
82
+ github_client.get_open_pulls
83
+ end
84
+ when :l3
85
+ if val
86
+ bugzilla_client.write_l3_trends
87
+ end
88
+ end
89
+ end
90
+
@@ -0,0 +1,14 @@
1
+ ---
2
+ bugzilla:
3
+ url: # Url of your Bugzilla instance
4
+ products:
5
+ example_product: # Just a a short key/name for the product (can be arbitrary)
6
+ versions:
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
10
+ # just leave it blank if your repo isn't hosted under an organizational umbrella
11
+ repos:
12
+ # Array of GitHub repository names, as they appear in GitHub
13
+ # If there are no associated repos for the product, just leave it blank
14
+ # continue adding more products here
@@ -0,0 +1,65 @@
1
+ ---
2
+ bugzilla:
3
+ url: https://bugzilla.novell.com
4
+ products:
5
+ cloud:
6
+ versions:
7
+ - SUSE Cloud 3
8
+ - SUSE Cloud 4
9
+ - SUSE Cloud 5
10
+ organization: crowbar
11
+ 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
42
+ susemanager:
43
+ versions:
44
+ - SUSE Manager 2.1 Server
45
+ - SUSE Manager 2.1 Proxy
46
+ organization: SUSE
47
+ repos:
48
+ - spacewalk
49
+ scc:
50
+ versions:
51
+ - SUSE Customer Center
52
+ organization: SUSE
53
+ repos:
54
+ - happy-customer
55
+ sles:
56
+ versions:
57
+ - SUSE Linux Enterprise Server 12 (SLES 12)
58
+ organization: SUSE
59
+ repos:
60
+ - machinery
61
+ opensuse:
62
+ versions:
63
+ - openSUSE 13.1
64
+ organization:
65
+ repos: