schlueter-rushmate 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.0.7 / 2008-08-14
2
+ * added texts
3
+ * rename input -> user_input
4
+ * renamed select_from_array -> quick_menu_from_array
5
+
1
6
  == 0.0.6 / 2008-08-14
2
7
  * beginning adding hooks for collecting user input
3
8
 
data/Manifest.txt CHANGED
@@ -1,9 +1,14 @@
1
1
  History.txt
2
2
  Manifest.txt
3
3
  README
4
- rushmate.gemspec
4
+ Rakefile
5
5
  lib/rushmate.rb
6
6
  lib/rushmate/command.rb
7
7
  lib/rushmate/exit.rb
8
8
  lib/rushmate/textmate_helper.rb
9
- lib/rushmate/user_input.rb
9
+ lib/rushmate/user_input.rb
10
+ rushmate.gemspec
11
+ test/command_test.rb
12
+ test/helper.rb
13
+ test/textmate_helper_test.rb
14
+ test/user_input_test.rb
data/README CHANGED
@@ -32,7 +32,7 @@ Rushmate::Command.new {
32
32
  # if there are multiple files prompt the user for which file they want to switch to
33
33
  # then switch to their selection
34
34
  menu_files = found_files.collect { |f| f.full_path.gsub(project_directory.full_path, "") }
35
- project_directory[input.select_from_array(menu_files)].mate
35
+ project_directory[user_input.quick_menu_from_array(menu_files)].mate
36
36
  end
37
37
  end
38
38
  }
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ task :coverage do
2
+ system("rm -fr coverage")
3
+ system("export TM_SUPPORT_PATH=/Applications/TextMate.app/Contents/SharedSupport/Support && rcov --sort=coverage --threshold=100 --exclude=gems/*,TextMate.app --sort=coverage test/*_test.rb")
4
+ system("open coverage/index.html")
5
+ end
@@ -5,7 +5,7 @@ module Rushmate
5
5
  attr_accessor :shell
6
6
  def initialize(&block)
7
7
  setup_shell
8
- self.instance_eval(&block)
8
+ self.instance_eval(&block) if block
9
9
  end
10
10
 
11
11
  def execute(thing)
@@ -21,7 +21,7 @@ module Rushmate
21
21
  Rushmate::Exit
22
22
  end
23
23
 
24
- def input
24
+ def user_input
25
25
  Rushmate::UserInput
26
26
  end
27
27
 
@@ -1,7 +1,7 @@
1
1
  module Rushmate
2
2
  module UserInput
3
3
  class << self
4
- def select_from_array(strings)
4
+ def quick_menu_from_array(strings)
5
5
  strings[TextMate::UI.menu(strings)]
6
6
  end
7
7
  end
data/rushmate.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "rushmate"
3
- s.version = "0.0.6"
3
+ s.version = "0.0.7"
4
4
  s.email = "schlueter@gmail.com"
5
5
  s.homepage = "http://github.com/schlueter/rushmate"
6
- s.description = "Textmate to Rush bridge"
6
+ s.description = "Makes writing TextMate commands easier by providing convient methods for getting environment variables and getting user input."
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.date = %q{2008-08-14}
9
9
  s.require_paths = ["lib"]
@@ -14,12 +14,17 @@ Gem::Specification.new do |s|
14
14
  "History.txt",
15
15
  "Manifest.txt",
16
16
  "README",
17
+ "Rakefile",
17
18
  "rushmate.gemspec",
18
19
  "lib/rushmate.rb",
19
20
  "lib/rushmate/command.rb",
20
21
  "lib/rushmate/exit.rb",
21
22
  "lib/rushmate/textmate_helper.rb",
22
- "lib/rushmate/user_input.rb"
23
+ "lib/rushmate/user_input.rb",
24
+ "test/command_test.rb",
25
+ "test/helper.rb",
26
+ "test/textmate_helper_test.rb",
27
+ "test/user_input_test.rb"
23
28
  ]
24
29
 
25
30
  s.has_rdoc = true
