yap-shell-core 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +24 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/.travis.yml +11 -0
- data/DESIGN.md +87 -0
- data/Gemfile +8 -0
- data/Gemfile.travis +8 -0
- data/Gemfile.travis.lock +106 -0
- data/LICENSE.txt +22 -0
- data/README.md +27 -0
- data/Rakefile +3 -0
- data/WISHLIST.md +54 -0
- data/bin/yap-dev +45 -0
- data/lib/tasks/gem.rake +62 -0
- data/lib/yap-shell-core.rb +52 -0
- data/lib/yap/addon.rb +24 -0
- data/lib/yap/addon/base.rb +52 -0
- data/lib/yap/addon/export_as.rb +12 -0
- data/lib/yap/addon/loader.rb +84 -0
- data/lib/yap/addon/path.rb +56 -0
- data/lib/yap/addon/rc_file.rb +21 -0
- data/lib/yap/addon/reference.rb +22 -0
- data/lib/yap/cli.rb +4 -0
- data/lib/yap/cli/commands.rb +6 -0
- data/lib/yap/cli/commands/addon.rb +14 -0
- data/lib/yap/cli/commands/addon/disable.rb +35 -0
- data/lib/yap/cli/commands/addon/enable.rb +35 -0
- data/lib/yap/cli/commands/addon/list.rb +37 -0
- data/lib/yap/cli/commands/addon/search.rb +99 -0
- data/lib/yap/cli/commands/generate.rb +13 -0
- data/lib/yap/cli/commands/generate/addon.rb +258 -0
- data/lib/yap/cli/commands/generate/addonrb.template +22 -0
- data/lib/yap/cli/commands/generate/gemspec.template +25 -0
- data/lib/yap/cli/commands/generate/license.template +21 -0
- data/lib/yap/cli/commands/generate/rakefile.template +6 -0
- data/lib/yap/cli/commands/generate/readme.template +40 -0
- data/lib/yap/cli/options.rb +162 -0
- data/lib/yap/cli/options/addon.rb +64 -0
- data/lib/yap/cli/options/addon/disable.rb +62 -0
- data/lib/yap/cli/options/addon/enable.rb +63 -0
- data/lib/yap/cli/options/addon/list.rb +65 -0
- data/lib/yap/cli/options/addon/search.rb +76 -0
- data/lib/yap/cli/options/generate.rb +59 -0
- data/lib/yap/cli/options/generate/addon.rb +63 -0
- data/lib/yap/configuration.rb +74 -0
- data/lib/yap/gem_helper.rb +195 -0
- data/lib/yap/gem_tasks.rb +6 -0
- data/lib/yap/shell.rb +116 -0
- data/lib/yap/shell/aliases.rb +58 -0
- data/lib/yap/shell/builtins.rb +18 -0
- data/lib/yap/shell/builtins/alias.rb +42 -0
- data/lib/yap/shell/builtins/cd.rb +57 -0
- data/lib/yap/shell/builtins/env.rb +11 -0
- data/lib/yap/shell/commands.rb +163 -0
- data/lib/yap/shell/evaluation.rb +439 -0
- data/lib/yap/shell/evaluation/shell_expansions.rb +99 -0
- data/lib/yap/shell/event_emitter.rb +18 -0
- data/lib/yap/shell/execution.rb +16 -0
- data/lib/yap/shell/execution/builtin_command_execution.rb +20 -0
- data/lib/yap/shell/execution/command_execution.rb +30 -0
- data/lib/yap/shell/execution/context.rb +128 -0
- data/lib/yap/shell/execution/file_system_command_execution.rb +137 -0
- data/lib/yap/shell/execution/result.rb +18 -0
- data/lib/yap/shell/execution/ruby_command_execution.rb +80 -0
- data/lib/yap/shell/execution/shell_command_execution.rb +30 -0
- data/lib/yap/shell/prompt.rb +21 -0
- data/lib/yap/shell/repl.rb +237 -0
- data/lib/yap/shell/version.rb +5 -0
- data/lib/yap/world.rb +286 -0
- data/rcfiles/yaprc +390 -0
- data/scripts/4 +8 -0
- data/scripts/bg-vim +4 -0
- data/scripts/fail +3 -0
- data/scripts/letters +8 -0
- data/scripts/lots-of-output +6 -0
- data/scripts/pass +3 -0
- data/scripts/simulate-long-running +4 -0
- data/scripts/write-to-stderr.rb +3 -0
- data/scripts/write-to-stdout.rb +3 -0
- data/spec/features/addons/generating_an_addon_spec.rb +55 -0
- data/spec/features/addons/using_an_addon_spec.rb +182 -0
- data/spec/features/aliases_spec.rb +79 -0
- data/spec/features/environment_variables_spec.rb +69 -0
- data/spec/features/filesystem_commands_spec.rb +61 -0
- data/spec/features/first_time_spec.rb +45 -0
- data/spec/features/grouping_spec.rb +81 -0
- data/spec/features/line_editing_spec.rb +174 -0
- data/spec/features/range_spec.rb +35 -0
- data/spec/features/redirection_spec.rb +234 -0
- data/spec/features/repetition_spec.rb +118 -0
- data/spec/features/shell_expansions_spec.rb +128 -0
- data/spec/spec_helper.rb +172 -0
- data/spec/support/matchers/have_not_printed.rb +30 -0
- data/spec/support/matchers/have_printed.rb +68 -0
- data/spec/support/very_soon.rb +9 -0
- data/spec/support/yap_spec_dsl.rb +258 -0
- data/update-rawline.sh +6 -0
- data/yap-shell-core.gemspec +45 -0
- metadata +356 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8df0d46eaeafabdcfc65397e5e86bf8040027c43
|
4
|
+
data.tar.gz: c443e376c4e6535df11c383fb7d348e387323b3a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2c584e58835c0dceaa4f3ace8359e7120a3755f671e69baaf97d548e409f612ab56249836dabf8a263ea193cc72b89e2ebafa0da0b4a95e72e3ae35a2091b9fd
|
7
|
+
data.tar.gz: fdf2dc26999a6dac707e3df0cd6a1b4fbf64650cd64832160745233e4f1987264b41291f8c4cd788cbf34db947b1e83227d8acb24036f88b0dbe2270696d4cde
|
data/.gitignore
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
|
24
|
+
wiki/
|
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.1
|
data/.travis.yml
ADDED
data/DESIGN.md
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
### Shell
|
2
|
+
|
3
|
+
The shell takes input from the user, turns them into commands, and then runs them by evaluating or executing them. It is responsible for job control, and for providing useful information to the user such as a prompt and other line decorations.
|
4
|
+
|
5
|
+
The shell collects input from the user by running a REPL. It then takes the input collected and turns in into a parse tree. The parse tree is then walked, evaluating nodes along the way, which is what evaluates/executes the command. Before each command is evaluated it is processed in order to expand aliases, environment variables, etc.
|
6
|
+
|
7
|
+
The parse tree is generated by the yap/shell/line-parser. All nodes are defined by that library.
|
8
|
+
|
9
|
+
### Nodes
|
10
|
+
|
11
|
+
The nodes that the parse tree knows about are the following: AssignmentNode, ConditionalNode, CommandNode, EnvNode, EnvWrapperNode, InternalEvalNode, PipelineNode, RedirectionNode, and StatementsNode.
|
12
|
+
|
13
|
+
These are evaluated by the Shell in the following manner.
|
14
|
+
|
15
|
+
#### AssignmentNode, EnvNode, EnvWrapperNode
|
16
|
+
|
17
|
+
An env node represents a type of assignment such as an expression "A=B". This node is evaluated to set environment variables for the current execution context.
|
18
|
+
|
19
|
+
Currently an AssignmentNode is not used, but it may be used to replace an EnvNode as necessary. An EnvWrapperNode is a meta-EnvNode, all it does is wrap EnvNode(s). It is on the chopping block to go away with parser optimizations that would merge all of these types of concepts together.
|
20
|
+
|
21
|
+
#### ConditionalNode
|
22
|
+
|
23
|
+
A conditional node represents a conditional expression such as "&&" or "||". It is evaluated by processing its left child node and then processing its right child node based on its result.
|
24
|
+
|
25
|
+
#### CommandNode
|
26
|
+
|
27
|
+
A command node represents any command and arguments provided by the user such as the "ls" in "ls -al" or the "echo" in "echo foo bar baz".
|
28
|
+
|
29
|
+
The command associated with a command node may be a shell function, an alias, a builtin, or an executable found on the file-system. This lookup and determination of what the command refers to is determined when processing a command node.
|
30
|
+
|
31
|
+
Every command executed generates an exit status or a signal status.
|
32
|
+
|
33
|
+
#### InternalEvalNode
|
34
|
+
|
35
|
+
An internal eval node represents an expression that should be evaluated internally (currently only supports the ruby interpreter running the shell).
|
36
|
+
|
37
|
+
It needs to generate an exit status or a signal status.
|
38
|
+
|
39
|
+
#### PipelineNode
|
40
|
+
|
41
|
+
A pipeline node represents a series of commands or statements where the output of one should be the input of another. For example, "ls | grep foo" is a pipeline.
|
42
|
+
|
43
|
+
#### RedirectionNode
|
44
|
+
|
45
|
+
A redirection node represents the intent to redirect STDOUT, STDERR, or both to file. For example, "echo foo > bar.txt".
|
46
|
+
|
47
|
+
#### StatementsNode
|
48
|
+
|
49
|
+
A statements node represents more than one statement and contains two nodes: a head and a tail. Either node can refer to any other node.
|
50
|
+
|
51
|
+
|
52
|
+
### Commands
|
53
|
+
|
54
|
+
In order to process a CommandNode it must first determine what type of command it represents. Since a CommandNode could refer to a shell function, alias, builtin, or executable on the file-system, we need to determine which one.
|
55
|
+
|
56
|
+
The CommandFactory is used to do just this.
|
57
|
+
|
58
|
+
|
59
|
+
### Execution
|
60
|
+
|
61
|
+
Once a CommandNode is fully expanded, the resulting command will be executed in a corresponding ExecutionContext. There is an execution context for every type command that can be run.
|
62
|
+
|
63
|
+
It is the job of the execution context to handle wiring up stdin, stdout, stderr before running a command as well as provide the exit status or signal status after a command has finished executing.
|
64
|
+
|
65
|
+
|
66
|
+
#### Handling SIGINT
|
67
|
+
|
68
|
+
The shell responds to a SIGINT signal (typically Ctrl-C) which will interrupt execution of the shell or any running process.
|
69
|
+
|
70
|
+
When a process is not running and a SIGINT is received the REPL will print a "^C" and then put a new line and prompt. The shell will not abort itself.
|
71
|
+
|
72
|
+
When a process is running and the SIGINT signal is received it will forwarded on to the currently running child process. In most cases, the child process will abort, but in some cases it will not. An example of this is program like `irb` that is itself an interactive REPL with the user.
|
73
|
+
|
74
|
+
#### Handling SIGSTOP / SIGCONT
|
75
|
+
|
76
|
+
The shell responds to a SIGSTOP signal (typically Ctrl-Z) by forwarding it to the currently running process.
|
77
|
+
|
78
|
+
When no process is running it prints "^Z" in the REPL and prints a new line and prompt. The shell itself will not suspend.
|
79
|
+
|
80
|
+
When a process is running and the SIGSTOP signal is received it will be forwarded on to the currently running child process. In most cases, the child process will suspend running.
|
81
|
+
|
82
|
+
When the child process is suspended control will be returned to the REPL, a user will be able to run new commands. The suspended process can be restarted by sending it the SIGCONT signal. The `fg` builtin can be used to send the suspended process the SIGCONT signal.
|
83
|
+
|
84
|
+
|
85
|
+
### Job Control
|
86
|
+
|
87
|
+
.
|
data/Gemfile
ADDED
data/Gemfile.travis
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
gem 'treefell', git: 'https://github.com/zdennis/treefell.git'
|
6
|
+
gem 'yap-shell-parser', git: 'https://github.com/zdennis/yap-shell-parser.git'
|
7
|
+
gem 'terminal-layout', git: 'https://github.com/zdennis/terminal-layout.git'
|
8
|
+
gem 'yap-rawline', git: 'https://github.com/zdennis/rawline.git'
|
data/Gemfile.travis.lock
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/zdennis/rawline.git
|
3
|
+
revision: 7bdfad1be32dbc93263431679ce4bc4cb9784235
|
4
|
+
specs:
|
5
|
+
yap-rawline (0.6.3)
|
6
|
+
ansi_string (~> 0.1)
|
7
|
+
highline (~> 1.7, >= 1.7.2)
|
8
|
+
term-ansicolor (~> 1.3.0)
|
9
|
+
terminal-layout (~> 0.4.2)
|
10
|
+
|
11
|
+
GIT
|
12
|
+
remote: https://github.com/zdennis/terminal-layout.git
|
13
|
+
revision: b75a41372077c7b8aada3f35de23d924457bc83e
|
14
|
+
specs:
|
15
|
+
terminal-layout (0.4.2)
|
16
|
+
ansi_string (~> 0.1)
|
17
|
+
highline (~> 1.7, >= 1.7.8)
|
18
|
+
ruby-terminfo (~> 0.1.1)
|
19
|
+
ruby-termios (~> 0.9.6)
|
20
|
+
treefell (~> 0.3)
|
21
|
+
|
22
|
+
GIT
|
23
|
+
remote: https://github.com/zdennis/treefell.git
|
24
|
+
revision: 8b3abf937b83ba1f4cc0628330f617951b4a4f00
|
25
|
+
specs:
|
26
|
+
treefell (0.3.0)
|
27
|
+
ansi_string (~> 0.1)
|
28
|
+
term-ansicolor (~> 1.3)
|
29
|
+
|
30
|
+
GIT
|
31
|
+
remote: https://github.com/zdennis/yap-shell-parser.git
|
32
|
+
revision: 48175ae32af47eb421a89d4358f0b777114f7a85
|
33
|
+
specs:
|
34
|
+
yap-shell-parser (0.7.1)
|
35
|
+
term-ansicolor (~> 1.3)
|
36
|
+
treefell (~> 0.3)
|
37
|
+
|
38
|
+
PATH
|
39
|
+
remote: .
|
40
|
+
specs:
|
41
|
+
yap-shell (0.7.1)
|
42
|
+
chronic (~> 0.10.2)
|
43
|
+
pry-byebug (~> 3.3)
|
44
|
+
ruby-terminfo (~> 0.1.1)
|
45
|
+
ruby-termios (~> 0.9.6)
|
46
|
+
term-ansicolor (~> 1.3)
|
47
|
+
yap-rawline (~> 0.6.3)
|
48
|
+
yap-shell-parser (~> 0.7.1)
|
49
|
+
|
50
|
+
GEM
|
51
|
+
remote: https://rubygems.org/
|
52
|
+
specs:
|
53
|
+
ansi_string (0.1.0)
|
54
|
+
byebug (9.0.5)
|
55
|
+
childprocess (0.5.9)
|
56
|
+
ffi (~> 1.0, >= 1.0.11)
|
57
|
+
chronic (0.10.2)
|
58
|
+
coderay (1.1.1)
|
59
|
+
diff-lcs (1.2.5)
|
60
|
+
ffi (1.9.10)
|
61
|
+
highline (1.7.8)
|
62
|
+
method_source (0.8.2)
|
63
|
+
pry (0.10.3)
|
64
|
+
coderay (~> 1.1.0)
|
65
|
+
method_source (~> 0.8.1)
|
66
|
+
slop (~> 3.4)
|
67
|
+
pry-byebug (3.4.0)
|
68
|
+
byebug (~> 9.0)
|
69
|
+
pry (~> 0.10)
|
70
|
+
rake (11.2.2)
|
71
|
+
rspec (3.5.0)
|
72
|
+
rspec-core (~> 3.5.0)
|
73
|
+
rspec-expectations (~> 3.5.0)
|
74
|
+
rspec-mocks (~> 3.5.0)
|
75
|
+
rspec-core (3.5.0)
|
76
|
+
rspec-support (~> 3.5.0)
|
77
|
+
rspec-expectations (3.5.0)
|
78
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
79
|
+
rspec-support (~> 3.5.0)
|
80
|
+
rspec-mocks (3.5.0)
|
81
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
82
|
+
rspec-support (~> 3.5.0)
|
83
|
+
rspec-support (3.5.0)
|
84
|
+
ruby-terminfo (0.1.1)
|
85
|
+
ruby-termios (0.9.6)
|
86
|
+
slop (3.6.0)
|
87
|
+
term-ansicolor (1.3.2)
|
88
|
+
tins (~> 1.0)
|
89
|
+
tins (1.10.2)
|
90
|
+
|
91
|
+
PLATFORMS
|
92
|
+
ruby
|
93
|
+
|
94
|
+
DEPENDENCIES
|
95
|
+
bundler (~> 1.6)
|
96
|
+
childprocess (~> 0.5.9)
|
97
|
+
rake (~> 11)
|
98
|
+
rspec (~> 3.0)
|
99
|
+
terminal-layout!
|
100
|
+
treefell!
|
101
|
+
yap-rawline!
|
102
|
+
yap-shell!
|
103
|
+
yap-shell-parser!
|
104
|
+
|
105
|
+
BUNDLED WITH
|
106
|
+
1.12.5
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Zach Dennis
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/zdennis/yap-shell.svg?branch=master)](https://travis-ci.org/zdennis/yap-shell)
|
2
|
+
|
3
|
+
# Yap
|
4
|
+
|
5
|
+
Yap is a modern, developer shell. Inspired by shells like bash and zsh it's a modern implementation keeping the good parts and leaving out the rest.
|
6
|
+
|
7
|
+
See the slide deck that [introduces Yap](http://slides.com/zdennis/yaptastic-1#/)
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
This should not go in your Gemfile, you should install from the command line:
|
12
|
+
|
13
|
+
> gem install yap-shell
|
14
|
+
|
15
|
+
Then follow the on-screen installation instructions.
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
See the Yap [shell reference](https://github.com/zdennis/yap-shell/wiki/ShellReference)
|
20
|
+
|
21
|
+
## Contributing
|
22
|
+
|
23
|
+
1. Fork it ( https://github.com/zdennis/yap-shell/fork )
|
24
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
25
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
26
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
27
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/WISHLIST.md
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
CLI
|
2
|
+
|
3
|
+
* yap install right-prompt
|
4
|
+
|
5
|
+
|
6
|
+
* need to add custom tab completion for aliases, builtins, shell commands, and file system commands
|
7
|
+
* support user-specified gems to install (so they're available for rc files)
|
8
|
+
* truncate the prompt so you can type long commands
|
9
|
+
* add right-prompt (similar to ZSH)
|
10
|
+
* provide realtime updating prompt items
|
11
|
+
* don't overwrite timestamp? (or have it disappear when you write over it altogether, similar to ZSH)
|
12
|
+
* have configurable prompt components
|
13
|
+
* interact with the "World" rather than just operating on string contents
|
14
|
+
* communicate exit codes to user (w/color)
|
15
|
+
* allow for a multiline smart prompt or at least some kind of status notifications
|
16
|
+
* get readline's history to work between start and restops
|
17
|
+
* fix reload! so it works again
|
18
|
+
* handle stderr
|
19
|
+
* intelligently handle pipes that show up in ruby blocks, e.g. map{ |a,b| a }
|
20
|
+
* Fix shell builtins like pushd/popd. :(
|
21
|
+
* Support user-requested background processes, e.g. "ls &"
|
22
|
+
* You cannto load yap if you are within yap. Handle the error or let it happen.
|
23
|
+
|
24
|
+
Others requests.
|
25
|
+
|
26
|
+
* Sam: Better text movement/manipulation tools
|
27
|
+
** e.g. delete-forward-word
|
28
|
+
** I spend a lot of time using my arrow keys (or equivalents) in my terminal and I hate that.
|
29
|
+
|
30
|
+
* Jonah: The one thing that seems passive agressive to me is the lack of confirmation when something has gone well. You get barked at if things don’t work, but when they do you get nothing. I think that’s a BS way to behave. Everything. The long running processes give you feedback. Something short and sweet returns nothing. Consistent behavior would be nice.
|
31
|
+
|
32
|
+
* EJ reply: my shell’s prompt color changes depending on the success/failure of the last command
|
33
|
+
|
34
|
+
* Sam: a way to say "make the last 7 items in my history into a script/macro”
|
35
|
+
|
36
|
+
* Sam: I want my history to be dependent on the project, so when I go into an old project I can see the commands I had been running there months ago.
|
37
|
+
|
38
|
+
* Sam: integration with ruby/python/etc interpreters and my editor, so I can interact with stack traces -- even just to open file and jump to line number.
|
39
|
+
|
40
|
+
* Sam: sublime style fuzzy autocomplete* Sam: (ooh, but what about an 'oh shit please pipe this through less/paginate this' that you could run after a command has started. 6/3)
|
41
|
+
|
42
|
+
* @dylanized: themeable
|
43
|
+
* @dylanized: browser-based
|
44
|
+
* @dylanized: bookmarks
|
45
|
+
|
46
|
+
|
47
|
+
### Tab completion
|
48
|
+
* sort completions for printing
|
49
|
+
* print completion in groups?
|
50
|
+
* match on command, command with arguments, arguments, env var args
|
51
|
+
* supply the completion text
|
52
|
+
* supply the descriptive text
|
53
|
+
* alias one completion for another
|
54
|
+
* cache completions? invalidate cached completions
|
data/bin/yap-dev
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler'
|
4
|
+
Bundler.setup
|
5
|
+
require 'pry'
|
6
|
+
|
7
|
+
module SilenceWarnings
|
8
|
+
# Runs a block of code without warnings.
|
9
|
+
def self.silence_warnings(&block)
|
10
|
+
warn_level = $VERBOSE
|
11
|
+
$VERBOSE = nil
|
12
|
+
result = block.call
|
13
|
+
$VERBOSE = warn_level
|
14
|
+
result
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
### START debundle.rb ###
|
19
|
+
|
20
|
+
# MIT License
|
21
|
+
# Copyright (c) Conrad Irwin <conrad.irwin@gmail.com>
|
22
|
+
# Copyright (c) Jan Lelis <mail@janlelis.de>
|
23
|
+
|
24
|
+
module Debundle
|
25
|
+
VERSION = '1.0.0'
|
26
|
+
|
27
|
+
def self.debundle!
|
28
|
+
if Gem.post_reset_hooks.reject!{ |hook| hook.source_location.first =~ %r{/bundler/} }
|
29
|
+
Gem.clear_paths
|
30
|
+
SilenceWarnings.silence_warnings do
|
31
|
+
load 'rubygems/core_ext/kernel_require.rb'
|
32
|
+
load 'rubygems/core_ext/kernel_gem.rb'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
rescue => e
|
36
|
+
warn "DEBUNDLE.RB FAILED: #{e.class}\n#{e.message}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
Debundle.debundle!
|
41
|
+
|
42
|
+
### END debundle.rb ###
|
43
|
+
|
44
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
45
|
+
load File.dirname(__FILE__) + '/yap'
|
data/lib/tasks/gem.rake
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
namespace :bump do
|
2
|
+
namespace :version do
|
3
|
+
class ProjectVersion
|
4
|
+
FILE = File.dirname(__FILE__) + '/../yap/shell/version.rb'
|
5
|
+
PATTERN = /VERSION\s*=\s*['"](\d+)\.(\d+)\.(\d+)['"]/m
|
6
|
+
|
7
|
+
def initialize(file=FILE, pattern=PATTERN)
|
8
|
+
@file = file
|
9
|
+
@pattern = pattern
|
10
|
+
end
|
11
|
+
|
12
|
+
def bump(major:nil, minor:nil, patch:nil)
|
13
|
+
version = nil
|
14
|
+
contents.sub!(@pattern) do
|
15
|
+
_major = major.call($1) if major
|
16
|
+
_minor = minor.call($2) if minor
|
17
|
+
_patch = patch.call($3) if patch
|
18
|
+
version = "#{_major}.#{_minor}.#{_patch}"
|
19
|
+
results = %|VERSION = "#{version}"|
|
20
|
+
end
|
21
|
+
File.write(@file, contents)
|
22
|
+
system "bundle"
|
23
|
+
system "git add #{ProjectVersion::FILE} && git commit -m 'Bumping version to #{version}'"
|
24
|
+
system "git tag v#{version}"
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def contents
|
30
|
+
@contents ||= File.read(@file)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Increments the patch number by 1 for the project"
|
35
|
+
task :patch do
|
36
|
+
ProjectVersion.new.bump(
|
37
|
+
major: ->(major){ major },
|
38
|
+
minor: ->(minor){ minor },
|
39
|
+
patch: ->(patch){ patch.succ }
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
desc "Increments the minor number by 1 for the project"
|
44
|
+
task :minor do
|
45
|
+
ProjectVersion.new.bump(
|
46
|
+
major: ->(major){ major },
|
47
|
+
minor: ->(minor){ minor.succ },
|
48
|
+
patch: ->(patch){ 0 }
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
desc "Increments the major number by 1 for the project"
|
53
|
+
task :major do
|
54
|
+
ProjectVersion.new.bump(
|
55
|
+
major: ->(major){ major.succ },
|
56
|
+
minor: ->(minor){ 0 },
|
57
|
+
patch: ->(patch){ 0 }
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|