aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorGravatar √Čtienne Deparis 2020-11-12 11:03:00 +0100
committerGravatar √Čtienne Deparis 2020-11-12 11:03:29 +0100
commit6693c3ade6b099a50dc077702de703c766dcf8a9 (patch)
tree4915c472f76d5d60a0c53a2e60284f7cdaf1a202
parent06249969e69cdc390e4f3f161bf6086ba8a3ce95 (diff)
downloadfronde-6693c3ade6b099a50dc077702de703c766dcf8a9.tar.gz
fronde-6693c3ade6b099a50dc077702de703c766dcf8a9.tar.xz
fronde-6693c3ade6b099a50dc077702de703c766dcf8a9.zip
feat: Add a default .gitignore file
-rw-r--r--lib/fronde/cli.rb18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/fronde/cli.rb b/lib/fronde/cli.rb
index 10a0b90..c9bd87e 100644
--- a/lib/fronde/cli.rb
+++ b/lib/fronde/cli.rb
@@ -8,6 +8,7 @@ module Fronde
class CLI
def initialize(opts = {})
@options = { verbose: false }.merge(opts)
+ init_required_files
init_rake
end
@@ -15,8 +16,12 @@ module Fronde
private
- def init_rake
+ def init_required_files
init_rakefile unless File.exist?('Rakefile')
+ init_gitignore unless File.exist?('.gitignore')
+ end
+
+ def init_rake
@rake = Rake.application
Rake.verbose(false) unless @options[:verbose]
@rake.raw_load_rakefile
@@ -40,5 +45,16 @@ module Fronde
RAKE
IO.write 'Rakefile', rakefile
end
+
+ def init_gitignore
+ gitignore = <<~GITIGNORE
+ .dir-locals.el
+ Rakefile
+ lib
+ public_html
+ var
+ GITIGNORE
+ IO.write '.gitignore', gitignore
+ end
end
end