horse_power 0.6.5 → 0.7.0

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: 668684646d59500b137031f2e00481d621f0bcc6
4
- data.tar.gz: 5e82003e0f6b90c5d585d0984a4bbd01388ede30
3
+ metadata.gz: 550eb3d0263cb6397253a791ccfc7dca994c51fd
4
+ data.tar.gz: 75d6f716f07d055049b806f38e95c7a36436dcc0
5
5
  SHA512:
6
- metadata.gz: 017a0e6c0bd17d018902efecf4960d4b0ddb8f7389b0fa14295dc9f0bcecdaf4bcde616bc87a7a7f03581bdb174aa2a41e4510eec4293387bd69db60c23758a8
7
- data.tar.gz: ccc1aca8f557ff48946d08705815fbbda678ed54559612b7a4712e703c88ecb1d97d1256f4a39a9640ce1bc54a3f5d6457815aefb44faff7395ec9abb8c67234
6
+ metadata.gz: 52ed557404a37a05229ed22bca11fec54cd7a839f30ec7c1d2eed3d985f7fc587d0b15afd7c92ab7f39961068794f66beb771bd1d17a2f0949564bbc8db00cb5
7
+ data.tar.gz: c2622f1ba0be52144c4739e993e6a7454724b80b2ade5ba5cca0f1897e594b9d6fee0216c23d2149694c6b7492fefe64353c7135f3dd6f9ac1380a50539c03f7
@@ -30,13 +30,13 @@ module HorsePower
30
30
 
31
31
  def createEnvSettings
32
32
  prepend_to_file 'config/settings/development.yml' do
33
- "main_api_key: \"123456789\"\n"
33
+ "main_api_key: ENV[\"main_api_key\"] || \"123456789\"\n"
34
34
  end
35
35
  prepend_to_file 'config/settings/test.yml' do
36
- "main_api_key: \"123456789\"\n"
36
+ "main_api_key: ENV[\"main_api_key\"] || \"123456789\"\n"
37
37
  end
38
38
  prepend_to_file 'config/settings/production.yml' do
39
- "main_api_key: \"123456789\"\n"
39
+ "main_api_key: ENV[\"main_api_key\"] || \"123456789\"\n"
40
40
  end
41
41
  end
42
42
 
@@ -6,8 +6,8 @@ module HorsePower
6
6
  argument :attributes, type: :array, default: [], banner: "field:type field:type"
7
7
 
8
8
  def sprint
9
- template "auth_file.rb.erb", "gems/authorization/lib/authorization/v#{api_version}/#{HorsePower.get_singular(resource_name)}.rb"
10
- require_authfile
9
+ template "auth_file.rb.erb", "lib/authorization/v#{api_version}/#{HorsePower.get_singular(resource_name)}.rb"
10
+ #require_authfile
11
11
  end
12
12
 
13
13
  private
@@ -1,5 +1,5 @@
1
1
  require_dependency "api/v<%= api_version %>/application_controller"
2
- require 'authorization'
2
+ require 'authorization/v<%= api_version %>/<%= HorsePower.get_singular(resource_name) %>'
3
3
 
4
4
  class Api::V<%= api_version %>::<%= HorsePower.get_camel_plural(resource_name) %>Controller < Api::V<%= api_version %>::ApplicationController
5
5
  before_action :set_<%= HorsePower.get_singular(resource_name) %>, only: [:show, :update, :destroy]
@@ -29,16 +29,10 @@ class Api::V<%= api_version %>::<%= HorsePower.get_camel_plural(resource_name) %
29
29
 
30
30
  # POST /api/<%= api_version %>/<%= HorsePower.get_plural(resource_name) %>/showAll
31
31
  def showAll
32
- all_<%= HorsePower.get_plural(resource_name) %> = [];
33
- ActiveRecord::Base.transaction do
34
- @<%= HorsePower.get_plural(resource_name) %>.each do |<%= HorsePower.get_singular(resource_name) %>|
35
- if !::Authorization::V<%= api_version %>::<%= HorsePower.get_camel(resource_name) %>.show?(<%= HorsePower.get_singular(resource_name) %>,current_user)
36
- render :json => {errors: "User is not authorized for this action"}, status: :forbidden
37
- raise ActiveRecord::Rollback
38
- return
39
- end
40
- all_<%= HorsePower.get_plural(resource_name) %>.push(<%= HorsePower.get_singular(resource_name) %>)
41
- end
32
+ all_<%= HorsePower.get_plural(resource_name) %> = ::<%= HorsePower.get_camel(resource_name) %>.showAll(@<%= HorsePower.get_plural(resource_name) %>,current_user)
33
+ if all_<%= HorsePower.get_plural(resource_name) %>.nil?
34
+ render :json => {errors: "User is not authorized for this action"}, status: :forbidden
35
+ else
42
36
  render json: all_<%= HorsePower.get_plural(resource_name) %>, each_serializer: ::V<%= api_version %>::<%= HorsePower.get_camel(resource_name) %>Serializer
