Skip to content

Commit 06f37bf

Browse files
committed
- Remove Colsole and Exec modules
1 parent c95b759 commit 06f37bf

File tree

44 files changed

+173
-316
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+173
-316
lines changed

Gemfile

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
source "https://rubygems.org"
22

3-
gemspec
3+
gem 'runfile-tasks'
4+
gem 'cucumber'
5+
gem 'rspec-expectations'
6+
gem 'rdoc'
7+
gem 'similar_text'
8+
gem 'byebug'
9+
gem 'colsole'
410

5-
group :development do
6-
gem 'runfile-tasks'
7-
gem 'cucumber'
8-
gem 'rspec-expectations'
9-
gem 'rdoc'
10-
gem 'similar_text'
11-
gem 'byebug'
12-
end
11+
gemspec

Runfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
require "runfile-tasks"
22
require "yaml"
3+
require "colsole"
4+
require "byebug"
5+
6+
include Colsole
37

48
title "Runfile Runfile"
59
summary "Runfile tasks for building the Runfile gem"

bin/run

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ require 'runfile'
55
# for dev
66
# require File.dirname(__FILE__) + "/../lib/runfile"
77

8-
include Colsole
98
include Runfile::DSL
109

1110
Runfile::Runner.instance.execute ARGV

bin/run!

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ require 'runfile'
1111
# for dev
1212
# require File.dirname(__FILE__) + "/../lib/runfile"
1313

14-
include Colsole
1514
include Runfile::DSL
1615

1716
Runfile::Runner.instance.execute ARGV, false

examples/a_minimal/Runfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
usage "greet <name>"
22
help "Say hello to <name>"
33
action :greet do |args|
4-
say "Hello #{args['<name>']}"
4+
puts "Hello #{args['<name>']}"
55
end

examples/b_basic/Runfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# include colsole, for easy color output
2+
require 'colsole'
3+
include Colsole
4+
15
# define the application itself
26
title "Runner"
37
summary "The first ever Runfile program"

examples/c_documented/Runfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
# each Runfile may have a summary and a version. Both are optional.
44
#---
55

6+
# optionally, include colsole, for easy color output (for the method 'say')
7+
require 'colsole'
8+
include Colsole
9+
610
# title sets the title of the application (default: 'Runfile').
711
title "Runner"
812

examples/d_realistic/Runfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@ usage "compile <source> <dest> [--quick]"
55
help "Compile <source> to <dest>"
66
option "-q --quick", "Make everything quicker"
77
action :compile do |args|
8-
say "!txtred!Compiling #{args['<source>']}... "
8+
puts "Compiling #{args['<source>']}... "
99
sleep 3 unless args['--quick']
10-
say "!txtgrn!done"
11-
say "Output is saved to #{args['<dest>']}"
10+
puts "done"
11+
puts "Output is saved to #{args['<dest>']}"
1212
end
1313

1414
usage "download <url> [<outfile>] [-CIq]"
1515
help "Download HTML and images from <url>. Use the --quick flag to download quickly."
1616
option "-C --no-cache", "Bypass cache"
1717
option "-I --no-img" , "Do not download images"
1818
action :download do |args|
19-
say "!txtred!Downloading #{args['<url>']}... "
19+
puts "Downloading #{args['<url>']}... "
2020
sleep 3 unless args['--quick']
21-
say "!txtgrn!downloaded"
22-
say "!txtred!cache was bypassed" if args['--no-cache']
21+
puts "downloaded"
22+
puts "cache was bypassed" if args['--no-cache']
2323
end

examples/e_optionals/Runfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
action :explain do
2-
say "Actions without arguments do not need 'usage'"
2+
puts "Actions without arguments do not need 'usage'"
33
end
44

55
usage "greet <name>"
66
action :greet do |args|
7-
say "Hello #{args['<name>']}"
7+
puts "Hello #{args['<name>']}"
88
end
99

