kalibro_client 0.5.0 → 1.0.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.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/features/metric_result/descendant_values.feature +1 -1
  4. data/features/metric_result/history_of.feature +1 -1
  5. data/features/metric_result/metric_results_of.feature +1 -1
  6. data/features/repository/all.feature +1 -2
  7. data/features/{processing/first_processing_of.feature → repository/processing/first_processing.feature} +2 -2
  8. data/features/{processing → repository/processing}/first_processing_after.feature +0 -0
  9. data/features/{processing → repository/processing}/has_processing.feature +0 -0
  10. data/features/{processing → repository/processing}/has_processing_after.feature +0 -0
  11. data/features/{processing → repository/processing}/has_processing_before.feature +0 -0
  12. data/features/{processing → repository/processing}/has_ready_processing.feature +0 -0
  13. data/features/{processing/last_processing_of.feature → repository/processing/last_processing.feature} +2 -2
  14. data/features/{processing → repository/processing}/last_processing_before.feature +0 -0
  15. data/features/{processing/last_processing_state_of.feature → repository/processing/last_processing_state.feature} +2 -2
  16. data/features/{processing/last_ready_processing_of.feature → repository/processing/last_ready_processing.feature} +2 -2
  17. data/features/{processing/processing_of.feature → repository/processing/processing.feature} +3 -3
  18. data/features/{processing/processing_with_date_of.feature → repository/processing/processing_with_date.feature} +3 -3
  19. data/features/step_definitions/metric_result_steps.rb +2 -2
  20. data/features/step_definitions/module_result_steps.rb +2 -2
  21. data/features/step_definitions/processing_steps.rb +26 -26
  22. data/features/step_definitions/repository_steps.rb +4 -6
  23. data/kalibro_client.gemspec +1 -1
  24. data/lib/kalibro_client/entities/miscellaneous/granularity.rb +31 -36
  25. data/lib/kalibro_client/entities/processor/metric_result.rb +0 -5
  26. data/lib/kalibro_client/entities/processor/processing.rb +0 -75
  27. data/lib/kalibro_client/entities/processor/repository.rb +9 -2
  28. data/lib/kalibro_client/version.rb +1 -1
  29. data/spec/entities/base_spec.rb +1 -1
  30. data/spec/entities/configurations/kalibro_configuration_spec.rb +1 -1
  31. data/spec/entities/configurations/kalibro_range_spec.rb +1 -1
  32. data/spec/entities/configurations/reading_group_spec.rb +1 -1
  33. data/spec/entities/miscellaneous/granularity_spec.rb +0 -20
  34. data/spec/entities/processor/metric_collector_details_spec.rb +2 -2
  35. data/spec/entities/processor/metric_result_spec.rb +0 -41
  36. data/spec/entities/processor/processing_spec.rb +0 -197
  37. data/spec/entities/processor/project_spec.rb +2 -2
  38. data/spec/entities/processor/repository_spec.rb +8 -3
  39. data/spec/factories/repositories.rb +1 -2
  40. metadata +29 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b40775ac3e5ba10762848b6572733224f37a152a
4
- data.tar.gz: 92263bcca84854b2fc945eed763cf8508fc4e5c2
3
+ metadata.gz: b71716183bdffd5a09ffdab9ff0f7807281f4983
4
+ data.tar.gz: 7485250e6703227bcef08cc18169bf38400920ac
5
5
  SHA512:
6
- metadata.gz: 31e14134d85a08877a3839550c8e97c8b8c73b390042b24c6068723bf5304af652d0a046bf3795458c00f15639a1b621bf0e74146b562f0b9944db23186af183
7
- data.tar.gz: bb36487be04498b65d0f4bd3007ca6e886e78f41ffb06995377af90f7a795fb174bb0dc86ddd92e400482be7dc1d359eca3a3d48a38e6bd304ad633662c6160a
6
+ metadata.gz: be9d54132f013e1995fad8f2697101fe31d59438872bf4c4247514811a534a7b94bbde4268c83d63c70e98bb7fbd2350b880255f5efde8f3992ad2a2f49adf75
7
+ data.tar.gz: f5d3e9a1091943f7831e10067a25aabb01fffaf352a43746c2073be36bba7c949eadd1a08d4dd70ed0bbfc0b50b3d6a8a7e4b55170e0459158e704da1ed2117c
data/.travis.yml CHANGED
@@ -6,7 +6,7 @@ addons:
6
6
  postgresql: "9.3"
7
7
 
8
8
  before_script:
9
- - git clone https://github.com/mezuro/kalibro_install.git -b v2.6 kalibro_install
9
+ - git clone https://github.com/mezuro/kalibro_install.git -b v2.5 kalibro_install
10
10
  - pushd kalibro_install
11
11
  # Remove bugged libzmq3 package, see https://github.com/travis-ci/travis-ci/issues/982 and https://github.com/travis-ci/travis-ci/issues/1715 for details
12
12
  - sudo apt-get remove libzmq3
@@ -14,6 +14,6 @@ Feature: Descendant values
14
14
  | Kalibro | GIT | https://github.com/rafamanzo/runge-kutta-vtk.git |
15
15
  And I call the process method for the given repository
16
16
  And I wait up for a ready processing
17
- And I call the first_processing_of method for the given repository
17
+ And I call the first_processing method for the given repository
18
18
  And I search a metric result with descendant values for the given metric result
19
19
  Then I should get a Float list
@@ -15,6 +15,6 @@ Feature: history of
15
15
  | Kalibro | GIT | https://github.com/rafamanzo/runge-kutta-vtk.git |
16
16
  And I call the process method for the given repository
17
17
  And I wait up for a ready processing
18
- And I call the first_processing_of method for the given repository
18
+ And I call the first_processing method for the given repository
19
19
  When I call the history of method with the metric name and the results root id of the given processing
20
20
  Then I should get a list of date metric results
@@ -14,7 +14,7 @@ Feature: Metric results of
14
14
  | Kalibro | GIT | https://github.com/rafamanzo/runge-kutta-vtk.git |
