Class: Sylvia::Jekyll
- Inherits:
-
Object
- Object
- Sylvia::Jekyll
- Defined in:
- lib/sylvia/jekyll.rb
Class Method Summary collapse
- .copy_fallback_template(target) ⇒ Object
- .git_installed? ⇒ Boolean
- .new_project(target = 'jekyll-app') ⇒ Object
Class Method Details
.copy_fallback_template(target) ⇒ Object
26 27 28 29 |
# File 'lib/sylvia/jekyll.rb', line 26 def self.copy_fallback_template(target) source = File.('../../templates/jekyll', __dir__) FileUtils.cp_r("#{source}/.", target) end |
.git_installed? ⇒ Boolean
22 23 24 |
# File 'lib/sylvia/jekyll.rb', line 22 def self.git_installed? system('git --version > /dev/null 2>&1') end |
.new_project(target = 'jekyll-app') ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/sylvia/jekyll.rb', line 6 def self.new_project(target = 'jekyll-app') repo = 'https://github.com/spellbooks/jekyll-boilerplate' if git_installed? puts 'Git found, cloning repo...' system("git clone #{repo} #{target}") else puts 'Git not found, using fallback template...' copy_fallback_template(target) end puts "Project created successfully in folder: #{target}" end |