script_finder 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -64,7 +64,7 @@ Email me at: tcrawley@gmail.com if you find any problems.
64
64
 
65
65
  ## Contributors
66
66
 
67
- * [Blue-Dog-Archolite](https://github.com/Blue-Dog-Archolite)
67
+ * [Robert R. Meyer](https://github.com/Blue-Dog-Archolite)
68
68
 
69
69
  ## License
70
70
 
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 1
3
- :minor: 0
3
+ :minor: 2
4
4
  :build:
5
5
  :patch: 0
@@ -14,9 +14,23 @@ class BaseFinder
14
14
 
15
15
  def self.find_and_execute(command, bin_dir = nil)
16
16
  command = command.split(' ') if command.is_a?(String)
17
+ unless running_command_for_current_rails_version?(command.first)
18
+ puts "You are attempting to run a command for a version of rails you are not currently running. Please verify rails version"
19
+ exit
20
+ end
17
21
  finder = new(command, bin_dir).execute_command
18
22
  end
19
23
 
24
+ def self.running_command_for_current_rails_version?(command)
25
+ if command =~ /r/i or command =~ /s/i
26
+ right_version = command =~ /r/i ? Regexp.new(/rails\s3\./i) : Regexp.new(/rails\s2\./i)
27
+ return !right_version.match(`rails -v`).nil?
28
+ end
29
+
30
+ #unknown command. Assuming that this is the right call and they know what they are doing
31
+ return true
32
+ end
33
+
20
34
  def initialize(command, bin_dir = nil)
21
35
  @command = command
22
36
  self.bin_dir = bin_dir || DEFAULT_BIN_DIR
metadata CHANGED
@@ -1,26 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: script_finder
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 0
9
- - 0
10
- version: 1.0.0
4
+ prerelease:
5
+ version: 1.2.0
11
6
  platform: ruby
12
7
  authors:
8
+ - Robert R. Meyer
13
9
  - Tobias Crawley
14
10
  autorequire:
15
11
  bindir: bin
16
12
  cert_chain: []
17
13
 
18
- date: 2010-12-26 00:00:00 -05:00
19
- default_executable:
14
+ date: 2011-09-27 00:00:00 Z
20
15
  dependencies: []
21
16
 
22
17
  description:
23
- email: tcrawley@gmail.com
18
+ email: blue.dog.archolite@gmail.com
24
19
  executables:
25
20
  - r
26
21
  - s
@@ -41,7 +36,6 @@ files:
41
36
  - test/base_finder_test.rb
42
37
  - test/test_helper.rb
43
38
  - LICENSE
44
- has_rdoc: true
45
39
  homepage: http://github.com/tobias/script_finder
46
40
  licenses: []
47
41
 
@@ -55,26 +49,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
55
49
  requirements:
56
50
  - - ">="
57
51
  - !ruby/object:Gem::Version
58
- hash: 3
59
- segments:
60
- - 0
61
52
  version: "0"
62
53
  required_rubygems_version: !ruby/object:Gem::Requirement
63
54
  none: false
64
55
  requirements:
65
56
  - - ">="
66
57
  - !ruby/object:Gem::Version
67
- hash: 3
68
- segments:
69
- - 0
70
58
  version: "0"
71
59
  requirements: []
72
60
 
73
61
  rubyforge_project:
74
- rubygems_version: 1.3.7
62
+ rubygems_version: 1.8.10
75
63
  signing_key:
76
64
  specification_version: 3
77
65
  summary: A gem that provides tools to find and execute scripts in a project.
78
- test_files:
79
- - test/base_finder_test.rb
80
- - test/test_helper.rb
66
+ test_files: []
67
+