front_end_builds 0.0.6 → 0.0.7
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 +4 -4
- data/Rakefile +17 -0
- data/app/controllers/front_end_builds/admin_controller.rb +17 -0
- data/app/controllers/front_end_builds/apps_controller.rb +91 -0
- data/app/models/front_end_builds/app.rb +6 -0
- data/app/models/front_end_builds/build.rb +5 -1
- data/app/views/front_end_builds/admin/index.html.erb +26 -0
- data/config/routes.rb +10 -0
- data/lib/front_end_builds/engine.rb +5 -0
- data/lib/front_end_builds/ext/routes.rb +0 -8
- data/lib/front_end_builds/version.rb +1 -1
- metadata +25 -37
- data/app/views/layouts/front_end_builds/application.html.erb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce1268253a64231fec485962a4a354ce6eb2ba19
|
4
|
+
data.tar.gz: 483d5a2c0dbcff38e9fbacd62432e770968143ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2001ef6a82057c6c7901b27f2a18b1dd2df29331aa510f1f226f2573a9cd02a36e0d7a15b7a9b21452ce52b7850b4f8a0261db9869afdbf03823e10331547b88
|
7
|
+
data.tar.gz: b83a54a65c9f1482b7e3fa928bf45034d04c45b016962ba17de4ec0caca85dbed2669c3fff5760d3264d36dc85a202d01bb5dda3cadd5f0e2569702943a6b5f0
|
data/Rakefile
CHANGED
@@ -14,6 +14,23 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
14
14
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
15
|
end
|
16
16
|
|
17
|
+
begin
|
18
|
+
require 'rspec/core/rake_task'
|
19
|
+
RSpec::Core::RakeTask.new(:spec)
|
20
|
+
task :default => :spec
|
21
|
+
rescue LoadError
|
22
|
+
# no rspec available
|
23
|
+
end
|
24
|
+
|
25
|
+
task :build_admin do
|
26
|
+
Dir.chdir('admin'){
|
27
|
+
cmd = 'ember build --output-path ../public --environment production'
|
28
|
+
system 'echo Running command: ' + cmd
|
29
|
+
system cmd
|
30
|
+
system 'rm ../public/index.html'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
17
34
|
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
18
35
|
load 'rails/tasks/engine.rake'
|
19
36
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_dependency "front_end_builds/application_controller"
|
2
|
+
|
3
|
+
module FrontEndBuilds
|
4
|
+
class AdminController < ApplicationController
|
5
|
+
|
6
|
+
def index
|
7
|
+
# We need to pass the url which the host app has mounted the
|
8
|
+
# engine to into index.html.erb, so the ember app's router
|
9
|
+
# will work appropriately.
|
10
|
+
|
11
|
+
# Trim leading/trailing slash marks...
|
12
|
+
@baseURL = request.fullpath[1..request.fullpath.length-2]
|
13
|
+
render :index, layout: false
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require_dependency "front_end_builds/application_controller"
|
2
|
+
|
3
|
+
module FrontEndBuilds
|
4
|
+
class AppsController < ApplicationController
|
5
|
+
before_filter :set_app , :only => [:show, :destroy]
|
6
|
+
respond_to :json
|
7
|
+
|
8
|
+
def index
|
9
|
+
apps = []
|
10
|
+
builds = []
|
11
|
+
|
12
|
+
FrontEndBuilds::App.all.each do |app|
|
13
|
+
apps.push serialize_app(app)
|
14
|
+
builds.concat serialize_builds(app)
|
15
|
+
end
|
16
|
+
|
17
|
+
respond_with({
|
18
|
+
apps: apps,
|
19
|
+
builds: builds
|
20
|
+
})
|
21
|
+
end
|
22
|
+
|
23
|
+
def show
|
24
|
+
respond_with({
|
25
|
+
app: serialize_app(@app),
|
26
|
+
builds: serialize_builds(@app)
|
27
|
+
})
|
28
|
+
end
|
29
|
+
|
30
|
+
def create
|
31
|
+
@app = FrontEndBuilds::App.new(app_create_params)
|
32
|
+
|
33
|
+
if @app.save!
|
34
|
+
hash = { app: @app }
|
35
|
+
respond_with hash, location: nil
|
36
|
+
|
37
|
+
else
|
38
|
+
respond_with(
|
39
|
+
{errors: @app.errors},
|
40
|
+
status: :unprocessable_entity
|
41
|
+
)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def destroy
|
46
|
+
if @app.destroy
|
47
|
+
hash = { app: @app }
|
48
|
+
respond_with hash, location: nil
|
49
|
+
|
50
|
+
else
|
51
|
+
respond_with(
|
52
|
+
{errors: @app.errors},
|
53
|
+
status: :unprocessable_entity
|
54
|
+
)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def set_app
|
61
|
+
@app = FrontEndBuilds::App.find params[:id]
|
62
|
+
end
|
63
|
+
|
64
|
+
def app_create_params
|
65
|
+
params.require(:app).permit(
|
66
|
+
:name
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
def serialize_app(app)
|
71
|
+
build_ids = app.builds.map {|build| build.id}
|
72
|
+
|
73
|
+
app.as_json.merge( {build_ids: build_ids} )
|
74
|
+
end
|
75
|
+
|
76
|
+
def serialize_builds(app)
|
77
|
+
builds = app.builds.as_json
|
78
|
+
best_build = app.find_best_build
|
79
|
+
|
80
|
+
if best_build
|
81
|
+
builds.each do |build|
|
82
|
+
if build["id"] === best_build.id
|
83
|
+
build["is_best"] = true
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
return builds
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -18,7 +18,7 @@ module FrontEndBuilds
|
|
18
18
|
}
|
19
19
|
|
20
20
|
if params[:app]
|
21
|
-
query[:
|
21
|
+
query[:app_id] = params[:app].id
|
22
22
|
end
|
23
23
|
|
24
24
|
if params[:app_name]
|
@@ -51,6 +51,10 @@ module FrontEndBuilds
|
|
51
51
|
.first
|
52
52
|
end
|
53
53
|
|
54
|
+
def live?
|
55
|
+
self == app.find_best_build
|
56
|
+
end
|
57
|
+
|
54
58
|
def fetch!
|
55
59
|
return if fetched?
|
56
60
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
6
|
+
<title>Admin</title>
|
7
|
+
<meta name="description" content="">
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
9
|
+
|
10
|
+
<script>
|
11
|
+
window.RAILS_ENV = {
|
12
|
+
baseURL: '<%=@baseURL%>'
|
13
|
+
}
|
14
|
+
</script>
|
15
|
+
<base href="/<%=@baseURL%>">
|
16
|
+
<meta name="admin/config/environment" content="%7B%22modulePrefix%22%3A%22admin%22%2C%22environment%22%3A%22production%22%2C%22baseURL%22%3A%22/%22%2C%22locationType%22%3A%22auto%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%7D%2C%22APP%22%3A%7B%7D%2C%22contentSecurityPolicyHeader%22%3A%22Content-Security-Policy-Report-Only%22%2C%22contentSecurityPolicy%22%3A%7B%22default-src%22%3A%22%27none%27%22%2C%22script-src%22%3A%22%27self%27%22%2C%22font-src%22%3A%22%27self%27%22%2C%22connect-src%22%3A%22%27self%27%22%2C%22img-src%22%3A%22%27self%27%22%2C%22style-src%22%3A%22%27self%27%22%2C%22media-src%22%3A%22%27self%27%22%7D%2C%22exportApplicationGlobal%22%3Afalse%7D">
|
17
|
+
|
18
|
+
|
19
|
+
<link rel="stylesheet" href="/assets/vendor.css">
|
20
|
+
<link rel="stylesheet" href="/assets/admin.css">
|
21
|
+
</head>
|
22
|
+
<body>
|
23
|
+
<script src="/assets/vendor.js"></script>
|
24
|
+
<script src="/assets/admin.js"></script>
|
25
|
+
</body>
|
26
|
+
</html>
|
data/config/routes.rb
CHANGED
@@ -1,2 +1,12 @@
|
|
1
|
+
# Front end
|
1
2
|
FrontEndBuilds::Engine.routes.draw do
|
3
|
+
resources :apps, only: [:index, :show, :create, :edit, :destroy], path: '/api/apps'
|
4
|
+
|
5
|
+
get '/(*path)', to: 'admin#index'
|
6
|
+
end
|
7
|
+
|
8
|
+
Rails.application.routes.draw do
|
9
|
+
namespace :front_end_builds do
|
10
|
+
resources :builds, only: [:index, :create]
|
11
|
+
end
|
2
12
|
end
|
@@ -8,5 +8,10 @@ module FrontEndBuilds
|
|
8
8
|
g.assets false
|
9
9
|
g.helper false
|
10
10
|
end
|
11
|
+
|
12
|
+
# Initializer to combine this engines static assets with the static assets of the hosting site.
|
13
|
+
initializer "static assets" do |app|
|
14
|
+
app.middleware.insert_before(::ActionDispatch::Static, ::ActionDispatch::Static, "#{root}/public")
|
15
|
+
end
|
11
16
|
end
|
12
17
|
end
|
@@ -5,14 +5,6 @@ module ActionDispatch::Routing
|
|
5
5
|
|
6
6
|
# Create a front end in your rails router.
|
7
7
|
def front_end(name, path = name, options = {})
|
8
|
-
|
9
|
-
# Generic routes that have nothing to do with the app
|
10
|
-
# name. Use this for testing or providing a non
|
11
|
-
# app api endpoint.
|
12
|
-
namespace :front_end_builds do
|
13
|
-
resources :builds, only: [:index, :create]
|
14
|
-
end
|
15
|
-
|
16
8
|
# Create a new build for this app.
|
17
9
|
post(
|
18
10
|
"#{path}" => "front_end_builds/builds#create",
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Toronto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rails
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 3.2.0
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 3.2.0
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: sqlite3
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,44 +28,44 @@ dependencies:
|
|
42
28
|
name: rspec-rails
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
|
-
- - "
|
31
|
+
- - ">="
|
46
32
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
33
|
+
version: '0'
|
48
34
|
type: :development
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
|
-
- - "
|
38
|
+
- - ">="
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
40
|
+
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: factory_girl_rails
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
|
-
- - "
|
45
|
+
- - ">="
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
47
|
+
version: '0'
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
|
-
- - "
|
52
|
+
- - ">="
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
54
|
+
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: pry
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- - "
|
59
|
+
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0
|
61
|
+
version: '0'
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- - "
|
66
|
+
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0
|
68
|
+
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: pry-stack_explorer
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,30 +84,30 @@ dependencies:
|
|
98
84
|
name: shoulda-matchers
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
|
-
- - "
|
87
|
+
- - ">="
|
102
88
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
89
|
+
version: '0'
|
104
90
|
type: :development
|
105
91
|
prerelease: false
|
106
92
|
version_requirements: !ruby/object:Gem::Requirement
|
107
93
|
requirements:
|
108
|
-
- - "
|
94
|
+
- - ">="
|
109
95
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
96
|
+
version: '0'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
98
|
name: webmock
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
|
-
- - "
|
101
|
+
- - ">="
|
116
102
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
103
|
+
version: '0'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
107
|
requirements:
|
122
|
-
- - "
|
108
|
+
- - ">="
|
123
109
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
110
|
+
version: '0'
|
125
111
|
description: Description of FrontEndBuilds.
|
126
112
|
email:
|
127
113
|
- rt@ted.com
|
@@ -133,12 +119,14 @@ files:
|
|
133
119
|
- Rakefile
|
134
120
|
- app/assets/javascripts/front_end_builds/application.js
|
135
121
|
- app/assets/stylesheets/front_end_builds/application.css
|
122
|
+
- app/controllers/front_end_builds/admin_controller.rb
|
136
123
|
- app/controllers/front_end_builds/application_controller.rb
|
124
|
+
- app/controllers/front_end_builds/apps_controller.rb
|
137
125
|
- app/controllers/front_end_builds/builds_controller.rb
|
138
126
|
- app/helpers/front_end_builds/application_helper.rb
|
139
127
|
- app/models/front_end_builds/app.rb
|
140
128
|
- app/models/front_end_builds/build.rb
|
141
|
-
- app/views/
|
129
|
+
- app/views/front_end_builds/admin/index.html.erb
|
142
130
|
- config/routes.rb
|
143
131
|
- db/migrate/20141010162405_create_front_end_builds_builds.rb
|
144
132
|
- db/migrate/20141010165726_create_front_end_builds_apps.rb
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>FrontEndBuilds</title>
|
5
|
-
<%= stylesheet_link_tag "front_end_builds/application", media: "all" %>
|
6
|
-
<%= javascript_include_tag "front_end_builds/application" %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
|
11
|
-
<%= yield %>
|
12
|
-
|
13
|
-
</body>
|
14
|
-
</html>
|