bombshell 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -9
- data/Rakefile +5 -20
- data/VERSION +1 -1
- data/bombshell.gemspec +16 -26
- data/features/callbacks.feature +48 -0
- data/features/completion.feature +55 -0
- data/features/prompts.feature +69 -0
- data/features/shell.feature +45 -0
- data/features/step_definitions/completion_steps.rb +14 -0
- data/features/subshells.feature +48 -0
- data/features/support/env.rb +10 -0
- metadata +49 -19
- data/spec/bombshell_spec.rb +0 -7
- data/spec/spec_helper.rb +0 -12
data/Gemfile
CHANGED
@@ -1,10 +1,2 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
|
-
|
3
|
-
# Example:
|
4
|
-
# gem "activesupport", ">= 2.3.5"
|
5
|
-
|
6
|
-
# Add dependencies to develop your gem here.
|
7
|
-
# Include everything needed to run rake, tests, features, etc.
|
8
|
-
group :development do
|
9
|
-
gem "jeweler", "~> 1.5.2"
|
10
|
-
end
|
2
|
+
gemspec
|
data/Rakefile
CHANGED
@@ -9,24 +9,9 @@ rescue Bundler::BundlerError => e
|
|
9
9
|
end
|
10
10
|
require 'rake'
|
11
11
|
|
12
|
-
require '
|
13
|
-
|
14
|
-
|
15
|
-
gem.homepage = "http://github.com/rossmeissl/bombshell"
|
16
|
-
gem.license = "MIT"
|
17
|
-
gem.summary = %Q{Custom IRB consoles made easy}
|
18
|
-
gem.description = %Q{Give your application or gem an interactive shell, complete with custom prompts, tab completion, and various callbacks. Commands are defined as Ruby methods and can be grouped into logical subshells.}
|
19
|
-
gem.email = "andy@rossmeissl.net"
|
20
|
-
gem.authors = ["Andy Rossmeissl"]
|
21
|
-
end
|
22
|
-
Jeweler::RubygemsDotOrgTasks.new
|
23
|
-
|
24
|
-
require 'rake/rdoctask'
|
25
|
-
Rake::RDocTask.new do |rdoc|
|
26
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
12
|
+
require 'cucumber/rake/task'
|
13
|
+
Cucumber::Rake::Task.new
|
14
|
+
task :default => :cucumber
|
27
15
|
|
28
|
-
|
29
|
-
|
30
|
-
rdoc.rdoc_files.include('README*')
|
31
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
32
|
-
end
|
16
|
+
require 'bueller'
|
17
|
+
Bueller::Tasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/bombshell.gemspec
CHANGED
@@ -1,15 +1,14 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in rakefile, and run 'rake gemspec'
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "bombshell/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
6
|
s.name = %q{bombshell}
|
8
|
-
s.version =
|
7
|
+
s.version = Bombshell::VERSION
|
9
8
|
|
10
9
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
10
|
s.authors = ["Andy Rossmeissl"]
|
12
|
-
s.date = %q{2011-03-
|
11
|
+
s.date = %q{2011-03-31}
|
13
12
|
s.description = %q{Give your application or gem an interactive shell, complete with custom prompts, tab completion, and various callbacks. Commands are defined as Ruby methods and can be grouped into logical subshells.}
|
14
13
|
s.email = %q{andy@rossmeissl.net}
|
15
14
|
s.extra_rdoc_files = [
|
@@ -26,36 +25,27 @@ Gem::Specification.new do |s|
|
|
26
25
|
"VERSION",
|
27
26
|
"bombshell.gemspec",
|
28
27
|
"doc/brainstorm.rb",
|
28
|
+
"features/callbacks.feature",
|
29
|
+
"features/completion.feature",
|
30
|
+
"features/prompts.feature",
|
31
|
+
"features/shell.feature",
|
32
|
+
"features/step_definitions/completion_steps.rb",
|
33
|
+
"features/subshells.feature",
|
34
|
+
"features/support/env.rb",
|
29
35
|
"lib/bombshell.rb",
|
30
36
|
"lib/bombshell/completor.rb",
|
31
37
|
"lib/bombshell/environment.rb",
|
32
38
|
"lib/bombshell/irb.rb",
|
33
39
|
"lib/bombshell/shell.rb",
|
34
|
-
"lib/bombshell/shell/commands.rb"
|
35
|
-
"spec/bombshell_spec.rb",
|
36
|
-
"spec/spec_helper.rb"
|
40
|
+
"lib/bombshell/shell/commands.rb"
|
37
41
|
]
|
38
42
|
s.homepage = %q{http://github.com/rossmeissl/bombshell}
|
39
43
|
s.licenses = ["MIT"]
|
40
44
|
s.require_paths = ["lib"]
|
41
|
-
s.rubygems_version = %q{1.
|
45
|
+
s.rubygems_version = %q{1.6.2}
|
42
46
|
s.summary = %q{Custom IRB consoles made easy}
|
43
|
-
s.
|
44
|
-
|
45
|
-
|
46
|
-
]
|
47
|
-
|
48
|
-
if s.respond_to? :specification_version then
|
49
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
50
|
-
s.specification_version = 3
|
51
|
-
|
52
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
53
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
54
|
-
else
|
55
|
-
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
56
|
-
end
|
57
|
-
else
|
58
|
-
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
59
|
-
end
|
47
|
+
s.add_dependency 'bombshell'
|
48
|
+
s.add_development_dependency 'aruba'
|
49
|
+
s.add_development_dependency 'bueller'
|
60
50
|
end
|
61
51
|
|
@@ -0,0 +1,48 @@
|
|
1
|
+
Feature: Callbacks
|
2
|
+
|
3
|
+
In order to have customization flexibility
|
4
|
+
As a Ruby library developer
|
5
|
+
I want to have access to callbacks
|
6
|
+
|
7
|
+
Scenario: Using a before_launch callback
|
8
|
+
Given a file named "fooshell.rb" with:
|
9
|
+
"""
|
10
|
+
require 'bombshell'
|
11
|
+
module Foo
|
12
|
+
class Shell < Bombshell::Environment
|
13
|
+
include Bombshell::Shell
|
14
|
+
before_launch do
|
15
|
+
puts "Hi, I'm #{name}"
|
16
|
+
end
|
17
|
+
def self.name; 'Foo' end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
Bombshell.launch Foo::Shell
|
21
|
+
"""
|
22
|
+
When I run "ruby fooshell.rb" interactively
|
23
|
+
And I type "quit"
|
24
|
+
Then the output should contain:
|
25
|
+
"""
|
26
|
+
Hi, I'm Foo
|
27
|
+
"""
|
28
|
+
|
29
|
+
Scenario: Using a having_launched callback
|
30
|
+
Given a file named "fooshell.rb" with:
|
31
|
+
"""
|
32
|
+
require 'bombshell'
|
33
|
+
module Foo
|
34
|
+
class Shell < Bombshell::Environment
|
35
|
+
include Bombshell::Shell
|
36
|
+
having_launched do
|
37
|
+
puts "Hi, I'm an instance of #{self.class}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
Bombshell.launch Foo::Shell
|
42
|
+
"""
|
43
|
+
When I run "ruby fooshell.rb" interactively
|
44
|
+
And I type "quit"
|
45
|
+
Then the output should contain:
|
46
|
+
"""
|
47
|
+
Hi, I'm an instance of Foo::Shell
|
48
|
+
"""
|
@@ -0,0 +1,55 @@
|
|
1
|
+
Feature: Completion
|
2
|
+
|
3
|
+
In order to expedite my exploration
|
4
|
+
As a user of a Bombshell-enabled Ruby library
|
5
|
+
I want to be able to use tab completion
|
6
|
+
|
7
|
+
Scenario: Single matching command
|
8
|
+
Given a file named "fooshell.rb" with:
|
9
|
+
"""
|
10
|
+
require 'bombshell'
|
11
|
+
module Foo
|
12
|
+
class Shell < Bombshell::Environment
|
13
|
+
include Bombshell::Shell
|
14
|
+
def abcdef; end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
Bombshell.launch Foo::Shell
|
18
|
+
"""
|
19
|
+
When I run "ruby fooshell.rb" interactively
|
20
|
+
And I type "abc" and hit tab
|
21
|
+
And I type "quit"
|
22
|
+
Then the output should contain:
|
23
|
+
"""
|
24
|
+
abcdef
|
25
|
+
"""
|
26
|
+
And the output should not contain:
|
27
|
+
"""
|
28
|
+
method_missing
|
29
|
+
"""
|
30
|
+
|
31
|
+
Scenario: Multiple matching commands
|
32
|
+
Given a file named "fooshell.rb" with:
|
33
|
+
"""
|
34
|
+
require 'bombshell'
|
35
|
+
module Foo
|
36
|
+
class Shell < Bombshell::Environment
|
37
|
+
include Bombshell::Shell
|
38
|
+
def abcd; end
|
39
|
+
def abcx; end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
Bombshell.launch Foo::Shell
|
43
|
+
"""
|
44
|
+
When I run "ruby fooshell.rb" interactively
|
45
|
+
And I type "abc" and hit tab twice
|
46
|
+
And I type "quit"
|
47
|
+
Then the output should contain:
|
48
|
+
"""
|
49
|
+
abcd
|
50
|
+
"""
|
51
|
+
And the output should contain:
|
52
|
+
"""
|
53
|
+
abcx
|
54
|
+
"""
|
55
|
+
|
@@ -0,0 +1,69 @@
|
|
1
|
+
Feature: Prompts
|
2
|
+
|
3
|
+
In order to brand my custom shell experience
|
4
|
+
As a developer of a Bombshell-enabled Ruby library
|
5
|
+
I want to set custom prompts
|
6
|
+
|
7
|
+
Scenario: Static-string prompt
|
8
|
+
Given a file named "fooshell.rb" with:
|
9
|
+
"""
|
10
|
+
require 'bombshell'
|
11
|
+
module Foo
|
12
|
+
class Shell < Bombshell::Environment
|
13
|
+
include Bombshell::Shell
|
14
|
+
prompt_with 'fooprompt'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
Bombshell.launch Foo::Shell
|
18
|
+
"""
|
19
|
+
When I run "ruby fooshell.rb" interactively
|
20
|
+
And I type "quit"
|
21
|
+
Then the output should contain:
|
22
|
+
"""
|
23
|
+
fooprompt>
|
24
|
+
"""
|
25
|
+
|
26
|
+
Scenario: Class-oriented prompt
|
27
|
+
Given a file named "fooshell.rb" with:
|
28
|
+
"""
|
29
|
+
require 'bombshell'
|
30
|
+
module Foo
|
31
|
+
class Shell < Bombshell::Environment
|
32
|
+
include Bombshell::Shell
|
33
|
+
prompt_with do
|
34
|
+
_prompt
|
35
|
+
end
|
36
|
+
def self._prompt; 'fooprompt-class' end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
Bombshell.launch Foo::Shell
|
40
|
+
"""
|
41
|
+
When I run "ruby fooshell.rb" interactively
|
42
|
+
And I type "quit"
|
43
|
+
Then the output should contain:
|
44
|
+
"""
|
45
|
+
fooprompt-class>
|
46
|
+
"""
|
47
|
+
|
48
|
+
Scenario: Instance-oriented prompt
|
49
|
+
Given a file named "fooshell.rb" with:
|
50
|
+
"""
|
51
|
+
require 'bombshell'
|
52
|
+
module Foo
|
53
|
+
class Shell < Bombshell::Environment
|
54
|
+
include Bombshell::Shell
|
55
|
+
prompt_with do |foo|
|
56
|
+
foo._prompt
|
57
|
+
end
|
58
|
+
def _prompt; 'fooprompt-instance' end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
Bombshell.launch Foo::Shell
|
62
|
+
"""
|
63
|
+
When I run "ruby fooshell.rb" interactively
|
64
|
+
And I type "quit"
|
65
|
+
Then the output should contain:
|
66
|
+
"""
|
67
|
+
fooprompt-instance>
|
68
|
+
"""
|
69
|
+
|
@@ -0,0 +1,45 @@
|
|
1
|
+
Feature: Custom shell
|
2
|
+
|
3
|
+
In order to allow my users to explore my library
|
4
|
+
As a Ruby library developer
|
5
|
+
I want to give them an interactive shell
|
6
|
+
|
7
|
+
Scenario: Running the shell
|
8
|
+
Given a file named "fooshell.rb" with:
|
9
|
+
"""
|
10
|
+
require 'bombshell'
|
11
|
+
module Foo
|
12
|
+
class Shell < Bombshell::Environment
|
13
|
+
include Bombshell::Shell
|
14
|
+
end
|
15
|
+
end
|
16
|
+
Bombshell.launch Foo::Shell
|
17
|
+
"""
|
18
|
+
When I run "ruby fooshell.rb" interactively
|
19
|
+
And I type "quit"
|
20
|
+
Then the output should contain:
|
21
|
+
"""
|
22
|
+
[Bombshell]
|
23
|
+
"""
|
24
|
+
|
25
|
+
Scenario: Using a command
|
26
|
+
Given a file named "fooshell.rb" with:
|
27
|
+
"""
|
28
|
+
require 'bombshell'
|
29
|
+
module Foo
|
30
|
+
class Shell < Bombshell::Environment
|
31
|
+
include Bombshell::Shell
|
32
|
+
def hello
|
33
|
+
puts 'hello world'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
Bombshell.launch Foo::Shell
|
38
|
+
"""
|
39
|
+
When I run "ruby fooshell.rb" interactively
|
40
|
+
And I type "hello"
|
41
|
+
And I type "quit"
|
42
|
+
Then the output should contain:
|
43
|
+
"""
|
44
|
+
[Bombshell]
|
45
|
+
"""
|
@@ -0,0 +1,14 @@
|
|
1
|
+
When /^I type "(.*)" and hit tab$/ do |command|
|
2
|
+
pending
|
3
|
+
_write_interactive(command)
|
4
|
+
_write_interactive("\t")
|
5
|
+
_write_interactive("\n")
|
6
|
+
end
|
7
|
+
|
8
|
+
When /^I type "(.*)" and hit tab twice$/ do |command|
|
9
|
+
pending
|
10
|
+
_write_interactive(command)
|
11
|
+
_write_interactive("\t")
|
12
|
+
_write_interactive("\t")
|
13
|
+
_write_interactive("\n")
|
14
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
Feature: Subshells
|
2
|
+
|
3
|
+
In order to organize my shell commands
|
4
|
+
As a developer of a Bombshell-enabled Ruby library
|
5
|
+
I want to use subshells
|
6
|
+
|
7
|
+
Scenario: Using subshells
|
8
|
+
Given a file named "fooshell.rb" with:
|
9
|
+
"""
|
10
|
+
require 'bombshell'
|
11
|
+
module Foo
|
12
|
+
class Shell < Bombshell::Environment
|
13
|
+
include Bombshell::Shell
|
14
|
+
def deeper
|
15
|
+
Subshell.launch
|
16
|
+
end
|
17
|
+
prompt_with 'first'
|
18
|
+
class Subshell < Bombshell::Environment
|
19
|
+
include Bombshell::Shell
|
20
|
+
def foo; puts 'bar' end
|
21
|
+
prompt_with 'second'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
Bombshell.launch Foo::Shell
|
26
|
+
"""
|
27
|
+
When I run "ruby fooshell.rb" interactively
|
28
|
+
And I type "deeper"
|
29
|
+
And I type "foo"
|
30
|
+
And I type "quit"
|
31
|
+
And I type "quit"
|
32
|
+
Then the output should contain:
|
33
|
+
"""
|
34
|
+
first> deeper
|
35
|
+
"""
|
36
|
+
And the output should contain:
|
37
|
+
"""
|
38
|
+
second> foo
|
39
|
+
bar
|
40
|
+
"""
|
41
|
+
And the output should contain:
|
42
|
+
"""
|
43
|
+
second> quit
|
44
|
+
"""
|
45
|
+
And the output should contain:
|
46
|
+
"""
|
47
|
+
first> quit
|
48
|
+
"""
|
@@ -0,0 +1,10 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
2
|
+
require 'aruba/cucumber'
|
3
|
+
require 'fileutils'
|
4
|
+
require 'rspec/expectations'
|
5
|
+
require 'bombshell'
|
6
|
+
|
7
|
+
Before do
|
8
|
+
@aruba_io_wait_seconds = 2
|
9
|
+
@dirs = [File.join(ENV['HOME'], 'bombshell_features')]
|
10
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bombshell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andy Rossmeissl
|
@@ -15,25 +15,51 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-31 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
type: :development
|
23
22
|
prerelease: false
|
24
|
-
name:
|
23
|
+
name: bombshell
|
24
|
+
type: :runtime
|
25
25
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
26
26
|
none: false
|
27
27
|
requirements:
|
28
|
-
- -
|
28
|
+
- - ">="
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
hash:
|
30
|
+
hash: 3
|
31
31
|
segments:
|
32
|
-
-
|
33
|
-
|
34
|
-
- 2
|
35
|
-
version: 1.5.2
|
32
|
+
- 0
|
33
|
+
version: "0"
|
36
34
|
requirement: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
prerelease: false
|
37
|
+
name: aruba
|
38
|
+
type: :development
|
39
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
version: "0"
|
48
|
+
requirement: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
prerelease: false
|
51
|
+
name: bueller
|
52
|
+
type: :development
|
53
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
62
|
+
requirement: *id003
|
37
63
|
description: Give your application or gem an interactive shell, complete with custom prompts, tab completion, and various callbacks. Commands are defined as Ruby methods and can be grouped into logical subshells.
|
38
64
|
email: andy@rossmeissl.net
|
39
65
|
executables: []
|
@@ -53,14 +79,19 @@ files:
|
|
53
79
|
- VERSION
|
54
80
|
- bombshell.gemspec
|
55
81
|
- doc/brainstorm.rb
|
82
|
+
- features/callbacks.feature
|
83
|
+
- features/completion.feature
|
84
|
+
- features/prompts.feature
|
85
|
+
- features/shell.feature
|
86
|
+
- features/step_definitions/completion_steps.rb
|
87
|
+
- features/subshells.feature
|
88
|
+
- features/support/env.rb
|
56
89
|
- lib/bombshell.rb
|
57
90
|
- lib/bombshell/completor.rb
|
58
91
|
- lib/bombshell/environment.rb
|
59
92
|
- lib/bombshell/irb.rb
|
60
93
|
- lib/bombshell/shell.rb
|
61
94
|
- lib/bombshell/shell/commands.rb
|
62
|
-
- spec/bombshell_spec.rb
|
63
|
-
- spec/spec_helper.rb
|
64
95
|
has_rdoc: true
|
65
96
|
homepage: http://github.com/rossmeissl/bombshell
|
66
97
|
licenses:
|
@@ -91,10 +122,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
122
|
requirements: []
|
92
123
|
|
93
124
|
rubyforge_project:
|
94
|
-
rubygems_version: 1.
|
125
|
+
rubygems_version: 1.6.2
|
95
126
|
signing_key:
|
96
127
|
specification_version: 3
|
97
128
|
summary: Custom IRB consoles made easy
|
98
|
-
test_files:
|
99
|
-
|
100
|
-
- spec/spec_helper.rb
|
129
|
+
test_files: []
|
130
|
+
|
data/spec/bombshell_spec.rb
DELETED
data/spec/spec_helper.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
-
require 'rspec'
|
4
|
-
require 'bombshell'
|
5
|
-
|
6
|
-
# Requires supporting files with custom matchers and macros, etc,
|
7
|
-
# in ./support/ and its subdirectories.
|
8
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
-
|
10
|
-
RSpec.configure do |config|
|
11
|
-
|
12
|
-
end
|