@@ -0,0 +1,49 @@
1
+ require File.dirname(__FILE__) + "/helper"
2
+
3
+ class CommandText < Test::Unit::TestCase
4
+ def setup
5
+
6
+ end
7
+
8
+ def test_shell
9
+ rush_shell = Rushmate::Command.new.shell
10
+ assert_not_nil rush_shell
11
+ assert rush_shell.is_a?(Rush::Shell)
12
+ end
13
+
14
+ def test_execute
15
+ rush_output = Rushmate::Command.new.execute("root")
16
+ assert_not_nil(rush_output)
17
+ assert rush_output.is_a?(Rush::Dir)
18
+ end
19
+
20
+ def test_method_missing
21
+ rush_output = Rushmate::Command.new.root
22
+ assert_not_nil(rush_output)
23
+ assert rush_output.is_a?(Rush::Dir)
24
+ end
25
+
26
+ def test_exit
27
+ exit = Rushmate::Command.new.exit
28
+ assert_not_nil(exit)
29
+ assert_equal(Rushmate::Exit, exit)
30
+ end
31
+
32
+ def test_user_input
33
+ user_input = Rushmate::Command.new.user_input
34
+ assert_not_nil(user_input)
35
+ assert_equal(Rushmate::UserInput, user_input)
36
+ end
37
+
38
+ def test_initialize_should_call_block
39
+ assert_nil($last_res)
40
+ Rushmate::Command.new {
41
+ root
42
+ }
43
+ assert_not_nil($last_res)
44
+ end
45
+
46
+ def test_should_mixin_textmate_helper
47
+ assert Rushmate::Command.new.respond_to?(:project_directory)
48
+ end
49
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,5 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), *%w[.. lib]))
2
+ require 'rushmate'
3
+ require 'test/unit'
4
+ require 'rubygems'
5
+ require 'mocha'
@@ -0,0 +1,53 @@
1
+ require File.dirname(__FILE__) + "/helper"
2
+
3
+ class TextmateHelperTest < Test::Unit::TestCase
4
+ def setup
5
+ @proxy = Class.new
6
+ @proxy.send(:include, Rushmate::TextmateHelper)
7
+ @instance = @proxy.new
8
+ @instance.stubs(:root).returns({"/root/" => true, "/root/foo.rb" => true, "/root/lib/" => true})
9
+ end
10
+
11
+ def test_current_word
12
+ ENV["TM_CURRENT_WORD"] = "foo"
13
+ assert_equal("foo", @instance.current_word)
14
+ end
15
+
16
+ def test_line
17
+ ENV["TM_CURRENT_LINE"] = "foo bar"
18
+ assert_equal("foo bar", @instance.current_line)
19
+ end
20
+
21
+ def test_tm_filename
22
+ ENV["TM_FILENAME"] = "foo.rb"
23
+ assert_equal("foo.rb", @instance.tm_filename)
24
+ end
25
+
26
+ def test_project_directory?
27
+ ENV["TM_PROJECT_DIRECTORY"] = nil
28
+ assert !@instance.project_directory?
29
+
30
+ ENV["TM_PROJECT_DIRECTORY"] = "/"
31
+ assert @instance.project_directory?
32
+ end
33
+
34
+ def test_selected_text
35
+ ENV["TM_SELECTED_TEXT"] = "foo b"
36
+ assert_equal("foo b", @instance.selected_text)
37
+ end
38
+
39
+ def test_project_directory
40
+ ENV["TM_PROJECT_DIRECTORY"] = "/root"
41
+ assert @instance.project_directory
42
+ end
43
+
44
+ def test_tm_directory
45
+ ENV["TM_DIRECTORY"] = "/root/lib"
46
+ assert @instance.tm_directory
47
+ end
48
+
49
+ def test_tm_file
50
+ ENV["TM_FILEPATH"] = "/root/foo.rb"
51
+ @instance.tm_file
52
+ end
53
+ end
@@ -0,0 +1,17 @@
1
+ require File.dirname(__FILE__) + "/helper"
2
+
3
+ class UserInputTest < Test::Unit::TestCase
4
+ def setup
5
+
6
+ end
7
+
8
+ def test_quick_menu_from_array_returns_the_string_the_user_selected
9
+ menu_items = %w[foo bar baz]
10
+ TextMate::UI.stubs(:menu).returns(0)
11
+ assert_equal("foo", Rushmate::UserInput.quick_menu_from_array(menu_items))
12
+ TextMate::UI.stubs(:menu).returns(1)
13
+ assert_equal("bar", Rushmate::UserInput.quick_menu_from_array(menu_items))
14
+ TextMate::UI.stubs(:menu).returns(2)
15
+ assert_equal("baz", Rushmate::UserInput.quick_menu_from_array(menu_items))
16
+ end
17
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schlueter-rushmate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Schlueter
@@ -21,7 +21,7 @@ dependencies:
21
21
  - !ruby/object:Gem::Version
22
22
  version: "0.4"
23
23
  version:
24
- description: Textmate to Rush bridge
24
+ description: Makes writing TextMate commands easier by providing convient methods for getting environment variables and getting user input.
25
25
  email: schlueter@gmail.com
26
26
  executables: []
27
27
 
@@ -35,12 +35,17 @@ files:
35
35
  - History.txt
36
36
  - Manifest.txt
37
37
  - README
38
+ - Rakefile
38
39
  - rushmate.gemspec
39
40
  - lib/rushmate.rb
40
41
  - lib/rushmate/command.rb
41
42
  - lib/rushmate/exit.rb
42
43
  - lib/rushmate/textmate_helper.rb
43
44
  - lib/rushmate/user_input.rb
45
+ - test/command_test.rb
46
+ - test/helper.rb
47
+ - test/textmate_helper_test.rb
48
+ - test/user_input_test.rb
44
49
  has_rdoc: true
45
50
  homepage: http://github.com/schlueter/rushmate
46
51
  post_install_message: