framework_identificator 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +16 -0
- data/.gpairrc +1 -0
- data/.rspec +2 -0
- data/.rvmrc +1 -0
- data/.travis.yml +6 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +22 -0
- data/README.md +50 -0
- data/Rakefile +5 -0
- data/framework_identificator.gemspec +19 -0
- data/lib/framework_identificator/frameworks/rails.rb +43 -0
- data/lib/framework_identificator/version.rb +3 -0
- data/lib/framework_identificator.rb +12 -0
- data/spec/fixtures/basic_folders_and_files/backup/main.sh +3 -0
- data/spec/fixtures/basic_folders_and_files/main.sh +3 -0
- data/spec/framework_identificator_spec.rb +334 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/support/webmocks.rb +0 -0
- metadata +75 -0
data/.gitignore
ADDED
data/.gpairrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
alone for github
|
data/.rspec
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm --create use 1.9.3@framework_identificator
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 zedtux
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# FrameworkIdentificator [![Build Status](https://secure.travis-ci.org/zedtux/framework_identificator.png)](http://travis-ci.org/zedtux/framework_identificator) [![Dependency Status](https://gemnasium.com/zedtux/framework_identificator.png)](http://gemnasium.com/zedtux/framework_identificator) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/zedtux/framework_identificator) [![endorse](http://api.coderwall.com/zedtux/endorsecount.png)](http://coderwall.com/zedtux)
|
2
|
+
|
3
|
+
Identify the used framework in a given project.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'framework_identificator'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install framework_identificator
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
### With a Pathname object
|
22
|
+
|
23
|
+
FrameworkIdentificator.from(Pathname.new(File.join("projects", "my_project")))
|
24
|
+
=> Frameworks::Rails
|
25
|
+
|
26
|
+
### With a Git object
|
27
|
+
|
28
|
+
require "git"
|
29
|
+
FrameworkIdentificator.from(Git.clone("git@myhost.tld:my_project", "my_project"))
|
30
|
+
=> Frameworks::Rails
|
31
|
+
|
32
|
+
## Implemented
|
33
|
+
|
34
|
+
### VCS
|
35
|
+
|
36
|
+
- Git
|
37
|
+
|
38
|
+
### Frameworks
|
39
|
+
|
40
|
+
- Rails
|
41
|
+
|
42
|
+
## Contributing
|
43
|
+
|
44
|
+
You can contribute to this gem by adding support for new [VCS](http://en.wikipedia.org/wiki/Concurrent_Versions_System) or new frameworks.
|
45
|
+
|
46
|
+
1. Fork it
|
47
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
48
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
49
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
50
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "framework_identificator/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "framework_identificator"
|
8
|
+
gem.version = FrameworkIdentificator::VERSION
|
9
|
+
gem.authors = ["zedtux"]
|
10
|
+
gem.email = ["zedtux@zedroot.org"]
|
11
|
+
gem.description = %q{Identify the used framework of a given project.}
|
12
|
+
gem.summary = %q{This gem will identify the framework of a given project based on existing files and path.}
|
13
|
+
gem.homepage = "https://github.com/zedtux/framework_identificator"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Frameworks
|
2
|
+
class Rails
|
3
|
+
attr_accessor :source
|
4
|
+
def self.recognized?(source)
|
5
|
+
@source = source.is_a?(Git::Base) ? source.dir.path : source
|
6
|
+
|
7
|
+
self.recognize_a_rails_project? ? self.new : nil
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def self.recognize_a_rails_project?
|
13
|
+
self.have_valid_script_folder? &&
|
14
|
+
self.have_valid_app_folder? &&
|
15
|
+
self.have_valid_config_folder? &&
|
16
|
+
self.have_rakefile?
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.have_valid_script_folder?
|
20
|
+
File.exists?(File.join(@source, "script", "rails"))
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.have_valid_app_folder?
|
24
|
+
File.exists?(File.join(@source, "app", "controllers"))
|
25
|
+
File.exists?(File.join(@source, "app", "models"))
|
26
|
+
File.exists?(File.join(@source, "app", "views"))
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.have_valid_config_folder?
|
30
|
+
File.exists?(File.join(@source, "config", "environments"))
|
31
|
+
File.exists?(File.join(@source, "config", "environments", "development.rb"))
|
32
|
+
File.exists?(File.join(@source, "config", "application.rb"))
|
33
|
+
File.exists?(File.join(@source, "config", "boot.rb"))
|
34
|
+
File.exists?(File.join(@source, "config", "environment.rb"))
|
35
|
+
File.exists?(File.join(@source, "config", "routes.rb"))
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.have_rakefile?
|
39
|
+
File.exists?(File.join(@source, "Rakefile"))
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require "framework_identificator/version"
|
2
|
+
require "framework_identificator/frameworks/rails"
|
3
|
+
|
4
|
+
module FrameworkIdentificator
|
5
|
+
def self.from(source)
|
6
|
+
raise ArgumentError unless source.is_a?(Pathname) || source.is_a?(Git::Base)
|
7
|
+
|
8
|
+
[Frameworks::Rails].detect do |framework|
|
9
|
+
framework.recognized?(source)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,334 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe FrameworkIdentificator do
|
4
|
+
|
5
|
+
describe "#from" do
|
6
|
+
describe "with a nil" do
|
7
|
+
it "should raise an ArgumentError" do
|
8
|
+
lambda {
|
9
|
+
subject.from
|
10
|
+
}.should raise_error(ArgumentError)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
describe "with an empty string" do
|
14
|
+
it "should raise an ArgumentError" do
|
15
|
+
lambda {
|
16
|
+
subject.from("")
|
17
|
+
}.should raise_error(ArgumentError)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
describe "with a Pathname object" do
|
21
|
+
before { @repository_path = Pathname.new(File.join("projects", "my_rails_project")) }
|
22
|
+
describe "for a Rails framework" do
|
23
|
+
describe "with script/rails" do
|
24
|
+
before { Frameworks::Rails.stub(:have_valid_script_folder?).and_return(true) }
|
25
|
+
describe "with valid app/ folder" do
|
26
|
+
before { Frameworks::Rails.stub(:have_valid_app_folder?).and_return(true) }
|
27
|
+
describe "with valid config/ folder" do
|
28
|
+
before { Frameworks::Rails.stub(:have_valid_config_folder?).and_return(true) }
|
29
|
+
describe "with a Rakefile" do
|
30
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
31
|
+
it "should return not return a nil" do
|
32
|
+
framework = subject.from(@repository_path)
|
33
|
+
framework.should_not be_nil
|
34
|
+
end
|
35
|
+
it "should return an instance of Frameworks::Rails" do
|
36
|
+
framework = subject.from(@repository_path)
|
37
|
+
framework.should be Frameworks::Rails
|
38
|
+
end
|
39
|
+
end
|
40
|
+
describe "without Rakefile" do
|
41
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
42
|
+
it "should return false" do
|
43
|
+
subject.from(@repository_path).should be_false
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
describe "without valid config/ folder" do
|
48
|
+
before { Frameworks::Rails.stub(:have_valid_config_folder?).and_return(false) }
|
49
|
+
describe "with a Rakefile" do
|
50
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
51
|
+
it "should return false" do
|
52
|
+
subject.from(@repository_path).should be_false
|
53
|
+
end
|
54
|
+
end
|
55
|
+
describe "without Rakefile" do
|
56
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
57
|
+
it "should return false" do
|
58
|
+
subject.from(@repository_path).should be_false
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
describe "without valid app/ folder" do
|
64
|
+
before { Frameworks::Rails.stub(:have_valid_app_folder?).and_return(false) }
|
65
|
+
describe "with valid config/ folder" do
|
66
|
+
before { Frameworks::Rails.stub(:have_valid_config_folder?).and_return(true) }
|
67
|
+
describe "with a Rakefile" do
|
68
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
69
|
+
it "should return false" do
|
70
|
+
subject.from(@repository_path).should be_false
|
71
|
+
end
|
72
|
+
end
|
73
|
+
describe "without Rakefile" do
|
74
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
75
|
+
it "should return false" do
|
76
|
+
subject.from(@repository_path).should be_false
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
describe "without valid config/ folder" do
|
81
|
+
before { Frameworks::Rails.stub(:have_valid_config_folder?).and_return(false) }
|
82
|
+
describe "with a Rakefile" do
|
83
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
84
|
+
it "should return false" do
|
85
|
+
subject.from(@repository_path).should be_false
|
86
|
+
end
|
87
|
+
end
|
88
|
+
describe "without Rakefile" do
|
89
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
90
|
+
it "should return false" do
|
91
|
+
subject.from(@repository_path).should be_false
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
describe "with script/rails" do
|
98
|
+
before { Frameworks::Rails.stub(:have_valid_script_folder?).and_return(false) }
|
99
|
+
describe "with valid app/ folder" do
|
100
|
+
before { Frameworks::Rails.stub(:have_valid_app_folder?).and_return(true) }
|
101
|
+
describe "with valid config/ folder" do
|
102
|
+
before { Frameworks::Rails.stub(:have_valid_config_folder?).and_return(true) }
|
103
|
+
describe "with a Rakefile" do
|
104
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
105
|
+
it "should return false" do
|
106
|
+
subject.from(@repository_path).should be_false
|
107
|
+
end
|
108
|
+
end
|
109
|
+
describe "without Rakefile" do
|
110
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
111
|
+
it "should return false" do
|
112
|
+
subject.from(@repository_path).should be_false
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
describe "without valid config/ folder" do
|
117
|
+
before { Frameworks::Rails.stub(:have_valid_config_folder?).and_return(false) }
|
118
|
+
describe "with a Rakefile" do
|
119
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
120
|
+
it "should return false" do
|
121
|
+
subject.from(@repository_path).should be_false
|
122
|
+
end
|
123
|
+
end
|
124
|
+
describe "without Rakefile" do
|
125
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
126
|
+
it "should return false" do
|
127
|
+
subject.from(@repository_path).should be_false
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
describe "without valid app/ folder" do
|
133
|
+
before { Frameworks::Rails.stub(:have_valid_app_folder?).and_return(false) }
|
134
|
+
describe "with valid config/ folder" do
|
135
|
+
before { Frameworks::Rails.stub(:have_valid_config_folder?).and_return(true) }
|
136
|
+
describe "with a Rakefile" do
|
137
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
138
|
+
it "should return false" do
|
139
|
+
subject.from(@repository_path).should be_false
|
140
|
+
end
|
141
|
+
end
|
142
|
+
describe "without Rakefile" do
|
143
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
144
|
+
it "should return false" do
|
145
|
+
subject.from(@repository_path).should be_false
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
describe "without valid config/ folder" do
|
150
|
+
before { Frameworks::Rails.stub(:have_valid_config_folder?).and_return(false) }
|
151
|
+
describe "with a Rakefile" do
|
152
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
153
|
+
it "should return false" do
|
154
|
+
subject.from(@repository_path).should be_false
|
155
|
+
end
|
156
|
+
end
|
157
|
+
describe "without Rakefile" do
|
158
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
159
|
+
it "should return false" do
|
160
|
+
subject.from(@repository_path).should be_false
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
describe "for a basic folders/files project" do
|
168
|
+
before { @basic_folders_and_files_path = Pathname.new(File.join("spec", "fixtures", "basic_folders_and_files")) }
|
169
|
+
it "should return false" do
|
170
|
+
subject.from(@basic_folders_and_files_path).should be_false
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
describe "with a Git object" do
|
175
|
+
before do
|
176
|
+
Git.stub!(:clone).and_return(Git::Base.new)
|
177
|
+
@git_repository = Git.clone("git://citask.it:citaskit", "Test.git")
|
178
|
+
@git_repository.stub_chain(:dir, :path).and_return(File.join("projects", "my_rails_project"))
|
179
|
+
end
|
180
|
+
describe "for a Rails framework" do
|
181
|
+
describe "with script/rails" do
|
182
|
+
before { Frameworks::Rails.stub(:have_valid_script_folder?).and_return(true) }
|
183
|
+
describe "with valid app/ folder" do
|
184
|
+
before { Frameworks::Rails.stub(:have_valid_app_folder?).and_return(true) }
|
185
|
+
describe "with valid config/ folder" do
|
186
|
+
before { Frameworks::Rails.stub(:have_valid_config_folder?).and_return(true) }
|
187
|
+
describe "with a Rakefile" do
|
188
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
189
|
+
it "should return not return a nil" do
|
190
|
+
framework = subject.from(@git_repository)
|
191
|
+
framework.should_not be_nil
|
192
|
+
end
|
193
|
+
it "should return an instance of Frameworks::Rails" do
|
194
|
+
framework = subject.from(@git_repository)
|
195
|
+
framework.should be Frameworks::Rails
|
196
|
+
end
|
197
|
+
end
|
198
|
+
describe "without Rakefile" do
|
199
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
200
|
+
it "should return false" do
|
201
|
+
subject.from(@git_repository).should be_false
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
describe "without valid config/ folder" do
|
206
|
+
before { Frameworks::Rails.stub(:have_valid_config_folder?).and_return(false) }
|
207
|
+
describe "with a Rakefile" do
|
208
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
209
|
+
it "should return false" do
|
210
|
+
subject.from(@git_repository).should be_false
|
211
|
+
end
|
212
|
+
end
|
213
|
+
describe "without Rakefile" do
|
214
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
215
|
+
it "should return false" do
|
216
|
+
subject.from(@git_repository).should be_false
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
describe "without valid app/ folder" do
|
222
|
+
before { Frameworks::Rails.stub(:have_valid_app_folder?).and_return(false) }
|
223
|
+
describe "with valid config/ folder" do
|
224
|
+
before { Frameworks::Rails.stub(:have_valid_config_folder?).and_return(true) }
|
225
|
+
describe "with a Rakefile" do
|
226
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
227
|
+
it "should return false" do
|
228
|
+
subject.from(@git_repository).should be_false
|
229
|
+
end
|
230
|
+
end
|
231
|
+
describe "without Rakefile" do
|
232
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
233
|
+
it "should return false" do
|
234
|
+
subject.from(@git_repository).should be_false
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
describe "without valid config/ folder" do
|
239
|
+
before { Frameworks::Rails.stub(:have_valid_config_folder?).and_return(false) }
|
240
|
+
describe "with a Rakefile" do
|
241
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
242
|
+
it "should return false" do
|
243
|
+
subject.from(@git_repository).should be_false
|
244
|
+
end
|
245
|
+
end
|
246
|
+
describe "without Rakefile" do
|
247
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
248
|
+
it "should return false" do
|
249
|
+
subject.from(@git_repository).should be_false
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
end
|
255
|
+
describe "with script/rails" do
|
256
|
+
before { Frameworks::Rails.stub(:have_valid_script_folder?).and_return(false) }
|
257
|
+
describe "with valid app/ folder" do
|
258
|
+
before { Frameworks::Rails.stub(:have_valid_app_folder?).and_return(true) }
|
259
|
+
describe "with valid config/ folder" do
|
260
|
+
before { Frameworks::Rails.stub(:have_valid_config_folder?).and_return(true) }
|
261
|
+
describe "with a Rakefile" do
|
262
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
263
|
+
it "should return false" do
|
264
|
+
subject.from(@git_repository).should be_false
|
265
|
+
end
|
266
|
+
end
|
267
|
+
describe "without Rakefile" do
|
268
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
269
|
+
it "should return false" do
|
270
|
+
subject.from(@git_repository).should be_false
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end
|
274
|
+
describe "without valid config/ folder" do
|
275
|
+
before { Frameworks::Rails.stub(:have_valid_config_folder?).and_return(false) }
|
276
|
+
describe "with a Rakefile" do
|
277
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
278
|
+
it "should return false" do
|
279
|
+
subject.from(@git_repository).should be_false
|
280
|
+
end
|
281
|
+
end
|
282
|
+
describe "without Rakefile" do
|
283
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
284
|
+
it "should return false" do
|
285
|
+
subject.from(@git_repository).should be_false
|
286
|
+
end
|
287
|
+
end
|
288
|
+
end
|
289
|
+
end
|
290
|
+
describe "without valid app/ folder" do
|
291
|
+
before { Frameworks::Rails.stub(:have_valid_app_folder?).and_return(false) }
|
292
|
+
describe "with valid config/ folder" do
|
293
|
+
before { Frameworks::Rails.stub(:have_valid_config_folder?).and_return(true) }
|
294
|
+
describe "with a Rakefile" do
|
295
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
296
|
+
it "should return false" do
|
297
|
+
subject.from(@git_repository).should be_false
|
298
|
+
end
|
299
|
+
end
|
300
|
+
describe "without Rakefile" do
|
301
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
302
|
+
it "should return false" do
|
303
|
+
subject.from(@git_repository).should be_false
|
304
|
+
end
|
305
|
+
end
|
306
|
+
end
|
307
|
+
describe "without valid config/ folder" do
|
308
|
+
before { Frameworks::Rails.stub(:have_valid_config_folder?).and_return(false) }
|
309
|
+
describe "with a Rakefile" do
|
310
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
311
|
+
it "should return false" do
|
312
|
+
subject.from(@git_repository).should be_false
|
313
|
+
end
|
314
|
+
end
|
315
|
+
describe "without Rakefile" do
|
316
|
+
before { Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
317
|
+
it "should return false" do
|
318
|
+
subject.from(@git_repository).should be_false
|
319
|
+
end
|
320
|
+
end
|
321
|
+
end
|
322
|
+
end
|
323
|
+
end
|
324
|
+
end
|
325
|
+
describe "for a basic folders/files project" do
|
326
|
+
before { @basic_folders_and_files_path = Pathname.new(File.join("spec", "fixtures", "basic_folders_and_files")) }
|
327
|
+
it "should return false" do
|
328
|
+
subject.from(@basic_folders_and_files_path).should be_false
|
329
|
+
end
|
330
|
+
end
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
if RUBY_VERSION[0, 3] == "1.9"
|
3
|
+
require "simplecov"
|
4
|
+
SimpleCov.start
|
5
|
+
end
|
6
|
+
|
7
|
+
require "rubygems"
|
8
|
+
require "bundler/setup"
|
9
|
+
|
10
|
+
# our gem
|
11
|
+
require "framework_identificator"
|
12
|
+
require "git"
|
13
|
+
|
14
|
+
RSpec.configure do |config|
|
15
|
+
|
16
|
+
end
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: framework_identificator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- zedtux
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-11-20 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Identify the used framework of a given project.
|
15
|
+
email:
|
16
|
+
- zedtux@zedroot.org
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- .gpairrc
|
23
|
+
- .rspec
|
24
|
+
- .rvmrc
|
25
|
+
- .travis.yml
|
26
|
+
- Gemfile
|
27
|
+
- LICENSE.txt
|
28
|
+
- README.md
|
29
|
+
- Rakefile
|
30
|
+
- framework_identificator.gemspec
|
31
|
+
- lib/framework_identificator.rb
|
32
|
+
- lib/framework_identificator/frameworks/rails.rb
|
33
|
+
- lib/framework_identificator/version.rb
|
34
|
+
- spec/fixtures/basic_folders_and_files/backup/main.sh
|
35
|
+
- spec/fixtures/basic_folders_and_files/main.sh
|
36
|
+
- spec/framework_identificator_spec.rb
|
37
|
+
- spec/spec_helper.rb
|
38
|
+
- spec/support/webmocks.rb
|
39
|
+
homepage: https://github.com/zedtux/framework_identificator
|
40
|
+
licenses: []
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - ! '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
segments:
|
52
|
+
- 0
|
53
|
+
hash: 4491665536790450036
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
segments:
|
61
|
+
- 0
|
62
|
+
hash: 4491665536790450036
|
63
|
+
requirements: []
|
64
|
+
rubyforge_project:
|
65
|
+
rubygems_version: 1.8.24
|
66
|
+
signing_key:
|
67
|
+
specification_version: 3
|
68
|
+
summary: This gem will identify the framework of a given project based on existing
|
69
|
+
files and path.
|
70
|
+
test_files:
|
71
|
+
- spec/fixtures/basic_folders_and_files/backup/main.sh
|
72
|
+
- spec/fixtures/basic_folders_and_files/main.sh
|
73
|
+
- spec/framework_identificator_spec.rb
|
74
|
+
- spec/spec_helper.rb
|
75
|
+
- spec/support/webmocks.rb
|