framework_identificator 1.0.0 → 1.1.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
@@ -2,9 +2,9 @@ module Frameworks
|
|
2
2
|
class Rails
|
3
3
|
attr_accessor :source
|
4
4
|
def self.recognized?(source)
|
5
|
-
@source = source
|
5
|
+
@source = source
|
6
6
|
|
7
|
-
self.recognize_a_rails_project?
|
7
|
+
self.recognize_a_rails_project?
|
8
8
|
end
|
9
9
|
|
10
10
|
private
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Frameworks
|
2
|
+
|
3
|
+
# Collect and return classes representing frameworks implemented into the Frameworks module
|
4
|
+
def self.available
|
5
|
+
Frameworks.constants.select{|klass|
|
6
|
+
Frameworks.const_get(klass).is_a?(Class)
|
7
|
+
}.collect{|klass_sym|
|
8
|
+
eval("Frameworks::#{klass_sym.to_s}")
|
9
|
+
}
|
10
|
+
end
|
11
|
+
end
|
@@ -1,12 +1,17 @@
|
|
1
1
|
require "framework_identificator/version"
|
2
|
-
require "framework_identificator/frameworks
|
2
|
+
require "framework_identificator/frameworks"
|
3
|
+
|
4
|
+
# Load all frameworks
|
5
|
+
Dir[File.join(File.dirname(__FILE__), "framework_identificator", "frameworks", "*.rb")].each{|file| require file}
|
3
6
|
|
4
7
|
module FrameworkIdentificator
|
5
8
|
def self.from(source)
|
6
9
|
raise ArgumentError unless source.is_a?(Pathname) || source.is_a?(Git::Base)
|
7
10
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
+
# Use source itself if Pathname otherwise fetch the Git dir path
|
12
|
+
source = source.is_a?(Git::Base) ? source.dir.path : source
|
13
|
+
|
14
|
+
# Try to detect a Framework using the source
|
15
|
+
Frameworks.available.detect{|framework| framework.recognized?(source)}
|
11
16
|
end
|
12
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: framework_identificator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-21 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Identify the used framework of a given project.
|
15
15
|
email:
|
@@ -29,6 +29,7 @@ files:
|
|
29
29
|
- Rakefile
|
30
30
|
- framework_identificator.gemspec
|
31
31
|
- lib/framework_identificator.rb
|
32
|
+
- lib/framework_identificator/frameworks.rb
|
32
33
|
- lib/framework_identificator/frameworks/rails.rb
|
33
34
|
- lib/framework_identificator/version.rb
|
34
35
|
- spec/fixtures/basic_folders_and_files/backup/main.sh
|
@@ -48,18 +49,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
48
49
|
- - ! '>='
|
49
50
|
- !ruby/object:Gem::Version
|
50
51
|
version: '0'
|
51
|
-
segments:
|
52
|
-
- 0
|
53
|
-
hash: 4491665536790450036
|
54
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
53
|
none: false
|
56
54
|
requirements:
|
57
55
|
- - ! '>='
|
58
56
|
- !ruby/object:Gem::Version
|
59
57
|
version: '0'
|
60
|
-
segments:
|
61
|
-
- 0
|
62
|
-
hash: 4491665536790450036
|
63
58
|
requirements: []
|
64
59
|
rubyforge_project:
|
65
60
|
rubygems_version: 1.8.24
|