angus 0.0.12 → 0.0.13.beta1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ba8e29585ccc3f4558ce66fdf257c696d65bb10
4
- data.tar.gz: 1f0b401af56b8462ca00bc53f223a54100bcc69f
3
+ metadata.gz: 52dfb62300b9cd894eb0c790f4aed070d537f66e
4
+ data.tar.gz: 8d162a39add6eabc1c96c3ab8f9699b7502f429f
5
5
  SHA512:
6
- metadata.gz: 289a56869ebd21adfda4f6ca58ab068e8c89e5454ec3a8a4cc1ffcedeba44915fb270134e4deca77594e262f02f8044a2d28d2260cfc86382a59743e3f484a02
7
- data.tar.gz: 26e891f72a1371f1547aca5b780d7cda9a95657f07f77bd2280580f87afe15d928f1f24b21dc069149927d32cafaccfb39a2ff63e3dc33d213fb8ae5a3e0eda1
6
+ metadata.gz: 4a8dd6e0e7f172aebb653f2e1016c4df724c8db0cc9a3499ee49189dde2d0f3073597e2457add8534a766074673c6fe7468fca1722fc9186e5d36cc86fd8e86f
7
+ data.tar.gz: 798aaecae287b2a3481b887ecbfa68dc8bf952536263c38d11c5ce89e38df9162c23c6b755470e6acfa4bc531d1e33cf43846768e24d0383978b10c698b22e99
@@ -1,4 +1,4 @@
1
- $: << (File.dirname(__FILE__))
1
+ $LOAD_PATH << (File.dirname(__FILE__))
2
2
 
3
3
  require 'bundler'
4
4
 
@@ -7,4 +7,4 @@ Bundler.setup
7
7
  require 'angus'
8
8
  require 'services/<%= underscore(app_name) %>'
9
9
 
10
- run <%= classify(name) %>.new
10
+ run <%= classify(underscore(name)) %>.new
@@ -1,4 +1,4 @@
1
- <% if is_demo? %>
1
+ <% if is_demo? -%>
2
2
  ResourceNotFound:
3
3
  status_code: 404
4
4
  level: error
@@ -1,26 +1,30 @@
1
- <% unless actions.nil? %>
2
- <% actions.each do |action_name| %>
1
+ <% unless actions.nil? -%>
2
+ <% actions.each_with_index do |action_name, index| -%>
3
+ <% unless index.zero? -%>
4
+
5
+ <% end -%>
3
6
  <%= action_name %>:
4
7
  name: '<%= action_name %>'
5
8
  description: '<%= action_description(action_name) %>'
6
9
  path: '<%= action_path(action_name) %>'
7
10
  method: '<%= action_method(action_name) %>'
8
- <% unless is_demo? %>
11
+ <% if action_has_id_in_path?(action_name) -%>
12
+
9
13
  uri:
10
- - element:
11
- description:
12
- <% end %>
14
+ - element: id
15
+ description: <%= resource_name %> id.
16
+ <% end -%>
13
17
 
14
18
  response:
15
19
  - element: '<%= response_element(action_name) %>'
16
20
  description: '<%= response_description(action_name) %>'
17
21
  required: <%= response_required(action_name) %>
18
22
  type: <%= response_type(action_name) %>
23
+ <% if is_demo? -%>
19
24
 
20
- <% if is_demo? %>
21
25
  messages:
22
26
  - key: <%= message_key(action_name) %>
23
27
  description: '<%= message_description(action_name) %>'
24
- <% end %>
25
- <% end %>
26
- <% end %>
28
+ <% end -%>
29
+ <% end -%>
30
+ <% end -%>
@@ -1,3 +1,3 @@
1
- service: '<%= classify(app_name) %>'
1
+ service: '<%= classify(underscore(app_name)) %>'
2
2
  code_name: '<%= app_name %>'
3
3
  version: '0.1'
@@ -1,4 +1,4 @@
1
- class <%= classify(app_name) %> < Angus::Base
1
+ class <%= classify(underscore(app_name)) %> < Angus::Base
2
2
  def configure
3
3
  end
4
4
  end
@@ -65,11 +65,10 @@ class Thor
65
65
  if is_demo?
66
66
  '/users'
67
67
  elsif is_scaffold?
68
- case action_name
69
- when 'show', 'update', 'destroy'
70
- "#{underscore(resource_name)}/:id"
71
- else
72
- "#{underscore(resource_name)}"
68
+ if action_has_id_in_path?(action_name)
69
+ "/#{underscore(resource_name)}/:id"
70
+ else
71
+ "/#{underscore(resource_name)}"
73
72
  end
74
73
  end
75
74
  end
@@ -91,6 +90,10 @@ class Thor
91
90
  end
92
91
  end
93
92
 
93
+ def action_has_id_in_path?(action_name)
94
+ %w[show update destroy].include?(action_name)
95
+ end
96
+
94
97
  def response_element(action_name)
95
98
  'users' if is_demo?
96
99
  end
data/lib/angus/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Angus
2
- VERSION = '0.0.12'
2
+ VERSION = '0.0.13.beta1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: angus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pablo Ifran
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2014-07-17 00:00:00.000000000 Z
18
+ date: 2014-09-16 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: thor
@@ -305,9 +305,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
305
305
  version: '0'
