hexx 7.1.0 → 8.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +2 -0
  3. data/.gitignore +9 -0
  4. data/.metrics +5 -0
  5. data/.rspec +2 -0
  6. data/.rubocop.yml +2 -63
  7. data/.travis.yml +5 -0
  8. data/.yardopts +2 -0
  9. data/Gemfile +3 -0
  10. data/Guardfile +16 -0
  11. data/{LICENSE.rdoc → LICENSE} +2 -2
  12. data/README.md +138 -0
  13. data/Rakefile +8 -14
  14. data/config/initializer.rb +5 -0
  15. data/config/initializers/capture.rb +19 -0
  16. data/config/initializers/sandbox.rb +16 -0
  17. data/config/initializers/sandbox/helpers.rb +38 -0
  18. data/config/initializers/sandbox/matchers.rb +19 -0
  19. data/config/metrics/STYLEGUIDE +230 -0
  20. data/config/metrics/cane.yml +5 -0
  21. data/config/metrics/churn.yml +6 -0
  22. data/config/metrics/flay.yml +2 -0
  23. data/config/metrics/metric_fu.yml +15 -0
  24. data/config/metrics/pippi.yml +3 -0
  25. data/config/metrics/reek.yml +1 -0
  26. data/config/metrics/roodi.yml +24 -0
  27. data/config/metrics/rubocop.yml +79 -0
  28. data/config/metrics/saikuro.yml +3 -0
  29. data/config/metrics/simplecov.yml +6 -0
  30. data/config/metrics/yardstick.yml +37 -0
  31. data/hexx.gemspec +24 -0
  32. data/lib/hexx.rb +8 -15
  33. data/lib/hexx/generator.rb +71 -0
  34. data/lib/hexx/generator/file.rb +83 -0
  35. data/lib/hexx/generator/folder.rb +68 -0
  36. data/lib/hexx/name.rb +122 -46
  37. data/lib/hexx/version.rb +6 -5
  38. data/spec/fixtures/root/_.beta +1 -0
  39. data/spec/fixtures/root/__omega +0 -0
  40. data/spec/fixtures/root/delta.erb.erb +0 -0
  41. data/spec/fixtures/root/gamma.rb.erb +1 -0
  42. data/spec/fixtures/root/subfolder/alfa.yml +0 -0
  43. data/spec/spec_helper.rb +5 -10
  44. data/spec/tests/lib/generator_spec.rb +126 -0
  45. data/spec/tests/lib/name_spec.rb +113 -0
  46. metadata +54 -168
  47. data/README.rdoc +0 -371
  48. data/lib/hexx/coercible.rb +0 -43
  49. data/lib/hexx/configurable.rb +0 -101
  50. data/lib/hexx/creators/base.rb +0 -103
  51. data/lib/hexx/creators/coercion.rb +0 -82
  52. data/lib/hexx/creators/dependency.rb +0 -87
  53. data/lib/hexx/creators/module_dependency.rb +0 -57
  54. data/lib/hexx/creators/parameter.rb +0 -40
  55. data/lib/hexx/dependable.rb +0 -51
  56. data/lib/hexx/helpers/exceptions.rb +0 -53
  57. data/lib/hexx/helpers/messages.rb +0 -26
  58. data/lib/hexx/helpers/parameters.rb +0 -47
  59. data/lib/hexx/helpers/validations.rb +0 -21
  60. data/lib/hexx/message.rb +0 -79
  61. data/lib/hexx/null.rb +0 -218
  62. data/lib/hexx/service.rb +0 -388
  63. data/lib/hexx/service/with_callbacks.rb +0 -104
  64. data/lib/hexx/service_invalid.rb +0 -73
  65. data/spec/hexx/coercible_spec.rb +0 -72
  66. data/spec/hexx/configurable_spec.rb +0 -93
  67. data/spec/hexx/dependable_spec.rb +0 -125
  68. data/spec/hexx/helpers/exceptions_spec.rb +0 -96
  69. data/spec/hexx/helpers/messages_spec.rb +0 -48
  70. data/spec/hexx/helpers/parameters_spec.rb +0 -96
  71. data/spec/hexx/helpers/validations_spec.rb +0 -32
  72. data/spec/hexx/message_spec.rb +0 -83
  73. data/spec/hexx/name_spec.rb +0 -80
  74. data/spec/hexx/null_spec.rb +0 -152
  75. data/spec/hexx/service_invalid_spec.rb +0 -46
  76. data/spec/hexx/service_spec.rb +0 -89
  77. data/spec/support/initializers/focus.rb +0 -5
  78. data/spec/support/initializers/garbage_collection.rb +0 -11
  79. data/spec/support/initializers/i18n.rb +0 -3
  80. data/spec/support/initializers/random_order.rb +0 -4
  81. data/spec/support/initializers/rspec.rb +0 -5
  82. data/spec/support/matchers/methods.rb +0 -11
