rails_complete 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  pkg
2
+ .yardoc
data/README.mkd CHANGED
@@ -4,9 +4,18 @@ Rails Complete
4
4
  Adds auto-completion to the `rails` command.
5
5
 
6
6
 
7
+ Install
8
+ -------
9
+
10
+ First, you need to run `gem install rails_complete`. Then just add the following
11
+ line to your `.bashrc`
12
+
13
+ complete -C rails-complete -o default rails
14
+
15
+
7
16
  License
8
17
  -------
9
18
 
10
- Copyright (c) 2010 Daniel Schierbeck, released under the MIT license.
19
+ Copyright (c) 2010 Daniel Schierbeck.
11
20
 
12
- See MIT-LICENSE for details.
21
+ Released under the MIT license. See MIT-LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
data/bin/rails-complete CHANGED
@@ -10,10 +10,9 @@ comp_line = ENV["COMP_LINE"]
10
10
  exit -1 if comp_line.nil?
11
11
 
12
12
  parts = comp_line.scan(/\w+/)
13
- exit 0 unless parts.size == 2
14
13
 
15
14
  require 'rails_complete'
16
15
 
17
- prefix = parts[1]
16
+ prefix = parts[1] || ""
18
17
 
19
18
  puts RailsComplete.complete(prefix)
@@ -3,7 +3,7 @@ module RailsComplete
3
3
  class << self
4
4
 
5
5
  COMMANDS = %w(server generate destroy plugin benchmarker profiler
6
- console dbconsole application runner)
6
+ console dbconsole application runner new)
7
7
 
8
8
  def complete(string)
9
9
  string = string.chomp
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rails_complete}
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Daniel Schierbeck"]
@@ -26,7 +26,8 @@ Gem::Specification.new do |s|
26
26
  "bin/rails-complete",
27
27
  "lib/rails_complete.rb",
28
28
  "rails_complete.gemspec",
29
- "test/test_completions.rb"
29
+ "test/test_completions.rb",
30
+ "test/test_executable.rb"
30
31
  ]
31
32
  s.homepage = %q{http://github.com/dasch/rails-complete}
32
33
  s.rdoc_options = ["--charset=UTF-8"]
@@ -34,7 +35,8 @@ Gem::Specification.new do |s|
34
35
  s.rubygems_version = %q{1.3.6}
35
36
  s.summary = %q{Bash completion for the rails command}
36
37
  s.test_files = [
37
- "test/test_completions.rb"
38
+ "test/test_executable.rb",
39
+ "test/test_completions.rb"
38
40
  ]
39
41
 
40
42
  if s.respond_to? :specification_version then
@@ -0,0 +1,25 @@
1
+
2
+ require 'test/unit'
3
+
4
+ BIN_DIR = File.join(File.dirname(__FILE__), '..', 'bin')
5
+
6
+ COMMANDS = %w(server generate destroy plugin benchmarker profiler
7
+ console dbconsole application runner)
8
+
9
+ class TestExecutable < Test::Unit::TestCase
10
+ def test_should_complete_commands
11
+ assert_equal %w(server), complete("ser")
12
+ assert_equal %w(plugin profiler), complete("p")
13
+ end
14
+
15
+ def test_should_list_commands_when_no_prefix_is_given
16
+ assert_equal COMMANDS.sort, complete("").sort
17
+ end
18
+
19
+ protected
20
+
21
+ def complete(prefix)
22
+ cmd = %(COMP_LINE="rails #{prefix}" #{BIN_DIR}/rails-complete)
23
+ `#{cmd}`.split("\n")
24
+ end
25
+ end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
7
+ - 3
8
8
  - 0
9
- version: 0.2.0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Schierbeck
@@ -36,6 +36,7 @@ files:
36
36
  - lib/rails_complete.rb
37
37
  - rails_complete.gemspec
38
38
  - test/test_completions.rb
39
+ - test/test_executable.rb
39
40
  has_rdoc: true
40
41
  homepage: http://github.com/dasch/rails-complete
41
42
  licenses: []
@@ -67,4 +68,5 @@ signing_key:
67
68
  specification_version: 3
68
69
  summary: Bash completion for the rails command
69
70
  test_files:
71
+ - test/test_executable.rb
70
72
  - test/test_completions.rb