script_finder 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 2
4
- :build:
5
- :patch: 0
4
+ :build:
5
+ :patch: 1
data/bin/r CHANGED
@@ -3,7 +3,7 @@
3
3
  require 'script_finder/rails_finder'
4
4
 
5
5
  #Rewrite in order to enable finding Rails3 arugments and tasks
6
- #Runs by default "rails ARGV"
6
+ #Runs by default "rails ARGV"
7
7
  #Verification and feeback provided as in find_and_execute
8
8
  # BlueDogArcholite - Robert R. Meyer
9
- RailsFinder.find_and_execute(ARGV)
9
+ RailsFinder.find_and_execute(ARGV, :prefix => 'r')
data/bin/s CHANGED
@@ -5,4 +5,4 @@ require 'script_finder/script_finder'
5
5
  # by default, this looks for executables in a script/ dir. To change,
6
6
  # pass the bin dir name as a second argument:
7
7
  # ScriptFinder.find_and_execute(ARGV, 'commands')
8
- ScriptFinder.find_and_execute(ARGV)
8
+ ScriptFinder.find_and_execute(ARGV, :prefix => 's')
@@ -12,9 +12,11 @@ class BaseFinder
12
12
 
13
13
  DEFAULT_BIN_DIR = 'script'
14
14
 
15
- def self.find_and_execute(command, bin_dir = nil)
15
+ def self.find_and_execute(command, opts = {})
16
+ bin_dir = opts[:bin_dir] ||= nil
17
+ r_or_s = opts[:prefix]
16
18
  command = command.split(' ') if command.is_a?(String)
17
- unless running_command_for_current_rails_version?(command.first)
19
+ unless running_command_for_current_rails_version?(r_or_s)
18
20
  puts "You are attempting to run a command for a version of rails you are not currently running. Please verify rails version"
19
21
  exit
20
22
  end
@@ -23,7 +25,8 @@ class BaseFinder
23
25
 
24
26
  def self.running_command_for_current_rails_version?(command)
25
27
  if command =~ /r/i or command =~ /s/i
26
- right_version = command =~ /r/i ? Regexp.new(/rails\s3\./i) : Regexp.new(/rails\s2\./i)
28
+ right_version = command =~ /r/i ? Regexp.new(/rails\s(3\.)/i) : Regexp.new(/rails\s(2\.)/i)
29
+
27
30
  return !right_version.match(`rails -v`).nil?
28
31
  end
29
32
 
@@ -39,9 +42,8 @@ class BaseFinder
39
42
  def execute_command
40
43
  raise NotImplementedError.new("You must implement execute_command for subclasses of BaseFinder!")
41
44
  end
42
-
43
- protected
44
45
 
46
+ protected
45
47
  def cmd_not_found
46
48
  raise NotImplementedError.new("You must implement cmd_not_found for subclasses of BaseFinder!")
47
49
  end
@@ -130,5 +132,4 @@ class BaseFinder
130
132
  cmd_exec "#{commands.first} #{commands_to_command_string(command)}"
131
133
  end
132
134
  end
133
-
134
135
  end
metadata CHANGED
@@ -1,8 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: script_finder
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 1.2.0
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 2
8
+ - 1
9
+ version: 1.2.1
6
10
  platform: ruby
7
11
  authors:
8
12
  - Robert R. Meyer
@@ -11,7 +15,8 @@ autorequire:
11
15
  bindir: bin
12
16
  cert_chain: []
13
17
 
14
- date: 2011-09-27 00:00:00 Z
18
+ date: 2011-10-11 00:00:00 -05:00
19
+ default_executable:
15
20
  dependencies: []
16
21
 
17
22
  description:
@@ -36,6 +41,7 @@ files:
36
41
  - test/base_finder_test.rb
37
42
  - test/test_helper.rb
38
43
  - LICENSE
44
+ has_rdoc: true
39
45
  homepage: http://github.com/tobias/script_finder
40
46
  licenses: []
41
47
 
@@ -49,17 +55,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
49
55
  requirements:
50
56
  - - ">="
51
57
  - !ruby/object:Gem::Version
58
+ segments:
59
+ - 0
52
60
  version: "0"
53
61
  required_rubygems_version: !ruby/object:Gem::Requirement
54
62
  none: false
55
63
  requirements:
56
64
  - - ">="
57
65
  - !ruby/object:Gem::Version
66
+ segments:
67
+ - 0
58
68
  version: "0"
59
69
  requirements: []
60
70
 
61
71
  rubyforge_project:
62
- rubygems_version: 1.8.10
72
+ rubygems_version: 1.3.7
63
73
  signing_key:
64
74
  specification_version: 3
65
75
  summary: A gem that provides tools to find and execute scripts in a project.