techcor 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/Gemfile +22 -0
  2. data/Gemfile.lock +96 -0
  3. data/README.md +27 -0
  4. data/Rakefile +45 -0
  5. data/bin/tc +6 -0
  6. data/config/cucumber.yml +2 -0
  7. data/config/mongoid.yml +29 -0
  8. data/config/mongoid.yml.sample +29 -0
  9. data/db/seed.rb +37 -0
  10. data/features/add_metric.feature +9 -0
  11. data/features/add_project.feature +9 -0
  12. data/features/console_interface.feature +58 -0
  13. data/features/describe_project.feature +25 -0
  14. data/features/edit_property.feature +9 -0
  15. data/features/list_projects.feature +69 -0
  16. data/features/property_history.feature +51 -0
  17. data/features/rake.feature +11 -0
  18. data/features/seeds.feature +9 -0
  19. data/features/step_definitions/add_project.rb +22 -0
  20. data/features/step_definitions/console_interface.rb +7 -0
  21. data/features/step_definitions/list_projects.rb +3 -0
  22. data/features/step_definitions/property_history.rb +4 -0
  23. data/features/step_definitions/rake.rb +3 -0
  24. data/features/support/env.rb +9 -0
  25. data/lib/commands/add_metric.rb +17 -0
  26. data/lib/commands/add_project.rb +5 -0
  27. data/lib/commands/describe_project.rb +26 -0
  28. data/lib/commands/edit_property.rb +9 -0
  29. data/lib/commands/gli/add.rb +12 -0
  30. data/lib/commands/gli/add_metric.rb +23 -0
  31. data/lib/commands/gli/describe.rb +16 -0
  32. data/lib/commands/gli/edit_property.rb +22 -0
  33. data/lib/commands/gli/history.rb +19 -0
  34. data/lib/commands/gli/hooks.rb +8 -0
  35. data/lib/commands/gli/list.rb +14 -0
  36. data/lib/commands/gli/program.rb +5 -0
  37. data/lib/commands/list_projects.rb +32 -0
  38. data/lib/commands/view_history.rb +37 -0
  39. data/lib/console_formatter.rb +18 -0
  40. data/lib/gli_interface.rb +15 -0
  41. data/lib/metrics/boolean_metric.rb +7 -0
  42. data/lib/metrics/metric.rb +24 -0
  43. data/lib/metrics/number_metric.rb +7 -0
  44. data/lib/metrics/string_metric.rb +7 -0
  45. data/lib/project.rb +15 -0
  46. data/lib/project_catalog.rb +34 -0
  47. data/lib/property_value.rb +3 -0
  48. data/lib/storage/metric_mongo.rb +11 -0
  49. data/lib/storage/project_mongo.rb +9 -0
  50. data/lib/storage/property_value_mongo.rb +10 -0
  51. data/lib/tc/version.rb +9 -0
  52. data/lib/tc.rb +27 -0
  53. data/spec/integration/mongo_spec.rb +19 -0
  54. data/spec/lib/commands/add_metric_spec.rb +31 -0
  55. data/spec/lib/commands/add_project_spec.rb +10 -0
  56. data/spec/lib/commands/describe_project_spec.rb +42 -0
  57. data/spec/lib/commands/edit_property_spec.rb +19 -0
  58. data/spec/lib/commands/list_projects_spec.rb +47 -0
  59. data/spec/lib/commands/view_history_spec.rb +64 -0
  60. data/spec/lib/console_formatter_spec.rb +29 -0
  61. data/spec/lib/metrics/boolean_metric_spec.rb +9 -0
  62. data/spec/lib/metrics/metric_spec.rb +26 -0
  63. data/spec/lib/metrics/number_metric_spec.rb +8 -0
  64. data/spec/lib/metrics/string_metric_spec.rb +7 -0
  65. data/spec/lib/project_catalog_spec.rb +23 -0
  66. data/spec/lib/project_spec.rb +45 -0
  67. data/spec/lib/storage/metric_mongo_spec.rb +12 -0
  68. data/spec/lib/storage/project_mongo_spec.rb +11 -0
  69. data/spec/lib/storage/property_value_mongo_spec.rb +11 -0
  70. data/spec/spec_helper.rb +8 -0
  71. metadata +313 -0