43
37
  end
44
38
  end
@@ -86,15 +80,9 @@ class Api::V<%= api_version %>::<%= HorsePower.get_camel_plural(resource_name) %
86
80
 
87
81
  # POST /api/<%= api_version %>/<%= HorsePower.get_plural(resource_name) %>/destroyAll
88
82
  def destroyAll
89
- ActiveRecord::Base.transaction do
90
- @<%= HorsePower.get_plural(resource_name) %>.each do |<%= HorsePower.get_singular(resource_name) %>|
91
- if !::Authorization::V<%= api_version %>::<%= HorsePower.get_camel(resource_name) %>.destroy?(<%= HorsePower.get_singular(resource_name) %>,current_user)
92
- render :json => {errors: "User is not authorized for this action"}, status: :forbidden
93
- raise ActiveRecord::Rollback
94
- return
95
- end
96
- <%= HorsePower.get_singular(resource_name) %>.destroy
97
- end
83
+ if ::<%= HorsePower.get_camel(resource_name) %>.destroyAll(@<%= HorsePower.get_plural(resource_name) %>,current_user).nil?
84
+ render :json => {errors: "User is not authorized for this action"}, status: :forbidden
85
+ else
98
86
  render json: {}
99
87
  end
100
88
  end
@@ -1,5 +1,36 @@
1
1
  require 'type_cartographer'
2
+ require 'authorization/v<%= api_version %>/<%= HorsePower.get_singular(resource_name) %>'
2
3
 
3
4
  class <%= HorsePower.get_camel(resource_name) %> < ActiveRecord::Base
4
-
5
+
6
+ #Controller logic
7
+
8
+ def showAll(<%= HorsePower.get_plural(resource_name) %>,current_user)
9
+ all_<%= HorsePower.get_plural(resource_name) %> = [];
10
+ ActiveRecord::Base.transaction do
11
+ <%= HorsePower.get_plural(resource_name) %>.each do |<%= HorsePower.get_singular(resource_name) %>|
12
+ if !::Authorization::V<%= api_version %>::<%= HorsePower.get_camel(resource_name) %>.show?(<%= HorsePower.get_singular(resource_name) %>,current_user)
13
+ all_<%= HorsePower.get_plural(resource_name) %> = nil
14
+ raise ActiveRecord::Rollback
15
+ end
16
+ all_<%= HorsePower.get_plural(resource_name) %>.push(<%= HorsePower.get_singular(resource_name) %>)
17
+ end
18
+ end
19
+ return all_<%= HorsePower.get_plural(resource_name) %>;
20
+ end
21
+
22
+ def destroyAll(<%= HorsePower.get_plural(resource_name) %>,current_user)
23
+ obj = {}
24
+ ActiveRecord::Base.transaction do
25
+ <%= HorsePower.get_plural(resource_name) %>.each do |<%= HorsePower.get_singular(resource_name) %>|
26
+ if !::Authorization::V<%= api_version %>::<%= HorsePower.get_camel(resource_name) %>.destroy?(<%= HorsePower.get_singular(resource_name) %>,current_user)
27
+ obj = nil
28
+ raise ActiveRecord::Rollback
29
+ end
30
+ <%= HorsePower.get_singular(resource_name) %>.destroy
31
+ end
32
+ end
33
+ return obj
34
+ end
35
+
5
36
  end
@@ -1,4 +1,4 @@
1
- require 'authorization'
1
+ require 'authorization/v<%= api_version %>/<%= HorsePower.get_singular(resource_name) %>'
2
2
 
3
3
  class V<%= api_version %>::<%= HorsePower.get_camel(resource_name) %>Serializer < ActiveModel::Serializer
4
4
  embed :ids, include: true
@@ -149,7 +149,7 @@ module HorsePower
149
149
  gem 'bootstrap-sass', '~> 3.2.0'
150
150
  gem 'activeadmin', :git => 'https://github.com/activeadmin/activeadmin.git', :branch => "master"
151
151
  gem 'defcon'
152
- gem 'authorization', :path => "gems/authorization"
152
+ #gem 'authorization', :path => "gems/authorization"
153
153
  gem 'whenever', :require => false
