GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — command-line-nuts/Rakefile at master · lescastcodeurs/command-line-nuts

Expand file tree

/

Rakefile

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
145 lines (130 loc) · 3.81 KB
/

Rakefile

Copy path

File metadata and controls

145 lines (130 loc) · 3.81 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# This file is a rake build file. The purpose of this file is to simplify
# setting up and using Awestruct. It's not required to use Awestruct, though it
# does save you time (hopefully). If you don't want to use rake, just ignore or
# delete this file.
#
# If you're just getting started, execute this command to install Awestruct and
# the libraries on which it depends:
#
# rake setup
#
# The setup task installs the necessary libraries according to which Ruby
# environment you are using. If you want the libraries kept inside the project,
# execute this command instead:
#
# rake setup[local]
#
# IMPORTANT: To install gems, you'll need development tools on your machine,
# which include a C compiler, the Ruby development libraries and some other
# development libraries as well.
#
# There are also tasks for running Awestruct. The build will auto-detect
# whether you are using Bundler and, if you are, wrap calls to awestruct in
# `bundle exec`.
#
# To run in Awestruct in development mode, execute:
#
# rake
#
# To clean the generated site before you build, execute:
#
# rake clean preview
#
# To deploy using the production profile, execute:
#
# rake deploy
#
# To get a list of all tasks, execute:
#
# rake -T
#
# Now you're Awestruct with rake!
$rakebin = "_bin#{File::SEPARATOR}forrake"
$awestruct_cmd = nil
task :default => :preview
task :build_deck do
run_asciidoctor "-T ~/Code/others/asciidoctor/asciidoctor-backends/haml/deckjs presentation.adoc"
end
desc 'Build the presentation in reveal.js'
task :build_reveal do
run_asciidoctor "-T ~/Code/others/asciidoctor/asciidoctor-reveal.js/templates/slim presentation.adoc"
end
desc 'Enable guard'
task :guard do
system "bundle exec guard"
end
# Execute Asciidoctor
def run_asciidoctor(args)
cmd = "bundle exec asciidoctor #{args}"
msg cmd
system cmd or raise "ERROR: Running Asciidoctor failed."
end
desc 'Setup the environment for Asciidoctor and guard'
task :setup, [:env] => :init do |task, args|
system "bundle install --binstubs=#{$rakebin} --path=.bundle"
msg 'Run awestruct `rake`'
# Don't execute any more tasks, need to reset env
exit 0
end
desc 'Update the environment to run Asciidoctor and guard'
task :update => :init do
system 'bundle update'
# Don't execute any more tasks, need to reset env
exit 0
end
desc 'Push local commits to origin/master'
task :push do
system 'git push upstream master'
end
desc 'Clean out generated site and temporary files, using [all] will also delete local gem files'
task :clean, :all do |task, args|
require 'fileutils'
dirs = ['.awestruct', '.sass-cache', '_site']
if args[:all] == 'all'
dirs << '_tmp'
dirs << '.bundle'
dirs << "#{$rakebin}"
end
dirs.each do |dir|
FileUtils.remove_dir dir unless !File.directory? dir
end
end
# Perform initialization steps, such as setting up the PATH
task :init do
# Detect using gems local to project
if File.exist? "#{$rakebin}"
ENV['PATH'] = "#{$rakebin}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
ENV['GEM_HOME'] = '.bundle'
end
end
# A cross-platform means of finding an executable in the $PATH.
# Respects $PATHEXT, which lists valid file extensions for executables on Windows
#
# which 'awestruct'
# => /usr/bin/awestruct
def which(cmd, opts = {})
unless $awestruct_cmd.nil? || opts[:clear_cache]
return $awestruct_cmd
end
$awestruct_cmd = nil
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
exts.each do |ext|
candidate = File.join path, "#{cmd}#{ext}"
if File.executable? candidate
$awestruct_cmd = candidate
return $awestruct_cmd
end
end
end
return $awestruct_cmd
end
# Print a message to STDOUT
def msg(text, level = :info)
case level
when :warn
puts "\e[31m#{text}\e[0m"
else
puts "\e[33m#{text}\e[0m"
end
end
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.