front_end_builds 0.2.0 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1542985a803ac72002fd437fc975726ee7dac9cc
4
- data.tar.gz: 2caa84a2a6c32e72ec08ff5273738778c809eaa1
2
+ SHA256:
3
+ metadata.gz: c79e8434a0ff0de302875b4a6e5659570622e6977514a2d7b6263eead44c0331
4
+ data.tar.gz: 378adb746ed9d7b0582ceb3d4243673c40552614797c945b4e540e7201f6dc85
5
5
  SHA512:
6
- metadata.gz: 1af52583c3a5ff0874f0033ca30bc1cfedce894a2d9eaeb9719bc766476c22aa4d47fab82f17c0d30844b9db872c7e28ec4087c49a4619af3748bbf226e4ab15
7
- data.tar.gz: 9b3bc4d6543bfa161d35d1f130fcfb56fef52918a92f82b4d558ee5b4f866d84ee93b3a686acd21ef93cee77c46754a86129ba5b5f7ed167d8fd5bc3f833ce63
6
+ metadata.gz: '098a7f9411dc70118a4ec676fbd0f7a9c4ecdffe9324f04b380a409d044b7321faf073cd093451f14b0efe15d56ceda896e1d28442f59a5240d74ae2d77cafbc'
7
+ data.tar.gz: 6f96701912242573b2f4337eab6144341f60fe0a5ccd88d16ba1e8698c8a376e50293f2eed1b61cfec033b78a5ec692d32e3d7f107f830a6a00da2504a05f782
data/Rakefile CHANGED
@@ -25,7 +25,7 @@ end
25
25
  namespace :admin do
26
26
  task :build do
27
27
  Dir.chdir('admin') do
28
- sh 'ember build --environment=production'
28
+ sh 'ember build production'
29
29
  end
30
30
 
31
31
  # Copy the dist to public
@@ -15,7 +15,7 @@ module FrontEndBuilds
15
15
  html = html.sub('BASEURL/', baseURL)
16
16
  html = html.sub("baseURL: ''", "baseURL: '#{baseURL}'")
17
17
 
18
- render text: html
18
+ render plain: html
19
19
  end
20
20
 
21
21
  end
@@ -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,10 +2,15 @@ require_dependency "front_end_builds/application_controller"
2
2
 
3
3
  module FrontEndBuilds
4
4
  class AppsController < ApplicationController
5
- before_filter :set_app , :only => [:show, :destroy, :update]
5
+ before_action :set_app , :only => [:show, :destroy, :update]
6
6
 
7
7
  def index
8
- apps = App.includes(:recent_builds)
8
+ # this should be the most recent 10 builds for each app
9
+
10
+ # DO NOT use `App.includes(:recent_builds)`
11
+ # b/c it mucks up the grouping logic and only gives the most
12
+ # recent 10 for ALL apps not 10 per app
13
+ apps = App.all
9
14
 