154
154
  gem 'rack-cors', :require => 'rack/cors'
155
155
  gem 'httparty'
@@ -173,7 +173,7 @@ module HorsePower
173
173
  run "mkdir engines && touch engines/.gitkeep"
174
174
  run "mkdir gems && touch gems/.gitkeep"
175
175
  run "mkdir notes && touch notes/.gitkeep"
176
- run "rails plugin new gems/authorization"
176
+ #run "rails plugin new gems/authorization"
177
177
  end
178
178
 
179
179
  def run_bundle
@@ -1,5 +1,5 @@
1
1
  require_dependency "api/v1/application_controller"
2
- require 'authorization'
2
+ require 'authorization/v1/user'
3
3
 
4
4
  class Api::V1::UsersController < Api::V1::ApplicationController
5
5
 
@@ -1,4 +1,5 @@
1
1
  require 'type_cartographer'
2
+ require 'facebook'
2
3
 
3
4
  class User < ActiveRecord::Base
4
5
  include IdentityCache
@@ -1,4 +1,4 @@
1
- require 'authorization'
1
+ require 'authorization/v1/user'
2
2
 
3
3
  class V1::UserSerializer < ActiveModel::Serializer
4
4
  embed :ids, include: true
@@ -17,8 +17,8 @@ module HorsePower
17
17
  private
18
18
 
19
19
  def create_facebook
20
- run "mkdir app/facebook"
21
- template "facebook.rb", "app/facebook/facebook.rb"
20
+ #run "mkdir app/facebook"
21
+ template "facebook.rb", "lib/facebook.rb"
22
22
  end
23
23
 
24
24
  def create_migration
@@ -37,8 +37,8 @@ module HorsePower
37
37
  end
38
38
 
39
39
  def create_authorization
40
- template "authorization.rb.erb", "gems/authorization/lib/authorization/v1/user.rb"
41
- prepend_file 'gems/authorization/lib/authorization.rb', "require \'authorization/v1/user\'\n"
40
+ template "authorization.rb.erb", "lib/authorization/v1/user.rb"
41
+ #prepend_file 'gems/authorization/lib/authorization.rb', "require \'authorization/v1/user\'\n"
42
42
  end
43
43
 
44
44
  def create_serializer
@@ -1,3 +1,3 @@
1
1
  module HorsePower
2
- VERSION = "0.6.5"
2
+ VERSION = "0.7.0"
3
3
  end
@@ -1,3 +1,9 @@
1
+ PATH
2
+ remote: ../../../
3
+ specs:
4
+ horse_power (0.6.5)
5
+ rails (>= 4.0.0)
6
+
1
7
  GEM
2
8
  remote: https://rubygems.org/
3
9
  specs:
@@ -40,24 +46,23 @@ GEM
40
46
  binding_of_caller (0.7.2)
41
47
  debug_inspector (>= 0.0.1)
42
48
  builder (3.2.2)
43
- byebug (4.0.3)
49
+ byebug (4.0.5)
44
50
  columnize (= 0.9.0)
45
51
  coffee-rails (4.1.0)
46
52
  coffee-script (>= 2.2.0)
47
53
  railties (>= 4.0.0, < 5.0)
48
- coffee-script (2.3.0)
54
+ coffee-script (2.4.1)
49
55
  coffee-script-source
50
56
  execjs
51
- coffee-script-source (1.9.1)
57
+ coffee-script-source (1.9.1.1)
52
58
  columnize (0.9.0)
53
59
  debug_inspector (0.0.2)
54
60
  erubis (2.7.0)
55
- execjs (2.4.0)
56
- globalid (0.3.3)
61
+ execjs (2.5.2)
62
+ globalid (0.3.5)
57
63
  activesupport (>= 4.1.0)
58
- hike (1.2.3)
59
64
  i18n (0.7.0)
60
- jbuilder (2.2.12)
65
+ jbuilder (2.2.13)
61
66
  activesupport (>= 3.0.0, < 5)
62
67
  multi_json (~> 1.2)
63
68
  jquery-rails (4.0.3)
@@ -71,7 +76,7 @@ GEM
71
76
  mime-types (>= 1.16, < 3)
72
77
  mime-types (2.4.3)
73
78
  mini_portile (0.6.2)
74
- minitest (5.5.1)
79
+ minitest (5.6.0)
75
80
  multi_json (1.11.0)
76
81
  nokogiri (1.6.6.2)
77
82
  mini_portile (~> 0.6.0)
@@ -106,7 +111,7 @@ GEM
106
111
  rdoc (4.2.0)
