<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>examples/tabtab.sh</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -5,6 +5,7 @@ README.rdoc
 Rakefile
 bin/install_tabtab
 bin/tabtab
+examples/tabtab.sh
 features/development.feature
 features/discovered_gem_app_completions.feature
 features/external_app_completions.feature
@@ -42,7 +43,27 @@ spec/fixtures/gems/my_app/Rakefile
 spec/fixtures/gems/my_app/bin/test_app
 spec/fixtures/gems/my_app/lib/my_app.rb
 spec/fixtures/gems/my_app/lib/tabtab_definitions.rb
+spec/fixtures/gems/my_app/lib/tabtab_definitions/gem.rb
+spec/fixtures/gems/my_app/lib/tabtab_definitions/github.rb
+spec/fixtures/gems/my_app/lib/tabtab_definitions/rails.rb
+spec/fixtures/gems/my_app/lib/tabtab_definitions/rake.rb
+spec/fixtures/gems/my_app/lib/tabtab_definitions/script-server.rb
+spec/fixtures/gems/my_app/my_app-0.0.1.gem
 spec/fixtures/gems/my_app/my_app.gemspec
+spec/fixtures/gems/my_app/pkg/my_app-0.0.1.gem
+spec/fixtures/gems/my_app/pkg/my_app-0.0.1.tgz
+spec/fixtures/gems/my_app/pkg/my_app-0.0.1/History.txt
+spec/fixtures/gems/my_app/pkg/my_app-0.0.1/Manifest.txt
+spec/fixtures/gems/my_app/pkg/my_app-0.0.1/Rakefile
+spec/fixtures/gems/my_app/pkg/my_app-0.0.1/bin/test_app
+spec/fixtures/gems/my_app/pkg/my_app-0.0.1/lib/my_app.rb
+spec/fixtures/gems/my_app/pkg/my_app-0.0.1/lib/tabtab_definitions.rb
+spec/fixtures/gems/my_app/pkg/my_app-0.0.1/lib/tabtab_definitions/gem.rb
+spec/fixtures/gems/my_app/pkg/my_app-0.0.1/lib/tabtab_definitions/github.rb
+spec/fixtures/gems/my_app/pkg/my_app-0.0.1/lib/tabtab_definitions/rails.rb
+spec/fixtures/gems/my_app/pkg/my_app-0.0.1/lib/tabtab_definitions/rake.rb
+spec/fixtures/gems/my_app/pkg/my_app-0.0.1/lib/tabtab_definitions/script-server.rb
+spec/fixtures/gems/my_app/pkg/my_app-0.0.1/my_app.gemspec
 spec/framework_testing_spec.rb
 spec/install_tabtab_cli_spec.rb
 spec/spec.opts</diff>
      <filename>Manifest.txt</filename>
    </modified>
    <modified>
      <diff>@@ -8,7 +8,7 @@ Feature: Discover completions config script in installed RubyGems
     And a RubyGem 'my_app' with executable 'test_app' with autocompletions
     When run local executable 'install_tabtab' with arguments ''
     Then home file '.tabtab.sh' is created
-    Then gem completions are ready to be installed for applications: test_app
+    Then gem completions are ready to be installed for applications test_app in gem my_app
   
   Scenario: Activate auto-completions for gem-based app, determine options and return all
     Given a user's RubyGems gem cache</diff>
      <filename>features/discovered_gem_app_completions.feature</filename>
    </modified>
    <modified>
      <diff>@@ -3,6 +3,12 @@ Feature: Autocompletions for app via an explicit definition file
   As a command-line application user
   I want my own autocompletions for an app, rather than those given by default
   
+  Scenario: Add completions within explicit files
+    Given a .tabtab.yml config file
+    When run local executable 'install_tabtab' with arguments ''
+    Then home file '.tabtab.sh' is created
+    Then file completions are ready to be installed for applications test_app in file /path/to/file.rb
+  
   Scenario: Trigger autocompletions where the definition is in a specific file
     Given a file 'my_definitions.rb' containing completion definitions
     When run local executable 'tabtab' with arguments '--file my_definitions.rb test_app &quot;&quot; test_app'</diff>
      <filename>features/file_completions.feature</filename>
    </modified>
    <modified>
      <diff>@@ -5,6 +5,9 @@ Given %r{^a .tabtab.yml config file} do
       'external' =&gt; { 
         '-h' =&gt; %w[rails test_app], 
         '-?' =&gt; [] 
+      },
+      'files' =&gt; { 
+        '/path/to/file.rb' =&gt; 'test_app' 
       }
     }
     File.open('.tabtab.yml', 'w') do |f|
