front_end_builds 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 73289473dbe8e87ac2027aa1bcac232568fe0e68
4
- data.tar.gz: 8093059b4f3617b49ab28e7330060501076a47f1
3
+ metadata.gz: 6fd868520d0d5a610455acb3c99d0840899fc90d
4
+ data.tar.gz: 7440bdcf50f76bb1ea2b5d7fff954c6851cbbaf9
5
5
  SHA512:
6
- metadata.gz: d75e87d5cb946ed4d5a86697d1ed983798c78748d3aaaa2f6275a7e612a54401d3da10a59f694d2857dd1b5560c1aba35702a29a762091b3234ce1bc1366da6d
7
- data.tar.gz: e41ff6b3243e41ed75132b5a60de0f9208a5e3c01e6fe20fca113f9043b06f3dea1f617dc740e6e8bcb5faf3261da9d1063a1d9dda316e0a237d29001c743e07
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
- app = find_app
18
+ build = @app.builds.new(build_create_params)
18
19
 
19
- if app
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
- head :unprocessable_entity
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(
@@ -0,0 +1,5 @@
1
+ class AddEndpointToFrontEndBuildsBuild < ActiveRecord::Migration
2
+ def change
3
+ add_column :front_end_builds_builds, :endpoint, :string, limit: 2038
4
+ end
5
+ end
@@ -26,7 +26,7 @@ module ActionDispatch::Routing
26
26
  get(
27
27
  "/#{path}/(*path)" => "front_end_builds/builds#index",
28
28
  defaults: {
29
- branch: :master,
29
+ branch: 'master',
30
30
  app_name: name
31
31
  }.merge(options)
32
32
  )
@@ -1,3 +1,3 @@
1
1
  module FrontEndBuilds
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
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.5
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