1010
help "Say bye"
1111
action :bye do
12-
say "Here we added help to an action without usage... "
13-
say "!txtgrn!and it works!"
12+
puts "Here we added help to an action without usage... "
1413
end
1514

examples/f_namespace/Runfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# this is a globel action
22
action :greet do
3-
say "Hello"
3+
puts "Hello"
44
end
55

66
# define a "super command" (namespace).
@@ -11,24 +11,24 @@ command "make"
1111
# will be stored as ":make_custard".
1212
usage "custard"
1313
action :custard do
14-
say "Making custard..."
14+
puts "Making custard..."
1515
end
1616

1717
usage "jam"
1818
action :jam do
19-
say "Making jam..."
19+
puts "Making jam..."
2020
end
2121

2222
usage "meat [--mix]"
2323
option "--mix", "Mix all the ingredients. Good."
2424
action :meat do |args|
25-
say "Making meat..."
26-
say "...and mixing it all up" if args['--mix']
25+
puts "Making meat..."
26+
puts "...and mixing it all up" if args['--mix']
2727
end
2828

2929
# return back to global namespace
3030
command
3131

3232
action :eat do
33-
say "Custard? Good! Jam? Good! Meat? Good!!!"
33+
puts "Custard? Good! Jam? Good! Meat? Good!!!"
3434
end

examples/g_overloading/Runfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# this is a globel action
44
action :jump do
5-
say "Jump!"
5+
puts "Jump!"
66
end
77

88
# define a namespace with the same name as the global action
@@ -11,12 +11,12 @@ command "jump"
1111
# this will be "jump around"
1212
usage "around"
1313
action :around do
14-
say "Jump around"
14+
puts "Jump around"
1515
end
1616

1717
# this will be "jump up"
1818
usage "up"
1919
action :up do
20-
say "Jump up jump up and get down"
20+
puts "Jump up jump up and get down"
2121
end
2222

examples/h_hyphen/Runfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ option "-u --up" , "Also jump up"
66
option "-d --down", "Get down after jump"
77

88
action :'jump-around' do |args|
9-
say "Jump around"
10-
say "Jump up jump up" if args['--up']
11-
say "and get down" if args['--down']
9+
puts "Jump around"
10+
puts "Jump up jump up" if args['--up']
11+
puts "and get down" if args['--down']
1212
end

examples/i_crosscall/Runfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
# run it from the command prompt.
44

55
action :jog do
6-
say "jog"
6+
puts "jog"
77
end
88

99
usage "jump [--high --twice]"
1010
action :jump do |args|
1111
word = args['--high'] ? "JUMP" : "jump"
12-
say word
13-
say word if args['--twice']
12+
puts word
13+
puts word if args['--twice']
1414
end
1515

1616
# this action calls other actions, including one in a different
@@ -24,7 +24,7 @@ end
2424
command "eat"
2525

2626
action :cake do
27-
say "time for cake"
27+
puts "time for cake"
2828
end
2929

3030
action :'two-cakes' do

examples/j_customname/greet.runfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@
55

66
usage "hello [<name>]"
77
action :hello do |args|
8-
say "hello #{args['<name>']}"
8+
puts "hello #{args['<name>']}"
99
end
1010

1111
command "spanish"
1212

1313
usage "hello [<name>]"
1414
action :hello do |args|
15-
say "hola #{args['<name>']}"
15+
puts "hola #{args['<name>']}"
1616
end
1717

1818
command "french"
1919

2020
usage "hello [<name>]"
2121
action :hello do |args|
22-
say "bonjour #{args['<name>']}"
22+
puts "bonjour #{args['<name>']}"
2323
end
2424

2525
command
2626

2727
action :bye do
28-
say "bye"
28+
puts "bye"
2929
end

examples/k_endcommand/Runfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
command "drink"
22

33
action :beer do
4-
say "drink beer"
4+
puts "drink beer"
55
end
66

77
# this is an alias to 'command', you can use either an empty call to
88
# 'command' or 'endcommand' to go back to the global namespace
99
endcommand
1010

