front_end_builds 0.2.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Rakefile +1 -1
- data/app/controllers/front_end_builds/admin_controller.rb +1 -1
- data/app/controllers/front_end_builds/application_controller.rb +0 -6
- data/app/controllers/front_end_builds/apps_controller.rb +6 -20
- data/app/controllers/front_end_builds/bests_controller.rb +8 -12
- data/app/controllers/front_end_builds/builds_controller.rb +5 -9
- data/app/controllers/front_end_builds/pubkeys_controller.rb +2 -7
- data/lib/front_end_builds/engine.rb +1 -1
- data/lib/front_end_builds/utils/ssh_pubkey_convert.rb +15 -18
- data/lib/front_end_builds/version.rb +1 -1
- metadata +111 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e63d1f6aedb627517cce00a61a0b3318589611bec299bff195426a0f0ba95ea7
|
4
|
+
data.tar.gz: 12e4734b74b1c1156dac188a6e0f8dc5d0b6821660784c980b649918ee835cad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fee953eb09c4e60ec55bf7bef38281f6c79e15c9d651e3a5d8ffd3b28b1afd5b7eb357f58ea9a651b840f79b22e0267af0845685f94ef800fc39eb7c3b2fc14
|
7
|
+
data.tar.gz: 15fc02a719a4501d2c8cd7d53c28f2138d74be516c6414a0089dadd6047fb114a33797631911414ed2d217ba6337d289d3b028621d208d6a72e703c3c38338aa
|
data/Rakefile
CHANGED
@@ -1,11 +1,6 @@
|
|
1
1
|
module FrontEndBuilds
|
2
2
|
class ApplicationController < ActionController::Base
|
3
3
|
|
4
|
-
def use_params(param_method)
|
5
|
-
v = Rails::VERSION::MAJOR
|
6
|
-
send("#{param_method}_rails_#{v}")
|
7
|
-
end
|
8
|
-
|
9
4
|
# Public: A quick helper to create a respond_to block for
|
10
5
|
# returning json to the client. Used because `respond_with`
|
11
6
|
# is no longer included in Rails.
|
@@ -20,6 +15,5 @@ module FrontEndBuilds
|
|
20
15
|
def error!(errors, status = :unprocessable_entity)
|
21
16
|
respond_with_json({ errors: errors }, status: status)
|
22
17
|
end
|
23
|
-
|
24
18
|
end
|
25
19
|
end
|
@@ -2,11 +2,10 @@ require_dependency "front_end_builds/application_controller"
|
|
2
2
|
|
3
3
|
module FrontEndBuilds
|
4
4
|
class AppsController < ApplicationController
|
5
|
-
|
5
|
+
before_action :set_app , :only => [:show, :destroy, :update]
|
6
6
|
|
7
7
|
def index
|
8
8
|
apps = App.includes(:recent_builds)
|
9
|
-
|
10
9
|
respond_with_json({
|
11
10
|
apps: apps.map(&:serialize),
|
12
11
|
builds: apps.map(&:recent_builds)
|
@@ -23,7 +22,7 @@ module FrontEndBuilds
|
|
23
22
|
end
|
24
23
|
|
25
24
|
def create
|
26
|
-
@app = FrontEndBuilds::App.new(
|
25
|
+
@app = FrontEndBuilds::App.new( app_create_params )
|
27
26
|
|
28
27
|
if @app.save
|
29
28
|
respond_with_json(
|
@@ -39,7 +38,7 @@ module FrontEndBuilds
|
|
39
38
|
end
|
40
39
|
|
41
40
|
def update
|
42
|
-
if @app.update_attributes(
|
41
|
+
if @app.update_attributes( app_update_params )
|
43
42
|
|
44
43
|
respond_with_json(
|
45
44
|
{ app: @app.serialize },
|
@@ -61,7 +60,7 @@ module FrontEndBuilds
|
|
61
60
|
)
|
62
61
|
else
|
63
62
|
respond_with_json(
|
64
|
-
{errors: @app.errors},
|
63
|
+
{ errors: @app.errors },
|
65
64
|
status: :unprocessable_entity
|
66
65
|
)
|
67
66
|
end
|
@@ -73,31 +72,18 @@ module FrontEndBuilds
|
|
73
72
|
@app = FrontEndBuilds::App.find(params[:id])
|
74
73
|
end
|
75
74
|
|
76
|
-
def
|
77
|
-
params[:app].slice(:name)
|
78
|
-
end
|
79
|
-
|
80
|
-
def app_create_params_rails_4
|
75
|
+
def app_create_params
|
81
76
|
params.require(:app).permit(
|
82
77
|
:name
|
83
78
|
)
|
84
79
|
end
|
85
80
|
|
86
|
-
def
|
87
|
-
params[:app].slice(
|
88
|
-
:name,
|
89
|
-
:require_manual_activation,
|
90
|
-
:live_build_id
|
91
|
-
)
|
92
|
-
end
|
93
|
-
|
94
|
-
def app_update_params_rails_4
|
81
|
+
def app_update_params
|
95
82
|
params.require(:app).permit(
|
96
83
|
:name,
|
97
84
|
:require_manual_activation,
|
98
85
|
:live_build_id
|
99
86
|
)
|
100
87
|
end
|
101
|
-
|
102
88
|
end
|
103
89
|
end
|
@@ -11,17 +11,17 @@ module FrontEndBuilds
|
|
11
11
|
class BestsController < ApplicationController
|
12
12
|
include Rails.application.routes.url_helpers
|
13
13
|
|
14
|
-
|
14
|
+
before_action :find_front_end, only: [:show]
|
15
15
|
|
16
16
|
def show
|
17
17
|
if @front_end
|
18
18
|
respond_to do |format|
|
19
|
-
format.html { render
|
19
|
+
format.html { render plain: @front_end.with_head_tag(meta_tags) }
|
20
20
|
format.json { render json: { version: @front_end.id } }
|
21
21
|
end
|
22
22
|
else
|
23
23
|
# TODO install instructions, user needs to push build
|
24
|
-
render
|
24
|
+
render plain: "not found", status: 404
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -33,10 +33,10 @@ module FrontEndBuilds
|
|
33
33
|
csrf_param: request_forgery_protection_token,
|
34
34
|
csrf_token: form_authenticity_token,
|
35
35
|
front_end_build_version: @front_end.id,
|
36
|
-
front_end_build_params:
|
36
|
+
front_end_build_params: build_search_params.to_h.to_query,
|
37
37
|
front_end_build_url: front_end_builds_best_path(
|
38
|
-
|
39
|
-
|
38
|
+
build_search_params.merge(format: :json)
|
39
|
+
)
|
40
40
|
}
|
41
41
|
|
42
42
|
tags
|
@@ -48,14 +48,10 @@ module FrontEndBuilds
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def find_front_end
|
51
|
-
@front_end = FrontEndBuilds::Build.find_best(
|
51
|
+
@front_end = FrontEndBuilds::Build.find_best(build_search_params)
|
52
52
|
end
|
53
53
|
|
54
|
-
def
|
55
|
-
params.slice(:app_name, :id, :branch, :sha, :job)
|
56
|
-
end
|
57
|
-
|
58
|
-
def build_search_params_rails_4
|
54
|
+
def build_search_params
|
59
55
|
params.permit(:app_name, :id, :branch, :sha, :job)
|
60
56
|
end
|
61
57
|
end
|
@@ -2,7 +2,7 @@ require_dependency "front_end_builds/application_controller"
|
|
2
2
|
|
3
3
|
module FrontEndBuilds
|
4
4
|
class BuildsController < ApplicationController
|
5
|
-
|
5
|
+
before_action :set_app!, only: [:create]
|
6
6
|
|
7
7
|
def index
|
8
8
|
builds = FrontEndBuilds::Build.where(app_id: params[:app_id])
|
@@ -12,7 +12,7 @@ module FrontEndBuilds
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def create
|
15
|
-
build = @app.builds.new(
|
15
|
+
build = @app.builds.new(build_create_params)
|
16
16
|
|
17
17
|
if build.verify && build.save
|
18
18
|
build.setup!
|
@@ -22,7 +22,7 @@ module FrontEndBuilds
|
|
22
22
|
build.errors[:base] << 'No access - invalid SSH key' if !build.verify
|
23
23
|
|
24
24
|
render(
|
25
|
-
|
25
|
+
plain: 'Could not create the build: ' + build.errors.full_messages.to_s,
|
26
26
|
status: :unprocessable_entity
|
27
27
|
)
|
28
28
|
end
|
@@ -45,7 +45,7 @@ module FrontEndBuilds
|
|
45
45
|
|
46
46
|
if @app.nil?
|
47
47
|
render(
|
48
|
-
|
48
|
+
plain: "No app named #{params[:app_name]}.",
|
49
49
|
status: :unprocessable_entity
|
50
50
|
)
|
51
51
|
|
@@ -64,11 +64,7 @@ module FrontEndBuilds
|
|
64
64
|
]
|
65
65
|
end
|
66
66
|
|
67
|
-
def
|
68
|
-
params.slice(*_create_params)
|
69
|
-
end
|
70
|
-
|
71
|
-
def build_create_params_rails_4
|
67
|
+
def build_create_params
|
72
68
|
params.permit(*_create_params)
|
73
69
|
end
|
74
70
|
end
|
@@ -8,8 +8,7 @@ module FrontEndBuilds
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def create
|
11
|
-
pubkey = FrontEndBuilds::Pubkey
|
12
|
-
.new( use_params(:pubkey_create_params) )
|
11
|
+
pubkey = FrontEndBuilds::Pubkey.new(pubkey_create_params)
|
13
12
|
|
14
13
|
if pubkey.save
|
15
14
|
respond_with_json(
|
@@ -36,11 +35,7 @@ module FrontEndBuilds
|
|
36
35
|
|
37
36
|
private
|
38
37
|
|
39
|
-
def
|
40
|
-
params[:pubkey].slice(:name, :pubkey)
|
41
|
-
end
|
42
|
-
|
43
|
-
def pubkey_create_params_rails_4
|
38
|
+
def pubkey_create_params
|
44
39
|
params.require(:pubkey).permit(
|
45
40
|
:name,
|
46
41
|
:pubkey
|
@@ -3,6 +3,9 @@
|
|
3
3
|
#
|
4
4
|
# https://github.com/mytestbed/omf/blob/master/omf_common/lib/omf_common/auth/ssh_pub_key_convert.rb
|
5
5
|
#
|
6
|
+
# Support for DSA keys was removed from this code as the FEB app doesn't support DSA keys
|
7
|
+
# See PubKey#verify
|
8
|
+
#
|
6
9
|
|
7
10
|
module FrontEndBuilds
|
8
11
|
module Utils
|
@@ -66,27 +69,21 @@ module FrontEndBuilds
|
|
66
69
|
(nstr, bytes) = unpack_string(bytes, n)
|
67
70
|
|
68
71
|
key = OpenSSL::PKey::RSA.new
|
69
|
-
key.n = OpenSSL::BN.new(nstr, 2)
|
70
|
-
key.e = OpenSSL::BN.new(estr, 2)
|
71
|
-
key
|
72
|
-
elsif keytype == 'ssh-dss'
|
73
|
-
(n, bytes) = unpack_u32(bytes)
|
74
|
-
(pstr, bytes) = unpack_string(bytes, n)
|
75
|
-
(n, bytes) = unpack_u32(bytes)
|
76
|
-
(qstr, bytes) = unpack_string(bytes, n)
|
77
|
-
(n, bytes) = unpack_u32(bytes)
|
78
|
-
(gstr, bytes) = unpack_string(bytes, n)
|
79
|
-
(n, bytes) = unpack_u32(bytes)
|
80
|
-
(pkstr, bytes) = unpack_string(bytes, n)
|
81
72
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
73
|
+
# support SSL 2
|
74
|
+
if Gem::Version.new(OpenSSL::VERSION) < Gem::Version.new('2.0.0')
|
75
|
+
key.n = OpenSSL::BN.new(nstr, 2)
|
76
|
+
key.e = OpenSSL::BN.new(estr, 2)
|
77
|
+
else
|
78
|
+
# params are n, e, d
|
79
|
+
key.set_key(OpenSSL::BN.new(nstr, 2), OpenSSL::BN.new(estr, 2), nil)
|
80
|
+
end
|
81
|
+
|
87
82
|
key
|
88
83
|
else
|
89
|
-
|
84
|
+
# anything non-RSA is not supported
|
85
|
+
# this part edited by TED
|
86
|
+
raise "Unsupported key type: #{keytype}"
|
90
87
|
end
|
91
88
|
end
|
92
89
|
end
|
metadata
CHANGED
@@ -1,18 +1,33 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: front_end_builds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Toronto
|
8
8
|
- Sam Selikoff
|
9
|
+
- John Hirbour
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date:
|
13
|
+
date: 2019-02-05 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
+
name: rails
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '5.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '5.0'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: bundler-audit
|
16
31
|
requirement: !ruby/object:Gem::Requirement
|
17
32
|
requirements:
|
18
33
|
- - ">="
|
@@ -26,21 +41,21 @@ dependencies:
|
|
26
41
|
- !ruby/object:Gem::Version
|
27
42
|
version: '0'
|
28
43
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
44
|
+
name: byebug
|
30
45
|
requirement: !ruby/object:Gem::Requirement
|
31
46
|
requirements:
|
32
|
-
- -
|
47
|
+
- - ">="
|
33
48
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
49
|
+
version: '0'
|
35
50
|
type: :development
|
36
51
|
prerelease: false
|
37
52
|
version_requirements: !ruby/object:Gem::Requirement
|
38
53
|
requirements:
|
39
|
-
- -
|
54
|
+
- - ">="
|
40
55
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
56
|
+
version: '0'
|
42
57
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
58
|
+
name: database_cleaner
|
44
59
|
requirement: !ruby/object:Gem::Requirement
|
45
60
|
requirements:
|
46
61
|
- - ">="
|
@@ -54,7 +69,7 @@ dependencies:
|
|
54
69
|
- !ruby/object:Gem::Version
|
55
70
|
version: '0'
|
56
71
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
72
|
+
name: factory_bot_rails
|
58
73
|
requirement: !ruby/object:Gem::Requirement
|
59
74
|
requirements:
|
60
75
|
- - ">="
|
@@ -95,6 +110,76 @@ dependencies:
|
|
95
110
|
- - ">="
|
96
111
|
- !ruby/object:Gem::Version
|
97
112
|
version: '0'
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: rb-readline
|
115
|
+
requirement: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
type: :development
|
121
|
+
prerelease: false
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
- !ruby/object:Gem::Dependency
|
128
|
+
name: rspec-rails
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
- !ruby/object:Gem::Dependency
|
142
|
+
name: rspec-its
|
143
|
+
requirement: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0'
|
148
|
+
type: :development
|
149
|
+
prerelease: false
|
150
|
+
version_requirements: !ruby/object:Gem::Requirement
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
155
|
+
- !ruby/object:Gem::Dependency
|
156
|
+
name: rubocop
|
157
|
+
requirement: !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
159
|
+
- - ">="
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '0'
|
162
|
+
type: :development
|
163
|
+
prerelease: false
|
164
|
+
version_requirements: !ruby/object:Gem::Requirement
|
165
|
+
requirements:
|
166
|
+
- - ">="
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
- !ruby/object:Gem::Dependency
|
170
|
+
name: rubocop-rspec
|
171
|
+
requirement: !ruby/object:Gem::Requirement
|
172
|
+
requirements:
|
173
|
+
- - ">="
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
type: :development
|
177
|
+
prerelease: false
|
178
|
+
version_requirements: !ruby/object:Gem::Requirement
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
98
183
|
- !ruby/object:Gem::Dependency
|
99
184
|
name: shoulda-matchers
|
100
185
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,6 +194,20 @@ dependencies:
|
|
109
194
|
- - '='
|
110
195
|
- !ruby/object:Gem::Version
|
111
196
|
version: 2.7.0
|
197
|
+
- !ruby/object:Gem::Dependency
|
198
|
+
name: sqlite3
|
199
|
+
requirement: !ruby/object:Gem::Requirement
|
200
|
+
requirements:
|
201
|
+
- - ">="
|
202
|
+
- !ruby/object:Gem::Version
|
203
|
+
version: '0'
|
204
|
+
type: :development
|
205
|
+
prerelease: false
|
206
|
+
version_requirements: !ruby/object:Gem::Requirement
|
207
|
+
requirements:
|
208
|
+
- - ">="
|
209
|
+
- !ruby/object:Gem::Version
|
210
|
+
version: '0'
|
112
211
|
- !ruby/object:Gem::Dependency
|
113
212
|
name: webmock
|
114
213
|
requirement: !ruby/object:Gem::Requirement
|
@@ -127,6 +226,7 @@ description: Rails engine to manage front end builds and deployments
|
|
127
226
|
email:
|
128
227
|
- rt@ted.com
|
129
228
|
- sam@ted.com
|
229
|
+
- gohn@ted.com
|
130
230
|
executables: []
|
131
231
|
extensions: []
|
132
232
|
extra_rdoc_files: []
|
@@ -194,7 +294,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
294
|
version: '0'
|
195
295
|
requirements: []
|
196
296
|
rubyforge_project:
|
197
|
-
rubygems_version: 2.
|
297
|
+
rubygems_version: 2.7.8
|
198
298
|
signing_key:
|
199
299
|
specification_version: 4
|
200
300
|
summary: Summary of FrontEndBuilds.
|