front_end_builds 0.0.18 → 0.0.19
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/application_controller.rb +11 -0
- data/app/controllers/front_end_builds/apps_controller.rb +6 -7
- data/app/controllers/front_end_builds/builds_controller.rb +4 -5
- data/app/controllers/front_end_builds/host_apps_controller.rb +1 -3
- data/lib/front_end_builds/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d0062a2dc66d2aaf27e8f7d5b89aac72e34ab47
|
4
|
+
data.tar.gz: 9f8a20ba073a3ebd36054294732808fae347e730
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b45a41309333845d763eccb90991ffd8ef06422b1d040599a749d6ab26b238b4953fddf6aed357df6516564834f2dedc147966553aa767ed95b64ec49e9f4d50
|
7
|
+
data.tar.gz: b51d329f26b67ebb9be42725751c02f04c61fcb59dd1005068e4d0fc851855d9014e73b454f8628cf890343ae48d45314cb57258a3be16de0a4758c02d99389f
|
@@ -6,5 +6,16 @@ module FrontEndBuilds
|
|
6
6
|
send("#{param_method}_rails_#{v}")
|
7
7
|
end
|
8
8
|
|
9
|
+
# Public: A quick helper to create a respond_to block for
|
10
|
+
# returning json to the client. Used because `respond_with`
|
11
|
+
# is no longer included in Rails.
|
12
|
+
def respond_with_json(object, options = {})
|
13
|
+
respond_to do |format|
|
14
|
+
format.json do
|
15
|
+
render options.merge(json: object)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
9
20
|
end
|
10
21
|
end
|
@@ -3,12 +3,11 @@ require_dependency "front_end_builds/application_controller"
|
|
3
3
|
module FrontEndBuilds
|
4
4
|
class AppsController < ApplicationController
|
5
5
|
before_filter :set_app , :only => [:show, :destroy]
|
6
|
-
respond_to :json
|
7
6
|
|
8
7
|
def index
|
9
8
|
apps = App.includes(:recent_builds)
|
10
9
|
|
11
|
-
|
10
|
+
respond_with_json({
|
12
11
|
apps: apps.map(&:serialize),
|
13
12
|
builds: apps.map(&:recent_builds)
|
14
13
|
.flat_map(&:to_a)
|
@@ -17,7 +16,7 @@ module FrontEndBuilds
|
|
17
16
|
end
|
18
17
|
|
19
18
|
def show
|
20
|
-
|
19
|
+
respond_with_json({
|
21
20
|
app: @app.serialize,
|
22
21
|
builds: @app.recent_builds.map(&:serialize)
|
23
22
|
})
|
@@ -27,12 +26,12 @@ module FrontEndBuilds
|
|
27
26
|
@app = FrontEndBuilds::App.new( use_params(:app_create_params) )
|
28
27
|
|
29
28
|
if @app.save!
|
30
|
-
|
29
|
+
respond_with_json(
|
31
30
|
{ app: @app.serialize },
|
32
31
|
location: nil
|
33
32
|
)
|
34
33
|
else
|
35
|
-
|
34
|
+
respond_with_json(
|
36
35
|
{ errors: @app.errors },
|
37
36
|
status: :unprocessable_entity
|
38
37
|
)
|
@@ -41,12 +40,12 @@ module FrontEndBuilds
|
|
41
40
|
|
42
41
|
def destroy
|
43
42
|
if @app.destroy
|
44
|
-
|
43
|
+
respond_with_json(
|
45
44
|
{ app: { id: @app.id } },
|
46
45
|
location: nil
|
47
46
|
)
|
48
47
|
else
|
49
|
-
|
48
|
+
respond_with_json(
|
50
49
|
{errors: @app.errors},
|
51
50
|
status: :unprocessable_entity
|
52
51
|
)
|
@@ -3,13 +3,12 @@ require_dependency "front_end_builds/application_controller"
|
|
3
3
|
module FrontEndBuilds
|
4
4
|
class BuildsController < ApplicationController
|
5
5
|
before_filter :set_app!, only: :create
|
6
|
-
respond_to :json
|
7
6
|
|
8
7
|
def index
|
9
8
|
builds = FrontEndBuilds::Build.where(app_id: params[:app_id])
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
respond_with_json({
|
10
|
+
builds: builds.map(&:serialize)
|
11
|
+
})
|
13
12
|
end
|
14
13
|
|
15
14
|
def create
|
@@ -30,7 +29,7 @@ module FrontEndBuilds
|
|
30
29
|
|
31
30
|
def show
|
32
31
|
build = FrontEndBuilds::Build.find(params[:id])
|
33
|
-
|
32
|
+
respond_with_json({
|
34
33
|
build: build.serialize
|
35
34
|
})
|
36
35
|
end
|
@@ -2,10 +2,8 @@ require_dependency "front_end_builds/application_controller"
|
|
2
2
|
|
3
3
|
module FrontEndBuilds
|
4
4
|
class HostAppsController < ApplicationController
|
5
|
-
respond_to :json
|
6
|
-
|
7
5
|
def show
|
8
|
-
|
6
|
+
respond_with_json({
|
9
7
|
host_app: {
|
10
8
|
id: params[:id],
|
11
9
|
name: Rails.application.class.parent_name
|