306
306
  required_rubygems_version: !ruby/object:Gem::Requirement
307
307
  requirements:
308
- - - ">="
308
+ - - ">"
309
309
  - !ruby/object:Gem::Version
310
- version: '0'
310
+ version: 1.3.1
311
311
  requirements: []
312
312
  rubyforge_project:
313
313
  rubygems_version: 2.2.2
@@ -315,48 +315,48 @@ signing_key:
315
315
  specification_version: 4
316
316
  summary: A web services summary
317
317
  test_files:
318
- - spec/support/matchers/have_in_message_matcher.rb
319
- - spec/support/matchers/have_error_response_matcher.rb
320
- - spec/support/matchers/have_success_response_matcher.rb
321
318
  - spec/spec_helper.rb
322
- - spec/angus/request_handler_spec.rb
323
- - spec/angus/middleware/exception_handler_spec.rb
324
- - spec/angus/rspec/examples/describe_errors_spec.rb
325
- - spec/functional/filters/exceptions/user_errors.rb
326
- - spec/functional/filters/models/user.rb
327
- - spec/functional/filters/resources/users.rb
328
- - spec/functional/filters/services/filters.rb
329
- - spec/functional/filters/definitions/representations.yml
330
- - spec/functional/filters/definitions/users/operations.yml
331
- - spec/functional/filters/definitions/messages.yml
332
- - spec/functional/filters/definitions/service.yml
333
- - spec/functional/no_resources_spec.rb
334
319
  - spec/functional/empty_resource_spec.rb
335
- - spec/functional/basic/exceptions/user_errors.rb
336
- - spec/functional/basic/models/user.rb
320
+ - spec/functional/type_validation_spec.rb
321
+ - spec/functional/type_validation/resources/admins.rb
322
+ - spec/functional/type_validation/models/admin.rb
323
+ - spec/functional/type_validation/definitions/admins/operations.yml
324
+ - spec/functional/type_validation/definitions/representations.yml
325
+ - spec/functional/type_validation/definitions/messages.yml
326
+ - spec/functional/type_validation/definitions/service.yml
327
+ - spec/functional/type_validation/services/type_validation.rb
337
328
  - spec/functional/basic/resources/users.rb
338
- - spec/functional/basic/services/basic.rb
339
- - spec/functional/basic/definitions/representations.yml
329
+ - spec/functional/basic/models/user.rb
330
+ - spec/functional/basic/exceptions/user_errors.rb
340
331
  - spec/functional/basic/definitions/users/operations.yml
332
+ - spec/functional/basic/definitions/representations.yml
341
333
  - spec/functional/basic/definitions/messages.yml
342
334
  - spec/functional/basic/definitions/service.yml
335
+ - spec/functional/basic/services/basic.rb
336
+ - spec/functional/no_resources/definitions/representations.yml
337
+ - spec/functional/no_resources/definitions/messages.yml
338
+ - spec/functional/no_resources/definitions/service.yml
339
+ - spec/functional/no_resources/services/no_resources.rb
343
340
  - spec/functional/filters_spec.rb
341
+ - spec/functional/filters/resources/users.rb
342
+ - spec/functional/filters/models/user.rb
343
+ - spec/functional/filters/exceptions/user_errors.rb
344
+ - spec/functional/filters/definitions/users/operations.yml
345
+ - spec/functional/filters/definitions/representations.yml
346
+ - spec/functional/filters/definitions/messages.yml
347
+ - spec/functional/filters/definitions/service.yml
348
+ - spec/functional/filters/services/filters.rb
349
+ - spec/functional/no_resources_spec.rb
344
350
  - spec/functional/empty_resource/resources/users.rb
345
- - spec/functional/empty_resource/services/empty_resource.rb
346
- - spec/functional/empty_resource/definitions/representations.yml
347
351
  - spec/functional/empty_resource/definitions/users/operations.yml
352
+ - spec/functional/empty_resource/definitions/representations.yml
348
353
  - spec/functional/empty_resource/definitions/messages.yml
349
354
  - spec/functional/empty_resource/definitions/service.yml
350
- - spec/functional/type_validation/models/admin.rb
351
- - spec/functional/type_validation/resources/admins.rb
352
- - spec/functional/type_validation/services/type_validation.rb
353
- - spec/functional/type_validation/definitions/admins/operations.yml
354
- - spec/functional/type_validation/definitions/representations.yml
355
- - spec/functional/type_validation/definitions/messages.yml
356
- - spec/functional/type_validation/definitions/service.yml
355
+ - spec/functional/empty_resource/services/empty_resource.rb
357
356
  - spec/functional/basic_spec.rb
358
- - spec/functional/type_validation_spec.rb
359
- - spec/functional/no_resources/services/no_resources.rb
360
- - spec/functional/no_resources/definitions/representations.yml
361
- - spec/functional/no_resources/definitions/messages.yml
362
- - spec/functional/no_resources/definitions/service.yml
357
+ - spec/angus/request_handler_spec.rb
358
+ - spec/angus/middleware/exception_handler_spec.rb
359
+ - spec/angus/rspec/examples/describe_errors_spec.rb
360
+ - spec/support/matchers/have_in_message_matcher.rb
361
+ - spec/support/matchers/have_success_response_matcher.rb
362
+ - spec/support/matchers/have_error_response_matcher.rb