tabtab 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. data/History.txt +4 -0
  2. data/Manifest.txt +76 -0
  3. data/PostInstall.txt +10 -0
  4. data/README.rdoc +385 -0
  5. data/Rakefile +25 -0
  6. data/bin/install_tabtab +10 -0
  7. data/bin/tabtab +10 -0
  8. data/examples/tabtab.sh +7 -0
  9. data/features/aliases_for_completions.feature +23 -0
  10. data/features/development.feature +19 -0
  11. data/features/different_shells_installation.feature +26 -0
  12. data/features/discovered_gem_app_completions.feature +37 -0
  13. data/features/external_app_completions.feature +24 -0
  14. data/features/file_completions.feature +17 -0
  15. data/features/hide_short_flags.feature +19 -0
  16. data/features/steps/cli.rb +63 -0
  17. data/features/steps/common.rb +211 -0
  18. data/features/steps/completions.rb +15 -0
  19. data/features/steps/configuration.rb +20 -0
  20. data/features/steps/env.rb +17 -0
  21. data/features/steps/gems.rb +18 -0
  22. data/features/steps/shells.rb +3 -0
  23. data/lib/dev_definitions/gem.rb +54 -0
  24. data/lib/dev_definitions/rake.rb +23 -0
  25. data/lib/dev_definitions/script-generate.rb +8 -0
  26. data/lib/dev_definitions/script-server.rb +14 -0
  27. data/lib/install_tabtab/cli.rb +139 -0
  28. data/lib/tabtab.rb +10 -0
  29. data/lib/tabtab/cli.rb +116 -0
  30. data/lib/tabtab/completions.rb +6 -0
  31. data/lib/tabtab/completions/external.rb +39 -0
  32. data/lib/tabtab/completions/file.rb +23 -0
  33. data/lib/tabtab/completions/gems.rb +44 -0
  34. data/lib/tabtab/definitions.rb +28 -0
  35. data/lib/tabtab/definitions/base.rb +146 -0
  36. data/lib/tabtab/definitions/command.rb +47 -0
  37. data/lib/tabtab/definitions/default.rb +41 -0
  38. data/lib/tabtab/definitions/flag.rb +38 -0
  39. data/lib/tabtab/definitions/root.rb +70 -0
  40. data/lib/tabtab/framework_testing.rb +11 -0
  41. data/lib/tabtab/local_config.rb +16 -0
  42. data/lib/tabtab/test/assertions.rb +6 -0
  43. data/lib/tabtab_definitions/cucumber.rb +19 -0
  44. data/lib/tabtab_definitions/github.rb +50 -0
  45. data/lib/tabtab_definitions/newgem.rb +27 -0
  46. data/lib/tabtab_definitions/rails.rb +15 -0
  47. data/lib/tabtab_definitions/rubyforge.rb +17 -0
  48. data/script/console +10 -0
  49. data/script/destroy +14 -0
  50. data/script/generate +14 -0
  51. data/spec/definition_spec.rb +334 -0
  52. data/spec/external_spec.rb +38 -0
  53. data/spec/fixtures/bin/test_app +11 -0
  54. data/spec/fixtures/gems/multi_app/History.txt +2 -0
  55. data/spec/fixtures/gems/multi_app/Manifest.txt +7 -0
  56. data/spec/fixtures/gems/multi_app/Rakefile +25 -0
  57. data/spec/fixtures/gems/multi_app/bin/test_app +11 -0
  58. data/spec/fixtures/gems/multi_app/lib/multi_app.rb +6 -0
  59. data/spec/fixtures/gems/multi_app/lib/tabtab_definitions/some_app.rb +5 -0
  60. data/spec/fixtures/gems/multi_app/multi_app-0.0.1.gem +0 -0
  61. data/spec/fixtures/gems/multi_app/multi_app.gemspec +38 -0
  62. data/spec/fixtures/gems/my_app/History.txt +2 -0
  63. data/spec/fixtures/gems/my_app/Manifest.txt +7 -0
  64. data/spec/fixtures/gems/my_app/Rakefile +25 -0
  65. data/spec/fixtures/gems/my_app/bin/test_app +11 -0
  66. data/spec/fixtures/gems/my_app/lib/my_app.rb +6 -0
  67. data/spec/fixtures/gems/my_app/lib/tabtab_definitions.rb +5 -0
  68. data/spec/fixtures/gems/my_app/my_app-0.0.1.gem +0 -0
  69. data/spec/fixtures/gems/my_app/my_app.gemspec +38 -0
  70. data/spec/framework_testing_spec.rb +55 -0
  71. data/spec/install_tabtab_cli_spec.rb +139 -0
  72. data/spec/spec.opts +1 -0
  73. data/spec/spec_helper.rb +14 -0
  74. data/spec/tabtab_cli_spec.rb +145 -0
  75. data/tasks/rspec.rake +21 -0
  76. data/website/images/tabtab.png +0 -0
  77. metadata +167 -0
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,14 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ gem 'rspec'
6
+ require 'spec'
7
+ end
8
+
9
+ Spec::Runner.configure do |config|
10
+ config.mock_with :mocha
11
+ end
12
+
13
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
14
+ require 'tabtab'
@@ -0,0 +1,145 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+ require 'tabtab/cli'
3
+
4
+ def it_should_print_completions
5
+ it "should print completions" do
6
+ @stdout_io.rewind
7
+ @stdout = @stdout_io.read
8
+ @stdout.should == <<-EOS.gsub(/^ /, '')
9
+ --extra
10
+ --help
11
+ -h
12
+ -x
13
+ EOS
14
+ end
15
+ end
16
+
17
+ describe TabTab::CLI, "--external flag" do
18
+ before(:each) do
19
+ @cli = TabTab::CLI.new
20
+ TabTab::Completions::External.any_instance.expects(:options_str).returns(<<-EOS.gsub(/^ /, ''))
21
+ --help, -h
22
+ --extra, -x
23
+ EOS
24
+ @stdout_io = StringIO.new
25
+ end
26
+
27
+ describe "to generate completion definitions from -h help description" do
28
+ before(:each) do
29
+ @cli.expects(:config).returns({"external" => %w[test_app]}).at_least(2)
30
+ @cli.execute(@stdout_io, ['--external', 'test_app', '', 'test_app'])
31
+ end
32
+ it_should_print_completions
33
+ end
34
+
35
+ describe "with --alias ALIAS" do
36
+ before(:each) do
37
+ @cli.expects(:config).returns({"external" => %w[test_app]}).at_least(2)
38
+ @cli.execute(@stdout_io, ['--external', '--alias', 'test_app', 'test', '', 'test'])
39
+ end
40
+ it_should_print_completions
41
+ end
42
+ end
43
+
44
+ describe TabTab::CLI, "--external flag" do
45
+ describe "with app_name and explicit -X flag" do
46
+ before(:each) do
47
+ @cli = TabTab::CLI.new
48
+ @stdout_io = StringIO.new
49
+ TabTab::Completions::External.expects(:new).with("test_app", '-?', {:shortflags=>"enable"}).returns(mock do
50
+ expects(:starts_with).with("").returns(%w[--extra --help -h -x])
51
+ end)
52
+ @cli.expects(:config).returns({"external" => [ {"-?" => %w[test_app] } ] }).at_least(2)
53
+ @cli.execute(@stdout_io, ['--external', 'test_app', '', 'test_app'])
54
+ end
55
+ it_should_print_completions
56
+ end
57
+ end
58
+
59
+ describe TabTab::CLI, "--gem GEM_NAME loads from tabtab_definitions.rb in gem" do
60
+ before(:each) do
61
+ @cli = TabTab::CLI.new
62
+ TabTab::Completions::Gem.any_instance.expects(:load_gem_and_return_definitions_file).returns('/path/to/definition.rb')
63
+ TabTab::Completions::Gem.any_instance.expects(:load).with('/path/to/definition.rb').returns(true)
64
+ @cli.expects(:config).returns({}).at_least(1)
65
+ TabTab::Definition.register('test_app') do |c|
66
+ c.flags :help, :h, "help"
67
+ c.flags :extra, :x
68
+ end
69
+ @stdout_io = StringIO.new
70
+ end
71
+
72
+ describe "to local completion definitions in file" do
73
+ before(:each) do
74
+ @cli.execute(@stdout_io, ['--gem', 'my_gem', 'test_app', '', 'test_app'])
75
+ end
76
+ it_should_print_completions
77
+ end
78
+
79
+ describe "with --alias ALIAS" do
80
+ before(:each) do
81
+ @cli.execute(@stdout_io, ['--gem', 'my_gem', '--alias', 'test_app', 'test', '', 'test'])
82
+ end
83
+ it_should_print_completions
84
+ end
85
+
86
+ end
87
+
88
+ describe TabTab::CLI, "--gem GEM_NAME/PATH loads from a PATH within a gem to find definition" do
89
+ before(:each) do
90
+ @cli = TabTab::CLI.new
91
+ TabTab::Completions::Gem.any_instance.expects(:load_gem_and_return_definitions_file).never
92
+ TabTab::Completions::Gem.any_instance.expects(:gem_root_path).returns('/path/to/my_gem-1.0.0')
93
+ TabTab::Completions::Gem.any_instance.expects(:load).with('/path/to/my_gem-1.0.0/lib/tabtab_definitions/definition.rb').returns(true)
94
+ @cli.expects(:config).returns({}).at_least(1)
95
+ TabTab::Definition.register('test_app') do |c|
96
+ c.flags :help, :h, "help"
97
+ c.flags :extra, :x
98
+ end
99
+ @stdout_io = StringIO.new
100
+ end
101
+
102
+ describe "to local completion definitions in file" do
103
+ before(:each) do
104
+ @cli.execute(@stdout_io, ['--gem', 'my_gem/lib/tabtab_definitions/definition.rb', 'test_app', '', 'test_app'])
105
+ end
106
+ it_should_print_completions
107
+ end
108
+
109
+ describe "with --alias ALIAS" do
110
+ before(:each) do
111
+ @cli.execute(@stdout_io, ['--gem', 'my_gem/lib/tabtab_definitions/definition.rb', '--alias', 'test_app', 'test', '', 'test'])
112
+ end
113
+ it_should_print_completions
114
+ end
115
+
116
+ end
117
+
118
+ describe TabTab::CLI, "--file flag" do
119
+ before(:each) do
120
+ @cli = TabTab::CLI.new
121
+ TabTab::Completions::File.any_instance.expects(:load).with('/path/to/definition.rb').returns(true)
122
+ TabTab::Definition.register('test_app') do |c|
123
+ c.flags :help, :h, "help"
124
+ c.flags :extra, :x
125
+ end
126
+ File.expects(:exists?).with('/path/to/definition.rb').returns(true).at_least(1)
127
+ @cli.expects(:config).returns({}).at_least(1)
128
+ @stdout_io = StringIO.new
129
+ end
130
+
131
+ describe "to local completion definitions in file" do
132
+ before(:each) do
133
+ @cli.execute(@stdout_io, ['--file', '/path/to/definition.rb', 'test_app', '', 'test_app'])
134
+ end
135
+ it_should_print_completions
136
+ end
137
+
138
+ describe "with --alias ALIAS" do
139
+ before(:each) do
140
+ @cli.execute(@stdout_io, ['--file', '/path/to/definition.rb', '--alias', 'test_app', 'test', '', 'test'])
141
+ end
142
+ it_should_print_completions
143
+ end
144
+ end
145
+
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ require 'spec'
6
+ end
7
+ begin
8
+ require 'spec/rake/spectask'
9
+ rescue LoadError
10
+ puts <<-EOS
11
+ To use rspec for testing you must install rspec gem:
12
+ gem install rspec
13
+ EOS
14
+ exit(0)
15
+ end
16
+
17
+ desc "Run the specs under spec/models"
18
+ Spec::Rake::SpecTask.new do |t|
19
+ t.spec_opts = ['--options', "spec/spec.opts"]
20
+ t.spec_files = FileList['spec/**/*_spec.rb']
21
+ end
Binary file
metadata ADDED
@@ -0,0 +1,167 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tabtab
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.0
5
+ platform: ruby
6
+ authors:
7
+ - Dr Nic Williams
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-11-23 00:00:00 +10:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: newgem
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.1.0
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: cucumber
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.1.8
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: hoe
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 1.8.0
44
+ version:
45
+ description: "Create and install double-tab ('tab tab') auto-completions for any command-line application on any shell (bash, fish, ksh, etc). When you use the command-line, you can double-tab to auto-complete the name of a command-line application or a target file or folder. Its possible to provide your own completions for applications: git comes with bash shell completions, and the fish shell includes a library of completions for many applications."
46
+ email:
47
+ - drnicwilliams@gmail.com
48
+ executables:
49
+ - install_tabtab
50
+ - tabtab
51
+ extensions: []
52
+
53
+ extra_rdoc_files:
54
+ - History.txt
55
+ - Manifest.txt
56
+ - PostInstall.txt
57
+ - README.rdoc
58
+ - spec/fixtures/gems/multi_app/History.txt
59
+ - spec/fixtures/gems/multi_app/Manifest.txt
60
+ - spec/fixtures/gems/my_app/History.txt
61
+ - spec/fixtures/gems/my_app/Manifest.txt
62
+ files:
63
+ - History.txt
64
+ - Manifest.txt
65
+ - PostInstall.txt
66
+ - README.rdoc
67
+ - Rakefile
68
+ - bin/install_tabtab
69
+ - bin/tabtab
70
+ - examples/tabtab.sh
71
+ - features/aliases_for_completions.feature
72
+ - features/development.feature
73
+ - features/different_shells_installation.feature
74
+ - features/discovered_gem_app_completions.feature
75
+ - features/external_app_completions.feature
76
+ - features/file_completions.feature
77
+ - features/hide_short_flags.feature
78
+ - features/steps/cli.rb
79
+ - features/steps/common.rb
80
+ - features/steps/completions.rb
81
+ - features/steps/configuration.rb
82
+ - features/steps/env.rb
83
+ - features/steps/gems.rb
84
+ - features/steps/shells.rb
85
+ - lib/dev_definitions/gem.rb
86
+ - lib/dev_definitions/rake.rb
87
+ - lib/dev_definitions/script-generate.rb
88
+ - lib/dev_definitions/script-server.rb
89
+ - lib/install_tabtab/cli.rb
90
+ - lib/tabtab.rb
91
+ - lib/tabtab/cli.rb
92
+ - lib/tabtab/completions.rb
93
+ - lib/tabtab/completions/external.rb
94
+ - lib/tabtab/completions/file.rb
95
+ - lib/tabtab/completions/gems.rb
96
+ - lib/tabtab/definitions.rb
97
+ - lib/tabtab/definitions/base.rb
98
+ - lib/tabtab/definitions/command.rb
99
+ - lib/tabtab/definitions/default.rb
100
+ - lib/tabtab/definitions/flag.rb
101
+ - lib/tabtab/definitions/root.rb
102
+ - lib/tabtab/framework_testing.rb
103
+ - lib/tabtab/local_config.rb
104
+ - lib/tabtab/test/assertions.rb
105
+ - lib/tabtab_definitions/cucumber.rb
106
+ - lib/tabtab_definitions/github.rb
107
+ - lib/tabtab_definitions/newgem.rb
108
+ - lib/tabtab_definitions/rails.rb
109
+ - lib/tabtab_definitions/rubyforge.rb
110
+ - script/console
111
+ - script/destroy
112
+ - script/generate
113
+ - spec/definition_spec.rb
114
+ - spec/external_spec.rb
115
+ - spec/fixtures/bin/test_app
116
+ - spec/fixtures/gems/multi_app/History.txt
117
+ - spec/fixtures/gems/multi_app/Manifest.txt
118
+ - spec/fixtures/gems/multi_app/Rakefile
119
+ - spec/fixtures/gems/multi_app/bin/test_app
120
+ - spec/fixtures/gems/multi_app/lib/multi_app.rb
121
+ - spec/fixtures/gems/multi_app/lib/tabtab_definitions/some_app.rb
122
+ - spec/fixtures/gems/multi_app/multi_app-0.0.1.gem
123
+ - spec/fixtures/gems/multi_app/multi_app.gemspec
124
+ - spec/fixtures/gems/my_app/History.txt
125
+ - spec/fixtures/gems/my_app/Manifest.txt
126
+ - spec/fixtures/gems/my_app/Rakefile
127
+ - spec/fixtures/gems/my_app/bin/test_app
128
+ - spec/fixtures/gems/my_app/lib/my_app.rb
129
+ - spec/fixtures/gems/my_app/lib/tabtab_definitions.rb
130
+ - spec/fixtures/gems/my_app/my_app-0.0.1.gem
131
+ - spec/fixtures/gems/my_app/my_app.gemspec
132
+ - spec/framework_testing_spec.rb
133
+ - spec/install_tabtab_cli_spec.rb
134
+ - spec/spec.opts
135
+ - spec/spec_helper.rb
136
+ - spec/tabtab_cli_spec.rb
137
+ - tasks/rspec.rake
138
+ - website/images/tabtab.png
139
+ has_rdoc: true
140
+ homepage: http://tabtab.rubyforge.org
141
+ post_install_message: PostInstall.txt
142
+ rdoc_options:
143
+ - --main
144
+ - README.rdoc
145
+ require_paths:
146
+ - lib
147
+ required_ruby_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: "0"
152
+ version:
153
+ required_rubygems_version: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: "0"
158
+ version:
159
+ requirements: []
160
+
161
+ rubyforge_project: tabtab
162
+ rubygems_version: 1.3.1
163
+ signing_key:
164
+ specification_version: 2
165
+ summary: Create and install double-tab ('tab tab') auto-completions for any command-line application on any shell (bash, fish, ksh, etc)
166
+ test_files: []
167
+