107
112
  json (~> 1.4)
108
113
  sass (3.4.13)
109
- sass-rails (5.0.1)
114
+ sass-rails (5.0.3)
110
115
  railties (>= 4.0.0, < 5.0)
111
116
  sass (~> 3.1)
112
117
  sprockets (>= 2.8, < 4.0)
@@ -115,12 +120,9 @@ GEM
115
120
  sdoc (0.4.1)
116
121
  json (~> 1.7, >= 1.7.7)
117
122
  rdoc (~> 4.0)
118
- spring (1.3.3)
119
- sprockets (2.12.3)
120
- hike (~> 1.2)
121
- multi_json (~> 1.0)
123
+ spring (1.3.4)
124
+ sprockets (3.0.0)
122
125
  rack (~> 1.0)
123
- tilt (~> 1.1, != 1.3.0)
124
126
  sprockets-rails (2.2.4)
125
127
  actionpack (>= 3.0)
126
128
  activesupport (>= 3.0)
@@ -148,6 +150,7 @@ PLATFORMS
148
150
  DEPENDENCIES
149
151
  byebug
150
152
  coffee-rails (~> 4.1.0)
153
+ horse_power!
151
154
  jbuilder (~> 2.0)
152
155
  jquery-rails
153
156
  rails (= 4.2.1)
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: ../../../
3
3
  specs:
4
- horse_power (0.0.1)
5
- rails (~> 4.1.6)
4
+ horse_power (0.6.5)
5
+ rails (>= 4.0.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -38,28 +38,28 @@ GEM
38
38
  coffee-rails (4.0.1)
39
39
  coffee-script (>= 2.2.0)
40
40
  railties (>= 4.0.0, < 5.0)
41
- coffee-script (2.3.0)
41
+ coffee-script (2.4.1)
42
42
  coffee-script-source
43
43
  execjs
44
- coffee-script-source (1.8.0)
44
+ coffee-script-source (1.9.1.1)
45
45
  erubis (2.7.0)
46
- execjs (2.2.2)
46
+ execjs (2.5.2)
47
47
  hike (1.2.3)
48
- i18n (0.6.11)
49
- jbuilder (2.2.5)
48
+ i18n (0.7.0)
49
+ jbuilder (2.2.13)
50
50
  activesupport (>= 3.0.0, < 5)
51
51
  multi_json (~> 1.2)
52
52
  jquery-rails (3.1.2)
53
53
  railties (>= 3.0, < 5.0)
54
54
  thor (>= 0.14, < 2.0)
55
- json (1.8.1)
55
+ json (1.8.2)
56
56
  mail (2.6.3)
57
57
  mime-types (>= 1.16, < 3)
58
58
  mime-types (2.4.3)
59
- minitest (5.4.3)
60
- multi_json (1.10.1)
59
+ minitest (5.6.0)
60
+ multi_json (1.11.0)
61
61
  rack (1.5.2)
62
- rack-test (0.6.2)
62
+ rack-test (0.6.3)
63
63
  rack (>= 1.0)
64
64
  rails (4.1.6)
65
65
  actionmailer (= 4.1.6)
@@ -88,25 +88,25 @@ GEM
88
88
  sdoc (0.4.1)
89
89
  json (~> 1.7, >= 1.7.7)
90
90
  rdoc (~> 4.0)
91
- spring (1.2.0)
91
+ spring (1.3.4)
92
92
  sprockets (2.12.3)
93
93
  hike (~> 1.2)
94
94
  multi_json (~> 1.0)
95
95
  rack (~> 1.0)
96
96
  tilt (~> 1.1, != 1.3.0)
97
- sprockets-rails (2.2.2)
97
+ sprockets-rails (2.2.4)
98
98
  actionpack (>= 3.0)
99
99
  activesupport (>= 3.0)
100
100
  sprockets (>= 2.8, < 4.0)
101
101
  sqlite3 (1.3.10)
102
102
  thor (0.19.1)
103
- thread_safe (0.3.4)
103
+ thread_safe (0.3.5)
104
104
  tilt (1.4.1)
105
- turbolinks (2.5.2)
105
+ turbolinks (2.5.3)
106
106
  coffee-rails
107
107
  tzinfo (1.2.2)
108
108
  thread_safe (~> 0.1)
109
- uglifier (2.5.3)
109
+ uglifier (2.7.1)
110
110
  execjs (>= 0.3.0)
111
111
  json (>= 1.8.0)
112
112
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: horse_power
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.5
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cleophus Robinson IV
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-13 00:00:00.000000000 Z
11
+ date: 2015-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails