diff options
-rw-r--r-- | web/app.rb | 134 | ||||
-rw-r--r-- | web/routes/build_status.rb | 24 | ||||
-rw-r--r-- | web/routes/outdated_gems.rb | 8 | ||||
-rw-r--r-- | web/routes/repoman_checks.rb | 24 | ||||
-rw-r--r-- | web/routes/ruby_targets.rb | 12 | ||||
-rw-r--r-- | web/routes/tasks.rb | 26 | ||||
-rw-r--r-- | web/routes/visualizations.rb | 46 | ||||
-rw-r--r-- | web/views/build/build_history.erb | 2 | ||||
-rw-r--r-- | web/views/build/build_status.erb | 4 | ||||
-rw-r--r-- | web/views/layout.erb | 2 | ||||
-rw-r--r-- | web/views/repoman/repoman_checks.erb | 4 | ||||
-rw-r--r-- | web/views/repoman/repoman_history.erb | 2 |
12 files changed, 148 insertions, 140 deletions
@@ -14,137 +14,5 @@ require_relative 'lib/models' require_relative 'lib/packages' class RubyTinderbox < Sinatra::Base - get '/' do - redirect to('/ruby_targets') - end - - get '/ruby_targets' do - update_timestamp = Package.first[:update_timestamp] - portage_timestamp = Package.first[:portage_timestamp] - packages = Package.distinct(:sha1, :identifier).order(:identifier) - erb :'package/ruby_targets', locals: { packages: packages, update_timestamp: update_timestamp, portage_timestamp: portage_timestamp } - end - - get '/outdated_gems' do - update_timestamp = Package.first[:update_timestamp] - portage_timestamp = Package.first[:portage_timestamp] - packages = Package.distinct(:category, :name).order(:category, :name, Sequel.desc(:version), Sequel.desc(:revision)).exclude(gem_version: 'nil') - erb :'package/outdated_gems', locals: { packages: packages, update_timestamp: update_timestamp, portage_timestamp: portage_timestamp } - end - - get '/build_status' do - update_timestamp = Build.order(:timestamp).last[:timestamp] - portage_timestamp = Package.first[:portage_timestamp] - builds = [] - Package.each do |package| - builds << package.build_dataset.where(target: 'current').reverse_order(:timestamp).first - end - builds = builds.compact.sort_by { |build| build.package[:identifier] } - erb :'build/build_status', locals: { builds: builds, update_timestamp: update_timestamp, portage_timestamp: portage_timestamp } - end - - get '/build_logs/:sha1/:timestamp' do - package = Package.where(sha1: params[:sha1]).first - build = package.build_dataset.where(timestamp: params[:timestamp]).first - erb :'build/build_logs', locals: { package: package, build: build } - end - - get '/build_history/:sha1' do - package = Package.where(sha1: params[:sha1]).first - builds = package.build_dataset.where(target: 'current').reverse_order(:timestamp) - erb :'build/build_history', locals: { builds: builds } - end - - get '/repoman_checks' do - update_timestamp = Build.order(:timestamp).last[:timestamp] - portage_timestamp = Package.first[:portage_timestamp] - repomans = [] - Package.each do |package| - repomans << package.repoman_dataset.where(target: 'current').reverse_order(:timestamp).first - end - repomans = repomans.compact.sort_by { |repoman| repoman.package[:identifier] } - erb :'repoman/repoman_checks', locals: { repomans: repomans, update_timestamp: update_timestamp, portage_timestamp: portage_timestamp } - end - - get '/repoman_logs/:sha1/:timestamp' do - package = Package.where(sha1: params[:sha1]).first - repoman = package.repoman_dataset.where(timestamp: params[:timestamp]).first - erb :'repoman/repoman_logs', locals: { package: package, repoman: repoman } - end - - get '/repoman_history/:sha1' do - package = Package.where(sha1: params[:sha1]).first - repomans = package.repoman_dataset.where(target: 'current').reverse_order(:timestamp) - erb :'repoman/repoman_history', locals: { repomans: repomans } - end - - get '/new_targets' do - update_timestamp = Package.first[:update_timestamp] - portage_timestamp = Package.first[:portage_timestamp] - packages = [] - Package.each do |package| - build_current = package.build_dataset.where(target: 'current').reverse_order(:timestamp).first - next if build_current.nil? - - build_next = package.build_dataset.where(target: 'next').reverse_order(:timestamp).first - next if build_next.nil? - - repoman_current = package.repoman_dataset.where(target: 'current').reverse_order(:timestamp).first - next if repoman_current.nil? - - repoman_next = package.repoman_dataset.where(target: 'next').reverse_order(:timestamp).first - next if repoman_next.nil? - - if repoman_current[:result] == 'passed' || repoman_current[:result] == 'partial' && repoman_next[:result] == 'passed' || repoman_next[:result] == 'partial' - packages << [package, build_current, build_next, repoman_current, repoman_next] - end - end - packages = packages.compact.sort_by { |package| package[0][:identifier] } - erb :'bumps/new_targets', locals: { packages: packages, update_timestamp: update_timestamp, portage_timestamp: portage_timestamp } - end - - get '/visualizations' do - # Timestamps - update_timestamp = Package.first[:update_timestamp] - portage_timestamp = Package.first[:portage_timestamp] - - # Ruby Targets - ruby_1_9_amd64 = Package.where(r19_target: 'ruby19', amd64_keyword: 'amd64').count - ruby_1_9__amd64 = Package.where(r19_target: 'ruby19', amd64_keyword: '~amd64').count - ruby_2_0_amd64 = Package.where(r20_target: 'ruby20', amd64_keyword: 'amd64').count - ruby_2_0__amd64 = Package.where(r20_target: 'ruby20', amd64_keyword: '~amd64').count - ruby_2_1_amd64 = Package.where(r21_target: 'ruby21', amd64_keyword: 'amd64').count - ruby_2_1__amd64 = Package.where(r21_target: 'ruby21', amd64_keyword: '~amd64').count - ruby_2_2_amd64 = Package.where(r22_target: 'ruby22', amd64_keyword: 'amd64').count - ruby_2_2__amd64 = Package.where(r22_target: 'ruby22', amd64_keyword: '~amd64').count - - # Outdated Gems - uptodate = [] - outdated = [] - Package.distinct(:category, :name).reverse_order(:category, :name, :version).exclude(gem_version: 'nil').each { |p| uptodate << p if p[:version] >= p[:gem_version] } - Package.distinct(:category, :name).reverse_order(:category, :name, :version).exclude(gem_version: 'nil').each { |p| outdated << p if p[:version] < p[:gem_version] } - - # Build Status - succeeded = Build.distinct(:package_id).order(:package_id, Sequel.desc(:timestamp)).where(result: "succeeded\n").count - failed = Build.distinct(:package_id).order(:package_id, Sequel.desc(:timestamp)).where(result: "failed\n").count - timed_out = Build.distinct(:package_id).order(:package_id, Sequel.desc(:timestamp)).where(result: "timed out\n").count - - erb :'overview/visualizations', locals: { - portage_timestamp: portage_timestamp, - update_timestamp: update_timestamp, - ruby_1_9_amd64: ruby_1_9_amd64, - ruby_1_9__amd64: ruby_1_9__amd64, - ruby_2_0_amd64: ruby_2_0_amd64, - ruby_2_0__amd64: ruby_2_0__amd64, - ruby_2_1_amd64: ruby_2_1_amd64, - ruby_2_1__amd64: ruby_2_1__amd64, - ruby_2_2_amd64: ruby_2_2_amd64, - ruby_2_2__amd64: ruby_2_2__amd64, - uptodate: uptodate.count, - outdated: outdated.count, - succeeded: succeeded, - failed: failed, - timed_out: timed_out - } - end + Dir.glob('./routes/*.rb') { |f| require f } end diff --git a/web/routes/build_status.rb b/web/routes/build_status.rb new file mode 100644 index 0000000..178787b --- /dev/null +++ b/web/routes/build_status.rb @@ -0,0 +1,24 @@ +class RubyTinderbox < Sinatra::Base + get '/build_status' do + update_timestamp = Build.order(:timestamp).last[:timestamp] + portage_timestamp = Package.first[:portage_timestamp] + builds = [] + Package.each do |package| + builds << package.build_dataset.where(target: 'current').reverse_order(:timestamp).first + end + builds = builds.compact.sort_by { |build| build.package[:identifier] } + erb :'build/build_status', locals: { builds: builds, update_timestamp: update_timestamp, portage_timestamp: portage_timestamp } + end + + get '/build_status/:sha1' do + package = Package.where(sha1: params[:sha1]).first + builds = package.build_dataset.where(target: 'current').reverse_order(:timestamp) + erb :'build/build_history', locals: { builds: builds } + end + + get '/build_status/:sha1/:timestamp' do + package = Package.where(sha1: params[:sha1]).first + build = package.build_dataset.where(timestamp: params[:timestamp]).first + erb :'build/build_logs', locals: { package: package, build: build } + end +end diff --git a/web/routes/outdated_gems.rb b/web/routes/outdated_gems.rb new file mode 100644 index 0000000..a2c2334 --- /dev/null +++ b/web/routes/outdated_gems.rb @@ -0,0 +1,8 @@ +class RubyTinderbox < Sinatra::Base + get '/outdated_gems' do + update_timestamp = Package.first[:update_timestamp] + portage_timestamp = Package.first[:portage_timestamp] + packages = Package.distinct(:category, :name).order(:category, :name, Sequel.desc(:version), Sequel.desc(:revision)).exclude(gem_version: 'nil') + erb :'package/outdated_gems', locals: { packages: packages, update_timestamp: update_timestamp, portage_timestamp: portage_timestamp } + end +end diff --git a/web/routes/repoman_checks.rb b/web/routes/repoman_checks.rb new file mode 100644 index 0000000..a85f8ce --- /dev/null +++ b/web/routes/repoman_checks.rb @@ -0,0 +1,24 @@ +class RubyTinderbox < Sinatra::Base + get '/repoman_checks' do + update_timestamp = Build.order(:timestamp).last[:timestamp] + portage_timestamp = Package.first[:portage_timestamp] + repomans = [] + Package.each do |package| + repomans << package.repoman_dataset.where(target: 'current').reverse_order(:timestamp).first + end + repomans = repomans.compact.sort_by { |repoman| repoman.package[:identifier] } + erb :'repoman/repoman_checks', locals: { repomans: repomans, update_timestamp: update_timestamp, portage_timestamp: portage_timestamp } + end + + get '/repoman_checks/:sha1' do + package = Package.where(sha1: params[:sha1]).first + repomans = package.repoman_dataset.where(target: 'current').reverse_order(:timestamp) + erb :'repoman/repoman_history', locals: { repomans: repomans } + end + + get '/repoman_checks/:sha1/:timestamp' do + package = Package.where(sha1: params[:sha1]).first + repoman = package.repoman_dataset.where(timestamp: params[:timestamp]).first + erb :'repoman/repoman_logs', locals: { package: package, repoman: repoman } + end +end diff --git a/web/routes/ruby_targets.rb b/web/routes/ruby_targets.rb new file mode 100644 index 0000000..653f199 --- /dev/null +++ b/web/routes/ruby_targets.rb @@ -0,0 +1,12 @@ +class RubyTinderbox < Sinatra::Base + get '/' do + redirect to('/ruby_targets') + end + + get '/ruby_targets' do + update_timestamp = Package.first[:update_timestamp] + portage_timestamp = Package.first[:portage_timestamp] + packages = Package.distinct(:sha1, :identifier).order(:identifier) + erb :'package/ruby_targets', locals: { packages: packages, update_timestamp: update_timestamp, portage_timestamp: portage_timestamp } + end +end diff --git a/web/routes/tasks.rb b/web/routes/tasks.rb new file mode 100644 index 0000000..4f189aa --- /dev/null +++ b/web/routes/tasks.rb @@ -0,0 +1,26 @@ +class RubyTinderbox < Sinatra::Base + get '/new_targets' do + update_timestamp = Package.first[:update_timestamp] + portage_timestamp = Package.first[:portage_timestamp] + packages = [] + Package.each do |package| + build_current = package.build_dataset.where(target: 'current').reverse_order(:timestamp).first + next if build_current.nil? + + build_next = package.build_dataset.where(target: 'next').reverse_order(:timestamp).first + next if build_next.nil? + + repoman_current = package.repoman_dataset.where(target: 'current').reverse_order(:timestamp).first + next if repoman_current.nil? + + repoman_next = package.repoman_dataset.where(target: 'next').reverse_order(:timestamp).first + next if repoman_next.nil? + + if repoman_current[:result] == 'passed' || repoman_current[:result] == 'partial' && repoman_next[:result] == 'passed' || repoman_next[:result] == 'partial' + packages << [package, build_current, build_next, repoman_current, repoman_next] + end + end + packages = packages.compact.sort_by { |package| package[0][:identifier] } + erb :'bumps/new_targets', locals: { packages: packages, update_timestamp: update_timestamp, portage_timestamp: portage_timestamp } + end +end diff --git a/web/routes/visualizations.rb b/web/routes/visualizations.rb new file mode 100644 index 0000000..6b617ff --- /dev/null +++ b/web/routes/visualizations.rb @@ -0,0 +1,46 @@ +class RubyTinderbox < Sinatra::Base + get '/visualizations' do + # Timestamps + update_timestamp = Package.first[:update_timestamp] + portage_timestamp = Package.first[:portage_timestamp] + + # Ruby Targets + ruby_1_9_amd64 = Package.where(r19_target: 'ruby19', amd64_keyword: 'amd64').count + ruby_1_9__amd64 = Package.where(r19_target: 'ruby19', amd64_keyword: '~amd64').count + ruby_2_0_amd64 = Package.where(r20_target: 'ruby20', amd64_keyword: 'amd64').count + ruby_2_0__amd64 = Package.where(r20_target: 'ruby20', amd64_keyword: '~amd64').count + ruby_2_1_amd64 = Package.where(r21_target: 'ruby21', amd64_keyword: 'amd64').count + ruby_2_1__amd64 = Package.where(r21_target: 'ruby21', amd64_keyword: '~amd64').count + ruby_2_2_amd64 = Package.where(r22_target: 'ruby22', amd64_keyword: 'amd64').count + ruby_2_2__amd64 = Package.where(r22_target: 'ruby22', amd64_keyword: '~amd64').count + + # Outdated Gems + uptodate = [] + outdated = [] + Package.distinct(:category, :name).reverse_order(:category, :name, :version).exclude(gem_version: 'nil').each { |p| uptodate << p if p[:version] >= p[:gem_version] } + Package.distinct(:category, :name).reverse_order(:category, :name, :version).exclude(gem_version: 'nil').each { |p| outdated << p if p[:version] < p[:gem_version] } + + # Build Status + succeeded = Build.distinct(:package_id).order(:package_id, Sequel.desc(:timestamp)).where(result: "succeeded\n").count + failed = Build.distinct(:package_id).order(:package_id, Sequel.desc(:timestamp)).where(result: "failed\n").count + timed_out = Build.distinct(:package_id).order(:package_id, Sequel.desc(:timestamp)).where(result: "timed out\n").count + + erb :'overview/visualizations', locals: { + portage_timestamp: portage_timestamp, + update_timestamp: update_timestamp, + ruby_1_9_amd64: ruby_1_9_amd64, + ruby_1_9__amd64: ruby_1_9__amd64, + ruby_2_0_amd64: ruby_2_0_amd64, + ruby_2_0__amd64: ruby_2_0__amd64, + ruby_2_1_amd64: ruby_2_1_amd64, + ruby_2_1__amd64: ruby_2_1__amd64, + ruby_2_2_amd64: ruby_2_2_amd64, + ruby_2_2__amd64: ruby_2_2__amd64, + uptodate: uptodate.count, + outdated: outdated.count, + succeeded: succeeded, + failed: failed, + timed_out: timed_out + } + end +end diff --git a/web/views/build/build_history.erb b/web/views/build/build_history.erb index f6af24a..96f3fe4 100644 --- a/web/views/build/build_history.erb +++ b/web/views/build/build_history.erb @@ -13,7 +13,7 @@ <%=Time.at(build[:timestamp].to_i).strftime('%Y-%m-%d')%> </td> <td class="width-50 <%=build[:result]%>"> - <a href="/build_logs/<%=build.package[:sha1]%>/<%=build[:timestamp]%>"><%=build[:result].camelcase%></a> + <a href="/build_status/<%=build.package[:sha1]%>/<%=build[:timestamp]%>"><%=build[:result].camelcase%></a> </td> </tr> <%end%> diff --git a/web/views/build/build_status.erb b/web/views/build/build_status.erb index fc4f5d1..ede45cc 100644 --- a/web/views/build/build_status.erb +++ b/web/views/build/build_status.erb @@ -35,10 +35,10 @@ <%=Time.at(build[:timestamp].to_i).strftime('%Y-%m-%d')%> </td> <td class="width-17 <%=build[:result]%>"> - <a href="/build_logs/<%=build.package[:sha1]%>/<%=build[:timestamp]%>"><%=build[:result].camelcase%></a> + <a href="/build_status/<%=build.package[:sha1]%>/<%=build[:timestamp]%>"><%=build[:result].camelcase%></a> </td> <td class="width-17"> - <a href="/build_history/<%=build.package[:sha1]%>"><%=build.package.build_dataset.where(target: 'current').count%> Build(s)</a> + <a href="/build_status/<%=build.package[:sha1]%>"><%=build.package.build_dataset.where(target: 'current').count%> Build(s)</a> </td> <td style="display:none;"> +<%=build.package[:amd64_keyword]%> diff --git a/web/views/layout.erb b/web/views/layout.erb index 5f0467c..28f2f22 100644 --- a/web/views/layout.erb +++ b/web/views/layout.erb @@ -70,7 +70,7 @@ <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Package Bumps <span class="caret"></span></a> <ul class="dropdown-menu" role="menu"> - <li><a href="new_targets">New Targets</a></li> + <li><a href="/new_targets">New Targets</a></li> </ul> </li> <li><a href="/visualizations">Visualizations</a></li> diff --git a/web/views/repoman/repoman_checks.erb b/web/views/repoman/repoman_checks.erb index 9a14a89..573c8c3 100644 --- a/web/views/repoman/repoman_checks.erb +++ b/web/views/repoman/repoman_checks.erb @@ -35,10 +35,10 @@ <%=Time.at(repoman[:timestamp].to_i).strftime('%Y-%m-%d')%> </td> <td class="width-17 <%=repoman[:result]%>"> - <a href="/repoman_logs/<%=repoman.package[:sha1]%>/<%=repoman[:timestamp]%>"><%=repoman[:result].camelcase%></a> + <a href="/repoman_checks/<%=repoman.package[:sha1]%>/<%=repoman[:timestamp]%>"><%=repoman[:result].camelcase%></a> </td> <td class="width-17"> - <a href="/repoman_history/<%=repoman.package[:sha1]%>"><%=repoman.package.repoman_dataset.where(target: 'current').count%> Check(s)</a> + <a href="/repoman_checks/<%=repoman.package[:sha1]%>"><%=repoman.package.repoman_dataset.where(target: 'current').count%> Check(s)</a> </td> <td style="display:none;"> +<%=repoman.package[:amd64_keyword]%> diff --git a/web/views/repoman/repoman_history.erb b/web/views/repoman/repoman_history.erb index bc26cd8..459ee9d 100644 --- a/web/views/repoman/repoman_history.erb +++ b/web/views/repoman/repoman_history.erb @@ -13,7 +13,7 @@ <%=Time.at(repoman[:timestamp].to_i).strftime('%Y-%m-%d')%> </td> <td class="width-50 <%=repoman[:result]%>"> - <a href="/repoman_logs/<%=repoman.package[:sha1]%>/<%=repoman[:timestamp]%>"><%=repoman[:result].camelcase%></a> + <a href="/repoman_checks/<%=repoman.package[:sha1]%>/<%=repoman[:timestamp]%>"><%=repoman[:result].camelcase%></a> </td> </tr> <%end%> |