1111
action :eat do
12-
say "eat"
12+
puts "eat"
1313
end

examples/l_compact_usage/Runfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55

66
usage "(wakeup|code|sleep)"
77
action :wakeup do
8-
say "wakeup"
8+
puts "wakeup"
99
end
1010

1111
usage false
1212
action :code do
13-
say "code"
13+
puts "code"
1414
end
1515

1616
usage false
1717
action :sleep do
18-
say "sleep"
18+
puts "sleep"
1919
end
2020

2121
# this works exactly the same for a namespaced command
@@ -25,16 +25,16 @@ command "weekend"
2525

2626
usage "(wakeup|play|sleep)"
2727
action :wakeup do
28-
say "wakeup early"
28+
puts "wakeup early"
2929
end
3030

3131
usage false
3232
action :play do
33-
say "play"
33+
puts "play"
3434
end
3535

3636
usage false
3737
action :sleep do
38-
say "sleep late"
38+
puts "sleep late"
3939
end
4040

examples/m_dynamic_actions/Runfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ actions = [:css, :js, :'a-movie', :'friends-again']
99
actions.each do |act|
1010
help "Watch files of type #{act}"
1111
action act do
12-
say act.to_s
12+
puts act.to_s
1313
end
1414
end
1515

@@ -27,6 +27,6 @@ actions.each do |act|
2727
usage usage_text
2828
usage_text = false
2929
action act do
30-
say "git #{act}"
30+
puts "git #{act}"
3131
end
3232
end

examples/n_global_action/Runfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
# 1. the executed command matches the usage pattern
44
# 2. AND it does not match any other command in the file
55

6+
# Just so we can 'say' with colors
7+
require 'colsole'
8+
include Colsole
9+
610
usage "<file> <user> [--color]"
711
help "This is an action without a command"
812
option "--color", "Use color"

examples/o_options_label/Runfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@
88
usage "copy <file> [--force]"
99
option "--force", "Overwrite target", "Copy Options"
1010
action :copy do |args|
11-
say "Copying #{args['<file>']}"
11+
puts "Copying #{args['<file>']}"
1212
end
1313

1414
usage "rename <file> [--yes]"
1515
option "--yes", "Rename even if read only", "Rename Options"
1616
action :rename do |args|
17-
say "Renaming #{args['<file>']}"
17+
puts "Renaming #{args['<file>']}"
1818
end
1919

2020
# the option below will be added as usual, to the 'Options:' group
2121

2222
usage "show [--all]"
2323
option "--all", "Show all"
2424
action :all do
25-
say "Showing all"
25+
puts "Showing all"
2626
end

examples/p_alias/Runfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
# The usage pattern will be generated automatically as
55
# "(server|s)"
66
action :server, :s do
7-
say "Running server..."
7+
puts "Running server..."
88
end
99

1010
# For cases with other patameters, specify the usage pattern:
1111
usage "(greet|g) <name>"
1212
help "Say hello to <name>"
1313
action :greet, :g do |args|
14-
say "Hello #{args['<name>']}"
14+
puts "Hello #{args['<name>']}"
1515
end
1616

1717
# Start a namespace, to ensure this works in a napespaced form
1818
command "watch"
1919

2020
action :dog, :d do
21-
say "Watch dog"
21+
puts "Watch dog"
2222
end
2323

examples/q_example/Runfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ option "--force", "Overwrite target", "Copy Options"
1010
example "copy somefile.txt --force"
1111
example "copy somefile.txt"
1212
action :copy do |args|
13-
say "Copying #{args['<file>']}"
13+
puts "Copying #{args['<file>']}"
1414
end
1515

1616
# Example 2: Namespaced
@@ -23,7 +23,7 @@ option "--daemon", "Start in the background", "Server options"
2323
example "start"
2424
example "start --daemon"
2525
action :start do |args|
26-
say "Starting server..."
26+
puts "Starting server..."
2727
end
2828

2929
endcommand

0 commit comments

Comments
 (0)