Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Decreased encapsulation to make the tasks more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
dshevtsov committed Jan 7, 2019
1 parent ac31ab1 commit e63f3b3
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 57 deletions.
54 changes: 28 additions & 26 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,50 +1,52 @@
require_relative './rakelib/rake-helper.rb'
# frozen_string_literal: true

include JekyllRake
include Proofer
include Converter
# This file contains tasks with no namespace.
# All namespaced tasks are defined in the '../rakelib' directory.
# Each namespace is defined in a separate file.
# For example, 'preview:all' is defined in the '../rakelib/preview.rake' file.
# To see the list of tasks to use, run 'rake -T'.

require 'html-proofer'
require 'kramdown'
require 'launchy'
require 'colorator'

# Load ruby files with helper methods from the 'rakelib/' directory
require_relative 'rakelib/link-checker.rb'
require_relative 'rakelib/converter.rb'

desc "Same as 'rake', 'rake preview'"
task default: %w[preview]

desc "Same as 'test:report'"
task test: %w[test:report]

desc "Preview the devdocs locally"
desc 'Preview the devdocs locally'
task preview: %w[install clean] do
print "Generating devdocs locally ... ".magenta
if File.exists?('_config.local.yml')
print "enabled the additional configuration parameters from _config.local.yml: $ ".magenta
preview_local
puts 'Generating devdocs locally ... '.magenta
if File.exist?('_config.local.yml')
print 'enabled the additional configuration parameters from _config.local.yml: $ '.magenta
sh 'bundle exec jekyll serve --incremental --open-url --livereload --trace --config _config.yml,_config.local.yml'
else
print "enabled the default configuration; generating the entire devdocs $ ".magenta
preview
Rake::Task['preview:all'].invoke
end
end

desc "Remove the generated content"
task :clean do
print "Cleaning after the last site generation: $ ".magenta
jekyll 'clean'
puts "Clean!".green
print 'Cleaning after the last site generation: $ '.magenta
sh 'bundle exec jekyll clean'
puts 'Clean!'.green
end

desc "Install gems listed in the Gemfile"
task :install do
print "Install gems listed in the Gemfile: $ ".magenta
print 'Install gems listed in the Gemfile: $ '.magenta
sh 'bundle install'
puts "Installed!".green
puts 'Installed!'.green
end

desc "Build the entire website"
desc 'Build the entire website'
task build: %w[clean] do
print 'Building the site with Jekyll: $ '.magenta
jekyll 'build --verbose'
sh 'bundle exec jekyll build --verbose --trace'
puts 'Built!'.green
end

desc "Checkout to the master branch"
task :to_master do
print 'Checking out the branch to master: $ '.magenta
sh 'git checkout master'
end
16 changes: 0 additions & 16 deletions rakelib/jekyll.rb

This file was deleted.

14 changes: 8 additions & 6 deletions rakelib/preview.rake
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# frozen_string_literal: true

namespace :preview do
desc 'Preview the entire devdocs locally'
task all: %w[install clean] do
puts "Generating the entire devdocs locally ... ".magenta
preview
end
end
desc 'Preview the entire devdocs locally'
task all: %w[install clean] do
print 'Enabled the default configuration: $ '.magenta
sh 'bundle exec jekyll serve --incremental --open-url --livereload --trace'
end
end
9 changes: 0 additions & 9 deletions rakelib/rake-helper.rb

This file was deleted.

0 comments on commit e63f3b3

Please sign in to comment.