front_end_builds 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/front_end_builds/builds_controller.rb +20 -8
- data/app/models/front_end_builds/build.rb +1 -3
- data/db/migrate/20141105222855_add_endpoint_to_front_end_builds_build.rb +5 -0
- data/lib/front_end_builds/ext/routes.rb +1 -1
- data/lib/front_end_builds/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6fd868520d0d5a610455acb3c99d0840899fc90d
|
4
|
+
data.tar.gz: 7440bdcf50f76bb1ea2b5d7fff954c6851cbbaf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61396b3ac76d1a6fcce0b06a07b92ffc1abe25bca323c8bd4332cd99dd6d27894e3887ffee7abd7dfcce960c767ffe02b8ffac508be8a5914c60f4b913ba4082
|
7
|
+
data.tar.gz: 812c52f64e604aecaef6d1db4b89b891f69fa9a93a6a43ac08f1e84eab17947cf8b31ec7c80bdc61ed5226ac53c46f2ad68d3551b4dd358b317e0feadc866114
|
@@ -2,6 +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
6
|
|
6
7
|
def index
|
7
8
|
front_end = FrontEndBuilds::Build.find_best(build_search_params)
|
@@ -14,23 +15,33 @@ module FrontEndBuilds
|
|
14
15
|
end
|
15
16
|
|
16
17
|
def create
|
17
|
-
|
18
|
+
build = @app.builds.new(build_create_params)
|
18
19
|
|
19
|
-
if
|
20
|
-
build = app.builds.create(build_create_params)
|
21
|
-
end
|
22
|
-
|
23
|
-
if app && build
|
20
|
+
if build.save
|
24
21
|
build.fetch!
|
25
22
|
build.activate!
|
26
23
|
head :ok
|
24
|
+
|
27
25
|
else
|
28
|
-
|
26
|
+
render(
|
27
|
+
text: 'Could not create the build: ' + build.errors.full_messages.to_s,
|
28
|
+
status: :unprocessable_entity
|
29
|
+
)
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
32
33
|
private
|
33
34
|
|
35
|
+
def set_app!
|
36
|
+
@app = find_app
|
37
|
+
if @app.nil?
|
38
|
+
render(
|
39
|
+
text: 'That app name/API combination was not found.',
|
40
|
+
status: :unprocessable_entity
|
41
|
+
)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
34
45
|
def csrf_tag
|
35
46
|
[
|
36
47
|
"<meta name='csrf-param' content='#{request_forgery_protection_token}' />",
|
@@ -46,7 +57,8 @@ module FrontEndBuilds
|
|
46
57
|
params.permit(
|
47
58
|
:branch,
|
48
59
|
:sha,
|
49
|
-
:job
|
60
|
+
:job,
|
61
|
+
:endpoint
|
50
62
|
)
|
51
63
|
end
|
52
64
|
|
@@ -7,8 +7,8 @@ module FrontEndBuilds
|
|
7
7
|
|
8
8
|
validates :app, presence: true
|
9
9
|
validates :sha, presence: true
|
10
|
-
validates :job, presence: true
|
11
10
|
validates :branch, presence: true
|
11
|
+
validates :endpoint, presence: true
|
12
12
|
|
13
13
|
def self.find_best(params = {})
|
14
14
|
scope = self
|
@@ -54,8 +54,6 @@ module FrontEndBuilds
|
|
54
54
|
def fetch!
|
55
55
|
return if fetched?
|
56
56
|
|
57
|
-
# Store endpoint in app
|
58
|
-
endpoint = "http://ted.conferences.#{app.name}.s3-website-us-east-1.amazonaws.com/dist-#{job}-#{sha}/index.html"
|
59
57
|
html = Net::HTTP.get(URI.parse(endpoint))
|
60
58
|
|
61
59
|
update_attributes(
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: front_end_builds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Toronto
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- config/routes.rb
|
143
143
|
- db/migrate/20141010162405_create_front_end_builds_builds.rb
|
144
144
|
- db/migrate/20141010165726_create_front_end_builds_apps.rb
|
145
|
+
- db/migrate/20141105222855_add_endpoint_to_front_end_builds_build.rb
|
145
146
|
- lib/front_end_builds.rb
|
146
147
|
- lib/front_end_builds/engine.rb
|
147
148
|
- lib/front_end_builds/ext/routes.rb
|