Class: Tasker::Generators::AuthenticatorGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Tasker::Generators::AuthenticatorGenerator
show all
- Defined in:
- lib/generators/tasker/authenticator_generator.rb
Defined Under Namespace
Classes: UsageInstructionsFormatter
Instance Method Summary
collapse
Instance Method Details
#create_authenticator_file ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/generators/tasker/authenticator_generator.rb', line 24
def create_authenticator_file
ensure_directory_exists(options[:directory])
case options[:type].downcase
when 'jwt'
template 'jwt_authenticator.rb.erb', File.join(options[:directory], "#{file_name}_authenticator.rb")
when 'devise'
template 'devise_authenticator.rb.erb', File.join(options[:directory], "#{file_name}_authenticator.rb")
when 'api_token'
template 'api_token_authenticator.rb.erb', File.join(options[:directory], "#{file_name}_authenticator.rb")
when 'omniauth'
template 'omniauth_authenticator.rb.erb', File.join(options[:directory], "#{file_name}_authenticator.rb")
else
template 'custom_authenticator.rb.erb', File.join(options[:directory], "#{file_name}_authenticator.rb")
end
end
|
#create_spec_file ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/generators/tasker/authenticator_generator.rb', line 41
def create_spec_file
return unless options[:with_spec] && defined?(RSpec)
ensure_directory_exists('spec/tasker/authenticators')
case options[:type].downcase
when 'jwt'
template 'jwt_authenticator_spec.rb.erb',
File.join('spec/tasker/authenticators', "#{file_name}_authenticator_spec.rb")
when 'devise'
template 'devise_authenticator_spec.rb.erb',
File.join('spec/tasker/authenticators', "#{file_name}_authenticator_spec.rb")
when 'api_token'
template 'api_token_authenticator_spec.rb.erb',
File.join('spec/tasker/authenticators', "#{file_name}_authenticator_spec.rb")
when 'omniauth'
template 'omniauth_authenticator_spec.rb.erb',
File.join('spec/tasker/authenticators', "#{file_name}_authenticator_spec.rb")
else
template 'custom_authenticator_spec.rb.erb',
File.join('spec/tasker/authenticators', "#{file_name}_authenticator_spec.rb")
end
end
|
#show_usage_instructions ⇒ Object