15
15
  And I call the process method for the given repository
16
16
  And I wait up for a ready processing
17
- And I call the first_processing_of method for the given repository
17
+ And I call the first_processing method for the given repository
18
18
  When I call the metric results of method with the results root id of the given processing
19
19
  Then I should get a list of metric results
20
20
  And the first metric result should have a metric configuration
@@ -10,6 +10,5 @@ Feature: Repositories listing
10
10
  And the given project has the following Repositories:
11
11
  | name | scm_type | address |
12
12
  | Kalibro | GIT | https://github.com/rafamanzo/runge-kutta-vtk.git |
13
- And I have an independent repository
14
13
  When I ask for all the repositories
15
- Then the response should contain the given repositories
14
+ Then the response should contain the given repository
@@ -1,4 +1,4 @@
1
- Feature: First processing of
1
+ Feature: First processing
2
2
  In order to be able to retrieve processing results
3
3
  As a developer
4
4
  I want to be able to retrieve the first processing
@@ -14,5 +14,5 @@ Feature: First processing of
14
14
  | Kalibro | GIT | https://github.com/rafamanzo/runge-kutta-vtk.git |
15
15
  And I call the process method for the given repository
16
16
  And I wait up to 1 seconds
17
- When I call the first_processing_of method for the given repository
17
+ When I call the first_processing method for the given repository
18
18
  Then I should get a Processing
@@ -1,4 +1,4 @@
1
- Feature: Last processing of
1
+ Feature: Last processing
2
2
  In order to be able to retrieve processing results
3
3
  As a developer
4
4
  I want to be able to retrieve the last processing
@@ -14,5 +14,5 @@ Feature: Last processing of
14
14
  | Kalibro | GIT | https://github.com/rafamanzo/runge-kutta-vtk.git |
15
15
  And I call the process method for the given repository
16
16
  And I wait up to 1 seconds
17
- When I call the last_processing_of method for the given repository
17
+ When I call the last_processing method for the given repository
18
18
  Then I should get a Processing
@@ -1,4 +1,4 @@
1
- Feature: Last processing state of
1
+ Feature: Last processing state
2
2
  In order to be able to retrieve processing results
3
3
  As a developer
4
4
  I want to be able to check the last processing status
@@ -14,5 +14,5 @@ Feature: Last processing state of
14
14
  | Kalibro | GIT | https://github.com/rafamanzo/runge-kutta-vtk.git |
15
15
  And I call the process method for the given repository
16
16
  And I wait up to 1 seconds
17
- When I call the last_processing_state_of method for the given repository
17
+ When I call the last_processing_state method for the given repository
18
18
  Then I should get "PREPARING"
@@ -1,4 +1,4 @@
1
- Feature: Last ready processing of
1
+ Feature: Last ready processing
2
2
  In order to be able to retrieve processing results
3
3
  As a developer
4
4
  I want to be able to check the last ready processing
@@ -14,6 +14,6 @@ Feature: Last ready processing of
14
14
  | Kalibro | GIT | https://github.com/rafamanzo/runge-kutta-vtk.git |
15
15
  And I call the process method for the given repository
16
16
  And I wait up for a ready processing
17
- When I call the last_ready_processing_of method for the given repository
17
+ When I call the last_ready_processing method for the given repository
18
18
  Then I should get a Processing
19
19
  And this processing should have process times
@@ -1,4 +1,4 @@
1
- Feature: Processing of
1
+ Feature: Processing
2
2
  In order to be able to retrieve processing results
3
3
  As a developer
4
4
  I want to be able to retrieve the processing
@@ -14,7 +14,7 @@ Feature: Processing of
14
14
  | Kalibro | GIT | https://github.com/rafamanzo/runge-kutta-vtk.git |
15
15
  And I call the process method for the given repository
16
16
  And I wait up to 1 seconds
17
- When I call the processing_of method for the given repository
17
+ When I call the processing method for the given repository
18
18
  Then I should get a Processing with state "PREPARING"
19
19
 
20
20
  @kalibro_processor_restart @kalibro_configuration_restart
@@ -28,5 +28,5 @@ Feature: Processing of
28
28
  | Kalibro | GIT | https://github.com/rafamanzo/runge-kutta-vtk.git |
29
29
  And I call the process method for the given repository
30
30
  And I wait up for a ready processing
31
- When I call the processing_of method for the given repository
31
+ When I call the processing method for the given repository
32
32
  Then I should get a Processing with state "READY"
@@ -1,4 +1,4 @@
1
- Feature: Processing with date of
1
+ Feature: Processing with date
2
2
  In order to be able to retrieve processing results
3
3
  As a developer
4
4
  I want to be able to retrieve the processing for a given date
@@ -14,7 +14,7 @@ Feature: Processing with date of
14
14
  | Kalibro | GIT | https://github.com/rafamanzo/runge-kutta-vtk.git |
15
15
  And I call the process method for the given repository
16
16
  And I wait up to 1 seconds
17
- When I call the processing_with_date_of method for the given repository and tomorrow's date
17
+ When I call the processing_with_date method for the given repository and tomorrow's date
18
18
  Then I should get a Processing
19
19
 
20
20
  @kalibro_processor_restart @kalibro_configuration_restart
@@ -28,5 +28,5 @@ Feature: Processing with date of
28
28
  | Kalibro | GIT | https://github.com/rafamanzo/runge-kutta-vtk.git |
29
29
  And I call the process method for the given repository
30
30
  And I wait up to 1 seconds
31
- When I call the processing_with_date_of method for the given repository and yesterday's date
31
+ When I call the processing_with_date method for the given repository and yesterday's date
32
32
  Then I should get a Processing
@@ -1,11 +1,11 @@
1
1
  When(/^I call the metric results of method with the results root id of the given processing$/) do
2
- @response = KalibroClient::Entities::Processor::MetricResult.metric_results_of(@response.root_module_result_id)
2
+ @response = KalibroClient::Entities::Processor::ModuleResult.find(@response.root_module_result_id).metric_results
3
3
  end
