project_scout 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +3 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +30 -0
- data/Rakefile +17 -23
- data/VERSION +1 -1
- data/lib/project_scout/dir.rb +10 -6
- data/project_scout.gemspec +77 -0
- data/spec/project_scout/dir_spec.rb +10 -3
- data/spec/spec_helper.rb +3 -4
- metadata +109 -12
- data/.gitignore +0 -21
data/.rspec
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
# Add dependencies to develop your gem here.
|
4
|
+
# Include everything needed to run rake, tests, features, etc.
|
5
|
+
group :development do
|
6
|
+
gem "rspec", "~> 2.3.0"
|
7
|
+
gem "bundler", "~> 1.0.0"
|
8
|
+
gem "jeweler", "~> 1.5.1"
|
9
|
+
gem "rcov", ">= 0"
|
10
|
+
gem "autotest"
|
11
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
autotest (4.4.4)
|
5
|
+
diff-lcs (1.1.2)
|
6
|
+
git (1.2.5)
|
7
|
+
jeweler (1.5.1)
|
8
|
+
bundler (~> 1.0.0)
|
9
|
+
git (>= 1.2.5)
|
10
|
+
rake
|
11
|
+
rake (0.8.7)
|
12
|
+
rcov (0.9.9)
|
13
|
+
rspec (2.3.0)
|
14
|
+
rspec-core (~> 2.3.0)
|
15
|
+
rspec-expectations (~> 2.3.0)
|
16
|
+
rspec-mocks (~> 2.3.0)
|
17
|
+
rspec-core (2.3.1)
|
18
|
+
rspec-expectations (2.3.0)
|
19
|
+
diff-lcs (~> 1.1.2)
|
20
|
+
rspec-mocks (2.3.0)
|
21
|
+
|
22
|
+
PLATFORMS
|
23
|
+
ruby
|
24
|
+
|
25
|
+
DEPENDENCIES
|
26
|
+
autotest
|
27
|
+
bundler (~> 1.0.0)
|
28
|
+
jeweler (~> 1.5.1)
|
29
|
+
rcov
|
30
|
+
rspec (~> 2.3.0)
|
data/Rakefile
CHANGED
@@ -1,37 +1,31 @@
|
|
1
1
|
require 'rubygems'
|
2
|
+
require 'bundler'
|
2
3
|
require 'rake'
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
|
-
end
|
16
|
-
Jeweler::GemcutterTasks.new
|
17
|
-
rescue LoadError
|
18
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "project_scout"
|
8
|
+
gem.summary = %Q{scan directories to find the root directory of a project}
|
9
|
+
gem.description = %Q{scan directories to find the root directory of a project}
|
10
|
+
gem.email = "rick@lee-morlang.com"
|
11
|
+
gem.homepage = "http://github.com/rleemorlang/project_scout"
|
12
|
+
gem.authors = ["Rick Lee-Morlang"]
|
13
|
+
gem.add_development_dependency "rspec", ">= 2.1.0"
|
14
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
19
15
|
end
|
16
|
+
Jeweler::RubygemsDotOrgTasks.new
|
20
17
|
|
21
|
-
require '
|
22
|
-
|
23
|
-
|
24
|
-
spec.
|
18
|
+
require 'rspec/core'
|
19
|
+
require 'rspec/core/rake_task'
|
20
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
21
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
25
22
|
end
|
26
23
|
|
27
|
-
|
28
|
-
spec.libs << 'lib' << 'spec'
|
24
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
29
25
|
spec.pattern = 'spec/**/*_spec.rb'
|
30
26
|
spec.rcov = true
|
31
27
|
end
|
32
28
|
|
33
|
-
task :spec => :check_dependencies
|
34
|
-
|
35
29
|
task :default => :spec
|
36
30
|
|
37
31
|
require 'rake/rdoctask'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/lib/project_scout/dir.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module ProjectScout
|
2
2
|
|
3
|
-
# This is a helper class with a bit of syntactical magic. Want to know if
|
3
|
+
# This is a helper class with a bit of syntactical magic. Want to know if
|
4
4
|
# /home/user/bubbles is a Rails project?
|
5
5
|
#
|
6
6
|
# ProjectScout::Dir("/home/user/bubbles").ruby_rails_project?
|
@@ -16,6 +16,10 @@ module ProjectScout
|
|
16
16
|
self.path = path
|
17
17
|
end
|
18
18
|
|
19
|
+
def git_repository?
|
20
|
+
contains? ".git"
|
21
|
+
end
|
22
|
+
|
19
23
|
def ruby_cucumber?
|
20
24
|
contains? "features/env.rb"
|
21
25
|
end
|
@@ -33,15 +37,15 @@ module ProjectScout
|
|
33
37
|
end
|
34
38
|
|
35
39
|
# Explanation of magic:
|
36
|
-
#
|
40
|
+
#
|
37
41
|
# 1) if a method is invoked with a "_project?" suffix, strip "_project"
|
38
|
-
# and call with the same arguments. Thus calling foo_bar_project?
|
42
|
+
# and call with the same arguments. Thus calling foo_bar_project?
|
39
43
|
# invokes foo_bar?
|
40
44
|
#
|
41
45
|
# 2) if a method invoked has no underscores in it, and local methods
|
42
|
-
# exist that start with the same string, invoke all of them and
|
43
|
-
# return true if and return true. Thus calling foo_project? when
|
44
|
-
# foo_bar_project? and foo_baz_project? exist will return true
|
46
|
+
# exist that start with the same string, invoke all of them and
|
47
|
+
# return true if and return true. Thus calling foo_project? when
|
48
|
+
# foo_bar_project? and foo_baz_project? exist will return true
|
45
49
|
# only if any of foo_bar_project? and foo_baz_project? return true.
|
46
50
|
#
|
47
51
|
def method_missing(method, *args)
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{project_scout}
|
8
|
+
s.version = "0.0.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Rick Lee-Morlang"]
|
12
|
+
s.date = %q{2010-12-19}
|
13
|
+
s.default_executable = %q{ruby-project-root}
|
14
|
+
s.description = %q{scan directories to find the root directory of a project}
|
15
|
+
s.email = %q{rick@lee-morlang.com}
|
16
|
+
s.executables = ["ruby-project-root"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE",
|
19
|
+
"README.rdoc"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
".rspec",
|
24
|
+
"Gemfile",
|
25
|
+
"Gemfile.lock",
|
26
|
+
"LICENSE",
|
27
|
+
"README.rdoc",
|
28
|
+
"Rakefile",
|
29
|
+
"VERSION",
|
30
|
+
"bin/ruby-project-root",
|
31
|
+
"lib/project_scout.rb",
|
32
|
+
"lib/project_scout/dir.rb",
|
33
|
+
"project_scout.gemspec",
|
34
|
+
"spec/project_scout/dir_spec.rb",
|
35
|
+
"spec/project_scout_spec.rb",
|
36
|
+
"spec/spec.opts",
|
37
|
+
"spec/spec_helper.rb"
|
38
|
+
]
|
39
|
+
s.homepage = %q{http://github.com/rleemorlang/project_scout}
|
40
|
+
s.require_paths = ["lib"]
|
41
|
+
s.rubygems_version = %q{1.3.7}
|
42
|
+
s.summary = %q{scan directories to find the root directory of a project}
|
43
|
+
s.test_files = [
|
44
|
+
"spec/project_scout/dir_spec.rb",
|
45
|
+
"spec/project_scout_spec.rb",
|
46
|
+
"spec/spec_helper.rb"
|
47
|
+
]
|
48
|
+
|
49
|
+
if s.respond_to? :specification_version then
|
50
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
51
|
+
s.specification_version = 3
|
52
|
+
|
53
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
54
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.3.0"])
|
55
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
56
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
|
57
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
58
|
+
s.add_development_dependency(%q<autotest>, [">= 0"])
|
59
|
+
s.add_development_dependency(%q<rspec>, [">= 2.1.0"])
|
60
|
+
else
|
61
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
62
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
63
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
64
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
65
|
+
s.add_dependency(%q<autotest>, [">= 0"])
|
66
|
+
s.add_dependency(%q<rspec>, [">= 2.1.0"])
|
67
|
+
end
|
68
|
+
else
|
69
|
+
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
70
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
71
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
72
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
73
|
+
s.add_dependency(%q<autotest>, [">= 0"])
|
74
|
+
s.add_dependency(%q<rspec>, [">= 2.1.0"])
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
module ProjectScout
|
4
4
|
describe Dir do
|
@@ -12,12 +12,19 @@ module ProjectScout
|
|
12
12
|
end
|
13
13
|
subject { Dir.new "/parent" }
|
14
14
|
|
15
|
+
describe "#git_repository?" do
|
16
|
+
it "should be true if the directory contains a .git directory" do
|
17
|
+
File.should_receive(:exists?).with("/parent/.git").and_return true
|
18
|
+
subject.should be_a_git_repository
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
15
22
|
describe "#ruby_rails?" do
|
16
23
|
it "should be true if the directory is the root of a rails project" do
|
17
24
|
File.should_receive(:exists?).with("/parent/config/environment.rb").and_return true
|
18
25
|
subject.should be_a_ruby_rails_project
|
19
26
|
end
|
20
|
-
|
27
|
+
|
21
28
|
it "should be false if the directory is not the root of a rails project" do
|
22
29
|
File.should_receive(:exists?).with("/parent/config/environment.rb").and_return false
|
23
30
|
subject.should_not be_a_ruby_rails_project
|
@@ -33,7 +40,7 @@ module ProjectScout
|
|
33
40
|
subject.should_receive(:contains?).with("features/env.rb")
|
34
41
|
subject.ruby_cucumber_project?
|
35
42
|
end
|
36
|
-
|
43
|
+
|
37
44
|
specify "#ruby_spec? should check if the path contains spec/spec_helper.rb" do
|
38
45
|
subject.should_receive(:contains?).with("spec/spec_helper.rb")
|
39
46
|
subject.ruby_rspec_project?
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
2
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
3
|
require 'project_scout'
|
4
|
-
require '
|
5
|
-
|
4
|
+
require 'rspec/core'
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
6
7
|
|
7
|
-
Spec::Runner.configure do |config|
|
8
|
-
|
9
8
|
end
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: project_scout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Rick Lee-Morlang
|
@@ -9,19 +15,101 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2010-12-19 00:00:00 -08:00
|
13
19
|
default_executable: ruby-project-root
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 2
|
31
|
+
- 3
|
32
|
+
- 0
|
33
|
+
version: 2.3.0
|
16
34
|
name: rspec
|
35
|
+
requirement: *id001
|
36
|
+
type: :development
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ~>
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 23
|
45
|
+
segments:
|
46
|
+
- 1
|
47
|
+
- 0
|
48
|
+
- 0
|
49
|
+
version: 1.0.0
|
50
|
+
name: bundler
|
51
|
+
requirement: *id002
|
52
|
+
type: :development
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
prerelease: false
|
55
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ~>
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 1
|
61
|
+
segments:
|
62
|
+
- 1
|
63
|
+
- 5
|
64
|
+
- 1
|
65
|
+
version: 1.5.1
|
66
|
+
name: jeweler
|
67
|
+
requirement: *id003
|
68
|
+
type: :development
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
prerelease: false
|
71
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 3
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
version: "0"
|
80
|
+
name: rcov
|
81
|
+
requirement: *id004
|
82
|
+
type: :development
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
hash: 3
|
91
|
+
segments:
|
92
|
+
- 0
|
93
|
+
version: "0"
|
94
|
+
name: autotest
|
95
|
+
requirement: *id005
|
17
96
|
type: :development
|
18
|
-
|
19
|
-
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
prerelease: false
|
99
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
20
101
|
requirements:
|
21
102
|
- - ">="
|
22
103
|
- !ruby/object:Gem::Version
|
23
|
-
|
24
|
-
|
104
|
+
hash: 11
|
105
|
+
segments:
|
106
|
+
- 2
|
107
|
+
- 1
|
108
|
+
- 0
|
109
|
+
version: 2.1.0
|
110
|
+
name: rspec
|
111
|
+
requirement: *id006
|
112
|
+
type: :development
|
25
113
|
description: scan directories to find the root directory of a project
|
26
114
|
email: rick@lee-morlang.com
|
27
115
|
executables:
|
@@ -33,7 +121,9 @@ extra_rdoc_files:
|
|
33
121
|
- README.rdoc
|
34
122
|
files:
|
35
123
|
- .document
|
36
|
-
- .
|
124
|
+
- .rspec
|
125
|
+
- Gemfile
|
126
|
+
- Gemfile.lock
|
37
127
|
- LICENSE
|
38
128
|
- README.rdoc
|
39
129
|
- Rakefile
|
@@ -41,6 +131,7 @@ files:
|
|
41
131
|
- bin/ruby-project-root
|
42
132
|
- lib/project_scout.rb
|
43
133
|
- lib/project_scout/dir.rb
|
134
|
+
- project_scout.gemspec
|
44
135
|
- spec/project_scout/dir_spec.rb
|
45
136
|
- spec/project_scout_spec.rb
|
46
137
|
- spec/spec.opts
|
@@ -50,26 +141,32 @@ homepage: http://github.com/rleemorlang/project_scout
|
|
50
141
|
licenses: []
|
51
142
|
|
52
143
|
post_install_message:
|
53
|
-
rdoc_options:
|
54
|
-
|
144
|
+
rdoc_options: []
|
145
|
+
|
55
146
|
require_paths:
|
56
147
|
- lib
|
57
148
|
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
58
150
|
requirements:
|
59
151
|
- - ">="
|
60
152
|
- !ruby/object:Gem::Version
|
153
|
+
hash: 3
|
154
|
+
segments:
|
155
|
+
- 0
|
61
156
|
version: "0"
|
62
|
-
version:
|
63
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
|
+
none: false
|
64
159
|
requirements:
|
65
160
|
- - ">="
|
66
161
|
- !ruby/object:Gem::Version
|
162
|
+
hash: 3
|
163
|
+
segments:
|
164
|
+
- 0
|
67
165
|
version: "0"
|
68
|
-
version:
|
69
166
|
requirements: []
|
70
167
|
|
71
168
|
rubyforge_project:
|
72
|
-
rubygems_version: 1.3.
|
169
|
+
rubygems_version: 1.3.7
|
73
170
|
signing_key:
|
74
171
|
specification_version: 3
|
75
172
|
summary: scan directories to find the root directory of a project
|