hexx-suit 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +71 -0
  3. data/.yardopts +3 -0
  4. data/Guardfile +29 -0
  5. data/LICENSE +21 -0
  6. data/README.md +164 -0
  7. data/Rakefile +18 -0
  8. data/bin/hexx-suit +14 -0
  9. data/config/initializers/focus.rb +5 -0
  10. data/config/initializers/garbage_collection.rb +11 -0
  11. data/config/initializers/i18n.rb +3 -0
  12. data/config/initializers/metric_fu.rb +0 -0
  13. data/config/initializers/random_order.rb +4 -0
  14. data/config/initializers/rspec.rb +11 -0
  15. data/lib/hexx-suit.rb +16 -0
  16. data/lib/hexx/suit.rb +101 -0
  17. data/lib/hexx/suit/install.rb +85 -0
  18. data/lib/hexx/suit/install/Guardfile +6 -0
  19. data/lib/hexx/suit/install/Rakefile +17 -0
  20. data/lib/hexx/suit/install/_metrics +5 -0
  21. data/lib/hexx/suit/install/_rspec +2 -0
  22. data/lib/hexx/suit/install/_rubocop.yml +74 -0
  23. data/lib/hexx/suit/install/_yardopts +2 -0
  24. data/lib/hexx/suit/install/metrics/STYLEGUIDE +230 -0
  25. data/lib/hexx/suit/install/metrics/cane.yml +5 -0
  26. data/lib/hexx/suit/install/metrics/churn.yml +6 -0
  27. data/lib/hexx/suit/install/metrics/flay.yml +2 -0
  28. data/lib/hexx/suit/install/metrics/metric_fu.yml +15 -0
  29. data/lib/hexx/suit/install/metrics/pippi.yml +3 -0
  30. data/lib/hexx/suit/install/metrics/reek.yml +1 -0
  31. data/lib/hexx/suit/install/metrics/roodi.yml +24 -0
  32. data/lib/hexx/suit/install/metrics/rubocop.yml +79 -0
  33. data/lib/hexx/suit/install/metrics/saikuro.yml +3 -0
  34. data/lib/hexx/suit/install/metrics/simplecov.yml +8 -0
  35. data/lib/hexx/suit/install/metrics/yardstick.yml +37 -0
  36. data/lib/hexx/suit/metrics/base.rb +96 -0
  37. data/lib/hexx/suit/metrics/metric_fu.rb +165 -0
  38. data/lib/hexx/suit/metrics/metric_fu/base.rb +59 -0
  39. data/lib/hexx/suit/metrics/metric_fu/cane.rb +24 -0
  40. data/lib/hexx/suit/metrics/metric_fu/churn.rb +24 -0
  41. data/lib/hexx/suit/metrics/metric_fu/flay.rb +24 -0
  42. data/lib/hexx/suit/metrics/metric_fu/reek.rb +32 -0
  43. data/lib/hexx/suit/metrics/metric_fu/roodi.rb +32 -0
  44. data/lib/hexx/suit/metrics/metric_fu/saikuro.rb +24 -0
  45. data/lib/hexx/suit/metrics/pippi.rb +89 -0
  46. data/lib/hexx/suit/metrics/rubocop.rb +39 -0
  47. data/lib/hexx/suit/metrics/simplecov.rb +119 -0
  48. data/lib/hexx/suit/metrics/yardstick.rb +91 -0
  49. data/lib/hexx/suit/utils/system.rb +66 -0
  50. data/lib/hexx/suit/version.rb +7 -0
  51. data/lib/tasks/check.rake +32 -0
  52. data/lib/tasks/check/coverage.rake +27 -0
  53. data/lib/tasks/check/fu.rake +27 -0
  54. data/lib/tasks/check/inch.rake +11 -0
  55. data/lib/tasks/check/pippi.rake +31 -0
  56. data/lib/tasks/check/rubocop.rake +39 -0
  57. data/lib/tasks/check/yardstick.rake +27 -0
  58. data/lib/tasks/debug.rake +6 -0
  59. data/lib/tasks/test.rake +6 -0
  60. data/spec/spec_helper.rb +10 -0
  61. data/spec/support/config/sandbox.rb +16 -0
  62. data/spec/support/config/tasks.rb +32 -0
  63. data/spec/support/sandbox/helpers.rb +62 -0
  64. data/spec/support/sandbox/matchers.rb +21 -0
  65. data/spec/tests/bin/install_spec.rb +29 -0
  66. data/spec/tests/lib/install_spec.rb +34 -0
  67. data/spec/tests/lib/metrics/metric_fu/cane_spec.rb +32 -0
  68. data/spec/tests/lib/metrics/metric_fu/churn_spec.rb +31 -0
  69. data/spec/tests/lib/metrics/metric_fu/flay_spec.rb +27 -0
  70. data/spec/tests/lib/metrics/metric_fu/reek_spec.rb +22 -0
  71. data/spec/tests/lib/metrics/metric_fu/roodi_spec.rb +22 -0
  72. data/spec/tests/lib/metrics/metric_fu/saikuro_spec.rb +30 -0
  73. data/spec/tests/lib/metrics/metric_fu_spec.rb +181 -0
  74. data/spec/tests/lib/metrics/pippi_spec.rb +102 -0
  75. data/spec/tests/lib/metrics/rubocop_spec.rb +58 -0
  76. data/spec/tests/lib/metrics/simplecov_spec.rb +102 -0
  77. data/spec/tests/lib/metrics/yardstick_spec.rb +110 -0
  78. data/spec/tests/lib/utils/system_spec.rb +85 -0
  79. data/spec/tests/suit_spec.rb +96 -0
  80. data/spec/tests/tasks/check/coverage/display_spec.rb +49 -0
  81. data/spec/tests/tasks/check/coverage/run_spec.rb +25 -0
  82. data/spec/tests/tasks/check/coverage_spec.rb +26 -0
  83. data/spec/tests/tasks/check/display_spec.rb +50 -0
  84. data/spec/tests/tasks/check/fu/display_spec.rb +42 -0
  85. data/spec/tests/tasks/check/fu/run_spec.rb +42 -0
  86. data/spec/tests/tasks/check/fu_spec.rb +18 -0
  87. data/spec/tests/tasks/check/inch_spec.rb +19 -0
  88. data/spec/tests/tasks/check/pippi/display_spec.rb +47 -0
  89. data/spec/tests/tasks/check/pippi/run_spec.rb +25 -0
  90. data/spec/tests/tasks/check/pippi_spec.rb +26 -0
  91. data/spec/tests/tasks/check/rubocop/display_spec.rb +61 -0
  92. data/spec/tests/tasks/check/rubocop/run_spec.rb +78 -0
  93. data/spec/tests/tasks/check/rubocop_spec.rb +26 -0
  94. data/spec/tests/tasks/check/run_spec.rb +44 -0
  95. data/spec/tests/tasks/check/yardstick/display_spec.rb +51 -0
  96. data/spec/tests/tasks/check/yardstick/run_spec.rb +20 -0
  97. data/spec/tests/tasks/check/yardstick_spec.rb +26 -0
  98. data/spec/tests/tasks/check_spec.rb +56 -0
  99. data/spec/tests/tasks/debug_spec.rb +21 -0
  100. data/spec/tests/tasks/test_spec.rb +21 -0
  101. metadata +414 -0
