harbourmaster 0.2.2 → 0.2.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fad0e113567ab8f6d459dd794611cf1c8497a7b6
|
4
|
+
data.tar.gz: 4c87cde2aac140a8d4e3a24bcbf95a42830f1da0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db08e9f82dd77d696073d7d56115a50aa19c8a90aa3beeea7d922d340017fec7a94cced25cf3b91df4c158ed0a9bd55b28572710972e4e25322f26a9185502c1
|
7
|
+
data.tar.gz: 91acbb185acb6fe476500aa4465c2f2a9c437d1527d903012b49039113d79a5f1de08e12b63383595d8f7aec691db8d026d216e85440aaad3c32eb104d2a457e
|
@@ -4,10 +4,14 @@ module Harbourmaster
|
|
4
4
|
argument :api_base_route, type: :string, default: "app/controllers/api"
|
5
5
|
class_option :permit_params, type: :boolean, desc: "When included will generate a permitted_params method in the controller"
|
6
6
|
class_option :skip_tests, type: :boolean, desc: "Skip generating the acceptance tests used for generating documentation"
|
7
|
-
class_option :
|
7
|
+
class_option :skip_controller, type: :boolean, desc: "Skip generating the controller for the resource"
|
8
|
+
class_option :skip_serializer, type: :boolean, desc: "Skip generating the serializer for the resource"
|
9
|
+
class_option :authentication, type: :string, aliases: '-auth', desc: "Put controller behind authentication. Accepts either 'token' or 'devise' as options"
|
10
|
+
class_option :actions, type: :array, aliases: '-a', desc: "List of controller actions to generate", default: 'all'
|
8
11
|
source_root File.expand_path('../templates', __FILE__)\
|
9
12
|
|
10
13
|
def create_controller_file
|
14
|
+
return if options['skip_controller']
|
11
15
|
template 'controller.rb', "#{api_base_route}/#{plural_name}_controller.rb"
|
12
16
|
end
|
13
17
|
|
@@ -17,6 +21,7 @@ module Harbourmaster
|
|
17
21
|
end
|
18
22
|
|
19
23
|
def create_serializer
|
24
|
+
return if options['skip_serializer']
|
20
25
|
template 'serializer.rb', "app/serializers/#{name.underscore}_serializer.rb"
|
21
26
|
end
|
22
27
|
end
|
@@ -1,4 +1,9 @@
|
|
1
1
|
class <%= ("#{api_base_route}/#{plural_name}".split('/') - ['app', 'controllers']).map(&:camelize).join("::") -%>Controller < BaseApiController
|
2
|
+
<% if options['authentication'] -%>
|
3
|
+
<%= "before_action :authenticate_user!" if options['authentication'] == 'devise' -%>
|
4
|
+
<%= "acts_as_token_authentication_handler_for User" if options['authentication'] == 'token' -%>
|
5
|
+
<% end -%>
|
6
|
+
|
2
7
|
<%= "actions :#{options['actions'].join(', :') }" if options['actions'].present? -%>
|
3
8
|
|
4
9
|
<% if options['permit_params'] -%>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: harbourmaster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Isaac Norman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|