data/Gemfile ADDED
@@ -0,0 +1,22 @@
1
+ source :rubygems
2
+
3
+ group :test do
4
+ gem 'rspec'
5
+ gem 'cucumber'
6
+ gem 'autotest'
7
+ gem 'simplecov'
8
+ gem 'mongoid-rspec'
9
+ gem 'aruba'
10
+ end
11
+
12
+ group :development do
13
+ gem 'pry'
14
+ gem 'rake'
15
+ gem 'jeweler'
16
+ end
17
+
18
+ gem 'activesupport'
19
+ gem 'mongoid', '~> 3.0.0.rc'
20
+ gem 'bson_ext'
21
+ gem 'hirb'
22
+ gem 'gli', '~> 2.0.0.rc'
data/Gemfile.lock ADDED
@@ -0,0 +1,96 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ ZenTest (4.8.1)
5
+ activemodel (3.2.6)
6
+ activesupport (= 3.2.6)
7
+ builder (~> 3.0.0)
8
+ activesupport (3.2.6)
9
+ i18n (~> 0.6)
10
+ multi_json (~> 1.0)
11
+ aruba (0.4.11)
12
+ childprocess (>= 0.2.3)
13
+ cucumber (>= 1.1.1)
14
+ ffi (>= 1.0.11)
15
+ rspec (>= 2.7.0)
16
+ autotest (4.4.6)
17
+ ZenTest (>= 4.4.1)
18
+ bson (1.6.4)
19
+ bson_ext (1.6.4)
20
+ bson (~> 1.6.4)
21
+ builder (3.0.0)
22
+ childprocess (0.3.2)
23
+ ffi (~> 1.0.6)
24
+ coderay (1.0.6)
25
+ cucumber (1.2.1)
26
+ builder (>= 2.1.2)
27
+ diff-lcs (>= 1.1.3)
28
+ gherkin (~> 2.11.0)
29
+ json (>= 1.4.6)
30
+ diff-lcs (1.1.3)
31
+ ffi (1.0.11)
32
+ gherkin (2.11.1)
33
+ json (>= 1.4.6)
34
+ git (1.2.5)
35
+ gli (2.0.0.rc4)
36
+ hirb (0.6.2)
37
+ i18n (0.6.0)
38
+ jeweler (1.8.4)
39
+ bundler (~> 1.0)
40
+ git (>= 1.2.5)
41
+ rake
42
+ rdoc
43
+ json (1.7.3)
44
+ method_source (0.7.1)
45
+ mongoid (3.0.0.rc)
46
+ activemodel (~> 3.1)
47
+ moped (~> 1.0.0.rc)
48
+ origin (~> 1.0.0.rc)
49
+ tzinfo (~> 0.3.22)
50
+ mongoid-rspec (1.4.6)
51
+ mongoid (>= 3.0.0.rc)
52
+ rake
53
+ rspec (>= 2.9)
54
+ moped (1.0.0.rc)
55
+ multi_json (1.3.6)
56
+ origin (1.0.1)
57
+ pry (0.9.9.6)
58
+ coderay (~> 1.0.5)
59
+ method_source (~> 0.7.1)
60
+ slop (>= 2.4.4, < 3)
61
+ rake (0.9.2.2)
62
+ rdoc (3.12)
63
+ json (~> 1.4)
64
+ rspec (2.10.0)
65
+ rspec-core (~> 2.10.0)
66
+ rspec-expectations (~> 2.10.0)
67
+ rspec-mocks (~> 2.10.0)
68
+ rspec-core (2.10.1)
69
+ rspec-expectations (2.10.0)
70
+ diff-lcs (~> 1.1.3)
71
+ rspec-mocks (2.10.1)
72
+ simplecov (0.6.4)
73
+ multi_json (~> 1.0)
74
+ simplecov-html (~> 0.5.3)
75
+ simplecov-html (0.5.3)
76
+ slop (2.4.4)
77
+ tzinfo (0.3.33)
78
+
79
+ PLATFORMS
80
+ ruby
81
+
82
+ DEPENDENCIES
83
+ activesupport
84
+ aruba
85
+ autotest
86
+ bson_ext
87
+ cucumber
88
+ gli (~> 2.0.0.rc)
89
+ hirb
90
+ jeweler
91
+ mongoid (~> 3.0.0.rc)
92
+ mongoid-rspec
93
+ pry
94
+ rake
95
+ rspec
96
+ simplecov
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ [![Build Status](https://secure.travis-ci.org/maksar/tc.png)](http://travis-ci.org/maksar/tc)
2
+ [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/maksar/tc)
3
+
4
+ Technical Coordination project
5
+ ---------------
6
+
7
+ This repository contains code, related and useful for performing technical coordination tasks -- collecting informational (technology, start date, current status, etc.) and statistical (unit tests count, unit tests coverage, build time, etc.) information about projects.
8
+
9
+ `tc` console tools allows to manage mentioned above information (add projects, edit metrics, etc.). Information itself is stored in `mongodb`. `tc` tool can be used in CI environments to automatically collect metrics (like coverage and build time).
10
+
11
+ In future, it is planned to have web interface for doing same operation as with cli `tc` tool. For now, use `tc --help` to get information about supported operations and commands.
12
+
13
+ Examples:
14
+
15
+ * Add new project
16
+
17
+ tc add project_name
18
+
19
+ * Add new metric
20
+
21
+ tc add_metric --mt number --pn project_name metric_name
22
+
23
+ * List unit tests count for all ruby projects
24
+
25
+ tc list --fm "{'Name' => 'name', 'Unit tests' => 'property(\"unit tests count\").value'}" "property('technology') == 'ruby'"
26
+
27
+ Code is not released as a separate gem, but will be in a nearest future.
data/Rakefile ADDED
@@ -0,0 +1,45 @@
1
+ require 'rspec/core/rake_task'
2
+ require 'cucumber/rake/task'
3
+
4
+ Cucumber::Rake::Task.new(:cucumber)
5
+ RSpec::Core::RakeTask.new(:rspec) do |t|
6
+ t.rspec_opts = ' -r simplecov'
7
+ end
8
+
9
+ desc "Creates bunch of test data in database"
10
+ task :seed do
11
+ require_relative 'db/seed'
12
+ seed
13
+ end
14
+
15
+ desc "Run Cucumber & RSpec to generate aggregated coverage"
16
+ task :default do
17
+ FileUtils.rm_rf('coverage')
18
+
19
+ Rake::Task['rspec'].invoke
20
+ Rake::Task["cucumber"].invoke
21
+ end
22
+
23
+ require 'jeweler'
24
+ require_relative 'lib/tc/version'
25
+ Jeweler::Tasks.new do |gem|
26
+ gem.name = "techcor"
27
+ gem.homepage = "http://github.com/maksar/tc"
28
+ gem.license = "MIT"
29
+ gem.summary = %Q{Console tool allowing to perform technical coordination activities}
30
+ gem.description = %Q{This gem provides 'tc' console utility, which allows to collect and manage different metrics on software projects.}
31
+ gem.email = "Maksar.mail@gmail.com"
32
+ gem.authors = ["Alexander Shestakov"]
33
+
34
+ gem.executables = %w(tc)
35
+ gem.version = TC::Version::STRING
36
+
37
+ gem.files.exclude '.*'
38
+ gem.files.exclude '*.gemspec'
39
+
40
+ gem.add_dependency 'mongoid', '~> 3.0.0.rc'
41
+ gem.add_dependency 'bson_ext'
42
+ gem.add_dependency 'hirb'
43
+ gem.add_dependency 'gli', '~> 2.0.0.rc'
44
+ end
45
+ Jeweler::RubygemsDotOrgTasks.new
data/bin/tc ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/gli_interface'
4
+
5
+ exit TcCli.exec(ARGV)
6
+
@@ -0,0 +1,2 @@
1
+ ---
2
+ default: --color --format progress
@@ -0,0 +1,29 @@
1
+ development:
2
+ sessions:
3
+ default:
4
+ hosts:
5
+ - localhost:27017
6
+ database: tc_development
7
+ logger: false
8
+ options:
9
+ raise_not_found_error: false
10
+
11
+ test:
12
+ sessions:
13
+ default:
14
+ hosts:
15
+ - localhost:27017
16
+ database: tc_test
17
+ logger: false
18
+ options:
19
+ raise_not_found_error: false
20
+
21
+ production:
22
+ sessions:
23
+ default:
24
+ hosts:
25
+ - localhost:27017
26
+ database: tc_production
27
+ logger: false
28
+ options:
29
+ raise_not_found_error: false
@@ -0,0 +1,29 @@
1
+ development:
2
+ sessions:
3
+ default:
4
+ hosts:
5
+ - localhost:27017
6
+ database: tc_development
7
+ logger: false
8
+ options:
9
+ raise_not_found_error: false
10
+
11
+ test:
12
+ sessions:
13
+ default:
14
+ hosts:
15
+ - localhost:27017
16
+ database: tc_test
17
+ logger: false
18
+ options:
19
+ raise_not_found_error: false
20
+
21
+ production:
22
+ sessions:
23
+ default:
24
+ hosts:
25
+ - localhost:27017
26
+ database: tc_production
27
+ logger: false
28
+ options:
29
+ raise_not_found_error: false
data/db/seed.rb ADDED
@@ -0,0 +1,37 @@
1
+ ENV['RACK_ENV'] ||= 'development'
2
+
3
+ require_relative '../lib/tc'
4
+
5
+ def seed
6
+ Project.delete_all
7
+
8
+ user = 'a.shestakov'
9
+
10
+ ProjectCatalog.new.
11
+ add_project(
12
+ Project.new(name: 'TC').
13
+ add_metric(StringMetric.new(name: 'Technology').edit('Ruby', user)).
14
+ add_metric(BooleanMetric.new(name: 'Active').edit(true, user)).
15
+ add_metric(StringMetric.new(name: 'SCM').edit('http://github.com/maksar/tc', user)).
16
+ add_metric(StringMetric.new(name: 'CI').edit('http://travis-ci.org/#!/maksar/tc', user)).
17
+ add_metric(NumberMetric.new(name: 'Unit Tests Coverage').edit(98.55, user)).
18
+ add_metric(NumberMetric.new(name: 'Unit Tests Count').edit(40, user)).
19
+ add_metric(NumberMetric.new(name: 'Cucumber Tests Coverage').edit(92.68, user)).
20
+ add_metric(NumberMetric.new(name: 'Cucumber Tests Count').edit(10, user)).
21
+ add_metric(NumberMetric.new(name: 'Tests Coverage').edit(100, user)).
22
+ edit_property('Unit Tests Count', 45, user).
23
+ edit_property('Unit Tests Count', 60, user).
24
+ edit_property('Unit Tests Count', 100, user).
25
+ edit_property('Unit Tests Coverage', 99, user).
26
+ edit_property('Unit Tests Coverage', 100, user)
27
+ ).
28
+ add_project(Project.new(name: 'Anagrams').
29
+ add_metric(StringMetric.new(name: 'Technology').edit('Ruby', user)).
30
+ add_metric(BooleanMetric.new(name: 'Active').edit(false, user)).
31
+ add_metric(StringMetric.new(name: 'SCM').edit('http://github.com/maksar/anagrams', user)).
32
+ add_metric(StringMetric.new(name: 'CI').edit('http://travis-ci.org/#!/maksar/anagrams', user)).
33
+ add_metric(NumberMetric.new(name: 'Unit Tests Coverage').edit(100, user)).
34
+ add_metric(NumberMetric.new(name: 'Unit Tests Count').edit(6, user)).
35
+ add_metric(NumberMetric.new(name: 'Tests Coverage').edit(100, 'john.dow'))).
36
+ save
37
+ end
@@ -0,0 +1,9 @@
1
+ Feature: Adding metric
2
+ In order to add new metric to the project
3
+ As a console user
4
+ I want to be able to do that
5
+
6
+ Scenario: adding metric
7
+ Given catalog filled by seeds script
8
+ When I execute cli "add_metric --pn TC --mt number new_metric"
9
+ Then the cli output should contain "Metric new_metric with type number was successfully added to project TC."
@@ -0,0 +1,9 @@
1
+ Feature: Adding project
2
+ In order to add new project
3
+ As a console user
4
+ I want to be able to do that
5
+
6
+ Scenario: adding project
7
+ Given no projects in catalog
8
+ When I execute cli "add TC"
9
+ Then the cli output should contain "Project TC was successfully added."
@@ -0,0 +1,58 @@
1
+ Feature: console command
2
+ In order to do technical coordination
3
+ As a console user
4
+ I want use cli (command line interface)
5
+
6
+ Scenario: View general help in cli
7
+ When I execute cli "help"
8
+ Then the cli output should contain "Command Line Interface for Technical Coordination"
9
+ And the cli output should contain "[global options] command [command options] [arguments...]"
10
+ And the output have option "add" with description "Adds new project"
11
+ And the output have option "add_metric" with description "Adds new metric to the project"
12
+ And the output have option "edit_property" with description "Edits one metric of the project"
13
+ And the output have option "list" with description "List projects from catalog"
14
+
15
+ Scenario: View help of add command
16
+ When I execute cli "help add"
17
+ Then the cli output should contain "Adds new project"
18
+ And the cli output should contain "add [command options] {project_name}"
19
+ And the cli output should contain "Adds new project"
20
+ And the cli output should contain "Allows to create new project"
21
+
22
+ Scenario: View help of add_metric command
23
+ When I execute cli "help add_metric"
24
+ Then the cli output should contain "add_metric [command options] {metric_name}"
25
+ And the cli output should contain "Adds new metric to the project"
26
+ And the cli output should contain "Allows to add new metric to the project"
27
+ And the output should have flag "mt/metric_type" with name "metric type" and description "type of the metric you want to add (string, number, boolean) (default: string)"
28
+ And the output should have flag "pn/project_name" with name "project name" and description "name of the project, to which you want to add metric"
29
+
30
+ Scenario: View help of edit_property command
31
+ When I execute cli "help edit_property"
32
+ Then the cli output should contain "edit_property [command options] {value}"
33
+ And the cli output should contain "Edits one metric of the project"
34
+ And the cli output should contain "Allows to edit one of the project's metrics"
35
+ And the output should have flag "mn/metric_name" with name "metric name" and description "name of the metric, which you want to edit"
36
+ And the output should have flag "pn/project_name" with name "project name" and description "name of the project, property of which you want to edit"
37
+
38
+ Scenario: View help of list command
39
+ When I execute cli "help list"
40
+ Then the cli output should contain "list [command options] {criteria}"
41
+ And the cli output should contain "List projects from catalog"
42
+ And the cli output should contain "Lists projects from catalog matching specified criteria"
43
+ And the output should have flag "fm/format" with name "table format" and description "ruby code for table format"
44
+
45
+ Scenario: View help of history command
46
+ When I execute cli "help history"
47
+ Then the cli output should contain "history [command options] [{property}],[{another_property}],[...]"
48
+ And the cli output should contain "Displays property history"
49
+ And the cli output should contain "Displays one or more properties history (list of values over time)"
50
+ And the output should have flag "pn/project_name" with name "project name" and description "name of the project, property of which you want to edit"
51
+ And the output should have flag "df/date_format" with name "date format" and description "ruby date format to display time of change (default: %d-%m-%Y)"
52
+
53
+ Scenario: View help of describe command
54
+ When I execute cli "help describe"
55
+ Then the cli output should contain "describe [command options] {project_name}"
56
+ And the cli output should contain "Describes current state of the project"
57
+ And the cli output should contain "Displays current metrics of the project, date and author of last modification"
58
+ And the output should have flag "df/date_format" with name "date format" and description "ruby date format to display time of change (default: %d-%m-%Y)"
@@ -0,0 +1,25 @@
1
+ Feature: Describing project
2
+ In order to view project metrics
3
+ As a console user
4
+ I want to see state of all current project metrics
5
+
6
+ Scenario: describing project
7
+ Given catalog filled by seeds script
8
+ When I execute cli "describe --df ---- TC"
9
+ Then the cli output should contain:
10
+ """
11
+ +-------------------------+-----------------------------------+------------+-------------+
12
+ | Metric | Value | Changed at | Changed by |
13
+ +-------------------------+-----------------------------------+------------+-------------+
14
+ | Technology | Ruby | ---- | a.shestakov |
15
+ | Active | true | ---- | a.shestakov |
16
+ | SCM | http://github.com/maksar/tc | ---- | a.shestakov |
17
+ | CI | http://travis-ci.org/#!/maksar/tc | ---- | a.shestakov |
18
+ | Unit Tests Coverage | 100.0 | ---- | a.shestakov |
19
+ | Unit Tests Count | 100.0 | ---- | a.shestakov |
20
+ | Cucumber Tests Coverage | 92.68 | ---- | a.shestakov |
21
+ | Cucumber Tests Count | 10.0 | ---- | a.shestakov |
22
+ | Tests Coverage | 100.0 | ---- | a.shestakov |
23
+ +-------------------------+-----------------------------------+------------+-------------+
24
+ 9 rows in set
25
+ """
@@ -0,0 +1,9 @@
1
+ Feature: Edit property
2
+ In order to edit property of the project
3
+ As a console user
4
+ I want to be able to do that
5
+
6
+ Scenario: editing property
7
+ Given catalog filled by seeds script
8
+ When I execute cli "edit_property --pn TC --mn Technology RoR"
9
+ Then the cli output should contain "Metric Technology in project TC now has value RoR."
@@ -0,0 +1,69 @@
1
+ Feature: Listing projects in console
2
+ In order to view projects by criteria
3
+ As a console user
4
+ I want to specify criteria and see list of the projects
5
+
6
+ Scenario: listing empty project catalog with empty criteria
7
+ Given no projects in catalog
8
+ When I execute cli "list --fm "{'Name' => 'name', 'Count' => '\\'Count: \\' + property(\\'Unit Tests Count\\').value.to_s'}" "
9
+ Then the cli output should contain "0 rows in set"
10
+
11
+ Scenario: listing empty project catalog with specified criteria
12
+ Given no projects in catalog
13
+ When I execute cli "list --fm "{'Name' => 'name', 'Count' => '\\'Count: \\' + property(\\'Unit Tests Count\\').value.to_s'}" "property('Unit Tests Count').value == 1""
14
+ Then the cli output should contain "0 rows in set"
15
+
16
+ Scenario: listing projects catalog with empty criteria
17
+ Given catalog filled by seeds script
18
+ When I execute cli "list --fm "{'Name' => 'name', 'Count' => '\\'Count: \\' + property(\\'Unit Tests Count\\').value.to_s'}" "
19
+ Then the cli output should contain:
20
+ """
21
+ +----------+--------------+
22
+ | Name | Count |
23
+ +----------+--------------+
24
+ | Anagrams | Count: 6.0 |
25
+ | TC | Count: 100.0 |
26
+ +----------+--------------+
27
+ 2 rows in set
28
+ """
29
+
30
+ Scenario: listing projects catalog with simple criteria
31
+ Given catalog filled by seeds script
32
+ When I execute cli "list --fm "{'Name' => 'name', 'Count' => '\\'Count: \\' + property(\\'Unit Tests Count\\').value.to_s'}" "property('Unit Tests Count').value == 6""
33
+ Then the cli output should contain:
34
+ """
35
+ +----------+------------+
36
+ | Name | Count |
37
+ +----------+------------+
38
+ | Anagrams | Count: 6.0 |
39
+ +----------+------------+
40
+ 1 row in set
41
+ """
42
+
43
+ Scenario: listing projects catalog with complex criteria
44
+ Given catalog filled by seeds script
45
+ When I execute cli "list --fm "{'Name' => 'name', 'Count' => '\\'Count: \\' + property(\\'Unit Tests Count\\').value.to_s'}" "property('Unit Tests Count').value == 6 || property('Unit Tests Count').value == 100""
46
+ Then the cli output should contain:
47
+ """
48
+ +----------+--------------+
49
+ | Name | Count |
50
+ +----------+--------------+
51
+ | Anagrams | Count: 6.0 |
52
+ | TC | Count: 100.0 |
53
+ +----------+--------------+
54
+ 2 rows in set
55
+ """
56
+
57
+ Scenario: listing projects catalog with empty format
58
+ Given catalog filled by seeds script
59
+ When I execute cli "list"
60
+ Then the cli output should contain:
61
+ """
62
+ +----------+------------+--------+-----------------------------------+-----------------------------------------+---------------------+------------------+----------------+-------------------------+----------------------+
63
+ | Name | Technology | Active | SCM | CI | Unit Tests Coverage | Unit Tests Count | Tests Coverage | Cucumber Tests Coverage | Cucumber Tests Count |
64
+ +----------+------------+--------+-----------------------------------+-----------------------------------------+---------------------+------------------+----------------+-------------------------+----------------------+
65
+ | Anagrams | Ruby | false | http://github.com/maksar/anagrams | http://travis-ci.org/#!/maksar/anagrams | 100.0 | 6.0 | 100.0 | | |
66
+ | TC | Ruby | true | http://github.com/maksar/tc | http://travis-ci.org/#!/maksar/tc | 100.0 | 100.0 | 100.0 | 92.68 | 10.0 |
67
+ +----------+------------+--------+-----------------------------------+-----------------------------------------+---------------------+------------------+----------------+-------------------------+----------------------+
68
+ 2 rows in set
69
+ """
@@ -0,0 +1,51 @@
1
+ Feature: Property history
2
+ In order to view property history
3
+ As a console user
4
+ I want to specify property(ies) and see its history
5
+
6
+ Background:
7
+ Given catalog filled by seeds script
8
+
9
+ Scenario: trying to list non-existing property
10
+ When I execute cli "history --pn TC --df ---- "non existing property""
11
+ Then the cli output should contain "0 rows in set"
12
+
13
+ Scenario: listing property history
14
+ When I execute cli "history --pn TC --df ---- "Unit Tests Count""
15
+ Then the cli output should contain:
16
+ """
17
+ +------+------------------+
18
+ | Date | Unit Tests Count |
19
+ +------+------------------+
20
+ | ---- | 40.0 |
21
+ | ---- | 45.0 |
22
+ | ---- | 60.0 |
23
+ | ---- | 100.0 |
24
+ +------+------------------+
25
+ 4 rows in set
26
+ """
27
+
28
+ Scenario: listing all properties history
29
+ When I execute cli "history --pn TC --df ----"
30
+ Then the cli output should contain:
31
+ """
32
+ +------+------------+--------+-----------------------------+-----------------------------------+---------------------+------------------+-------------------------+----------------------+----------------+
33
+ | Date | Technology | Active | SCM | CI | Unit Tests Coverage | Unit Tests Count | Cucumber Tests Coverage | Cucumber Tests Count | Tests Coverage |
34
+ +------+------------+--------+-----------------------------+-----------------------------------+---------------------+------------------+-------------------------+----------------------+----------------+
35
+ | ---- | Ruby | | | | | | | | |
36
+ | ---- | | true | | | | | | | |
37
+ | ---- | | | http://github.com/maksar/tc | | | | | | |
38
+ | ---- | | | | http://travis-ci.org/#!/maksar/tc | | | | | |
39
+ | ---- | | | | | 98.55 | | | | |
40
+ | ---- | | | | | 99.0 | | | | |
41
+ | ---- | | | | | 100.0 | | | | |
42
+ | ---- | | | | | | 40.0 | | | |
43
+ | ---- | | | | | | 45.0 | | | |
44
+ | ---- | | | | | | 60.0 | | | |
45
+ | ---- | | | | | | 100.0 | | | |
46
+ | ---- | | | | | | | 92.68 | | |
47
+ | ---- | | | | | | | | 10.0 | |
48
+ | ---- | | | | | | | | | 100.0 |
49
+ +------+------------+--------+-----------------------------+-----------------------------------+---------------------+------------------+-------------------------+----------------------+----------------+
50
+ 14 rows in set
51
+ """
@@ -0,0 +1,11 @@
1
+ Feature: rake support
2
+ In order to do technical coordination
3
+ As a console user
4
+ I want use rake tasks
5
+
6
+ Scenario: View list of rake commands
7
+ When I run `rake -T`
8
+ And the output should contain rake command "default" with description "Run Cucumber & RSpec to generate aggregated coverage"
9
+ And the output should contain rake command "cucumber" with description "Run Cucumber features"
10
+ And the output should contain rake command "rspec" with description "Run RSpec code examples"
11
+ And the output should contain rake command "seed" with description "Creates bunch of test data in database"
@@ -0,0 +1,9 @@
1
+ Feature: rake seed task
2
+ In order to do technical coordination
3
+ As a console user
4
+ I want use seed rake task
5
+
6
+ Scenario: Generate seed data in database
7
+ Given catalog filled by seeds script
8
+ When I execute cli "list"
9
+ Then the cli output should contain "2 rows in set"
@@ -0,0 +1,22 @@
1
+ When /^I execute cli "(.*)"$/ do |command|
2
+ old_stdout = $stdout
3
+ $stdout = Tempfile.new("")
4
+
5
+ TcCli.exec Shellwords.shellwords command
6
+
7
+ $stdout.rewind
8
+ @console = $stdout.readlines.join
9
+ $stdout = old_stdout
10
+ end
11
+
12
+ Then /^the cli output should contain "(.*)"$/ do |text|
13
+ @console.should include text
14
+ end
15
+
16
+ Then /^the cli output should match \/(.*)\/$/ do |text|
17
+ @console.should =~ Regexp.new(text)
18
+ end
19
+
20
+ Then /^the cli output should contain:$/ do |text|
21
+ @console.should include text
22
+ end
@@ -0,0 +1,7 @@
1
+ Then /^the output have option "(\w+)" with description "(.*)"$/ do |option, description|
2
+ step "the cli output should match /#{option}\\s+- #{Regexp.quote description}/"
3
+ end
4
+
5
+ When /^the output should have flag "(\w+)\/(\w+)" with name "(.*)" and description "(.*)"$/ do |short_flag, long_flag, name, description|
6
+ step "the cli output should match /--#{Regexp.quote short_flag}, --#{Regexp.quote long_flag}=#{Regexp.quote name}[\\s]+- #{Regexp.quote description}/"
7
+ end
@@ -0,0 +1,3 @@
1
+ Given /^no projects in catalog$/ do
2
+ Project.delete_all
3
+ end
@@ -0,0 +1,4 @@
1
+ Given /^catalog filled by seeds script$/ do
2
+ require_relative '../../db/seed'
3
+ seed
4
+ end
@@ -0,0 +1,3 @@
1
+ When /^the output should contain rake command "(\w+)" with description "(.*)"$/ do |name, description|
2
+ step "the output should match /rake #{Regexp.quote name}[\\s]+\\# #{Regexp.quote description}/"
3
+ end
@@ -0,0 +1,9 @@
1
+ ENV['RACK_ENV'] = 'test'
2
+
3
+ require_relative '../../lib/tc'
4
+
5
+ require 'tempfile'
6
+ require 'gli_interface'
7
+
8
+ require 'aruba/cucumber'
9
+ ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
@@ -0,0 +1,17 @@
1
+ class AddMetric < Struct.new :project_name, :type, :name
2
+ def call project = project, metric = metric
3
+ project.add_metric(metric)
4
+ end
5
+
6
+ def project project_name = project_name
7
+ Project.find_by(name: project_name)
8
+ end
9
+
10
+ def metric metric_class = metric_class, name = name
11
+ metric_class.new name: name
12
+ end
13
+
14
+ def metric_class type = type
15
+ "#{type}Metric".classify.constantize
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ class AddProject < Struct.new :name
2
+ def call name = name
3
+ Project.create(name: name)
4
+ end
5
+ end