framework_identificator 1.3.0 → 1.4.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/.rspec +0 -1
- data/lib/framework_identificator/{frameworks → application_frameworks}/rails.rb +1 -1
- data/lib/framework_identificator/application_frameworks.rb +5 -0
- data/lib/framework_identificator/framework.rb +28 -0
- data/lib/framework_identificator/testing_frameworks/rspec.rb +27 -0
- data/lib/framework_identificator/testing_frameworks.rb +5 -0
- data/lib/framework_identificator/version.rb +1 -1
- data/lib/framework_identificator.rb +13 -4
- data/spec/framework_identificator/application_frameworks/rails_spec.rb +185 -0
- data/spec/framework_identificator/application_frameworks_spec.rb +11 -0
- data/spec/framework_identificator/testing_frameworks/rspec_spec.rb +40 -0
- data/spec/framework_identificator/testing_frameworks_spec.rb +11 -0
- data/spec/framework_identificator_spec.rb +2 -322
- metadata +17 -10
- data/lib/framework_identificator/frameworks.rb +0 -13
- data/spec/framework_identificator/frameworks/rails_spec.rb +0 -23
- data/spec/framework_identificator/frameworks_spec.rb +0 -11
data/.rspec
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
module FrameworkIdentificator
|
2
|
+
module Framework
|
3
|
+
module ClassMethods
|
4
|
+
def son_name
|
5
|
+
@son_name
|
6
|
+
end
|
7
|
+
def son_name=(name)
|
8
|
+
@son_name = name
|
9
|
+
end
|
10
|
+
|
11
|
+
# Collect and return classes representing testing frameworks implemented into the FrameworkIdentificator::TestingFrameworks module
|
12
|
+
def available
|
13
|
+
son = eval("FrameworkIdentificator::#{son_name}")
|
14
|
+
son.constants.select{|klass|
|
15
|
+
son.const_get(klass).is_a?(Class)
|
16
|
+
}.collect{|klass_sym|
|
17
|
+
eval("FrameworkIdentificator::#{son_name}::#{klass_sym.to_s}")
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
extend ClassMethods
|
22
|
+
|
23
|
+
def self.included(including)
|
24
|
+
including.extend(ClassMethods)
|
25
|
+
including.son_name = including.name.split("::").last
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module FrameworkIdentificator
|
2
|
+
module TestingFrameworks
|
3
|
+
class Rspec
|
4
|
+
# ~~~~ Attributes ~~~~
|
5
|
+
attr_accessor :source
|
6
|
+
|
7
|
+
# ~~~~ Class Methods ~~~~
|
8
|
+
def self.recognized?(source)
|
9
|
+
@source = source
|
10
|
+
|
11
|
+
self.has_spec_spec_helper_file?
|
12
|
+
end
|
13
|
+
|
14
|
+
# ~~~~ Instance Methods ~~~~
|
15
|
+
def initialize(*source)
|
16
|
+
# Nothing do initialize for now
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def self.has_spec_spec_helper_file?
|
22
|
+
File.exists?(File.join(@source, "spec", "spec_helper.rb"))
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -1,18 +1,27 @@
|
|
1
1
|
require "framework_identificator/version"
|
2
|
-
require "framework_identificator/
|
2
|
+
require "framework_identificator/framework"
|
3
|
+
require "framework_identificator/application_frameworks"
|
4
|
+
require "framework_identificator/testing_frameworks"
|
3
5
|
|
4
6
|
# Load all frameworks
|
5
|
-
|
7
|
+
["application_frameworks", "testing_frameworks"].each do |frameworks|
|
8
|
+
Dir[File.join(File.dirname(__FILE__), "framework_identificator", frameworks, "*.rb")].each{|file| require file}
|
9
|
+
end
|
6
10
|
|
7
11
|
module FrameworkIdentificator
|
8
|
-
def self.from(source)
|
12
|
+
def self.from(source, type)
|
9
13
|
raise ArgumentError unless source.class.name == "Pathname" || source.class.name == "Git::Base"
|
10
14
|
|
11
15
|
# Use source itself if Pathname otherwise fetch the Git dir path
|
12
16
|
source = source.class.name == "Git::Base" ? source.dir.path : source
|
13
17
|
|
14
18
|
# Try to detect a Framework using the source
|
15
|
-
|
19
|
+
case type
|
20
|
+
when :application
|
21
|
+
FrameworkIdentificator::ApplicationFrameworks
|
22
|
+
when :testing
|
23
|
+
FrameworkIdentificator::TestingFrameworks
|
24
|
+
end.available.detect do |framework|
|
16
25
|
return framework.new(source) if framework.recognized?(source)
|
17
26
|
end
|
18
27
|
end
|
@@ -0,0 +1,185 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe FrameworkIdentificator::ApplicationFrameworks::Rails do
|
4
|
+
|
5
|
+
describe "Attributes" do
|
6
|
+
it "should have an attribute :source" do
|
7
|
+
subject.should respond_to(:source)
|
8
|
+
subject.should respond_to(:source=)
|
9
|
+
end
|
10
|
+
it "should have an attribute :routes_path" do
|
11
|
+
subject.should respond_to(:routes_path)
|
12
|
+
subject.should respond_to(:routes_path=)
|
13
|
+
end
|
14
|
+
it "should have an attribute :project_name" do
|
15
|
+
subject.should respond_to(:project_name)
|
16
|
+
subject.should respond_to(:project_name=)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "Class Methods" do
|
21
|
+
describe "ApplicationFrameworks" do
|
22
|
+
before { @repository_path = Pathname.new(File.join("projects", "my_rails_project")) }
|
23
|
+
describe "for a Rails framework" do
|
24
|
+
context "with script/rails" do
|
25
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_valid_rails_3_script_folder?).and_return(true) }
|
26
|
+
context "with valid app/ folder" do
|
27
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_valid_app_folder?).and_return(true) }
|
28
|
+
context "with valid config/ folder" do
|
29
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_valid_config_folder?).and_return(true) }
|
30
|
+
context "with a Rakefile" do
|
31
|
+
before do
|
32
|
+
FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_rakefile?).and_return(true)
|
33
|
+
FrameworkIdentificator::ApplicationFrameworks::Rails.any_instance.stub(:parse_source).and_return(true)
|
34
|
+
@framework = FrameworkIdentificator.from(@repository_path, :application)
|
35
|
+
end
|
36
|
+
it "should return not return a nil" do
|
37
|
+
@framework.should_not be_nil
|
38
|
+
end
|
39
|
+
it "should return an instance of ApplicationFrameworks::Rails" do
|
40
|
+
@framework.class.should be FrameworkIdentificator::ApplicationFrameworks::Rails
|
41
|
+
end
|
42
|
+
describe "instance" do
|
43
|
+
describe "project_name" do
|
44
|
+
before { @framework.stub(:project_name).and_return("MyRailsProject") }
|
45
|
+
it "should respond to project_name" do
|
46
|
+
@framework.should respond_to(:project_name)
|
47
|
+
end
|
48
|
+
context "with a project name \"MyRailsProject\"" do
|
49
|
+
it "should return the \"MyRailsProject\"" do
|
50
|
+
@framework.project_name.should == "MyRailsProject"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
context "without Rakefile" do
|
57
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
58
|
+
it "should return false" do
|
59
|
+
FrameworkIdentificator.from(@repository_path, :application).should be_false
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
context "without valid config/ folder" do
|
64
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_valid_config_folder?).and_return(false) }
|
65
|
+
context "with a Rakefile" do
|
66
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
67
|
+
it "should return false" do
|
68
|
+
FrameworkIdentificator.from(@repository_path, :application).should be_false
|
69
|
+
end
|
70
|
+
end
|
71
|
+
context "without Rakefile" do
|
72
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
73
|
+
it "should return false" do
|
74
|
+
FrameworkIdentificator.from(@repository_path, :application).should be_false
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
context "without valid app/ folder" do
|
80
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_valid_app_folder?).and_return(false) }
|
81
|
+
context "with valid config/ folder" do
|
82
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_valid_config_folder?).and_return(true) }
|
83
|
+
context "with a Rakefile" do
|
84
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
85
|
+
it "should return false" do
|
86
|
+
FrameworkIdentificator.from(@repository_path, :application).should be_false
|
87
|
+
end
|
88
|
+
end
|
89
|
+
context "without Rakefile" do
|
90
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
91
|
+
it "should return false" do
|
92
|
+
FrameworkIdentificator.from(@repository_path, :application).should be_false
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
context "without valid config/ folder" do
|
97
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_valid_config_folder?).and_return(false) }
|
98
|
+
context "with a Rakefile" do
|
99
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
100
|
+
it "should return false" do
|
101
|
+
FrameworkIdentificator.from(@repository_path, :application).should be_false
|
102
|
+
end
|
103
|
+
end
|
104
|
+
context "without Rakefile" do
|
105
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
106
|
+
it "should return false" do
|
107
|
+
FrameworkIdentificator.from(@repository_path, :application).should be_false
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
context "with script/rails" do
|
114
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_valid_script_folder?).and_return(false) }
|
115
|
+
context "with valid app/ folder" do
|
116
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_valid_app_folder?).and_return(true) }
|
117
|
+
context "with valid config/ folder" do
|
118
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_valid_config_folder?).and_return(true) }
|
119
|
+
context "with a Rakefile" do
|
120
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
121
|
+
it "should return false" do
|
122
|
+
FrameworkIdentificator.from(@repository_path, :application).should be_false
|
123
|
+
end
|
124
|
+
end
|
125
|
+
context "without Rakefile" do
|
126
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
127
|
+
it "should return false" do
|
128
|
+
FrameworkIdentificator.from(@repository_path, :application).should be_false
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
context "without valid config/ folder" do
|
133
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_valid_config_folder?).and_return(false) }
|
134
|
+
context "with a Rakefile" do
|
135
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
136
|
+
it "should return false" do
|
137
|
+
FrameworkIdentificator.from(@repository_path, :application).should be_false
|
138
|
+
end
|
139
|
+
end
|
140
|
+
context "without Rakefile" do
|
141
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
142
|
+
it "should return false" do
|
143
|
+
FrameworkIdentificator.from(@repository_path, :application).should be_false
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
context "without valid app/ folder" do
|
149
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_valid_app_folder?).and_return(false) }
|
150
|
+
context "with valid config/ folder" do
|
151
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_valid_config_folder?).and_return(true) }
|
152
|
+
context "with a Rakefile" do
|
153
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
154
|
+
it "should return false" do
|
155
|
+
FrameworkIdentificator.from(@repository_path, :application).should be_false
|
156
|
+
end
|
157
|
+
end
|
158
|
+
context "without Rakefile" do
|
159
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
160
|
+
it "should return false" do
|
161
|
+
FrameworkIdentificator.from(@repository_path, :application).should be_false
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
context "without valid config/ folder" do
|
166
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_valid_config_folder?).and_return(false) }
|
167
|
+
context "with a Rakefile" do
|
168
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
169
|
+
it "should return false" do
|
170
|
+
FrameworkIdentificator.from(@repository_path, :application).should be_false
|
171
|
+
end
|
172
|
+
end
|
173
|
+
context "without Rakefile" do
|
174
|
+
before { FrameworkIdentificator::ApplicationFrameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
175
|
+
it "should return false" do
|
176
|
+
FrameworkIdentificator.from(@repository_path, :application).should be_false
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe FrameworkIdentificator::ApplicationFrameworks do
|
4
|
+
|
5
|
+
describe "#available" do
|
6
|
+
it "should return an array with FrameworkIdentificator::ApplicationFrameworks::Rails" do
|
7
|
+
subject.available.should == [FrameworkIdentificator::ApplicationFrameworks::Rails]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe FrameworkIdentificator::TestingFrameworks::Rspec do
|
4
|
+
|
5
|
+
describe "Attributes" do
|
6
|
+
it "should have an attribute :source" do
|
7
|
+
subject.should respond_to(:source)
|
8
|
+
subject.should respond_to(:source=)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "Class Methods" do
|
13
|
+
describe "TestingFrameworks" do
|
14
|
+
before { @repository_path = Pathname.new(File.join("projects", "my_rails_project")) }
|
15
|
+
describe "for Rspec framework" do
|
16
|
+
context "without spec/spec_helper.rb file" do
|
17
|
+
before do
|
18
|
+
FrameworkIdentificator::TestingFrameworks::Rspec.stub(:has_spec_spec_helper_file?).and_return(false)
|
19
|
+
@framework = FrameworkIdentificator.from(@repository_path, :testing)
|
20
|
+
end
|
21
|
+
it "should return return a nil" do
|
22
|
+
@framework.should be_nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
context "with spec/spec_helper.rb file" do
|
26
|
+
before do
|
27
|
+
FrameworkIdentificator::TestingFrameworks::Rspec.stub(:has_spec_spec_helper_file?).and_return(true)
|
28
|
+
@framework = FrameworkIdentificator.from(@repository_path, :testing)
|
29
|
+
end
|
30
|
+
it "should return not return a nil" do
|
31
|
+
@framework.should_not be_nil
|
32
|
+
end
|
33
|
+
it "should return an instance of ApplicationFrameworks::Rspec" do
|
34
|
+
@framework.class.should be FrameworkIdentificator::TestingFrameworks::Rspec
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe FrameworkIdentificator::TestingFrameworks do
|
4
|
+
|
5
|
+
describe "#available" do
|
6
|
+
it "should return an array with FrameworkIdentificator::ApplicationFrameworks::Rspec" do
|
7
|
+
subject.available.should == [FrameworkIdentificator::TestingFrameworks::Rspec]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
@@ -19,170 +19,10 @@ describe FrameworkIdentificator do
|
|
19
19
|
end
|
20
20
|
describe "with a Pathname object" do
|
21
21
|
before { @repository_path = Pathname.new(File.join("projects", "my_rails_project")) }
|
22
|
-
describe "for a Rails framework" do
|
23
|
-
context "with script/rails" do
|
24
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_rails_3_script_folder?).and_return(true) }
|
25
|
-
context "with valid app/ folder" do
|
26
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_app_folder?).and_return(true) }
|
27
|
-
context "with valid config/ folder" do
|
28
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_config_folder?).and_return(true) }
|
29
|
-
context "with a Rakefile" do
|
30
|
-
before do
|
31
|
-
FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(true)
|
32
|
-
FrameworkIdentificator::Frameworks::Rails.any_instance.stub(:parse_source).and_return(true)
|
33
|
-
@framework = subject.from(@repository_path)
|
34
|
-
end
|
35
|
-
it "should return not return a nil" do
|
36
|
-
@framework.should_not be_nil
|
37
|
-
end
|
38
|
-
it "should return an instance of Frameworks::Rails" do
|
39
|
-
@framework.class.should be FrameworkIdentificator::Frameworks::Rails
|
40
|
-
end
|
41
|
-
describe "instance" do
|
42
|
-
describe "project_name" do
|
43
|
-
before { @framework.stub(:project_name).and_return("MyRailsProject") }
|
44
|
-
it "should respond to project_name" do
|
45
|
-
@framework.should respond_to(:project_name)
|
46
|
-
end
|
47
|
-
context "with a project name \"MyRailsProject\"" do
|
48
|
-
it "should return the \"MyRailsProject\"" do
|
49
|
-
@framework.project_name.should == "MyRailsProject"
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
context "without Rakefile" do
|
56
|
-
before { FrameworkIdentificator::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
|
-
context "without valid config/ folder" do
|
63
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_config_folder?).and_return(false) }
|
64
|
-
context "with a Rakefile" do
|
65
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
66
|
-
it "should return false" do
|
67
|
-
subject.from(@repository_path).should be_false
|
68
|
-
end
|
69
|
-
end
|
70
|
-
context "without Rakefile" do
|
71
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
72
|
-
it "should return false" do
|
73
|
-
subject.from(@repository_path).should be_false
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
context "without valid app/ folder" do
|
79
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_app_folder?).and_return(false) }
|
80
|
-
context "with valid config/ folder" do
|
81
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_config_folder?).and_return(true) }
|
82
|
-
context "with a Rakefile" do
|
83
|
-
before { FrameworkIdentificator::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
|
-
context "without Rakefile" do
|
89
|
-
before { FrameworkIdentificator::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
|
-
context "without valid config/ folder" do
|
96
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_config_folder?).and_return(false) }
|
97
|
-
context "with a Rakefile" do
|
98
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
99
|
-
it "should return false" do
|
100
|
-
subject.from(@repository_path).should be_false
|
101
|
-
end
|
102
|
-
end
|
103
|
-
context "without Rakefile" do
|
104
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
105
|
-
it "should return false" do
|
106
|
-
subject.from(@repository_path).should be_false
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
context "with script/rails" do
|
113
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_script_folder?).and_return(false) }
|
114
|
-
context "with valid app/ folder" do
|
115
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_app_folder?).and_return(true) }
|
116
|
-
context "with valid config/ folder" do
|
117
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_config_folder?).and_return(true) }
|
118
|
-
context "with a Rakefile" do
|
119
|
-
before { FrameworkIdentificator::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
|
-
context "without Rakefile" do
|
125
|
-
before { FrameworkIdentificator::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
|
-
context "without valid config/ folder" do
|
132
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_config_folder?).and_return(false) }
|
133
|
-
context "with a Rakefile" do
|
134
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
135
|
-
it "should return false" do
|
136
|
-
subject.from(@repository_path).should be_false
|
137
|
-
end
|
138
|
-
end
|
139
|
-
context "without Rakefile" do
|
140
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
141
|
-
it "should return false" do
|
142
|
-
subject.from(@repository_path).should be_false
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
context "without valid app/ folder" do
|
148
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_app_folder?).and_return(false) }
|
149
|
-
context "with valid config/ folder" do
|
150
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_config_folder?).and_return(true) }
|
151
|
-
context "with a Rakefile" do
|
152
|
-
before { FrameworkIdentificator::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
|
-
context "without Rakefile" do
|
158
|
-
before { FrameworkIdentificator::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
|
-
context "without valid config/ folder" do
|
165
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_config_folder?).and_return(false) }
|
166
|
-
context "with a Rakefile" do
|
167
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
168
|
-
it "should return false" do
|
169
|
-
subject.from(@repository_path).should be_false
|
170
|
-
end
|
171
|
-
end
|
172
|
-
context "without Rakefile" do
|
173
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
174
|
-
it "should return false" do
|
175
|
-
subject.from(@repository_path).should be_false
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|
182
22
|
describe "for a basic folders/files project" do
|
183
23
|
before { @basic_folders_and_files_path = Pathname.new(File.join("spec", "fixtures", "basic_folders_and_files")) }
|
184
24
|
it "should return false" do
|
185
|
-
subject.from(@basic_folders_and_files_path).should be_false
|
25
|
+
subject.from(@basic_folders_and_files_path, :application).should be_false
|
186
26
|
end
|
187
27
|
end
|
188
28
|
end
|
@@ -192,170 +32,10 @@ describe FrameworkIdentificator do
|
|
192
32
|
@git_repository = Git.clone("git://citask.it:citaskit", "Test.git")
|
193
33
|
@git_repository.stub_chain(:dir, :path).and_return(File.join("projects", "my_rails_project"))
|
194
34
|
end
|
195
|
-
describe "for a Rails framework" do
|
196
|
-
context "with script/ folder" do
|
197
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_rails_3_script_folder?).and_return(true) }
|
198
|
-
context "with valid app/ folder" do
|
199
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_app_folder?).and_return(true) }
|
200
|
-
context "with valid config/ folder" do
|
201
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_config_folder?).and_return(true) }
|
202
|
-
context "with a Rakefile" do
|
203
|
-
before do
|
204
|
-
FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(true)
|
205
|
-
FrameworkIdentificator::Frameworks::Rails.any_instance.stub(:parse_source).and_return(true)
|
206
|
-
@framework = subject.from(@git_repository)
|
207
|
-
end
|
208
|
-
it "should return not return a nil" do
|
209
|
-
@framework.should_not be_nil
|
210
|
-
end
|
211
|
-
it "should return an instance of Frameworks::Rails" do
|
212
|
-
@framework.class.should be FrameworkIdentificator::Frameworks::Rails
|
213
|
-
end
|
214
|
-
describe "instance" do
|
215
|
-
it "should respond to project_name" do
|
216
|
-
@framework.should respond_to(:project_name)
|
217
|
-
end
|
218
|
-
describe "project_name" do
|
219
|
-
context "with a project name \"MyRailsProject\"" do
|
220
|
-
before { @framework.stub(:project_name).and_return("MyRailsProject") }
|
221
|
-
it "should return the \"MyRailsProject\"" do
|
222
|
-
@framework.project_name.should == "MyRailsProject"
|
223
|
-
end
|
224
|
-
end
|
225
|
-
end
|
226
|
-
end
|
227
|
-
end
|
228
|
-
context "without Rakefile" do
|
229
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
230
|
-
it "should return false" do
|
231
|
-
subject.from(@git_repository).should be_false
|
232
|
-
end
|
233
|
-
end
|
234
|
-
end
|
235
|
-
context "without valid config/ folder" do
|
236
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_config_folder?).and_return(false) }
|
237
|
-
context "with a Rakefile" do
|
238
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
239
|
-
it "should return false" do
|
240
|
-
subject.from(@git_repository).should be_false
|
241
|
-
end
|
242
|
-
end
|
243
|
-
context "without Rakefile" do
|
244
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
245
|
-
it "should return false" do
|
246
|
-
subject.from(@git_repository).should be_false
|
247
|
-
end
|
248
|
-
end
|
249
|
-
end
|
250
|
-
end
|
251
|
-
context "without valid app/ folder" do
|
252
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_app_folder?).and_return(false) }
|
253
|
-
context "with valid config/ folder" do
|
254
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_config_folder?).and_return(true) }
|
255
|
-
context "with a Rakefile" do
|
256
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
257
|
-
it "should return false" do
|
258
|
-
subject.from(@git_repository).should be_false
|
259
|
-
end
|
260
|
-
end
|
261
|
-
context "without Rakefile" do
|
262
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
263
|
-
it "should return false" do
|
264
|
-
subject.from(@git_repository).should be_false
|
265
|
-
end
|
266
|
-
end
|
267
|
-
end
|
268
|
-
context "without valid config/ folder" do
|
269
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_config_folder?).and_return(false) }
|
270
|
-
context "with a Rakefile" do
|
271
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
272
|
-
it "should return false" do
|
273
|
-
subject.from(@git_repository).should be_false
|
274
|
-
end
|
275
|
-
end
|
276
|
-
context "without Rakefile" do
|
277
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
278
|
-
it "should return false" do
|
279
|
-
subject.from(@git_repository).should be_false
|
280
|
-
end
|
281
|
-
end
|
282
|
-
end
|
283
|
-
end
|
284
|
-
end
|
285
|
-
context "with script/rails" do
|
286
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_script_folder?).and_return(false) }
|
287
|
-
context "with valid app/ folder" do
|
288
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_app_folder?).and_return(true) }
|
289
|
-
context "with valid config/ folder" do
|
290
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_config_folder?).and_return(true) }
|
291
|
-
context "with a Rakefile" do
|
292
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
293
|
-
it "should return false" do
|
294
|
-
subject.from(@git_repository).should be_false
|
295
|
-
end
|
296
|
-
end
|
297
|
-
context "without Rakefile" do
|
298
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
299
|
-
it "should return false" do
|
300
|
-
subject.from(@git_repository).should be_false
|
301
|
-
end
|
302
|
-
end
|
303
|
-
end
|
304
|
-
context "without valid config/ folder" do
|
305
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_config_folder?).and_return(false) }
|
306
|
-
context "with a Rakefile" do
|
307
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
308
|
-
it "should return false" do
|
309
|
-
subject.from(@git_repository).should be_false
|
310
|
-
end
|
311
|
-
end
|
312
|
-
context "without Rakefile" do
|
313
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
314
|
-
it "should return false" do
|
315
|
-
subject.from(@git_repository).should be_false
|
316
|
-
end
|
317
|
-
end
|
318
|
-
end
|
319
|
-
end
|
320
|
-
context "without valid app/ folder" do
|
321
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_app_folder?).and_return(false) }
|
322
|
-
context "with valid config/ folder" do
|
323
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_config_folder?).and_return(true) }
|
324
|
-
context "with a Rakefile" do
|
325
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
326
|
-
it "should return false" do
|
327
|
-
subject.from(@git_repository).should be_false
|
328
|
-
end
|
329
|
-
end
|
330
|
-
context "without Rakefile" do
|
331
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
332
|
-
it "should return false" do
|
333
|
-
subject.from(@git_repository).should be_false
|
334
|
-
end
|
335
|
-
end
|
336
|
-
end
|
337
|
-
context "without valid config/ folder" do
|
338
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_valid_config_folder?).and_return(false) }
|
339
|
-
context "with a Rakefile" do
|
340
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(true) }
|
341
|
-
it "should return false" do
|
342
|
-
subject.from(@git_repository).should be_false
|
343
|
-
end
|
344
|
-
end
|
345
|
-
context "without Rakefile" do
|
346
|
-
before { FrameworkIdentificator::Frameworks::Rails.stub(:have_rakefile?).and_return(false) }
|
347
|
-
it "should return false" do
|
348
|
-
subject.from(@git_repository).should be_false
|
349
|
-
end
|
350
|
-
end
|
351
|
-
end
|
352
|
-
end
|
353
|
-
end
|
354
|
-
end
|
355
35
|
describe "for a basic folders/files project" do
|
356
36
|
before { @basic_folders_and_files_path = Pathname.new(File.join("spec", "fixtures", "basic_folders_and_files")) }
|
357
37
|
it "should return false" do
|
358
|
-
subject.from(@basic_folders_and_files_path).should be_false
|
38
|
+
subject.from(@basic_folders_and_files_path, :application).should be_false
|
359
39
|
end
|
360
40
|
end
|
361
41
|
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.4.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-
|
12
|
+
date: 2012-12-23 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Identify the used framework of a given project.
|
15
15
|
email:
|
@@ -29,13 +29,18 @@ files:
|
|
29
29
|
- Rakefile
|
30
30
|
- framework_identificator.gemspec
|
31
31
|
- lib/framework_identificator.rb
|
32
|
-
- lib/framework_identificator/
|
33
|
-
- lib/framework_identificator/
|
32
|
+
- lib/framework_identificator/application_frameworks.rb
|
33
|
+
- lib/framework_identificator/application_frameworks/rails.rb
|
34
|
+
- lib/framework_identificator/framework.rb
|
35
|
+
- lib/framework_identificator/testing_frameworks.rb
|
36
|
+
- lib/framework_identificator/testing_frameworks/rspec.rb
|
34
37
|
- lib/framework_identificator/version.rb
|
35
38
|
- spec/fixtures/basic_folders_and_files/backup/main.sh
|
36
39
|
- spec/fixtures/basic_folders_and_files/main.sh
|
37
|
-
- spec/framework_identificator/
|
38
|
-
- spec/framework_identificator/
|
40
|
+
- spec/framework_identificator/application_frameworks/rails_spec.rb
|
41
|
+
- spec/framework_identificator/application_frameworks_spec.rb
|
42
|
+
- spec/framework_identificator/testing_frameworks/rspec_spec.rb
|
43
|
+
- spec/framework_identificator/testing_frameworks_spec.rb
|
39
44
|
- spec/framework_identificator_spec.rb
|
40
45
|
- spec/spec_helper.rb
|
41
46
|
homepage: https://github.com/zedtux/framework_identificator
|
@@ -52,7 +57,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
52
57
|
version: '0'
|
53
58
|
segments:
|
54
59
|
- 0
|
55
|
-
hash:
|
60
|
+
hash: -1570611119829215661
|
56
61
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
62
|
none: false
|
58
63
|
requirements:
|
@@ -61,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
66
|
version: '0'
|
62
67
|
segments:
|
63
68
|
- 0
|
64
|
-
hash:
|
69
|
+
hash: -1570611119829215661
|
65
70
|
requirements: []
|
66
71
|
rubyforge_project:
|
67
72
|
rubygems_version: 1.8.24
|
@@ -72,7 +77,9 @@ summary: This gem will identify the framework of a given project based on existi
|
|
72
77
|
test_files:
|
73
78
|
- spec/fixtures/basic_folders_and_files/backup/main.sh
|
74
79
|
- spec/fixtures/basic_folders_and_files/main.sh
|
75
|
-
- spec/framework_identificator/
|
76
|
-
- spec/framework_identificator/
|
80
|
+
- spec/framework_identificator/application_frameworks/rails_spec.rb
|
81
|
+
- spec/framework_identificator/application_frameworks_spec.rb
|
82
|
+
- spec/framework_identificator/testing_frameworks/rspec_spec.rb
|
83
|
+
- spec/framework_identificator/testing_frameworks_spec.rb
|
77
84
|
- spec/framework_identificator_spec.rb
|
78
85
|
- spec/spec_helper.rb
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module FrameworkIdentificator
|
2
|
-
module Frameworks
|
3
|
-
|
4
|
-
# Collect and return classes representing frameworks implemented into the FrameworkIdentificator::Frameworks module
|
5
|
-
def self.available
|
6
|
-
FrameworkIdentificator::Frameworks.constants.select{|klass|
|
7
|
-
FrameworkIdentificator::Frameworks.const_get(klass).is_a?(Class)
|
8
|
-
}.collect{|klass_sym|
|
9
|
-
eval("FrameworkIdentificator::Frameworks::#{klass_sym.to_s}")
|
10
|
-
}
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe FrameworkIdentificator::Frameworks::Rails do
|
4
|
-
|
5
|
-
describe "Attributes" do
|
6
|
-
it "should have an attribute :source" do
|
7
|
-
subject.should respond_to(:source)
|
8
|
-
subject.should respond_to(:source=)
|
9
|
-
end
|
10
|
-
it "should have an attribute :routes_path" do
|
11
|
-
subject.should respond_to(:routes_path)
|
12
|
-
subject.should respond_to(:routes_path=)
|
13
|
-
end
|
14
|
-
it "should have an attribute :project_name" do
|
15
|
-
subject.should respond_to(:project_name)
|
16
|
-
subject.should respond_to(:project_name=)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "Class Methods" do
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe FrameworkIdentificator::Frameworks do
|
4
|
-
|
5
|
-
describe "#available" do
|
6
|
-
it "should return an array with FrameworkIdentificator::Frameworks::Rails" do
|
7
|
-
subject.available.should == [FrameworkIdentificator::Frameworks::Rails]
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
end
|