4
4
 
5
5
  Given(/^I search a metric result with descendant values for the given metric result$/) do
6
6
  first_module_result = KalibroClient::Entities::Processor::ModuleResult.find(@response.root_module_result_id)
7
7
 
8
- metric_results = KalibroClient::Entities::Processor::MetricResult.metric_results_of(first_module_result.id)
8
+ metric_results = first_module_result.metric_results
9
9
  @response = metric_results.first.descendant_values
10
10
  end
11
11
 
@@ -13,7 +13,7 @@ end
13
13
 
14
14
  When(/^I ask for the children of the processing root module result$/) do
15
15
  @children = KalibroClient::Entities::Processor::ModuleResult.
16
- find(KalibroClient::Entities::Processor::Processing.processing_of(@repository.id).root_module_result_id).children
16
+ find(@repository.processing.root_module_result_id).children
17
17
  end
18
18
 
19
19
  Then(/^I should get a list with the children module results$/) do
@@ -26,7 +26,7 @@ end
26
26
 
27
27
  Given(/^I get the module result of the processing$/) do
28
28
  @module_result = KalibroClient::Entities::Processor::ModuleResult.
29
- find(KalibroClient::Entities::Processor::Processing.processing_of(@repository.id).root_module_result_id)
29
+ find(@repository.processing.root_module_result_id)
30
30
  end
31
31
 
32
32
  When(/^I ask for the history of the given module result$/) do
@@ -1,11 +1,7 @@
1
- Given(/^I wait up to (\d+) seconds$/) do |seconds|
2
- sleep(seconds.to_i)
3
- end
4
-
5
1
  Given(/^I wait up for a ready processing$/) do
6
- unless KalibroClient::Entities::Processor::Processing.has_ready_processing(@repository.id)
2
+ unless @repository.has_ready_processing
7
3
  while(true)
8
- if KalibroClient::Entities::Processor::Processing.has_ready_processing(@repository.id)
4
+ if @repository.has_ready_processing
9
5
  break
10
6
  else
11
7
  sleep(10)
@@ -15,55 +11,59 @@ Given(/^I wait up for a ready processing$/) do
15
11
  end
16
12
 
17
13
  When(/^I call the has_processing for the given repository$/) do
18
- @response = KalibroClient::Entities::Processor::Processing.has_processing(@repository.id)
14
+ @response = @repository.has_processing
19
15
  end
20
16
 
21
17
  When(/^I call the has_ready_processing for the given repository$/) do
22
- @response = KalibroClient::Entities::Processor::Processing.has_ready_processing(@repository.id)
18
+ @response = @repository.has_ready_processing
23
19
  end
24
20
 