10
15
  respond_with_json({
11
16
  apps: apps.map(&:serialize),
@@ -23,7 +28,7 @@ module FrontEndBuilds
23
28
  end
24
29
 
25
30
  def create
26
- @app = FrontEndBuilds::App.new( use_params(:app_create_params) )
31
+ @app = FrontEndBuilds::App.new( app_create_params )
27
32
 
28
33
  if @app.save
29
34
  respond_with_json(
@@ -39,7 +44,7 @@ module FrontEndBuilds
39
44
  end
40
45
 
41
46
  def update
42
- if @app.update_attributes( use_params(:app_update_params) )
47
+ if @app.update_attributes( app_update_params )
43
48
 
44
49
  respond_with_json(
45
50
  { app: @app.serialize },
@@ -61,7 +66,7 @@ module FrontEndBuilds
61
66
  )
62
67
  else
63
68
  respond_with_json(
64
- {errors: @app.errors},
69
+ { errors: @app.errors },
65
70
  status: :unprocessable_entity
66
71
  )
67
72
  end
@@ -73,31 +78,18 @@ module FrontEndBuilds
73
78
  @app = FrontEndBuilds::App.find(params[:id])
74
79
  end
75
80
 
76
- def app_create_params_rails_3
77
- params[:app].slice(:name)
78
- end
79
-
80
- def app_create_params_rails_4
81
+ def app_create_params
81
82
  params.require(:app).permit(
82
83
  :name
83
84
  )
84
85
  end
85
86
 
86
- def app_update_params_rails_3
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
87
+ def app_update_params
95
88
  params.require(:app).permit(
96
89
  :name,
97
90
  :require_manual_activation,
98
91
  :live_build_id
99
92
  )
100
93
  end
101
-
102
94
  end
103
95
  end
@@ -11,17 +11,17 @@ module FrontEndBuilds
11
11
  class BestsController < ApplicationController
12
12
  include Rails.application.routes.url_helpers
13
13
 
14
- before_filter :find_front_end, only: [:show]
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 text: @front_end.with_head_tag(meta_tags) }
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 text: "not found", status: 404
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: use_params(:build_search_params).to_query,
36
+ front_end_build_params: build_search_params.to_h.to_query,
37
37
  front_end_build_url: front_end_builds_best_path(
38
- use_params(:build_search_params).merge(format: :json)
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(use_params(:build_search_params))
51
+ @front_end = FrontEndBuilds::Build.find_best(build_search_params)
52
52
  end
53
53
 
54
- def build_search_params_rails_3
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
- before_filter :set_app!, only: [:create]
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(use_params(:build_create_params))
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
- text: 'Could not create the build: ' + build.errors.full_messages.to_s,
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
- text: "No app named #{params[:app_name]}.",
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 build_create_params_rails_3
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 pubkey_create_params_rails_3
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
@@ -6,7 +6,7 @@ module FrontEndBuilds
6
6
  :live_build_id
7
7
  end
8
8
 
9
- belongs_to :live_build, class_name: 'FrontEndBuilds::Build'
9
+ belongs_to :live_build, class_name: 'FrontEndBuilds::Build', optional: true
10
10
  has_many :builds, class_name: 'FrontEndBuilds::Build'
11
11
 
12
12
  if ActiveRecord::VERSION::MAJOR < 4
@@ -2,9 +2,9 @@ class CreateFrontEndBuildsBuilds < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :front_end_builds_builds do |t|
4
4
  t.references :app
5
- t.string :sha
6
- t.string :job
7
- t.string :branch
5
+ t.string :sha, limit: 191
6
+ t.string :job, limit: 191
7
+ t.string :branch, limit: 191
8
8
  t.text :html
9
9
  t.boolean :fetched, default: false
10
10
  t.boolean :active, default: false
@@ -1,8 +1,8 @@
1
1
  class CreateFrontEndBuildsApps < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :front_end_builds_apps do |t|
4
- t.string :name
5
- t.string :api_key
4
+ t.string :name, limit: 191
5
+ t.string :api_key, limit: 191
6
6
 
7
7
  t.timestamps
8
8
  end
@@ -1,7 +1,7 @@
1
1
  class CreateFrontEndBuildsPubkeys < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :front_end_builds_pubkeys do |t|
4
- t.string :name, null: false
4
+ t.string :name, null: false, limit: 191
5
5
  t.text :pubkey, null: false
6
6
 
7
7
  t.timestamps null: false
@@ -6,7 +6,7 @@ module FrontEndBuilds
6
6
 
7
7
  config.generators do |g|
8
8
  g.test_framework :rspec, fixture: false
9
- g.fixture_replacement :factory_girl, dir: 'spec/factories'
9
+ g.fixture_replacement :factory_bot, dir: 'spec/factories'
10
10
  g.assets false
11
11
  g.helper false
12
12
  end
@@ -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
- key = OpenSSL::PKey::DSA.new
83
- key.p = OpenSSL::BN.new(pstr, 2)
84
- key.q = OpenSSL::BN.new(qstr, 2)
85
- key.g = OpenSSL::BN.new(gstr, 2)
86
- key.pub_key = OpenSSL::BN.new(pkstr, 2)
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
- nil
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
@@ -1,3 +1,3 @@
1
1
  module FrontEndBuilds
2
- VERSION = "0.2.0"
2
+ VERSION = '1.0.3'
3
3
  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.2.0
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Toronto
8
8
  - Sam Selikoff
9
- autorequire:
9
+ - John Hirbour
10
+ autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2015-11-13 00:00:00.000000000 Z
13
+ date: 2020-11-19 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
- name: sqlite3
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: rspec-rails
44
+ name: byebug
30
45
  requirement: !ruby/object:Gem::Requirement
31
46
  requirements:
32
- - - '='
47
+ - - ">="
33
48
  - !ruby/object:Gem::Version
34
- version: 3.1.0
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: 3.1.0
56
+ version: '0'
42
57
  - !ruby/object:Gem::Dependency
43
- name: rspec-its
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: factory_girl_rails
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,48 @@ dependencies:
109
194
  - - '='
110
195
  - !ruby/object:Gem::Version
111
196
  version: 2.7.0
197
+ - !ruby/object:Gem::Dependency
198
+ name: sprockets
199
+ requirement: !ruby/object:Gem::Requirement
200
+ requirements:
201
+ - - '='
202
+ - !ruby/object:Gem::Version
203
+ version: 3.7.2
204
+ type: :development
205
+ prerelease: false
206
+ version_requirements: !ruby/object:Gem::Requirement
207
+ requirements:
208
+ - - '='
209
+ - !ruby/object:Gem::Version
210
+ version: 3.7.2
211
+ - !ruby/object:Gem::Dependency
212
+ name: sprockets-rails
213
+ requirement: !ruby/object:Gem::Requirement
214
+ requirements:
215
+ - - '='
216
+ - !ruby/object:Gem::Version
217
+ version: 3.2.1
218
+ type: :development
219
+ prerelease: false
220
+ version_requirements: !ruby/object:Gem::Requirement
221
+ requirements:
222
+ - - '='
223
+ - !ruby/object:Gem::Version
224
+ version: 3.2.1
225
+ - !ruby/object:Gem::Dependency
226
+ name: sqlite3
227
+ requirement: !ruby/object:Gem::Requirement
228
+ requirements:
229
+ - - ">="
230
+ - !ruby/object:Gem::Version
231
+ version: '0'
232
+ type: :development
233
+ prerelease: false
234
+ version_requirements: !ruby/object:Gem::Requirement
235
+ requirements:
236
+ - - ">="
237
+ - !ruby/object:Gem::Version
238
+ version: '0'
112
239
  - !ruby/object:Gem::Dependency
113
240
  name: webmock
114
241
  requirement: !ruby/object:Gem::Requirement
@@ -127,6 +254,7 @@ description: Rails engine to manage front end builds and deployments
127
254
  email:
128
255
  - rt@ted.com
129
256
  - sam@ted.com
257
+ - gohn@ted.com
130
258
  executables: []
131
259
  extensions: []
132
260
  extra_rdoc_files: []
@@ -172,13 +300,12 @@ files:
172
300
  - public/front_end_builds/assets/fontawesome-webfont.woff2
173
301
  - public/front_end_builds/assets/vendor-23f9bdd567ccab65909edb0f4ac32394.css
174
302
  - public/front_end_builds/assets/vendor-7c6d3f715703c96d6dce5d24fd762eb6.js
175
- - public/front_end_builds/crossdomain.xml
176
303
  - public/front_end_builds/robots.txt
177
304
  homepage: http://github.com/tedconf/front_end_builds
178
305
  licenses:
179
306
  - MIT
180
307
  metadata: {}
181
- post_install_message:
308
+ post_install_message:
182
309
  rdoc_options: []
183
310
  require_paths:
184
311
  - lib
@@ -193,9 +320,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
320
  - !ruby/object:Gem::Version
194
321
  version: '0'
195
322
  requirements: []
196
- rubyforge_project:
197
- rubygems_version: 2.2.2
198
- signing_key:
323
+ rubyforge_project:
324
+ rubygems_version: 2.7.8
325
+ signing_key:
199
326
  specification_version: 4
200
327
  summary: Summary of FrontEndBuilds.
201
328
  test_files: []
@@ -1,15 +0,0 @@
1
- <?xml version="1.0"?>
2
- <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
3
- <cross-domain-policy>
4
- <!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->
5
-
6
- <!-- Most restrictive policy: -->
7
- <site-control permitted-cross-domain-policies="none"/>
8
-
9
- <!-- Least restrictive policy: -->
10
- <!--
11
- <site-control permitted-cross-domain-policies="all"/>
12
- <allow-access-from domain="*" to-ports="*" secure="false"/>
13
- <allow-http-request-headers-from domain="*" headers="*" secure="false"/>
14
- -->
15
- </cross-domain-policy>