@@ -1,46 +0,0 @@
1
- require "spec_helper"
2
-
3
- module Hexx
4
- describe ServiceInvalid do
5
-
6
- let(:service) { Service.new }
7
- let(:error) { Hexx::Message.new(type: "error", text: "some error") }
8
-
9
- describe ".new" do
10
-
11
- subject { Invalid }
12
-
13
- it "fails if no arguments given" do
14
- expect { described_class.new }.to raise_error ArgumentError
15
- end
16
-
17
- it "initializes the #service" do
18
- expect { described_class.new Service.new }.not_to raise_error
19
- end
20
- end
21
-
22
- describe "#messages" do
23
-
24
- subject { described_class.new(service).messages }
25
- let(:message) { subject.first }
26
-
27
- it "returns an array" do
28
- expect(subject).to be_kind_of Array
29
- end
30
-
31
- it "returns error messages" do
32
- service.errors.send :add, :base, error.text
33
- expect(message).to eq error
34
- end
35
- end
36
-
37
- describe "#message" do
38
-
39
- subject { described_class.new(service).message }
40
-
41
- it "returns a proper message" do
42
- expect(subject).to eq "Service invalid: #{ service.inspect }"
43
- end
44
- end
45
- end
46
- end
@@ -1,89 +0,0 @@
1
- require "spec_helper"
2
-
3
- module Hexx
4
- describe Service do
5
-
6
- around :each do |example|
7
- class Test < Service
8
- attr_reader :on_something, :something
9
- private :on_something, :something
10
- end
11
- example.run
12
- Hexx.send :remove_const, :Test
13
- end
14
-
15
- let!(:described_class) { Test }
16
-
17
- it "includes Whisper::Publisher" do
18
- expect(subject).to be_kind_of Wisper::Publisher
19
- end
20
-
21
- it "includes helpers from Parameters" do
22
- expect(described_class).to include Hexx::Helpers::Parameters
23
- expect(described_class).to have_private_method :allow_params
24
- expect(subject).to have_private_method :params
25
- end
26
-
27
- it "includes helpers from Messages" do
28
- expect(described_class).to include Hexx::Helpers::Messages
29
- expect(subject).to have_public_method :messages
30
- expect(subject).to have_private_method :add_message
31
- expect(subject).to have_private_method :t
32
- end
33
-
34
- it "includes helpers from Validations" do
35
- expect(described_class).to include Hexx::Helpers::Validations
36
- expect(subject).to have_private_method :validate!
37
- end
38
-
39
- it "includes helpers from Exceptions" do
40
- expect(described_class).to include Hexx::Helpers::Exceptions
41
- expect(described_class).to have_private_method :raises
42
- expect(subject).to have_private_method :on_error
43
- expect(subject).to have_private_method :escape
44
- end
45
-
46
- it "doesn't extend Hexx::Dependable by default" do
47
- expect(described_class).not_to be_kind_of Hexx::Dependable
48
- end
49
-
50
- describe ".new" do
51
-
52
- before { described_class.send :allow_params, :name }
53
- subject { described_class.new(name: "name", code: "code") }
54
-
55
- it "assigns params properly" do
56
- expect(subject.send :params).to eq("name" => "name")
57
- end
58
- end
59
-
60
- describe "#run" do
61
-
62
- it "is defined" do
63
- expect(subject).to respond_to :run
64
- end
65
- end
66
-
67
- describe "##run_service" do
68
-
69
- def service_spy(result)
70
- object = described_class.new
71
- allow(object).to receive(:run) { object.send :publish, result }
72
- class_spy described_class.name, new: object
73
- end
74
-
75
- let(:other_service_class) { service_spy :result }
76
- before { allow(subject).to receive(:on_service_result) }
77
-
78
- it "if wrong class given it fails with TypeError" do
79
- expect { subject.send :run_service, String, :on_string }
80
- .to raise_error { TypeError }
81
- end
82
-
83
- it "receives notifications from a service object" do
84
- subject.send :run_service, other_service_class, :on_service
85
- expect(subject).to have_received(:on_service_result)
86
- end
87
- end
88
- end
89
- end
@@ -1,5 +0,0 @@
1
- # Running only tests tagged by :focus
2
- RSpec.configure do |config|
3
- config.filter_run focus: true
4
- config.run_all_when_everything_filtered = true
5
- end
@@ -1,11 +0,0 @@
1
- # Delaying garbage collection to the end of tests
2
- RSpec.configure do |config|
3
-
4
- config.before(:each) do
5
- GC.disable
6
- end
7
-
8
- config.after(:each) do
9
- GC.enable
10
- end
11
- end
@@ -1,3 +0,0 @@
1
- require "i18n"
2
-
3
- I18n.enforce_available_locales = false
@@ -1,4 +0,0 @@
1
- # Running tests in a random order
2
- RSpec.configure do |config|
3
- config.order = "random"
4
- end
@@ -1,5 +0,0 @@
1
- RSpec.configure do |config|
2
- config.mock_with :rspec do |mocks|
3
- mocks.yield_receiver_to_any_instance_implementation_blocks = false
4
- end
5
- end
@@ -1,11 +0,0 @@
1
- RSpec::Matchers.define :have_private_method do |name|
2
- match do |object|
3
- expect(object.private_methods).to include(name)
4
- end
5
- end
6
-
7
- RSpec::Matchers.define :have_public_method do |name|
8
- match do |object|
9
- expect(object.public_methods).to include(name)
10
- end
11
- end