Class: Pah::Template
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Pah::Template
show all
- Defined in:
- lib/pah/template.rb
Direct Known Subclasses
Pah::Templates::Bin, Pah::Templates::Bourbon, Pah::Templates::Bullet, Pah::Templates::CanonicalHost, Pah::Templates::Capybara, Pah::Templates::Cleanup, Pah::Templates::Config, Pah::Templates::Database, Pah::Templates::Gem, Pah::Templates::Generator, Pah::Templates::Git, Pah::Templates::Heroku, Pah::Templates::Inflection, Pah::Templates::Jumpup, Pah::Templates::Layout, Pah::Templates::LetterOpener, Pah::Templates::Locale, Pah::Templates::Newrelic, Pah::Templates::Public, Pah::Templates::Puma, Pah::Templates::RackDeflater, Pah::Templates::Readme, Pah::Templates::Rollbar, Pah::Templates::Rspec, Pah::Templates::RubyEnv, Pah::Templates::SecretToken, Pah::Templates::SecureHeader, Pah::Templates::Sendgrid, Pah::Templates::SimpleForm
Instance Method Summary
collapse
Instance Method Details
#ask_unless_test(*params) ⇒ Object
24
25
26
|
# File 'lib/pah/template.rb', line 24
def ask_unless_test(*params)
ask(*params)
end
|
#copy_static_file(path) ⇒ Object
7
8
9
10
|
# File 'lib/pah/template.rb', line 7
def copy_static_file(path)
remove_file path
create_file path, File.read(File.join(static_files, path))
end
|
#git_commit(message) ⇒ Object
28
29
30
31
|
# File 'lib/pah/template.rb', line 28
def git_commit(message)
message = "#{message}\n\nGenerated by pah version #{Pah::VERSION}"
git commit: "-m '#{message}' -q"
end
|
#static_files ⇒ Object
3
4
5
|
# File 'lib/pah/template.rb', line 3
def static_files
File.join(TEMPLATE_ROOT, 'files')
end
|
#will_you_like_to?(question) ⇒ Boolean
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/pah/template.rb', line 12
def will_you_like_to?(question)
answer = ask("Will you like to #{question} [y,n]".green)
case answer.downcase
when 'yes', 'y'
true
when 'no', 'n'
false
else
will_you_like_to?(question)
end
end
|