@@ -27,11 +30,30 @@ Given /^a file '(.*)' containing completion definitions$/ do |file|
   end
 end
 
-Then %r{^(\w+) completions are ready to be installed for applications: (.*)$} do |type, app_list|
+Then %r{^external completions are ready to be installed for applications: (.*)$} do |app_list|
   in_home_folder do
     contents = File.read(&quot;.tabtab.sh&quot;)
     app_list.split(/,\s*/).each do |app|
-      contents.should =~ /complete -o default -C 'tabtab --#{type}' #{app}/
+      contents.should =~ /complete -o default -C 'tabtab --external' #{app}/
     end
   end
-end
\ No newline at end of file
+end
+
+Then %r{^gem completions are ready to be installed for applications (.*) in gem (.*)$} do |app_list, gem_name|
+  in_home_folder do
+    contents = File.read(&quot;.tabtab.sh&quot;)
+    app_list.split(/,\s*/).each do |app|
+      contents.should =~ /complete -o default -C 'tabtab --gem #{gem_name}' #{app}/
+    end
+  end
+end
+
+Then %r{^file completions are ready to be installed for applications (.*) in file (.*)$} do |app_list, file_name|
+  in_home_folder do
+    contents = File.read(&quot;.tabtab.sh&quot;)
+    app_list.split(/,\s*/).each do |app|
+      contents.should =~ /complete -o default -C 'tabtab --file #{file_name}' #{app}/
+    end
+  end
+end
+</diff>
      <filename>features/steps/cli.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 require 'yaml'
+require 'rubygems'
 require 'tabtab'
-require 'tabtab/local_config'
 
 # TODO extract into BashCompletion.install ...
 # TODO support non-Bash shells
@@ -14,11 +14,13 @@ module InstallTabTab
     
     def execute(stdout, arguments=[])
       usage unless config
-      @to_file = File.open(File.join(home, &quot;.tabtab.sh&quot;), &quot;w&quot;)
+      @to_file = []
       install_externals
       install_for_files
       install_from_gems
-      @to_file.close
+      @file = File.open(File.join(home, &quot;.tabtab.sh&quot;), &quot;w&quot;)
+      @file &lt;&lt; @to_file.join(&quot;\n&quot;)
+      @file.close
     end
    
     def install_externals</diff>
      <filename>lib/install_tabtab/cli.rb</filename>
    </modified>
    <modified>
      <diff>@@ -12,8 +12,8 @@ module TabTab
     end
     
     def execute(stdout, arguments=[])
-      require &quot;shellwords&quot;
       @stdout = stdout
+      # require &quot;shellwords&quot;
       # @full_line = ENV['COMP_LINE']
       # @full_line_argv = Shellwords.shellwords(@full_line)
       return &quot;&quot; unless @app_type = arguments.shift
@@ -62,8 +62,7 @@ module TabTab
     #   --file /path/to/definition.rb
     #
     def process_file arguments
-      definitions = TabTab::Completions::File.new(*arguments)
-      stdout.puts definitions.extract.join(&quot;\n&quot;)
+      stdout.puts TabTab::Completions::File.new(*arguments).extract.join(&quot;\n&quot;)
     end
     
     def usage</diff>
      <filename>lib/tabtab/cli.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>434dbd3da187b7f698219a84e6fbf7e980881ebe</id>
    </parent>
  </parents>
  <author>
    <name>Dr Nic Williams</name>
    <email>drnicwilliams@gmail.com</email>
  </author>
  <url>http://github.com/drnic/tabtab/commit/843b3feb0dbb3299ed924bac191510e1b5cd7c87</url>
  <id>843b3feb0dbb3299ed924bac191510e1b5cd7c87</id>
  <committed-date>2008-11-17T03:45:54-08:00</committed-date>
  <authored-date>2008-11-17T03:45:54-08:00</authored-date>
  <message>scenarios for install_tabtab for gem and file types</message>
  <tree>23e9091caf391aa25174893f28b12afc5568c190</tree>
  <committer>
    <name>Dr Nic Williams</name>
    <email>drnicwilliams@gmail.com</email>
  </committer>
</commit>