@@ -0,0 +1,49 @@
1
+ # encoding: utf-8
2
+
3
+ describe "Rake::Task['check:coverage:display']", :tasks do
4
+
5
+ # The {#commands} variable is defined in the spec/support/config/tasks.rb
6
+ # It collects the list of commands, that has been sent to system by
7
+ # any instance of Hexx::Suit::Utils::System utility.
8
+
9
+ let(:metric) { Hexx::Suit::Metrics::SimpleCov }
10
+ let(:task) { Rake::Task["check:coverage:display"] }
11
+
12
+ describe ".invoke", :sandbox do
13
+
14
+ subject { try_in_sandbox { task.invoke } }
15
+
16
+ context "when '.metrics.yml' is absent" do
17
+
18
+ it "loads the metric" do
19
+ expect(metric).to receive(:load)
20
+ subject
21
+ end
22
+
23
+ it "displays the default output" do
24
+ expect { subject }.to change { commands }.to [
25
+ "launchy tmp/coverage/index.html"
26
+ ]
27
+ end
28
+ end
29
+
30
+ context "when '.metrics.yml' is present" do
31
+
32
+ let(:output) { "tmp/coverage" }
33
+ before do
34
+ prepare_settings "simplecov" => { "output" => output }
35
+ end
36
+
37
+ it "loads the metric" do
38
+ expect(metric).to receive(:load)
39
+ subject
40
+ end
41
+
42
+ it "uses the custom output folder" do
43
+ expect { subject }.to change { commands }.to [
44
+ "launchy #{ output }/index.html"
45
+ ]
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+
3
+ describe "Rake::Task['check:coverage:run']", :tasks do
4
+
5
+ # The {#commands} variable is defined in the spec/support/config/tasks.rb
6
+ # It collects the list of commands, that has been sent to system by
7
+ # any instance of Hexx::Suit::Utils::System utility.
8
+
9
+ let(:metric) { Hexx::Suit::Metrics::SimpleCov }
10
+ let(:task) { Rake::Task["check:coverage:run"] }
11
+
12
+ describe ".invoke", :sandbox do
13
+
14
+ subject { try_in_sandbox { task.invoke } }
15
+
16
+ it "loads the metric" do
17
+ expect(metric).to receive(:load)
18
+ subject
19
+ end
20
+
21
+ it "runs tests" do
22
+ expect { subject }.to change { commands }.to ["rake test"]
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+
3
+ describe "Rake::Task['check:coverage']", :tasks do
4
+
5
+ # The {#task_invoked?} helper is defined in the spec/support/config/tasks.rb
6
+ # It checks if a task has been invoked.
7
+
8
+ let(:task) { Rake::Task["check:coverage"] }
9
+
10
+ describe ".invoke", :sandbox do
11
+
12
+ subject { try_in_sandbox { task.invoke } }
13
+
14
+ it "invokes check:coverage:run" do
15
+ expect { subject }
16
+ .to change { task_invoked? "check:coverage:run" }
17
+ .to(true)
18
+ end
19
+
20
+ it "invokes check:coverage:display" do
21
+ expect { subject }
22
+ .to change { task_invoked? "check:coverage:display" }
23
+ .to(true)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,50 @@
1
+ # encoding: utf-8
2
+
3
+ describe "Rake::Task['check:display']", :tasks do
4
+
5
+ # The {#task_invoked?} helper is defined in the spec/support/config/tasks.rb
6
+ # It checks if a task has been invoked.
7
+
8
+ let(:task) { Rake::Task["check:display"] }
9
+
10
+ describe ".invoke", :sandbox do
11
+
12
+ subject { try_in_sandbox { task.invoke } }
13
+
14
+ it "invokes check:inch" do
15
+ expect { subject }
16
+ .to change { task_invoked? "check:inch" }
17
+ .to(true)
18
+ end
19
+
20
+ it "invokes check:rubocop:display" do
21
+ expect { subject }
22
+ .to change { task_invoked? "check:rubocop:display" }
23
+ .to(true)
24
+ end
25
+
26
+ it "invokes check:fu:display" do
27
+ expect { subject }
28
+ .to change { task_invoked? "check:fu:display" }
29
+ .to(true)
30
+ end
31
+
32
+ it "invokes check:coverage:display" do
33
+ expect { subject }
34
+ .to change { task_invoked? "check:coverage:display" }
35
+ .to(true)
36
+ end
37
+
38
+ it "invokes check:pippi:display" do
39
+ expect { subject }
40
+ .to change { task_invoked? "check:pippi:display" }
41
+ .to(true)
42
+ end
43
+
44
+ it "invokes check:yardstick:display" do
45
+ expect { subject }
46
+ .to change { task_invoked? "check:yardstick:display" }
47
+ .to(true)
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+
3
+ describe "Rake::Task['check:fu:display']", :tasks do
4
+
5
+ # The {#commands} variable is defined in the spec/support/config/tasks.rb
6
+ # It collects the list of commands, that has been sent to system by
7
+ # any instance of Hexx::Suit::Utils::System utility.
8
+
9
+ let(:metric) { Hexx::Suit::Metrics::MetricFu }
10
+ let(:task) { Rake::Task["check:fu:display"] }
11
+
12
+ describe ".invoke", :sandbox do
13
+
14
+ let(:subject) { try_in_sandbox { task.invoke } }
15
+
16
+ it "loads the metric" do
17
+ expect(metric).to receive(:load)
18
+ subject
19
+ end
20
+
21
+ context "without metric_fu.yml" do
22
+
23
+ it "opens the metric" do
24
+ expect { subject }
25
+ .to change { commands }
26
+ .to ["metric_fu --open --out tmp/metric_fu"]
27
+ end
28
+ end
29
+
30
+ context "with metric_fu.yml" do
31
+
32
+ let(:options) { { "output" => "custom" } }
33
+ before { prepare_settings options, "config/metrics/metric_fu.yml" }
34
+
35
+ it "uses custom output" do
36
+ expect { subject }
37
+ .to change { commands }
38
+ .to ["metric_fu --open --out custom"]
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+
3
+ describe "Rake::Task['check:fu:run']", :tasks do
4
+
5
+ # The {#commands} variable is defined in the spec/support/config/tasks.rb
6
+ # It collects the list of commands, that has been sent to system by
7
+ # any instance of Hexx::Suit::Utils::System utility.
8
+
9
+ let(:metric) { Hexx::Suit::Metrics::MetricFu }
10
+ let(:task) { Rake::Task["check:fu:run"] }
11
+
12
+ describe ".invoke", :sandbox do
13
+
14
+ let(:subject) { try_in_sandbox { task.invoke } }
15
+
16
+ it "loads the metric" do
17
+ expect(metric).to receive(:load)
18
+ subject
19
+ end
20
+
21
+ context "without metric_fu.yml" do
22
+
23
+ it "runs the metric" do
24
+ expect { subject }
25
+ .to change { commands }
26
+ .to ["metric_fu --no-open --out tmp/metric_fu"]
27
+ end
28
+ end
29
+
30
+ context "with metric_fu.yml" do
31
+
32
+ let(:options) { { "output" => "custom" } }
33
+ before { prepare_settings options, "config/metrics/metric_fu.yml" }
34
+
35
+ it "uses custom output" do
36
+ expect { subject }
37
+ .to change { commands }
38
+ .to ["metric_fu --no-open --out custom"]
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,18 @@
1
+ # encoding: utf-8
2
+
3
+ describe "Rake::Task['check:fu']", :tasks do
4
+
5
+ # The {#task_invoked?} helper is defined in the spec/support/config/tasks.rb
6
+ # It checks if a task has been invoked.
7
+
8
+ let(:task) { Rake::Task["check:fu"] }
9
+
10
+ describe ".invoke", :sandbox do
11
+
12
+ subject { try_in_sandbox { task.invoke } }
13
+
14
+ it "invokes check:fu:run" do
15
+ expect { subject }.to change { task_invoked? "check:fu:display" }.to true
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+
3
+ describe "Rake::Task['check:inch']", :tasks do
4
+
5
+ # The {#commands} variable is defined in the spec/support/config/tasks.rb
6
+ # It collects the list of commands, that has been sent to system by
7
+ # any instance of Hexx::Suit::Utils::System utility.
8
+
9
+ let(:task) { Rake::Task["check:inch"] }
10
+
11
+ describe ".invoke", :sandbox do
12
+
13
+ subject { try_in_sandbox { task.invoke } }
14
+
15
+ it "runs inch metric" do
16
+ expect { subject }.to change { commands }.to ["inch --pedantic"]
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,47 @@
1
+ # encoding: utf-8
2
+
3
+ describe "Rake::Task['check:pippi:display']", :tasks do
4
+
5
+ # The {#commands} variable is defined in the spec/support/config/tasks.rb
6
+ # It collects the list of commands, that has been sent to system by
7
+ # any instance of Hexx::Suit::Utils::System utility.
8
+
9
+ let(:metric) { Hexx::Suit::Metrics::Pippi }
10
+ let(:task) { Rake::Task["check:pippi:display"] }
11
+
12
+ describe ".invoke", :sandbox do
13
+
14
+ subject { try_in_sandbox { task.invoke } }
15
+
16
+ context "when '.metrics.yml' is absent" do
17
+
18
+ it "loads the metric" do
19
+ expect(metric).to receive(:load)
20
+ subject
21
+ end
22
+
23
+ it "displays the output" do
24
+ expect { subject }
25
+ .to change { commands.include? "cat tmp/pippi/output.log" }
26
+ .to true
27
+ end
28
+ end
29
+
30
+ context "when '.metrics.yml' is present" do
31
+
32
+ let(:options) { { "output" => "custom/pippi.log" } }
33
+ before { prepare_settings options, "config/metrics/pippi.yml" }
34
+
35
+ it "loads the metric" do
36
+ expect(metric).to receive(:load)
37
+ subject
38
+ end
39
+
40
+ it "uses the custom output" do
41
+ expect { subject }
42
+ .to change { commands.include? "cat #{ options['output'] }" }
43
+ .to true
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+
3
+ describe "Rake::Task['check:pippi:run']", :tasks do
4
+
5
+ # The {#commands} variable is defined in the spec/support/config/tasks.rb
6
+ # It collects the list of commands, that has been sent to system by
7
+ # any instance of Hexx::Suit::Utils::System utility.
8
+
9
+ let(:metric) { Hexx::Suit::Metrics::Pippi }
10
+ let(:task) { Rake::Task["check:pippi:run"] }
11
+
12
+ describe ".invoke", :sandbox do
13
+
14
+ subject { try_in_sandbox { task.invoke } }
15
+
16
+ it "loads the metric" do
17
+ expect(metric).to receive(:load)
18
+ subject
19
+ end
20
+
21
+ it "runs tests" do
22
+ expect { subject }.to change { commands.include? "rake test" }.to true
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+
3
+ describe "Rake::Task['check:pippi']", :tasks do
4
+
5
+ # The {#task_invoked?} helper is defined in the spec/support/config/tasks.rb
6
+ # It checks if a task has been invoked.
7
+
8
+ let(:task) { Rake::Task["check:pippi"] }
9
+
10
+ describe ".invoke", :sandbox do
11
+
12
+ subject { try_in_sandbox { task.invoke } }
13
+
14
+ it "invokes check:pippi:run" do
15
+ expect { subject }
16
+ .to change { task_invoked? "check:pippi:run" }
17
+ .to(true)
18
+ end
19
+
20
+ it "invokes check:pippi:display" do
21
+ expect { subject }
22
+ .to change { task_invoked? "check:pippi:display" }
23
+ .to(true)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,61 @@
1
+ # encoding: utf-8
2
+
3
+ describe "Rake::Task['check:rubocop:display']", :tasks do
4
+
5
+ # The {#commands} variable is defined in the spec/support/config/tasks.rb
6
+ # It collects the list of commands, that has been sent to system by
7
+ # any instance of Hexx::Suit::Utils::System utility.
8
+
9
+ let(:task) { Rake::Task["check:rubocop:display"] }
10
+
11
+ shared_context "without rubocop.yml" do
12
+
13
+ let(:options) { { "output" => "tmp/rubocop/index.html" } }
14
+ end
15
+
16
+ shared_context "with rubocop.yml" do
17
+
18
+ let(:options) { { "output" => "custom/rubocop.html" } }
19
+
20
+ before { prepare_settings options, "config/metrics/rubocop.yml" }
21
+ end
22
+
23
+ shared_examples "metric loader" do
24
+
25
+ after { subject }
26
+
27
+ it "[loads rubocop]" do
28
+ expect(Hexx::Suit::Metrics::Rubocop).to receive :load
29
+ end
30
+ end
31
+
32
+ shared_examples "results displayer" do
33
+
34
+ it "displays rubocop results" do
35
+ expect { subject }
36
+ .to change { commands }
37
+ .to ["launchy #{ options["output"] }"]
38
+ end
39
+ end
40
+
41
+ describe ".invoke", :sandbox do
42
+
43
+ subject { try_in_sandbox { task.invoke } }
44
+
45
+ context "when .metrics.yml is absent" do
46
+
47
+ include_context "without rubocop.yml"
48
+
49
+ it_behaves_like "metric loader"
50
+ it_behaves_like "results displayer"
51
+ end
52
+
53
+ context "when .metrics.yml is present" do
54
+
55
+ include_context "with rubocop.yml"
56
+
57
+ it_behaves_like "metric loader"
58
+ it_behaves_like "results displayer"
59
+ end
60
+ end
61
+ end