polisher 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +8 -0
- data/LICENSE +661 -0
- data/README.rdoc +25 -0
- data/Rakefile +92 -0
- data/TODO +6 -0
- data/bin/server +3 -0
- data/config/database.yml +8 -43
- data/config/polisher.yml +15 -5
- data/config.ru +25 -0
- data/db/connection.rb +49 -0
- data/db/migrations/001_create_sources.rb +27 -0
- data/db/migrations/002_create_managed_gems.rb +24 -0
- data/db/migrations/003_create_events.rb +27 -0
- data/db/models/event.rb +61 -0
- data/db/models/managed_gem.rb +111 -0
- data/db/models/source.rb +35 -0
- data/lib/common.rb +39 -0
- data/lib/event_handlers.rb +100 -0
- data/lib/sinatra/url_for.rb +40 -0
- data/polisher.rb +120 -0
- data/public/javascripts/polisher.js +15 -0
- data/public/stylesheets/style.css +18 -3
- data/spec/event_handlers_spec.rb +164 -0
- data/spec/models_spec.rb +193 -0
- data/spec/polisher_spec.rb +133 -0
- data/spec/spec_helper.rb +44 -0
- data/views/gems/index.haml +106 -0
- data/views/layout.haml +24 -0
- data/views/sources/index.haml +41 -0
- metadata +36 -93
- data/README +0 -243
- data/app/controllers/application_controller.rb +0 -12
- data/app/controllers/callback_controller.rb +0 -47
- data/app/controllers/manage_controller.rb +0 -112
- data/app/helpers/application_helper.rb +0 -3
- data/app/models/artifact.rb +0 -21
- data/app/models/event_handler.rb +0 -61
- data/app/models/gem_search_criteria.rb +0 -24
- data/app/models/gem_source.rb +0 -43
- data/app/models/managed_gem.rb +0 -47
- data/app/views/callback/gem_updated.rhtml +0 -0
- data/app/views/layouts/_header.rhtml +0 -8
- data/app/views/layouts/index.rhtml +0 -27
- data/app/views/manage/create_event_handler.rhtml +0 -15
- data/app/views/manage/create_gem.rhtml +0 -15
- data/app/views/manage/create_gem_source.rhtml +0 -15
- data/app/views/manage/delete_event_handler.rhtml +0 -15
- data/app/views/manage/delete_gem.rhtml +0 -15
- data/app/views/manage/delete_gem_source.rhtml +0 -15
- data/app/views/manage/list.rhtml +0 -66
- data/app/views/manage/new_event_handler.rhtml +0 -38
- data/app/views/manage/new_gem.rhtml +0 -21
- data/app/views/manage/new_gem_search_criteria.rhtml +0 -3
- data/app/views/manage/new_gem_source.rhtml +0 -10
- data/config/boot.rb +0 -110
- data/config/environment.rb +0 -44
- data/config/environments/development.rb +0 -17
- data/config/environments/production.rb +0 -28
- data/config/environments/test.rb +0 -28
- data/config/initializers/backtrace_silencers.rb +0 -7
- data/config/initializers/inflections.rb +0 -10
- data/config/initializers/mime_types.rb +0 -5
- data/config/initializers/new_rails_defaults.rb +0 -21
- data/config/initializers/session_store.rb +0 -15
- data/config/locales/en.yml +0 -5
- data/config/routes.rb +0 -44
- data/db/migrate/001_create_gem_sources.rb +0 -34
- data/db/migrate/002_create_managed_gems.rb +0 -32
- data/db/migrate/003_create_gem_search_criterias.rb +0 -33
- data/db/migrate/004_create_event_handlers.rb +0 -32
- data/db/migrate/005_create_artifacts.rb +0 -32
- data/db/schema.rb +0 -42
- data/db/seeds.rb +0 -7
- data/lib/email_adapter.rb +0 -46
- data/lib/gem2rpm.rb +0 -189
- data/lib/gem_api_adapter.rb +0 -87
- data/lib/rpm_adapter.rb +0 -39
- data/public/404.html +0 -30
- data/public/422.html +0 -30
- data/public/500.html +0 -30
- data/public/dispatch.cgi +0 -10
- data/public/dispatch.fcgi +0 -24
- data/public/dispatch.rb +0 -29
- data/public/favicon.ico +0 -0
- data/public/images/rails.png +0 -0
- data/public/javascripts/application.js +0 -2
- data/public/javascripts/controls.js +0 -963
- data/public/javascripts/dragdrop.js +0 -973
- data/public/javascripts/effects.js +0 -1128
- data/public/javascripts/prototype.js +0 -4320
- data/public/robots.txt +0 -5
- data/script/about +0 -4
- data/script/console +0 -3
- data/script/dbconsole +0 -3
- data/script/destroy +0 -3
- data/script/generate +0 -3
- data/script/performance/benchmarker +0 -3
- data/script/performance/profiler +0 -3
- data/script/plugin +0 -3
- data/script/runner +0 -3
- data/script/server +0 -3
- data/tmp/gems/README +0 -1
- data/tmp/rpms/README +0 -1
@@ -1,33 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (C) 2010 Red Hat, Inc.
|
3
|
-
# Written by Mohammed Morsi <mmorsi@redhat.com>
|
4
|
-
#
|
5
|
-
# This program is free software; you can redistribute it and/or modify
|
6
|
-
# it under the terms of the GNU General Public License as published by
|
7
|
-
# the Free Software Foundation; version 2 of the License.
|
8
|
-
#
|
9
|
-
# This program is distributed in the hope that it will be useful,
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
-
# GNU General Public License for more details.
|
13
|
-
#
|
14
|
-
# You should have received a copy of the GNU General Public License
|
15
|
-
# along with this program; if not, write to the Free Software
|
16
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
17
|
-
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
18
|
-
# also available at http://www.gnu.org/copyleft/gpl.html.
|
19
|
-
|
20
|
-
# according to google the plural for "criteria" is "criterion"
|
21
|
-
# but the active_support inflector begs to differ and I'm not gonna argue :-)
|
22
|
-
class CreateGemSearchCriterias < ActiveRecord::Migration
|
23
|
-
def self.up
|
24
|
-
create_table :gem_search_criterias do |t|
|
25
|
-
t.string :regex
|
26
|
-
t.references :gem_source
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.down
|
31
|
-
drop_table :gem_search_criterias
|
32
|
-
end
|
33
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (C) 2010 Red Hat, Inc.
|
3
|
-
# Written by Mohammed Morsi <mmorsi@redhat.com>
|
4
|
-
#
|
5
|
-
# This program is free software; you can redistribute it and/or modify
|
6
|
-
# it under the terms of the GNU General Public License as published by
|
7
|
-
# the Free Software Foundation; version 2 of the License.
|
8
|
-
#
|
9
|
-
# This program is distributed in the hope that it will be useful,
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
-
# GNU General Public License for more details.
|
13
|
-
#
|
14
|
-
# You should have received a copy of the GNU General Public License
|
15
|
-
# along with this program; if not, write to the Free Software
|
16
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
17
|
-
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
18
|
-
# also available at http://www.gnu.org/copyleft/gpl.html.
|
19
|
-
|
20
|
-
class CreateEventHandlers < ActiveRecord::Migration
|
21
|
-
def self.up
|
22
|
-
create_table :event_handlers do |t|
|
23
|
-
t.references :managed_gem
|
24
|
-
t.string :event
|
25
|
-
t.string :handler
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.down
|
30
|
-
drop_table :event_handlers
|
31
|
-
end
|
32
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright (C) 2010 Red Hat, Inc.
|
3
|
-
# Written by Mohammed Morsi <mmorsi@redhat.com>
|
4
|
-
#
|
5
|
-
# This program is free software; you can redistribute it and/or modify
|
6
|
-
# it under the terms of the GNU General Public License as published by
|
7
|
-
# the Free Software Foundation; version 2 of the License.
|
8
|
-
#
|
9
|
-
# This program is distributed in the hope that it will be useful,
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
-
# GNU General Public License for more details.
|
13
|
-
#
|
14
|
-
# You should have received a copy of the GNU General Public License
|
15
|
-
# along with this program; if not, write to the Free Software
|
16
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
17
|
-
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
18
|
-
# also available at http://www.gnu.org/copyleft/gpl.html.
|
19
|
-
|
20
|
-
class CreateArtifacts < ActiveRecord::Migration
|
21
|
-
def self.up
|
22
|
-
create_table :artifacts do |t|
|
23
|
-
t.references :gem
|
24
|
-
t.string :type
|
25
|
-
t.string :location
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.down
|
30
|
-
drop_table :artifacts
|
31
|
-
end
|
32
|
-
end
|
data/db/schema.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
# This file is auto-generated from the current state of the database. Instead of editing this file,
|
2
|
-
# please use the migrations feature of Active Record to incrementally modify your database, and
|
3
|
-
# then regenerate this schema definition.
|
4
|
-
#
|
5
|
-
# Note that this schema.rb definition is the authoritative source for your database schema. If you need
|
6
|
-
# to create the application database on another system, you should be using db:schema:load, not running
|
7
|
-
# all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
8
|
-
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
9
|
-
#
|
10
|
-
# It's strongly recommended to check this file into your version control system.
|
11
|
-
|
12
|
-
ActiveRecord::Schema.define(:version => 5) do
|
13
|
-
|
14
|
-
create_table "artifacts", :force => true do |t|
|
15
|
-
t.integer "gem_id"
|
16
|
-
t.string "type"
|
17
|
-
t.string "location"
|
18
|
-
end
|
19
|
-
|
20
|
-
create_table "event_handlers", :force => true do |t|
|
21
|
-
t.integer "managed_gem_id"
|
22
|
-
t.string "event"
|
23
|
-
t.string "handler"
|
24
|
-
end
|
25
|
-
|
26
|
-
create_table "gem_search_criterias", :force => true do |t|
|
27
|
-
t.string "regex"
|
28
|
-
t.integer "gem_source_id"
|
29
|
-
end
|
30
|
-
|
31
|
-
create_table "gem_sources", :force => true do |t|
|
32
|
-
t.string "name"
|
33
|
-
t.string "uri"
|
34
|
-
end
|
35
|
-
|
36
|
-
create_table "managed_gems", :force => true do |t|
|
37
|
-
t.string "name"
|
38
|
-
t.string "version"
|
39
|
-
t.integer "gem_source_id"
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
data/db/seeds.rb
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
-
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
-
#
|
4
|
-
# Examples:
|
5
|
-
#
|
6
|
-
# cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
|
7
|
-
# Major.create(:name => 'Daley', :city => cities.first)
|
data/lib/email_adapter.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# Copyright (C) 2010 Red Hat, Inc.
|
2
|
-
# Written by Mohammed Morsi <mmorsi@redhat.com>
|
3
|
-
#
|
4
|
-
# This program is free software; you can redistribute it and/or modify
|
5
|
-
# it under the terms of the GNU General Public License as published by
|
6
|
-
# the Free Software Foundation; version 2 of the License.
|
7
|
-
#
|
8
|
-
# This program is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with this program; if not, write to the Free Software
|
15
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
16
|
-
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
17
|
-
# also available at http://www.gnu.org/copyleft/gpl.html.
|
18
|
-
|
19
|
-
require 'net/smtp'
|
20
|
-
|
21
|
-
# Adapts an email subsystem to polisher
|
22
|
-
class EmailAdapter
|
23
|
-
# send email w/ specified args
|
24
|
-
def self.send_email(args = {})
|
25
|
-
server = args[:server]
|
26
|
-
to = args[:to]
|
27
|
-
from = args[:from]
|
28
|
-
body = args[:body]
|
29
|
-
subject = args[:subject]
|
30
|
-
logger = args[:logger]
|
31
|
-
|
32
|
-
logger.info ">> sending email to #{to} from #{from} using smtp server #{server}" unless logger.nil?
|
33
|
-
msg = <<END_OF_MESSAGE
|
34
|
-
From: #{from}
|
35
|
-
To: #{to}
|
36
|
-
Subject: #{subject}
|
37
|
-
|
38
|
-
#{body}
|
39
|
-
END_OF_MESSAGE
|
40
|
-
|
41
|
-
Net::SMTP.start(server) do |smtp|
|
42
|
-
smtp.send_message msg, from, to
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
data/lib/gem2rpm.rb
DELETED
@@ -1,189 +0,0 @@
|
|
1
|
-
require 'erb'
|
2
|
-
require 'socket'
|
3
|
-
require 'rubygems/format'
|
4
|
-
|
5
|
-
# Adapt to the differences between rubygems < 1.0.0 and after
|
6
|
-
# Once we can be reasonably certain that everybody has version >= 1.0.0
|
7
|
-
# all this logic should be killed
|
8
|
-
GEM_VERSION = Gem::Version.create(Gem::RubyGemsVersion)
|
9
|
-
HAS_REMOTE_INSTALLER = GEM_VERSION < Gem::Version.create("1.0.0")
|
10
|
-
|
11
|
-
if HAS_REMOTE_INSTALLER
|
12
|
-
require 'rubygems/remote_installer'
|
13
|
-
end
|
14
|
-
|
15
|
-
# Extend String with a word_wrap method, which we use in the ERB template
|
16
|
-
# below. Taken with modification from the word_wrap method in ActionPack.
|
17
|
-
# Text::Format does the smae thing better.
|
18
|
-
class String
|
19
|
-
def word_wrap(line_width = 80)
|
20
|
-
gsub(/\n/, "\n\n").gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1\n").strip
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
module Gem
|
25
|
-
class Requirement
|
26
|
-
def rpm_version_transform(version)
|
27
|
-
if version == "> 0.0.0"
|
28
|
-
version = ""
|
29
|
-
end
|
30
|
-
version
|
31
|
-
end
|
32
|
-
|
33
|
-
def to_rpm
|
34
|
-
result = as_list
|
35
|
-
return result.map { |version| rpm_version_transform(version) }
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
module Gem2Rpm
|
42
|
-
Gem2Rpm::VERSION = "0.6.0"
|
43
|
-
|
44
|
-
if HAS_REMOTE_INSTALLER
|
45
|
-
def self.find_download_url(name, version)
|
46
|
-
installer = Gem::RemoteInstaller.new
|
47
|
-
dummy, download_path = installer.find_gem_to_install(name, "=#{version}")
|
48
|
-
download_path += "/gems/" if download_path.to_s != ""
|
49
|
-
return download_path
|
50
|
-
end
|
51
|
-
else
|
52
|
-
def self.find_download_url(name, version)
|
53
|
-
dep = Gem::Dependency.new(name, "=#{version}")
|
54
|
-
fetcher = Gem::SpecFetcher.fetcher
|
55
|
-
dummy, download_path = fetcher.find_matching(dep, false, false).first
|
56
|
-
download_path += "gems/" if download_path.to_s != ""
|
57
|
-
return download_path
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def Gem2Rpm.convert(fname, template=TEMPLATE, out=$stdout,
|
62
|
-
nongem=true, local=false)
|
63
|
-
format = Gem::Format.from_file_by_path(fname)
|
64
|
-
spec = format.spec
|
65
|
-
spec.description ||= spec.summary
|
66
|
-
download_path = ""
|
67
|
-
unless local
|
68
|
-
begin
|
69
|
-
download_path = find_download_url(spec.name, spec.version)
|
70
|
-
rescue Gem::Exception => e
|
71
|
-
$stderr.puts "Warning: Could not retrieve full URL for #{spec.name}\nWarning: Edit the specfile and enter the full download URL as 'Source0' manually"
|
72
|
-
$stderr.puts "#{e.inspect}"
|
73
|
-
end
|
74
|
-
end
|
75
|
-
template = ERB.new(template, 0, '<>')
|
76
|
-
out.puts template.result(binding)
|
77
|
-
end
|
78
|
-
|
79
|
-
# Returns the email address of the packager (i.e., the person running
|
80
|
-
# gem2spec). Taken from RPM macros if present, constructed from system
|
81
|
-
# username and hostname otherwise.
|
82
|
-
def Gem2Rpm.packager()
|
83
|
-
packager = `rpm --eval '%{packager}'`.chomp
|
84
|
-
if packager == '' or packager == '%{packager}'
|
85
|
-
packager = "FIXME"
|
86
|
-
#packager = "#{Etc::getpwnam(Etc::getlogin).gecos} <#{Etc::getlogin}@#{Socket::gethostname}>"
|
87
|
-
end
|
88
|
-
packager
|
89
|
-
end
|
90
|
-
|
91
|
-
TEMPLATE =
|
92
|
-
%q{# Generated from <%= File::basename(format.gem_path) %> by gem2rpm -*- rpm-spec -*-
|
93
|
-
%define ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")
|
94
|
-
%define gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
|
95
|
-
%define gemname <%= spec.name %>
|
96
|
-
%define geminstdir %{gemdir}/gems/%{gemname}-%{version}
|
97
|
-
|
98
|
-
Summary: <%= spec.summary.gsub(/\.$/, "") %>
|
99
|
-
Name: rubygem-%{gemname}
|
100
|
-
Version: <%= spec.version %>
|
101
|
-
Release: 1%{?dist}
|
102
|
-
Group: Development/Languages
|
103
|
-
License: GPLv2+ or Ruby
|
104
|
-
URL: <%= spec.homepage %>
|
105
|
-
Source0: <%= download_path %>%{gemname}-%{version}.gem
|
106
|
-
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
107
|
-
Requires: rubygems
|
108
|
-
<% for d in spec.dependencies %>
|
109
|
-
<% for req in d.version_requirements.to_rpm %>
|
110
|
-
Requires: rubygem(<%= d.name %>) <%= req %>
|
111
|
-
<% end %>
|
112
|
-
<% end %>
|
113
|
-
BuildRequires: rubygems
|
114
|
-
<% if spec.extensions.empty? %>
|
115
|
-
BuildArch: noarch
|
116
|
-
<% end %>
|
117
|
-
Provides: rubygem(%{gemname}) = %{version}
|
118
|
-
|
119
|
-
%description
|
120
|
-
<%= spec.description.to_s.chomp.word_wrap(78) + "\n" %>
|
121
|
-
|
122
|
-
<% if nongem %>
|
123
|
-
%package -n ruby-%{gemname}
|
124
|
-
Summary: <%= spec.summary.gsub(/\.$/, "") %>
|
125
|
-
Group: Development/Languages
|
126
|
-
Requires: rubygem(%{gemname}) = %{version}
|
127
|
-
<% spec.files.select{ |f| spec.require_paths.include?(File::dirname(f)) }.reject { |f| f =~ /\.rb$/ }.collect { |f| File::basename(f) }.each do |p| %>
|
128
|
-
Provides: ruby(<%= p %>) = %{version}
|
129
|
-
<% end %>
|
130
|
-
%description -n ruby-%{gemname}
|
131
|
-
<%= spec.description.to_s.chomp.word_wrap(78) + "\n" %>
|
132
|
-
<% end # if nongem %>
|
133
|
-
|
134
|
-
%prep
|
135
|
-
|
136
|
-
%build
|
137
|
-
|
138
|
-
%install
|
139
|
-
rm -rf %{buildroot}
|
140
|
-
mkdir -p %{buildroot}%{gemdir}
|
141
|
-
<% rdoc_opt = spec.has_rdoc ? "--rdoc " : "" %>
|
142
|
-
gem install --local --install-dir %{buildroot}%{gemdir} \
|
143
|
-
--force <%= rdoc_opt %>%{SOURCE0}
|
144
|
-
<% unless spec.executables.empty? %>
|
145
|
-
mkdir -p %{buildroot}/%{_bindir}
|
146
|
-
mv %{buildroot}%{gemdir}/bin/* %{buildroot}/%{_bindir}
|
147
|
-
rmdir %{buildroot}%{gemdir}/bin
|
148
|
-
find %{buildroot}%{geminstdir}/bin -type f | xargs chmod a+x
|
149
|
-
<% end %>
|
150
|
-
<% if nongem %>
|
151
|
-
mkdir -p %{buildroot}%{ruby_sitelib}
|
152
|
-
<% spec.files.select{ |f| spec.require_paths.include?(File::dirname(f)) }.each do |p| %>
|
153
|
-
ln -s %{gemdir}/gems/%{gemname}-%{version}/<%= p %> %{buildroot}%{ruby_sitelib}
|
154
|
-
<% end %>
|
155
|
-
<% end # if nongem %>
|
156
|
-
|
157
|
-
%clean
|
158
|
-
rm -rf %{buildroot}
|
159
|
-
|
160
|
-
%files
|
161
|
-
%defattr(-, root, root, -)
|
162
|
-
<% for f in spec.executables %>
|
163
|
-
%{_bindir}/<%= f %>
|
164
|
-
<% end %>
|
165
|
-
%{gemdir}/gems/%{gemname}-%{version}/
|
166
|
-
<% if spec.has_rdoc %>
|
167
|
-
%doc %{gemdir}/doc/%{gemname}-%{version}
|
168
|
-
<% end %>
|
169
|
-
<% for f in spec.extra_rdoc_files %>
|
170
|
-
%doc %{geminstdir}/<%= f %>
|
171
|
-
<% end %>
|
172
|
-
%{gemdir}/cache/%{gemname}-%{version}.gem
|
173
|
-
%{gemdir}/specifications/%{gemname}-%{version}.gemspec
|
174
|
-
|
175
|
-
<% if nongem %>
|
176
|
-
%files -n ruby-%{gemname}
|
177
|
-
%defattr(-, root, root, -)
|
178
|
-
%{ruby_sitelib}/*
|
179
|
-
<% end # if nongem %>
|
180
|
-
|
181
|
-
%changelog
|
182
|
-
* <%= Time.now.strftime("%a %b %d %Y") %> <%= packager %> - <%= spec.version %>-1
|
183
|
-
- Initial package
|
184
|
-
}
|
185
|
-
end
|
186
|
-
|
187
|
-
# Local Variables:
|
188
|
-
# ruby-indent-level: 2
|
189
|
-
# End:
|
data/lib/gem_api_adapter.rb
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
# Copyright (C) 2010 Red Hat, Inc.
|
2
|
-
# Written by Mohammed Morsi <mmorsi@redhat.com>
|
3
|
-
#
|
4
|
-
# This program is free software; you can redistribute it and/or modify
|
5
|
-
# it under the terms of the GNU General Public License as published by
|
6
|
-
# the Free Software Foundation; version 2 of the License.
|
7
|
-
#
|
8
|
-
# This program is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with this program; if not, write to the Free Software
|
15
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
16
|
-
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
17
|
-
# also available at http://www.gnu.org/copyleft/gpl.html.
|
18
|
-
|
19
|
-
require 'uri'
|
20
|
-
require 'net/http'
|
21
|
-
#require 'net/https'
|
22
|
-
require 'json'
|
23
|
-
|
24
|
-
# Adapts the gem(cutter) api to polisher
|
25
|
-
# http://gemcutter.org/pages/api_docs
|
26
|
-
class GemApiAdapter
|
27
|
-
# retrieve gem information
|
28
|
-
def self.gem_info(args = {})
|
29
|
-
api_uri = args[:api_uri]
|
30
|
-
gem_name = args[:gem_name]
|
31
|
-
logger = args[:logger]
|
32
|
-
|
33
|
-
get_path = "/api/v1/gems/#{gem_name}.json"
|
34
|
-
|
35
|
-
logger.info ">> getting gem #{gem_name} info from #{api_uri}#{get_path}" unless logger.nil?
|
36
|
-
http = Net::HTTP.new(URI.parse(api_uri).host, 80)
|
37
|
-
res = http.get(get_path)
|
38
|
-
logger.info ">> received #{res.body}"
|
39
|
-
JSON.parse(res.body)
|
40
|
-
end
|
41
|
-
|
42
|
-
# use api endpoint/credentials to add subscription for specified gem / url
|
43
|
-
def self.subscribe(args = {})
|
44
|
-
api_uri = args[:api_uri]
|
45
|
-
api_key = args[:api_key]
|
46
|
-
gem_name = args[:gem_name]
|
47
|
-
callback_url = args[:callback_url]
|
48
|
-
logger = args[:logger]
|
49
|
-
|
50
|
-
subscribe_path = '/api/v1/web_hooks'
|
51
|
-
|
52
|
-
http = Net::HTTP.new(URI.parse(api_uri).host, 80)
|
53
|
-
data = "gem_name=#{gem_name}&url=#{callback_url}"
|
54
|
-
headers = { 'Authorization' => api_key }
|
55
|
-
logger.info ">> sending http request to #{URI.parse(api_uri).host}#{subscribe_path}; data:#{data}; headers:#{headers}"
|
56
|
-
res = http.post(subscribe_path, data, headers)
|
57
|
-
# FIXME handle res = #<Net::HTTPNotFound:0x7f1df8319e40> This gem could not be found
|
58
|
-
logger.info ">> http response received #{res} #{res.body}"
|
59
|
-
end
|
60
|
-
|
61
|
-
# retrieve gem and save to file
|
62
|
-
def self.get_gem(args = {})
|
63
|
-
uri = args[:uri]
|
64
|
-
gemfile = args[:file]
|
65
|
-
logger = args[:logger]
|
66
|
-
|
67
|
-
# handle redirects
|
68
|
-
found = false
|
69
|
-
until found # FIXME should impose a max tries
|
70
|
-
gem_uri = URI.parse(uri)
|
71
|
-
http = Net::HTTP.new(gem_uri.host, 80)
|
72
|
-
res = http.get(gem_uri.path)
|
73
|
-
if res.code == "200"
|
74
|
-
File.open(gemfile, "wb") { |f| f.write res.body }
|
75
|
-
found = true
|
76
|
-
else
|
77
|
-
uri = res.header['location']
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
# helper, convert gem uri to source uri
|
83
|
-
def self.gem_to_source_uri(gem_uri)
|
84
|
-
uri = URI.parse(gem_uri)
|
85
|
-
return uri.scheme + "://" + uri.host
|
86
|
-
end
|
87
|
-
end
|
data/lib/rpm_adapter.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# Copyright (C) 2010 Red Hat, Inc.
|
2
|
-
# Written by Mohammed Morsi <mmorsi@redhat.com>
|
3
|
-
#
|
4
|
-
# This program is free software; you can redistribute it and/or modify
|
5
|
-
# it under the terms of the GNU General Public License as published by
|
6
|
-
# the Free Software Foundation; version 2 of the License.
|
7
|
-
#
|
8
|
-
# This program is distributed in the hope that it will be useful,
|
9
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
-
# GNU General Public License for more details.
|
12
|
-
#
|
13
|
-
# You should have received a copy of the GNU General Public License
|
14
|
-
# along with this program; if not, write to the Free Software
|
15
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
16
|
-
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
17
|
-
# also available at http://www.gnu.org/copyleft/gpl.html.
|
18
|
-
|
19
|
-
# use gem2rpm to create rpm from gem
|
20
|
-
require 'gem2rpm'
|
21
|
-
|
22
|
-
# Adapts rpm subsystem to polisher
|
23
|
-
class RpmAdapter
|
24
|
-
# build rpm from specified args
|
25
|
-
def self.build(args = {})
|
26
|
-
gem = args[:gem]
|
27
|
-
logger = args[:logger]
|
28
|
-
outfile = "../tmp/rpms/#{gem.name}-#{gem.version}.spec." + Time.now.strftime("%y%m%d%H%M%S")
|
29
|
-
outfh = File.open(outfile, "wb")
|
30
|
-
|
31
|
-
# get gem / write to file
|
32
|
-
gemfile = "../tmp/gems/#{gem.name}-#{gem.version}.gem"
|
33
|
-
logger.info ">> retreive gem from #{gem.uri} and writing to #{Dir.pwd}/#{gemfile}"
|
34
|
-
GemApiAdapter.get_gem :uri => gem.uri, :file => gemfile, :logger => logger
|
35
|
-
|
36
|
-
logger.info ">> generating rpm spec #{outfile} from gemfile #{gemfile}" unless logger.nil?
|
37
|
-
Gem2Rpm::convert gemfile, Gem2Rpm::TEMPLATE, outfh
|
38
|
-
end
|
39
|
-
end
|
data/public/404.html
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
-
|
6
|
-
<head>
|
7
|
-
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
8
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
9
|
-
<style type="text/css">
|
10
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
11
|
-
div.dialog {
|
12
|
-
width: 25em;
|
13
|
-
padding: 0 4em;
|
14
|
-
margin: 4em auto 0 auto;
|
15
|
-
border: 1px solid #ccc;
|
16
|
-
border-right-color: #999;
|
17
|
-
border-bottom-color: #999;
|
18
|
-
}
|
19
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
20
|
-
</style>
|
21
|
-
</head>
|
22
|
-
|
23
|
-
<body>
|
24
|
-
<!-- This file lives in public/404.html -->
|
25
|
-
<div class="dialog">
|
26
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
27
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
28
|
-
</div>
|
29
|
-
</body>
|
30
|
-
</html>
|
data/public/422.html
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
-
|
6
|
-
<head>
|
7
|
-
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
8
|
-
<title>The change you wanted was rejected (422)</title>
|
9
|
-
<style type="text/css">
|
10
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
11
|
-
div.dialog {
|
12
|
-
width: 25em;
|
13
|
-
padding: 0 4em;
|
14
|
-
margin: 4em auto 0 auto;
|
15
|
-
border: 1px solid #ccc;
|
16
|
-
border-right-color: #999;
|
17
|
-
border-bottom-color: #999;
|
18
|
-
}
|
19
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
20
|
-
</style>
|
21
|
-
</head>
|
22
|
-
|
23
|
-
<body>
|
24
|
-
<!-- This file lives in public/422.html -->
|
25
|
-
<div class="dialog">
|
26
|
-
<h1>The change you wanted was rejected.</h1>
|
27
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
28
|
-
</div>
|
29
|
-
</body>
|
30
|
-
</html>
|
data/public/500.html
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
-
|
6
|
-
<head>
|
7
|
-
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
8
|
-
<title>We're sorry, but something went wrong (500)</title>
|
9
|
-
<style type="text/css">
|
10
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
11
|
-
div.dialog {
|
12
|
-
width: 25em;
|
13
|
-
padding: 0 4em;
|
14
|
-
margin: 4em auto 0 auto;
|
15
|
-
border: 1px solid #ccc;
|
16
|
-
border-right-color: #999;
|
17
|
-
border-bottom-color: #999;
|
18
|
-
}
|
19
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
20
|
-
</style>
|
21
|
-
</head>
|
22
|
-
|
23
|
-
<body>
|
24
|
-
<!-- This file lives in public/500.html -->
|
25
|
-
<div class="dialog">
|
26
|
-
<h1>We're sorry, but something went wrong.</h1>
|
27
|
-
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
28
|
-
</div>
|
29
|
-
</body>
|
30
|
-
</html>
|
data/public/dispatch.cgi
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
|
3
|
-
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
|
4
|
-
|
5
|
-
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
|
6
|
-
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
|
7
|
-
require "dispatcher"
|
8
|
-
|
9
|
-
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
|
10
|
-
Dispatcher.dispatch
|
data/public/dispatch.fcgi
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
#
|
3
|
-
# You may specify the path to the FastCGI crash log (a log of unhandled
|
4
|
-
# exceptions which forced the FastCGI instance to exit, great for debugging)
|
5
|
-
# and the number of requests to process before running garbage collection.
|
6
|
-
#
|
7
|
-
# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
|
8
|
-
# and the GC period is nil (turned off). A reasonable number of requests
|
9
|
-
# could range from 10-100 depending on the memory footprint of your app.
|
10
|
-
#
|
11
|
-
# Example:
|
12
|
-
# # Default log path, normal GC behavior.
|
13
|
-
# RailsFCGIHandler.process!
|
14
|
-
#
|
15
|
-
# # Default log path, 50 requests between GC.
|
16
|
-
# RailsFCGIHandler.process! nil, 50
|
17
|
-
#
|
18
|
-
# # Custom log path, normal GC behavior.
|
19
|
-
# RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log'
|
20
|
-
#
|
21
|
-
require File.dirname(__FILE__) + "/../config/environment"
|
22
|
-
require 'fcgi_handler'
|
23
|
-
|
24
|
-
RailsFCGIHandler.process!
|
data/public/dispatch.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
#
|
3
|
-
# Copyright (C) 2008 Red Hat, Inc.
|
4
|
-
# Written by Scott Seago <sseago@redhat.com>
|
5
|
-
#
|
6
|
-
# This program is free software; you can redistribute it and/or modify
|
7
|
-
# it under the terms of the GNU General Public License as published by
|
8
|
-
# the Free Software Foundation; version 2 of the License.
|
9
|
-
#
|
10
|
-
# This program is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
# GNU General Public License for more details.
|
14
|
-
#
|
15
|
-
# You should have received a copy of the GNU General Public License
|
16
|
-
# along with this program; if not, write to the Free Software
|
17
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18
|
-
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
19
|
-
# also available at http://www.gnu.org/copyleft/gpl.html.
|
20
|
-
|
21
|
-
|
22
|
-
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
|
23
|
-
|
24
|
-
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
|
25
|
-
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
|
26
|
-
require "dispatcher"
|
27
|
-
|
28
|
-
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
|
29
|
-
Dispatcher.dispatch
|
data/public/favicon.ico
DELETED
File without changes
|
data/public/images/rails.png
DELETED
Binary file
|