25
21
  When(/^I call the has_processing_after for the given repository with yerterday's date$/) do
26
- @response = KalibroClient::Entities::Processor::Processing.has_processing_after(@repository.id, DateTime.now - 1)
22
+ @response = @repository.has_processing_after(DateTime.now - 1)
27
23
  end
28
24
 
29
25
  When(/^I call the has_processing_before for the given repository with tomorrows's date$/) do
30
- @response = KalibroClient::Entities::Processor::Processing.has_processing_before(@repository.id, DateTime.now + 1)
26
+ @response = @repository.has_processing_before(DateTime.now + 1)
31
27
  end
32
28
 
33
- When(/^I call the last_processing_state_of method for the given repository$/) do
34
- @response = KalibroClient::Entities::Processor::Processing.last_processing_state_of(@repository.id)
29
+ When(/^I call the last_processing_state method for the given repository$/) do
30
+ @response = @repository.last_processing_state
35
31
  end
36
32
 
37
- When(/^I call the last_ready_processing_of method for the given repository$/) do
38
- @response = KalibroClient::Entities::Processor::Processing.last_ready_processing_of(@repository.id)
33
+ When(/^I call the last_ready_processing method for the given repository$/) do
34
+ @response = @repository.last_ready_processing
39
35
  end
40
36
 
41
- When(/^I call the first_processing_of method for the given repository$/) do
42
- @response = KalibroClient::Entities::Processor::Processing.first_processing_of(@repository.id)
37
+ When(/^I call the first_processing method for the given repository$/) do
38
+ @response = @repository.first_processing
43
39
  end
44
40
 
45
- When(/^I call the last_processing_of method for the given repository$/) do
46
- @response = KalibroClient::Entities::Processor::Processing.last_processing_of(@repository.id)
41
+ When(/^I call the last_processing method for the given repository$/) do
42
+ @response = @repository.last_processing
47
43
  end
48
44
 
49
45
  When(/^I call the first_processing_after method for the given repository and yesterday's date$/) do
50
- @response = KalibroClient::Entities::Processor::Processing.first_processing_after(@repository.id, DateTime.now - 1)
46
+ @response = @repository.first_processing_after(DateTime.now - 1)
51
47
  end
52
48
 
53
49
  When(/^I call the last_processing_before method for the given repository and tomorrow's date$/) do
54
- @response = KalibroClient::Entities::Processor::Processing.last_processing_before(@repository.id, DateTime.now + 1)
50
+ @response = @repository.last_processing_before(DateTime.now + 1)
55
51
  end
56
52
 
57
- When(/^I call the processing_of method for the given repository$/) do
58
- @response = KalibroClient::Entities::Processor::Processing.processing_of(@repository.id)
53
+ When(/^I call the processing method for the given repository$/) do
54
+ @response = @repository.processing
59
55
  end
60
56
 
61
- When(/^I call the processing_with_date_of method for the given repository and tomorrow's date$/) do
62
- @response = KalibroClient::Entities::Processor::Processing.processing_with_date_of(@repository.id, DateTime.now + 1)
57
+ When(/^I call the processing_with_date method for the given repository and tomorrow's date$/) do
58
+ @response = @repository.processing_with_date(DateTime.now + 1)
63
59
  end
64
60
 
65
- When(/^I call the processing_with_date_of method for the given repository and yesterday's date$/) do
66
- @response = KalibroClient::Entities::Processor::Processing.processing_with_date_of(@repository.id, DateTime.now - 1)
61
+ When(/^I call the processing_with_date method for the given repository and yesterday's date$/) do
62
+ @response = @repository.processing_with_date(DateTime.now - 1)
63
+ end
64
+
65
+ Given(/^I wait up to (\d+) seconds$/) do |seconds|
66
+ sleep(seconds.to_i)
67
67
  end
68
68
 
69
69
  Then(/^I should get a Processing with state "(.*?)"$/) do |state|
@@ -1,6 +1,5 @@
1
- Given(/^I have an independent repository$/) do
2
- @independent_repository = FactoryGirl.create(:repository, project_id: nil)
3
- end
1
+
2
+
4
3
  Given(/^the given project has the following Repositories:$/) do |table|
5
4
  hash = table.hashes.first
6
5
  hash[:project_id] = @project.id
@@ -60,9 +59,8 @@ Then(/^I should get the given repository$/) do
60
59
  expect(@response).to eq(@repository)
61
60
  end
62
61
 
63
- Then(/^the response should contain the given repositories$/) do
64
- expect(@response).to include(@repository)
65
- expect(@response).to include(@independent_repository)
62
+ Then(/^the response should contain the given repository$/) do
63
+ expect(@response.first.project_id).to eq(@project.id)
66
64
  end
67
65
 
68
66
  Then(/^the repositories should contain the project id$/) do
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
 
38
38
  spec.add_development_dependency "bundler", "~> 1.3"
39
39
  spec.add_development_dependency "rake"
40
- spec.add_development_dependency "rspec", "~> 3.2.0"
40
+ spec.add_development_dependency "rspec", "~> 3.3.0"
41
41
  spec.add_development_dependency "cucumber", "~> 1.3.14"
42
42
  spec.add_development_dependency "mocha", "~> 1.1.0"
43
43
  spec.add_development_dependency "simplecov"
@@ -2,21 +2,12 @@ module KalibroClient
2
2
  module Entities
3
3
  module Miscellaneous
4
4
  class Granularity
5
- include Comparable
5
+ GRANULARITIES = [:METHOD, :CLASS, :PACKAGE, :SOFTWARE]
6
6
 
7
- GRANULARITIES = [:METHOD, :CLASS, :PACKAGE, :SOFTWARE, :FUNCTION]
8
-
9
- GRANULARITIES.each do |name|
10
- self.const_set(name, name)
11
- end
12
-
13
- PARENTS = {
14
- METHOD: CLASS,
15
- CLASS: PACKAGE,
16
- PACKAGE: SOFTWARE,
17
- SOFTWARE: SOFTWARE,
18
- FUNCTION: PACKAGE
19
- }
7
+ METHOD = GRANULARITIES[0]
8
+ CLASS = GRANULARITIES[1]
9
+ PACKAGE = GRANULARITIES[2]
10
+ SOFTWARE = GRANULARITIES[3]
20
11
 
21
12
  attr_reader :type
22
13
 
@@ -29,41 +20,45 @@ module KalibroClient
29
20
  end
30
21
 
31
22
  def parent
32
- parent_type = PARENTS[self.type]
33
- raise ArgumentError.new("Not supported granularity type #{type}") if parent_type.nil?
34
-
35
- return self if self.type == parent_type
36
- Granularity.new(parent_type)
23
+ return self if self.type == SOFTWARE
24
+ return Granularity.new(GRANULARITIES[GRANULARITIES.find_index(self.type) + 1])
37
25
  end
38
26
 
39
27
  def to_s
40
28
  self.type.to_s
41
29
  end
42
30
 
43
- # FYI: this is a spaceship operator
44
- def <=>(other)
45
- return nil if [[:FUNCTION, :METHOD], [:METHOD, :FUNCTION]].include?([self.type, other.type])
31
+ def <(other_granularity)
32
+ GRANULARITIES.find_index(self.type) < GRANULARITIES.find_index(other_granularity.type)
33
+ end
46
34
 
47
- if self.type == other.type
48
- return 0
49
- elsif self.is_lower_than?(other.type)
50
- return -1
51
- else
52
- return 1
53
- end
35
+ def ==(other_granularity)
36
+ self.type == other_granularity.type
54
37
  end
55
38
 
56
- def is_lower_than?(other_type)
57
- current_type = self.type
39
+ def <=(other_granularity)
40
+ (self < other_granularity) || (self == other_granularity)
41
+ end
58
42
 
59
- while current_type != PARENTS[current_type]
60
- return true if PARENTS[current_type] == other_type
61
- current_type = PARENTS[current_type]
62
- end
43
+ def >=(other_granularity)
44
+ (self > other_granularity) || (self == other_granularity)
45
+ end
63
46
 
64
- return false
47
+ def >(other_granularity)
48
+ !(self <= other_granularity)
49
+ end
50
+
51
+ def <=>(other_granularity)
52
+ if self < other_granularity
53
+ return -1
54
+ elsif self > other_granularity
55
+ return 1
56
+ else
57
+ return 0
58
+ end
65
59
  end
66
60
  end
61
+
67
62
  end
68
63
  end
69
64
  end
@@ -60,11 +60,6 @@ module KalibroClient
60
60
  descendant_values.map {|descendant_value| descendant_value.to_f}
61
61
  end
62
62
 
63
- def self.metric_results_of(module_result_id)
64
- puts "DEPRECATED: MetricResult.metric_results_of"
65
- KalibroClient::Entities::Processor::ModuleResult.find(module_result_id).metric_results
66
- end
67
-
68
63
  def self.history_of(metric_name, kalibro_module_id, repository_id)
69
64
  response = Repository.request(':id/metric_result_history_of', {metric_name: metric_name,
70
65
  kalibro_module_id: kalibro_module_id,
@@ -44,81 +44,6 @@ module KalibroClient
44
44
  def root_module_result_id=(value)
45
45
  @root_module_result_id = value.to_i
46
46
  end
47
-
48
- def self.processing_of(repository_id)
49
- if has_ready_processing(repository_id)
50
- last_ready_processing_of(repository_id)
51
- else
52
- last_processing_of(repository_id)
53
- end
54
- end
55
-
56
- def self.processing_with_date_of(repository_id, date)
57
- date = date.is_a?(String) ? DateTime.parse(date) : date
58
- if has_processing_after(repository_id, date)
59
- first_processing_after(repository_id, date)
60
- elsif has_processing_before(repository_id, date)
61
- last_processing_before(repository_id, date)
62
- else
63
- nil
64
- end
65
- end
66
-
67
- def self.has_processing(repository_id)
68
- puts "DEPRECATED: Processing.has_processing"
69
- repository(repository_id).has_processing
70
- end
71
-
72
- def self.has_ready_processing(repository_id)
73
- puts "DEPRECATED: Processing.has_ready_processing"
74
- repository(repository_id).has_ready_processing
75
- end
76
-
77
- def self.has_processing_after(repository_id, date)
78
- puts "DEPRECATED: Processing.has_processing_after"
79
- repository(repository_id).has_processing_after(date)
80
- end
81
-
82
- def self.has_processing_before(repository_id, date)
83
- puts "DEPRECATED: Processing.has_processing_before"
84
- repository(repository_id).has_processing_before(date)
85
- end
86
-
87
- def self.last_processing_state_of(repository_id)
88
- puts "DEPRECATED: Processing.last_processing_state_of"
89
- repository(repository_id).last_processing_state
90
- end
91
-
92
- def self.last_ready_processing_of(repository_id)
93
- puts "DEPRECATED: Processing.last_ready_processing_of"
94
- repository(repository_id).last_ready_processing
95
- end
96
-
97
- def self.first_processing_of(repository_id)
98
- puts "DEPRECATED: Processing.first_processing_of"
99
- repository(repository_id).first_processing
100
- end
101
-
102
- def self.last_processing_of(repository_id)
103
- puts "DEPRECATED: Processing.last_processing_of"
104
- repository(repository_id).last_processing
105
- end
106
-
107
- def self.first_processing_after(repository_id, date)
108
- puts "DEPRECATED: Processing.first_processing_after"
109
- repository(repository_id).first_processing_after(date)
110
- end
111
-
112
- def self.last_processing_before(repository_id, date)
113
- puts "DEPRECATED: Processing.last_processing_before"
114
- repository(repository_id).last_processing_before(date)
115
- end
116
-
117
- private
118
-
119
- def self.repository(id)
120
- Repository.find(id)
121
- end
122
47
  end
123
48
  end
124
49
  end
@@ -19,7 +19,7 @@ module KalibroClient
19
19
  module Processor
20
20
  class Repository < KalibroClient::Entities::Processor::Base
21
21
 
22
- attr_accessor :id, :name, :description, :license, :period, :scm_type, :address, :kalibro_configuration_id, :project_id, :code_directory, :branch
22
+ attr_accessor :id, :name, :description, :license, :period, :scm_type, :address, :kalibro_configuration_id, :project_id, :send_email, :code_directory, :branch
23
23
 
24
24
  def self.repository_types
25
25
  request('types', {}, :get)['types'].to_a
@@ -113,7 +113,14 @@ module KalibroClient
113
113
  end
114
114
 
115
115
  def self.all
116
- create_objects_array_from_hash(request("", {}, :get))
116
+ projects = Project.all
117
+ repositories = []
118
+
119
+ projects.each do |project|
120
+ repositories.concat(repositories_of(project.id))
121
+ end
122
+
123
+ return repositories
117
124
  end
118
125
 
119
126
  def self.branches(url, scm_type)
@@ -15,5 +15,5 @@
15
15
  # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
 
17
17
  module KalibroClient
18
- VERSION = "0.5.0"
18
+ VERSION = "1.0.0"
19
19
  end
@@ -356,7 +356,7 @@ describe KalibroClient::Entities::Base do
356
356
  describe 'create_objects_array_from_hash' do
357
357
  context 'with nil' do
358
358
  it 'should return an empty array' do
359
- expect(KalibroClient::Entities::Base.create_objects_array_from_hash("bases" => [])).to eq([])
359
+ expect(KalibroClient::Entities::Base.create_objects_array_from_hash("bases" => nil)).to eq([])
360
360
  end
361
361
  end
362
362
 
@@ -30,7 +30,7 @@ describe KalibroClient::Entities::Configurations::KalibroConfiguration do
30
30
  KalibroClient::Entities::Configurations::KalibroConfiguration.
31
31
  expects(:request).
32
32
  with('', {}, :get).
33
- returns({'kalibro_configurations' => []})
33
+ returns({'kalibro_configurations' => nil})
34
34
  end
35
35
 
36
36
  it 'should return nil' do
@@ -76,7 +76,7 @@ describe KalibroClient::Entities::Configurations::KalibroRange do
76
76
  KalibroClient::Entities::Configurations::KalibroRange.
77
77
  expects(:request).
78
78
  with('', {}, :get, "metric_configurations/#{metric_configuration.id}").
79
- returns({'ranges' => []})
79
+ returns({'ranges' => nil})
80
80
  end
81
81
 
82
82
  it 'should return a list with the ranges' do
@@ -32,7 +32,7 @@ describe KalibroClient::Entities::Configurations::ReadingGroup do
32
32
  KalibroClient::Entities::Configurations::ReadingGroup.
33
33
  expects(:request).
34
34
  with('', {}, :get).
35
- returns({'reading_groups' => []})
35
+ returns({'reading_groups' => nil})
36
36
  end
37
37
 
38
38
  it 'should return nil' do
@@ -32,14 +32,6 @@ describe KalibroClient::Entities::Miscellaneous::Granularity do
32
32
  expect(subject.parent.type).to eq(KalibroClient::Entities::Miscellaneous::Granularity::CLASS)
33
33
  end
34
34
  end
35
-
36
- context 'with a FUNCTION granularity' do
37
- subject { FactoryGirl.build(:granularity, type: KalibroClient::Entities::Miscellaneous::Granularity::FUNCTION) }
38
-
39
- it 'should return PACKAGE' do
40
- expect(subject.parent.type).to eq(KalibroClient::Entities::Miscellaneous::Granularity::PACKAGE)
41
- end
42
- end
43
35
  end
44
36
 
45
37
  describe 'Comparison Operators' do
@@ -100,18 +92,6 @@ describe KalibroClient::Entities::Miscellaneous::Granularity do
100
92
  expect(subject <=> other_granularity).to eq(1)
101
93
  end
102
94
  end
103
-
104
- context 'comparing unrelated ones' do
105
- let(:function_granularity) { FactoryGirl.build(:granularity, type: KalibroClient::Entities::Miscellaneous::Granularity::FUNCTION) }
106
- let(:method_granularity) { FactoryGirl.build(:granularity, type: KalibroClient::Entities::Miscellaneous::Granularity::METHOD) }
107
-
108
- it 'should raise an ArgumentError' do
109
- expect { function_granularity < method_granularity }.to raise_error(ArgumentError)
110
- expect { function_granularity <= method_granularity }.to raise_error(ArgumentError)
111
- expect { function_granularity >= method_granularity }.to raise_error(ArgumentError)
112
- expect { function_granularity > method_granularity }.to raise_error(ArgumentError)
113
- end
114
- end
115
95
  end
116
96
 
117
97
  describe 'to_s' do
@@ -23,7 +23,7 @@ describe KalibroClient::Entities::Processor::MetricCollectorDetails do
23
23
  KalibroClient::Entities::Processor::MetricCollectorDetails.
24
24
  expects(:request).
25
25
  with(:names, {}, :get).
26
- returns({'names' => []})
26
+ returns({'names' => nil}.to_json)
27
27
  end
28
28
 
29
29
  it 'should return empty array' do
@@ -58,7 +58,7 @@ describe KalibroClient::Entities::Processor::MetricCollectorDetails do
58
58
  KalibroClient::Entities::Processor::MetricCollectorDetails.
59
59
  expects(:request).
60
60
  with('', {}, :get).
61
- returns({"metric_collector_details" => []})
61
+ returns({"metric_collector_details" => nil})
62
62
  end
63
63
 
64
64
  it 'should return empty array' do
@@ -101,47 +101,6 @@ describe KalibroClient::Entities::Processor::MetricResult do
101
101
  end
102
102
  end
103
103
 
104
- describe 'metric_results_of' do
105
- let(:module_result) { FactoryGirl.build(:module_result) }
106
-
107
- before :each do
108
- KalibroClient::Entities::Processor::ModuleResult.
109
- expects(:find).
110
- with(module_result.id).
111
- returns(module_result)
112
- end
113
-
114
- context 'when there is one metric result for the given module_result' do
115
- before :each do
116
- module_result.expects(:metric_results).returns([subject])
117
- end
118
-
119
- it 'should return an unitary list with the metric result' do
120
- expect(KalibroClient::Entities::Processor::MetricResult.metric_results_of(module_result.id).first.value).to eq(subject.value)
121
- end
122
- end
123
-
124
- context 'when there is no metric result for the given module_result' do
125
- before :each do
126
- module_result.expects(:metric_results).returns([])
127
- end
128
-
129
- it 'should return an empty list' do
130
- expect(KalibroClient::Entities::Processor::MetricResult.metric_results_of(module_result.id)).to eq([])
131
- end
132
- end
133
-
134
- context 'when there are many metric results for the given module_result' do
135
- before :each do
136
- module_result.expects(:metric_results).returns([subject, subject])
137
- end
138
-
139
- it 'should return a list with the descendant results' do
140
- expect(KalibroClient::Entities::Processor::MetricResult.metric_results_of(module_result.id).first.value).to eq(subject.value)
141
- end
142
- end
143
- end
144
-
145
104
  describe 'history_of' do
146
105
  let(:kalibro_module) { FactoryGirl.build(:kalibro_module_with_id) }
147
106
  let(:metric) { FactoryGirl.build(:metric) }
@@ -76,201 +76,4 @@ describe KalibroClient::Entities::Processor::Processing do
76
76
  expect(subject.root_module_result_id).to eq 36
77
77
  end
78
78
  end
79
-
80
- context 'static methods' do
81
- context 'using repository as parametter' do
82
- let!(:repository) { FactoryGirl.build(:repository_with_id) }
83
-
84
- before :each do
85
- KalibroClient::Entities::Processor::Repository.stubs(:find).with(repository.id).returns(repository)
86
- end
87
-
88
- describe 'has_processing' do
89
- before :each do
90
- repository.expects(:has_processing).returns(false)
91
- end
92
-
93
- it 'should convert the hash to a Boolean class' do
94
- response = KalibroClient::Entities::Processor::Processing.has_processing repository.id
95
- expect(response).to be_a_kind_of(FalseClass)
96
- end
97
- end
98
-
99
- describe 'has_ready_processing' do
100
- before :each do
101
- repository.expects(:has_ready_processing).returns(false)
102
- end
103
-
104
- it 'should convert the hash to a Boolean class' do
105
- response = KalibroClient::Entities::Processor::Processing.has_ready_processing repository.id
106
- expect(response).to be_a_kind_of(FalseClass)
107
- end
108
- end
109
-
110
- describe 'has_processing_after' do
111
- before :each do
112
- repository.expects(:has_processing_after).with(date).returns(false)
113
- end
114
-
115
- it 'should convert the hash to a Boolean class' do
116
- response = KalibroClient::Entities::Processor::Processing.has_processing_after(repository.id, date)
117
- expect(response).to be_a_kind_of(FalseClass)
118
- end
119
- end
120
-
121
- describe 'has_processing_before' do
122
- before :each do
123
- repository.expects(:has_processing_before).with(date).returns(false)
124
- end
125
-
126
- it 'should convert the hash to a Boolean class' do
127
- response = KalibroClient::Entities::Processor::Processing.has_processing_before(repository.id, date)
128
- expect(response).to be_a_kind_of(FalseClass)
129
- end
130
- end
131
-
132
- describe 'last_processing_state_of' do
133
- let!(:any_state) { "READY" }
134
-
135
- before :each do
136
- repository.expects(:last_processing_state).returns(any_state)
137
- end
138
-
139
- it 'should return the state as string' do
140
- response = KalibroClient::Entities::Processor::Processing.last_processing_state_of repository.id
141
- expect(response).to eq(any_state)
142
- end
143
- end
144
-
145
- context 'getting processing entity from Kalibro web service' do
146
- let(:processing) { FactoryGirl.build(:processing) }
147
-
148
- describe 'processing_of' do
149
- context 'when the repository has a ready processing' do
150
- before do
151
- repository.expects(:has_ready_processing).returns(true)
152
-
153
- repository.expects(:last_ready_processing).returns(processing)
154
- end
155
-
156
- it 'should return the last ready processing' do
157
- response = KalibroClient::Entities::Processor::Processing.processing_of repository.id
158
- expect(response.state).to eq(processing.state)
159
- end
160
- end
161
-
162
- context 'when the repository has not a ready processing' do
163
- before do
164
- KalibroClient::Entities::Processor::Processing.expects(:has_ready_processing).returns(false)
165
-
166
- KalibroClient::Entities::Processor::Processing.expects(:last_processing_of).returns(processing)
167
- end
168
-
169
- it 'should return the last processing' do
170
- response = KalibroClient::Entities::Processor::Processing.processing_of repository.id
171
- expect(response.state).to eq(processing.state)
172
- end
173
- end
174
- end
175
-
176
- describe 'processing_with_date_of' do
177
- context 'when the repository has a processing after the given date' do
178
- before do
179
- repository.expects(:has_processing_after).with(date).returns(true)
180
-
181
- repository.expects(:first_processing_after).with(date).returns(processing)
182
- end
183
-
184
- it 'should return the first processing after the given date' do
185
- response = KalibroClient::Entities::Processor::Processing.processing_with_date_of(repository.id, date)
186
- expect(response.state).to eq(processing.state)
187
- end
188
- end
189
-
190
- context 'when the repository has a processing before the given date' do
191
- before do
192
- KalibroClient::Entities::Processor::Processing.expects(:has_processing_after).with(repository.id, date).returns(false)
193
-
194
- KalibroClient::Entities::Processor::Processing.expects(:has_processing_before).with(repository.id, date).returns(true)
195
-
196
- KalibroClient::Entities::Processor::Processing.expects(:last_processing_before).with(repository.id, date).returns(processing)
197
- end
198
-
199
- it 'should return the last ready processing' do
200
- response = KalibroClient::Entities::Processor::Processing.processing_with_date_of(repository.id, date)
201
- expect(response.state).to eq(processing.state)
202
- end
203
- end
204
-
205
- context 'when the repository has not a processing after or before the given date' do
206
- before do
207
- repository.expects(:has_processing_after).with(date).returns(false)
208
-
209
- repository.expects(:has_processing_before).with(date).returns(false)
210
- end
211
-
212
- it 'should return the last ready processing' do
213
- response = KalibroClient::Entities::Processor::Processing.processing_with_date_of(repository.id, date)
214
- expect(response).to be_nil
215
- end
216
- end
217
- end
218
-
219
- describe 'last_ready_processing_of' do
220
- before :each do
221
- repository.expects(:last_ready_processing).returns(processing)
222
- end
223
-
224
- it 'should return a processing object' do
225
- response = KalibroClient::Entities::Processor::Processing.last_ready_processing_of repository.id
226
- expect(response.state).to eq(processing.state)
227
- end
228
- end
229
-
230
- describe 'first_processing_of' do
231
- before :each do
232
- repository.expects(:first_processing).returns(processing)
233
- end
234
-
235
- it 'should return a processing object' do
236
- response = KalibroClient::Entities::Processor::Processing.first_processing_of repository.id
237
- expect(response.state).to eq(processing.state)
238
- end
239
- end
240
-
241
- describe 'last_processing_of' do
242
- before :each do
243
- repository.expects(:last_processing).returns(processing)
244
- end
245
-
246
- it 'should return a processing object' do
247
- response = KalibroClient::Entities::Processor::Processing.last_processing_of repository.id
248
- expect(response.state).to eq(processing.state)
249
- end
250
- end
251
-
252
- describe 'first_processing_after' do
253
- before :each do
254
- repository.expects(:first_processing_after).with(date).returns(processing)
255
- end
256
-
257
- it 'should return a processing object' do
258
- response = KalibroClient::Entities::Processor::Processing.first_processing_after(repository.id, date)
259
- expect(response.state).to eq(processing.state)
260
- end
261
- end
262
-
263
- describe 'last_processing_before' do
264
- before :each do
265
- repository.expects(:last_processing_before).with(date).returns(processing)
266
- end
267
-
268
- it 'should return a processing object' do
269
- response = KalibroClient::Entities::Processor::Processing.last_processing_before(repository.id, date)
270
- expect(response.state).to eq(processing.state)
271
- end
272
- end
273
- end
274
- end
275
- end
276
79
  end
@@ -5,7 +5,7 @@
5
5
  # it under the terms of the GNU General Public License as published by
6
6
  # the Free Software Foundation, either version 3 of the License, or
7
7
  # (at your option) any later version.
8
-
8
+ #
9
9
  # This program is distributed in the hope that it will be useful,
10
10
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
11
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -37,7 +37,7 @@ describe KalibroClient::Entities::Processor::Project do
37
37
  KalibroClient::Entities::Processor::Project.
38
38
  expects(:request).
39
39
  with('', {}, :get).
40
- returns({"projects" => []})
40
+ returns({"projects" => nil})
41
41
  end
42
42
 
43
43
  it 'should return nil' do
@@ -100,11 +100,16 @@ describe KalibroClient::Entities::Processor::Repository do
100
100
  end
101
101
 
102
102
  describe 'all' do
103
+ let(:project) { FactoryGirl.build(:project) }
104
+
103
105
  before :each do
106
+ KalibroClient::Entities::Processor::Project.
107
+ expects(:all).
108
+ returns([project])
104
109
  KalibroClient::Entities::Processor::Repository.
105
- expects(:request).
106
- with("", {}, :get).
107
- returns({'repositories' => [subject.to_hash]})
110
+ expects(:repositories_of).
111
+ with(project.id).
112
+ returns([subject])
108
113
  end
109
114
 
110
115
  it 'should list all the repositories' do
@@ -24,8 +24,7 @@ FactoryGirl.define do
24
24
  address "svn://svn.code.sf.net/p/qt-calculator/code/trunk"
25
25
  kalibro_configuration_id 1
26
26
  project_id 1
27
- branch "master"
28
- code_directory nil
27
+ send_email "test@test.com"
29
28
 
30
29
  trait :with_id do
31
30
  id 1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kalibro_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Quadros Miranda
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-08-17 00:00:00.000000000 Z
14
+ date: 2015-06-26 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -47,14 +47,14 @@ dependencies:
47
47
  requirements:
48
48
  - - "~>"
49
49
  - !ruby/object:Gem::Version
50
- version: 3.2.0
50
+ version: 3.3.0
51
51
  type: :development
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
55
  - - "~>"
56
56
  - !ruby/object:Gem::Version
57
- version: 3.2.0
57
+ version: 3.3.0
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: cucumber
60
60
  requirement: !ruby/object:Gem::Requirement
@@ -212,18 +212,6 @@ files:
212
212
  - features/module_result/children.feature
213
213
  - features/module_result/find.feature
214
214
  - features/module_result/history_of.feature
215
- - features/processing/first_processing_after.feature
216
- - features/processing/first_processing_of.feature
217
- - features/processing/has_processing.feature
218
- - features/processing/has_processing_after.feature
219
- - features/processing/has_processing_before.feature
220
- - features/processing/has_ready_processing.feature
221
- - features/processing/last_processing_before.feature
222
- - features/processing/last_processing_of.feature
223
- - features/processing/last_processing_state_of.feature
224
- - features/processing/last_ready_processing_of.feature
225
- - features/processing/processing_of.feature
226
- - features/processing/processing_with_date_of.feature
227
215
  - features/project/all.feature
228
216
  - features/project/creation.feature
229
217
  - features/project/destroy.feature
@@ -244,6 +232,18 @@ files:
244
232
  - features/repository/find.feature
245
233
  - features/repository/of.feature
246
234
  - features/repository/process.feature
235
+ - features/repository/processing/first_processing.feature
236
+ - features/repository/processing/first_processing_after.feature
237
+ - features/repository/processing/has_processing.feature
238
+ - features/repository/processing/has_processing_after.feature
239
+ - features/repository/processing/has_processing_before.feature
240
+ - features/repository/processing/has_ready_processing.feature
241
+ - features/repository/processing/last_processing.feature
242
+ - features/repository/processing/last_processing_before.feature
243
+ - features/repository/processing/last_processing_state.feature
244
+ - features/repository/processing/last_ready_processing.feature
245
+ - features/repository/processing/processing.feature
246
+ - features/repository/processing/processing_with_date.feature
247
247
  - features/repository/types.feature
248
248
  - features/statistic/metric_percentage.feature
249
249
  - features/step_definitions/kalibro_configuration_steps.rb
@@ -379,7 +379,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
379
379
  version: '0'
380
380
  requirements: []
381
381
  rubyforge_project:
382
- rubygems_version: 2.4.5
382
+ rubygems_version: 2.4.6
383
383
  signing_key:
384
384
  specification_version: 4
385
385
  summary: KalibroClient is a communication interface with the KalibroProcessor and
@@ -407,18 +407,6 @@ test_files:
407
407
  - features/module_result/children.feature
408
408
  - features/module_result/find.feature
409
409
  - features/module_result/history_of.feature
410
- - features/processing/first_processing_after.feature
411
- - features/processing/first_processing_of.feature
412
- - features/processing/has_processing.feature
413
- - features/processing/has_processing_after.feature
414
- - features/processing/has_processing_before.feature
415
- - features/processing/has_ready_processing.feature
416
- - features/processing/last_processing_before.feature
417
- - features/processing/last_processing_of.feature
418
- - features/processing/last_processing_state_of.feature
419
- - features/processing/last_ready_processing_of.feature
420
- - features/processing/processing_of.feature
421
- - features/processing/processing_with_date_of.feature
422
410
  - features/project/all.feature
423
411
  - features/project/creation.feature
424
412
  - features/project/destroy.feature
@@ -439,6 +427,18 @@ test_files:
439
427
  - features/repository/find.feature
440
428
  - features/repository/of.feature
441
429
  - features/repository/process.feature
430
+ - features/repository/processing/first_processing.feature
431
+ - features/repository/processing/first_processing_after.feature
432
+ - features/repository/processing/has_processing.feature
433
+ - features/repository/processing/has_processing_after.feature
434
+ - features/repository/processing/has_processing_before.feature
435
+ - features/repository/processing/has_ready_processing.feature
436
+ - features/repository/processing/last_processing.feature
437
+ - features/repository/processing/last_processing_before.feature
438
+ - features/repository/processing/last_processing_state.feature
439
+ - features/repository/processing/last_ready_processing.feature
440
+ - features/repository/processing/processing.feature
441
+ - features/repository/processing/processing_with_date.feature
442
442
  - features/repository/types.feature
443
443
  - features/statistic/metric_percentage.feature
444
444
  - features/step_definitions/kalibro_configuration_steps.rb