-
-
Notifications
You must be signed in to change notification settings - Fork 84
/
Runfile
75 lines (63 loc) · 1.96 KB
/
Runfile
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
require "runfile-tasks"
require "byebug"
require "colsole"
require_relative 'lib/bashly'
require_relative 'helpers/example'
include Colsole
title "Bashly Developer Toolbelt"
summary "Runfile tasks for building the Bashly gem"
version Bashly::VERSION
RunfileTasks::RubyGems.all 'bashly'
RunfileTasks::Testing.rspec
help "Run interactive console"
action :console, :c do
run "bundle exec bin/console"
end
help "Run shellcheck on all examples"
action :shellcheck do
Example.executables.each do |example|
success = system "shellcheck #{example}"
color = success ? 'txtgrn' : 'txtred'
say "- shellcheck !#{color}!#{example}"
exit 1 unless success
end
end
help "Generate changelog and append old changelog"
action :changelog do
run "git changelog --save"
# append older changelog (prior to switching to git-changelog)
run "cat .changelog.old.md >> CHANGELOG.md"
end
help "Append the content of bashly.yml to all example READMEs"
action :examples do
# Patch the PATH to allow the extensible example to run properly
ENV['PATH']="#{Dir.pwd}/examples/extensible:#{ENV['PATH']}"
Example.all.each do |example|
say example.dir
example.regenerate_readme
end
end
command :docker
help "Build the docker images"
action :build, :b do
run "docker build -t dannyben/bashly ."
run "docker tag dannyben/bashly dannyben/bashly:#{Bashly::VERSION}"
run "docker images |grep bashly"
end
help "Smoke test the docker image"
action :test, :t do
bashly_version = `docker run --rm dannyben/bashly --version`.chomp
if bashly_version != Bashly::VERSION
say "!txtred!FAIL: docker bashly version is #{bashly_version}, expected #{Bashly::VERSION}"
exit 1
else
say "!txtgrn!PASS: docker bashly version is #{bashly_version}"
end
end
help "Push the docker images to Docker Hub"
action :push, :p do
run "docker push dannyben/bashly"
run "docker push dannyben/bashly:#{Bashly::VERSION}"
end
endcommand
require './debug.rb' if File.exist? 'debug.rb'