puppet-forge-server 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -0
- data/lib/puppet_forge_server.rb +1 -0
- data/lib/puppet_forge_server/app/frontend.rb +59 -0
- data/lib/puppet_forge_server/app/public/css/puppetlabs.css +269 -0
- data/lib/puppet_forge_server/app/public/img/forge-logo.png +0 -0
- data/lib/puppet_forge_server/app/public/js/internal.js +25 -0
- data/lib/puppet_forge_server/app/views/index.haml +17 -0
- data/lib/puppet_forge_server/app/views/layout.haml +61 -0
- data/lib/puppet_forge_server/app/views/modules.haml +25 -0
- data/lib/puppet_forge_server/errors.rb +1 -1
- data/lib/puppet_forge_server/server.rb +6 -3
- data/lib/puppet_forge_server/utils/option_parser.rb +8 -1
- data/lib/puppet_forge_server/version.rb +1 -1
- data/puppet-forge-server.gemspec +1 -0
- data/spec/unit/server_spec.rb +2 -2
- metadata +23 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58520b3a933877bd6024c1e55258c4b5989e6e79
|
4
|
+
data.tar.gz: 7ba4f0509f1a7b4856f3f471c54685b20e610408
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 813db4f7c2fe027abc61954e855bbf317a30d1ad52cd8320c395fc85adb6691857c0403f58825a3997e3b225c07033e33af2ec7a7546704f67c9a8b00d010cde
|
7
|
+
data.tar.gz: 5b51e814c2006f7aea60a82837d9133528b32dda10c17952bc350340eb50a3610fe6c7079becd59f5be7b7bcd8ac54a8cf83683f7360c30c21a405f769ac89eb
|
data/README.md
CHANGED
@@ -8,6 +8,26 @@ Private Puppet Forge Server supporting local files and both v1 and v3 API proxie
|
|
8
8
|
Puppet Forge Server provides approximated implementation of both [v1](https://projects.puppetlabs.com/projects/module-site/wiki/Server-api)
|
9
9
|
and [v3](https://forgeapi.puppetlabs.com/) APIs, but behavioral deviations from the official implementation might occur.
|
10
10
|
|
11
|
+
## Table of Contents
|
12
|
+
|
13
|
+
* [Installation](#installation)
|
14
|
+
* [Getting Started](#getting-started)
|
15
|
+
* [Proxy](#proxy)
|
16
|
+
* [Proxy the official Puppet Forge v3 API](#proxy-the-official-puppet-forge-v3-api)
|
17
|
+
* [Proxy the official Puppet Forge v1 API and local Pulp puppet repository](#proxy-the-official-puppet-forge-v1-api-and-local-pulp-puppet-repository)
|
18
|
+
* [Locally stored modules](#locally-stored-modules)
|
19
|
+
* [All-in](#all-in)
|
20
|
+
* [Daemon](#daemon)
|
21
|
+
* [Web UI](#web-ui)
|
22
|
+
* [Architecture](#command-reference)
|
23
|
+
* [API (view)](#api-view)
|
24
|
+
* [App (controller)](#app-controller)
|
25
|
+
* [Models](#models)
|
26
|
+
* [Backends](#backends)
|
27
|
+
* [TODO](#todo)
|
28
|
+
* [Limitations](#limitations)
|
29
|
+
* [Reference](#reference)
|
30
|
+
|
11
31
|
## Installation
|
12
32
|
|
13
33
|
Install the gem
|
@@ -107,6 +127,12 @@ sudo -u forge puppet-forge-server -D -m /opt/forge/modules -x https://forgeapi.p
|
|
107
127
|
|
108
128
|
You are done. Now go install some puppet modules.
|
109
129
|
|
130
|
+
## Web UI
|
131
|
+
|
132
|
+
Puppet forge server comes with built-in web UI looking very similar to the official puppet forge web page and providing a simple module search feature. Each view haml file corresponds to the request endpoint; for example **/** or index is formed by the index.haml located in the *views* directory and obviously combined with layout.haml that is being refered to during any request.
|
133
|
+
|
134
|
+
It is possible to set an external web UI root directory containing at least *views* directory with required haml files. See https://github.com/unibet/puppet-forge-server/tree/master/lib/puppet_forge_server/app/views for built-in reference implementation.
|
135
|
+
|
110
136
|
## Architecture
|
111
137
|
|
112
138
|
Code is structured with MVC in mind to allow easier maintenance and readability
|
data/lib/puppet_forge_server.rb
CHANGED
@@ -34,6 +34,7 @@ module PuppetForgeServer
|
|
34
34
|
end
|
35
35
|
|
36
36
|
module App
|
37
|
+
autoload :Frontend, 'puppet_forge_server/app/frontend'
|
37
38
|
autoload :Generic, 'puppet_forge_server/app/generic'
|
38
39
|
autoload :Version1, 'puppet_forge_server/app/version1'
|
39
40
|
autoload :Version2, 'puppet_forge_server/app/version2'
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 North Development AB
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
require 'sinatra/base'
|
18
|
+
require 'haml'
|
19
|
+
require 'json'
|
20
|
+
|
21
|
+
module PuppetForgeServer::App
|
22
|
+
class Frontend < Sinatra::Base
|
23
|
+
|
24
|
+
configure do
|
25
|
+
set :haml, :format => :html5
|
26
|
+
enable :logging
|
27
|
+
use ::Rack::CommonLogger, PuppetForgeServer::Logger.get(:access)
|
28
|
+
end
|
29
|
+
|
30
|
+
before do
|
31
|
+
env['rack.errors'] = PuppetForgeServer::Logger.get(:server)
|
32
|
+
end
|
33
|
+
|
34
|
+
def initialize(root, http_client = PuppetForgeServer::Http::HttpClient.new)
|
35
|
+
super(nil)
|
36
|
+
settings.root = root
|
37
|
+
@http_client = http_client
|
38
|
+
end
|
39
|
+
|
40
|
+
get '/' do
|
41
|
+
haml :index
|
42
|
+
end
|
43
|
+
|
44
|
+
get '/modules' do
|
45
|
+
query = params[:query]
|
46
|
+
modules = get("#{request.base_url}/v3/modules?query=#{query}")['results']
|
47
|
+
haml :modules, :locals => {:query => query, :modules => modules}
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
def get(relative_url)
|
52
|
+
begin
|
53
|
+
JSON.parse(@http_client.get(relative_url))
|
54
|
+
rescue
|
55
|
+
{'results' => []}
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,269 @@
|
|
1
|
+
/*
|
2
|
+
* -*- encoding: utf-8 -*-
|
3
|
+
*
|
4
|
+
* Copyright 2014 North Development AB
|
5
|
+
*
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
* you may not use this file except in compliance with the License.
|
8
|
+
* You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
* See the License for the specific language governing permissions and
|
16
|
+
* limitations under the License.
|
17
|
+
*/
|
18
|
+
|
19
|
+
body {
|
20
|
+
background: #fff;
|
21
|
+
color: #5d5e59;
|
22
|
+
font-family: 'PT Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
23
|
+
line-height: 1.4;
|
24
|
+
padding-top: 40px;
|
25
|
+
}
|
26
|
+
/* navbar */
|
27
|
+
.navbar {
|
28
|
+
max-height:40px;
|
29
|
+
min-height:40px;
|
30
|
+
margin: 0px;
|
31
|
+
padding: 0px;
|
32
|
+
}
|
33
|
+
.navbar-default {
|
34
|
+
background-color: #302C6D;
|
35
|
+
border: none;
|
36
|
+
font-family: 'PT Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
37
|
+
font-size: 100%;
|
38
|
+
line-height: 20px;
|
39
|
+
}
|
40
|
+
/* link */
|
41
|
+
.navbar-default .navbar-nav > li > a {
|
42
|
+
color: #fff;
|
43
|
+
line-height: 20px;
|
44
|
+
padding: 10px;
|
45
|
+
}
|
46
|
+
.navbar-default .navbar-nav > li > a:hover,
|
47
|
+
.navbar-default .navbar-nav > li > a:focus {
|
48
|
+
color: #fff;
|
49
|
+
text-decoration: underline;
|
50
|
+
}
|
51
|
+
.navbar-default .navbar-nav > .active > a,
|
52
|
+
.navbar-default .navbar-nav > .active > a:hover,
|
53
|
+
.navbar-default .navbar-nav > .active > a:focus {
|
54
|
+
color: #fff;
|
55
|
+
background-color: #302C6D;
|
56
|
+
}
|
57
|
+
.navbar-default .navbar-nav > .open > a,
|
58
|
+
.navbar-default .navbar-nav > .open > a:hover,
|
59
|
+
.navbar-default .navbar-nav > .open > a:focus {
|
60
|
+
color: #fff;
|
61
|
+
background-color: #302C6D;
|
62
|
+
}
|
63
|
+
/* mobile version */
|
64
|
+
.navbar-default .navbar-toggle {
|
65
|
+
border: none;
|
66
|
+
}
|
67
|
+
.navbar-default .navbar-toggle:hover,
|
68
|
+
.navbar-default .navbar-toggle:focus {
|
69
|
+
background-color: #302C6D;
|
70
|
+
}
|
71
|
+
.navbar-default .navbar-toggle .icon-bar {
|
72
|
+
background-color: #302C6D;
|
73
|
+
}
|
74
|
+
@media (max-width: 767px) {
|
75
|
+
.navbar-default .navbar-nav .open .dropdown-menu > li > a {
|
76
|
+
color: #fff;
|
77
|
+
}
|
78
|
+
.navbar-default .navbar-nav .open .dropdown-menu > li > a:hover,
|
79
|
+
.navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {
|
80
|
+
color: #fff;
|
81
|
+
text-decoration: underline;
|
82
|
+
}
|
83
|
+
}
|
84
|
+
.section {
|
85
|
+
padding-right: 5%;
|
86
|
+
padding-left: 5%;
|
87
|
+
width: 90%;
|
88
|
+
display: block;
|
89
|
+
border: 0;
|
90
|
+
outline: 0;
|
91
|
+
font-weight: inherit;
|
92
|
+
font-style: inherit;
|
93
|
+
font-size: 100%;
|
94
|
+
font-family: inherit;
|
95
|
+
vertical-align: baseline;
|
96
|
+
}
|
97
|
+
.section#header {
|
98
|
+
width: 100%;
|
99
|
+
z-index: 2;
|
100
|
+
position: relative;
|
101
|
+
margin: 0 auto;
|
102
|
+
background: #F7F6F4;
|
103
|
+
height: 95px;
|
104
|
+
border-bottom: 2px solid #c4c4c5;
|
105
|
+
box-shadow: rgba(0, 0, 0, 0.15) 0 0 20px;
|
106
|
+
}
|
107
|
+
.section#header #logo {
|
108
|
+
float: left;
|
109
|
+
width: 20%;
|
110
|
+
}
|
111
|
+
.section#header #logo a {
|
112
|
+
text-decoration: none;
|
113
|
+
}
|
114
|
+
.section#header img.logo {
|
115
|
+
position: relative;
|
116
|
+
top: 15px;
|
117
|
+
left: 5px;
|
118
|
+
float: left;
|
119
|
+
}
|
120
|
+
.section .site-width {
|
121
|
+
width: 90%;
|
122
|
+
max-width: 1300px;
|
123
|
+
min-width: 940px;
|
124
|
+
margin: 0 auto;
|
125
|
+
position: relative;
|
126
|
+
}
|
127
|
+
.section#header .top-search {
|
128
|
+
float: left;
|
129
|
+
box-sizing: border-box;
|
130
|
+
padding-left: 10%;
|
131
|
+
width: 54%;
|
132
|
+
padding-top: 1.5em;
|
133
|
+
}
|
134
|
+
.clearfix {
|
135
|
+
display: block;
|
136
|
+
}
|
137
|
+
input[type=search] {
|
138
|
+
width: 80%;
|
139
|
+
max-width: 650px;
|
140
|
+
padding: 0.5em;
|
141
|
+
}
|
142
|
+
input[type="submit"],
|
143
|
+
textarea[type="submit"] {
|
144
|
+
background: #76c642;
|
145
|
+
color: #fff;
|
146
|
+
white-space: nowrap;
|
147
|
+
border: 0;
|
148
|
+
display: inline-block;
|
149
|
+
padding: 0.5em 1em 0.5em;
|
150
|
+
margin-right: 1em;
|
151
|
+
}
|
152
|
+
input[type="submit"].search-btn,
|
153
|
+
textarea[type="submit"].search-btn {
|
154
|
+
padding: 0.5em;
|
155
|
+
margin-right: 0em;
|
156
|
+
}
|
157
|
+
input[type="submit"]:hover,
|
158
|
+
textarea[type="submit"]:hover {
|
159
|
+
color: #fff;
|
160
|
+
text-decoration: none;
|
161
|
+
cursor: pointer;
|
162
|
+
background: #92d269;
|
163
|
+
}
|
164
|
+
input, textarea {
|
165
|
+
cursor: auto;
|
166
|
+
height: 40px;
|
167
|
+
border: 1px solid #CCC;
|
168
|
+
color: #777;
|
169
|
+
margin: 0em;
|
170
|
+
font-family: 'Lucida Grande';
|
171
|
+
font-size: 16px;
|
172
|
+
text-rendering: auto;
|
173
|
+
letter-spacing: normal;
|
174
|
+
word-spacing: normal;
|
175
|
+
text-transform: none;
|
176
|
+
text-indent: 0px;
|
177
|
+
text-shadow: none;
|
178
|
+
display: inline-block;
|
179
|
+
text-align: start;
|
180
|
+
}
|
181
|
+
section#content {
|
182
|
+
padding-top: 2em;
|
183
|
+
padding-bottom: 4em;
|
184
|
+
background: white;
|
185
|
+
}
|
186
|
+
h1,
|
187
|
+
h2,
|
188
|
+
h3,
|
189
|
+
h4 {
|
190
|
+
font-family: Arvo, 'PT Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
191
|
+
color: #6c6d6d;
|
192
|
+
font-weight: normal;
|
193
|
+
line-height: 1.15em;
|
194
|
+
margin: 1em 0px 0.25em;
|
195
|
+
}
|
196
|
+
h1 {
|
197
|
+
font-size: 36px;
|
198
|
+
}
|
199
|
+
h3.search-results-title {
|
200
|
+
float: left;
|
201
|
+
width: 55%;
|
202
|
+
}
|
203
|
+
.list-container {
|
204
|
+
float: right;
|
205
|
+
width: 73%;
|
206
|
+
}
|
207
|
+
.list {
|
208
|
+
list-style-type: none;
|
209
|
+
margin-left: 0;
|
210
|
+
}
|
211
|
+
.list > li {
|
212
|
+
position: relative;
|
213
|
+
min-height: 87px;
|
214
|
+
padding: 1em 0;
|
215
|
+
margin: 0;
|
216
|
+
border-bottom: solid 1px #cccccc;
|
217
|
+
}
|
218
|
+
ul, ol, dl {
|
219
|
+
margin-bottom: 1.5em;
|
220
|
+
margin-left: 0;
|
221
|
+
list-style-position: inside;
|
222
|
+
}
|
223
|
+
ol, ul {
|
224
|
+
list-style: none;
|
225
|
+
}
|
226
|
+
li {
|
227
|
+
line-height: 1.5em;
|
228
|
+
margin-bottom: 0.5em;
|
229
|
+
}
|
230
|
+
.list.modules .col {
|
231
|
+
width: 90%;
|
232
|
+
}
|
233
|
+
.list.modules .col {
|
234
|
+
float: left;
|
235
|
+
box-sizing: border-box;
|
236
|
+
}
|
237
|
+
.list.modules .col h3 {
|
238
|
+
margin: 0.25em 0 0.25em 0;
|
239
|
+
}
|
240
|
+
.list.modules .summary {
|
241
|
+
padding-right: 40px;
|
242
|
+
}
|
243
|
+
p.release-info {
|
244
|
+
font-size: 0.9em;
|
245
|
+
color: #6c6d6d;
|
246
|
+
}
|
247
|
+
p {
|
248
|
+
margin: 0;
|
249
|
+
}
|
250
|
+
span.search_error {
|
251
|
+
padding-top: 5px;
|
252
|
+
float: left;
|
253
|
+
color: #f00;
|
254
|
+
}
|
255
|
+
span.logo {
|
256
|
+
font-size: 26px;
|
257
|
+
position: relative;
|
258
|
+
font-weight: bold;
|
259
|
+
}
|
260
|
+
span.puppet {
|
261
|
+
top: 15px;
|
262
|
+
left: 5px;
|
263
|
+
color: #2B235F;
|
264
|
+
float: left;
|
265
|
+
}
|
266
|
+
span.forge {
|
267
|
+
color: #6B529A;
|
268
|
+
float: right;
|
269
|
+
}
|
Binary file
|
@@ -0,0 +1,25 @@
|
|
1
|
+
/*
|
2
|
+
* -*- encoding: utf-8 -*-
|
3
|
+
*
|
4
|
+
* Copyright 2014 North Development AB
|
5
|
+
*
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
* you may not use this file except in compliance with the License.
|
8
|
+
* You may obtain a copy of the License at
|
9
|
+
*
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
*
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
* See the License for the specific language governing permissions and
|
16
|
+
* limitations under the License.
|
17
|
+
*/
|
18
|
+
|
19
|
+
$('.search-btn').click(function() {
|
20
|
+
var emptyInputs = $(this).parent().find('input[type="search"]').filter(function() { return $(this).val() == ""; });
|
21
|
+
if (emptyInputs.length) {
|
22
|
+
$('span.search_error').text('Search query was empty!');
|
23
|
+
return false;
|
24
|
+
}
|
25
|
+
});
|
@@ -0,0 +1,17 @@
|
|
1
|
+
-# -*- encoding: utf-8 -*-
|
2
|
+
-#
|
3
|
+
-# Copyright 2014 North Development AB
|
4
|
+
-#
|
5
|
+
-# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
-# you may not use this file except in compliance with the License.
|
7
|
+
-# You may obtain a copy of the License at
|
8
|
+
-#
|
9
|
+
-# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
-#
|
11
|
+
-# Unless required by applicable law or agreed to in writing, software
|
12
|
+
-# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
-# See the License for the specific language governing permissions and
|
15
|
+
-# limitations under the License.
|
16
|
+
|
17
|
+
%h1 Welcome to your Internal Puppet Forge
|
@@ -0,0 +1,61 @@
|
|
1
|
+
-# -*- encoding: utf-8 -*-
|
2
|
+
-#
|
3
|
+
-# Copyright 2014 North Development AB
|
4
|
+
-#
|
5
|
+
-# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
-# you may not use this file except in compliance with the License.
|
7
|
+
-# You may obtain a copy of the License at
|
8
|
+
-#
|
9
|
+
-# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
-#
|
11
|
+
-# Unless required by applicable law or agreed to in writing, software
|
12
|
+
-# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
-# See the License for the specific language governing permissions and
|
15
|
+
-# limitations under the License.
|
16
|
+
|
17
|
+
!!!
|
18
|
+
%html
|
19
|
+
%head
|
20
|
+
%meta{ :charset => 'utf-8' }
|
21
|
+
%title Internal Puppet Forge
|
22
|
+
-# Latest compiled and minified CSS
|
23
|
+
%link{ :href => 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css', :type => 'text/css', :rel => 'stylesheet' }
|
24
|
+
%link{ :href => 'css/puppetlabs.css', :type => 'text/css', :rel => 'stylesheet' }
|
25
|
+
-#%link{ :href => 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css', :type => 'text/css', :rel => 'stylesheet' }
|
26
|
+
/[if lt IE 9]
|
27
|
+
%script{:src => 'https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js'}
|
28
|
+
%script{:src => 'https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js'}
|
29
|
+
%body
|
30
|
+
.navbar.navbar-default.navbar-fixed-top{ :role => 'navigation' }
|
31
|
+
.container
|
32
|
+
.navbar-header
|
33
|
+
%button.navbar-toggle{ :type => 'button', 'data-toggle' => 'collapse', 'data-target' => '.navbar-collapse'}
|
34
|
+
%span.sr-only Toggle Navigation
|
35
|
+
%span.icon-bar
|
36
|
+
%span.icon-bar
|
37
|
+
%span.icon-bar
|
38
|
+
.collapse.navbar-collapse
|
39
|
+
%ul.nav.navbar-nav.navbar-right
|
40
|
+
%li.active
|
41
|
+
%a{:href => 'https://forge.puppetlabs.com/', :target => 'official-puppet-forge'} Official Puppet Forge
|
42
|
+
%li
|
43
|
+
%a{:href => 'https://github.com/unibet/puppet-forge-server', :target => 'puppet-forge-server-github'} Help
|
44
|
+
%script{ :src => 'https://code.jquery.com/jquery-2.1.3.min.js' }
|
45
|
+
.section#header
|
46
|
+
.side-width.clearfix
|
47
|
+
%a{:href => '/'}
|
48
|
+
#logo
|
49
|
+
%img.logo{ :src => 'img/forge-logo.png', :height => 65}
|
50
|
+
%span.logo.puppet= 'Puppet Forge'
|
51
|
+
%span.logo.forge= 'Server'
|
52
|
+
.top-search
|
53
|
+
%form{:action => '/modules', :method=>'get'}
|
54
|
+
%input{ :type => 'search', :name=>'query', :placeholder=>'Search modules', :autofocus=>''}
|
55
|
+
%input.search-btn{ :type=>'submit', :value=>'Find'}
|
56
|
+
%span.search_error= ''
|
57
|
+
.section#content
|
58
|
+
.side-width.clearfix
|
59
|
+
= yield
|
60
|
+
%script{ :src => 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js' }
|
61
|
+
%script{ :src => 'js/internal.js' }
|
@@ -0,0 +1,25 @@
|
|
1
|
+
-# -*- encoding: utf-8 -*-
|
2
|
+
-#
|
3
|
+
-# Copyright 2014 North Development AB
|
4
|
+
-#
|
5
|
+
-# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
-# you may not use this file except in compliance with the License.
|
7
|
+
-# You may obtain a copy of the License at
|
8
|
+
-#
|
9
|
+
-# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
-#
|
11
|
+
-# Unless required by applicable law or agreed to in writing, software
|
12
|
+
-# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
-# See the License for the specific language governing permissions and
|
15
|
+
-# limitations under the License.
|
16
|
+
|
17
|
+
%h3.search-results-title Found #{modules.count} module matching '#{query}'
|
18
|
+
.list-container
|
19
|
+
%ul.list.modules
|
20
|
+
- modules.each do |element|
|
21
|
+
%li.clearfix
|
22
|
+
.col
|
23
|
+
%h3= "#{element['owner']['username']}/#{element['name']}"
|
24
|
+
%p= element['current_release']['metadata']['summary']
|
25
|
+
%p.release-info= "Version #{element['current_release']['metadata']['version']}"
|
@@ -22,14 +22,16 @@ module PuppetForgeServer
|
|
22
22
|
include PuppetForgeServer::Utils::Http
|
23
23
|
|
24
24
|
def go(args)
|
25
|
+
# Initial logger in case error occurs before logging options have been processed
|
26
|
+
@log = PuppetForgeServer::Logger.get
|
25
27
|
begin
|
26
28
|
options = parse_options(args)
|
27
29
|
@log = logging(options)
|
28
30
|
backends = backends(options)
|
29
|
-
server = build(backends)
|
31
|
+
server = build(backends, options[:webui_root])
|
30
32
|
announce(options, backends)
|
31
33
|
start(server, options)
|
32
|
-
rescue PuppetForgeServer::Errors::Expected
|
34
|
+
rescue PuppetForgeServer::Errors::Expected => error
|
33
35
|
@log.error error
|
34
36
|
end
|
35
37
|
end
|
@@ -46,8 +48,9 @@ module PuppetForgeServer
|
|
46
48
|
PuppetForgeServer::Logger.get
|
47
49
|
end
|
48
50
|
|
49
|
-
def build(backends)
|
51
|
+
def build(backends, webui_root)
|
50
52
|
Rack::Mount::RouteSet.new do |set|
|
53
|
+
set.add_route PuppetForgeServer::App::Frontend.new(webui_root)
|
51
54
|
set.add_route PuppetForgeServer::App::Generic.new
|
52
55
|
set.add_route PuppetForgeServer::App::Version1.new(backends)
|
53
56
|
set.add_route PuppetForgeServer::App::Version2.new(backends)
|
@@ -27,9 +27,10 @@ module PuppetForgeServer::Utils
|
|
27
27
|
@@DEFAULT_PID_FILE = File.join(Dir.tmpdir.to_s, 'puppet-forge-server', 'server.pid')
|
28
28
|
@@DEFAULT_CACHE_DIR = File.join(Dir.tmpdir.to_s, 'puppet-forge-server', 'cache')
|
29
29
|
@@DEFAULT_LOG_DIR = File.join(Dir.tmpdir.to_s, 'puppet-forge-server', 'log')
|
30
|
+
@@DEFAULT_WEBUI_ROOT = File.expand_path('../app', File.dirname(__FILE__))
|
30
31
|
|
31
32
|
def parse_options(args)
|
32
|
-
options = {:daemonize => @@DEFAULT_DAEMONIZE, :cache_basedir => @@DEFAULT_CACHE_DIR, :port => @@DEFAULT_PORT}
|
33
|
+
options = {:daemonize => @@DEFAULT_DAEMONIZE, :cache_basedir => @@DEFAULT_CACHE_DIR, :port => @@DEFAULT_PORT, :webui_root => @@DEFAULT_WEBUI_ROOT}
|
33
34
|
option_parser = ::OptionParser.new do |opts|
|
34
35
|
opts.banner = "Usage: #{File.basename $0} [options]"
|
35
36
|
opts.version = PuppetForgeServer::VERSION
|
@@ -66,6 +67,10 @@ module PuppetForgeServer::Utils
|
|
66
67
|
options[:log_dir] = log_dir
|
67
68
|
end
|
68
69
|
|
70
|
+
opts.on('--webui-root DIR', "Directory containing views and other public files used for web UI: #{@@DEFAULT_WEBUI_ROOT})") do |webui_root|
|
71
|
+
options[:webui_root] = webui_root
|
72
|
+
end
|
73
|
+
|
69
74
|
opts.on('--debug', 'Log everything into STDERR') do
|
70
75
|
options[:debug] = true
|
71
76
|
end
|
@@ -76,6 +81,8 @@ module PuppetForgeServer::Utils
|
|
76
81
|
raise PuppetForgeServer::Errors::Expected, parse_error.message + "\n" + option_parser.help
|
77
82
|
end
|
78
83
|
|
84
|
+
raise PuppetForgeServer::Errors::Expected, "Web UI directory doesn't exist: #{options[:webui_root]}" unless Dir.exists?(options[:webui_root])
|
85
|
+
|
79
86
|
# Handle option dependencies
|
80
87
|
if options[:daemonize]
|
81
88
|
options[:pidfile] = @@DEFAULT_PID_FILE unless options[:pidfile]
|
data/puppet-forge-server.gemspec
CHANGED
@@ -40,6 +40,7 @@ Gem::Specification.new do |spec|
|
|
40
40
|
spec.add_dependency 'rack-mount', '~> 0.8'
|
41
41
|
spec.add_dependency 'open4', '~> 1.3'
|
42
42
|
spec.add_dependency 'open_uri_redirections', '~> 0.1'
|
43
|
+
spec.add_dependency 'haml', '~> 4.0'
|
43
44
|
|
44
45
|
spec.add_development_dependency 'rake', '~> 10.3'
|
45
46
|
spec.add_development_dependency 'rspec', '~> 3.1'
|
data/spec/unit/server_spec.rb
CHANGED
@@ -21,8 +21,8 @@ module PuppetForgeServer
|
|
21
21
|
describe '#build' do
|
22
22
|
let(:server) { PuppetForgeServer::Server.new }
|
23
23
|
it 'builds rack routeset' do
|
24
|
-
routeset = server.build(nil)
|
25
|
-
expect(routeset.length).to eq
|
24
|
+
routeset = server.build(nil, nil)
|
25
|
+
expect(routeset.length).to eq 5
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-forge-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilja Bobkevic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02
|
11
|
+
date: 2015-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0.1'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: haml
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '4.0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '4.0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: rake
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -155,10 +169,17 @@ files:
|
|
155
169
|
- lib/puppet_forge_server/api/v1/releases.rb
|
156
170
|
- lib/puppet_forge_server/api/v3/modules.rb
|
157
171
|
- lib/puppet_forge_server/api/v3/releases.rb
|
172
|
+
- lib/puppet_forge_server/app/frontend.rb
|
158
173
|
- lib/puppet_forge_server/app/generic.rb
|
174
|
+
- lib/puppet_forge_server/app/public/css/puppetlabs.css
|
175
|
+
- lib/puppet_forge_server/app/public/img/forge-logo.png
|
176
|
+
- lib/puppet_forge_server/app/public/js/internal.js
|
159
177
|
- lib/puppet_forge_server/app/version1.rb
|
160
178
|
- lib/puppet_forge_server/app/version2.rb
|
161
179
|
- lib/puppet_forge_server/app/version3.rb
|
180
|
+
- lib/puppet_forge_server/app/views/index.haml
|
181
|
+
- lib/puppet_forge_server/app/views/layout.haml
|
182
|
+
- lib/puppet_forge_server/app/views/modules.haml
|
162
183
|
- lib/puppet_forge_server/backends/directory.rb
|
163
184
|
- lib/puppet_forge_server/backends/proxy.rb
|
164
185
|
- lib/puppet_forge_server/backends/proxy_v1.rb
|