muina 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/main.yml +16 -0
  3. data/.gitignore +5 -0
  4. data/.mutant.yml +38 -0
  5. data/.rspec +4 -0
  6. data/.rubocop.yml +172 -0
  7. data/.ruby-version +1 -0
  8. data/.simplecov +14 -0
  9. data/CHANGELOG.md +38 -0
  10. data/Gemfile +34 -0
  11. data/Gemfile.lock +265 -0
  12. data/Guardfile +24 -0
  13. data/README.md +36 -0
  14. data/Rakefile +13 -0
  15. data/SECURITY.md +14 -0
  16. data/bin/bundle +114 -0
  17. data/bin/console +15 -0
  18. data/bin/flay +29 -0
  19. data/bin/flog +29 -0
  20. data/bin/guard +29 -0
  21. data/bin/irb +29 -0
  22. data/bin/lefthook +29 -0
  23. data/bin/mutant +29 -0
  24. data/bin/parlour +29 -0
  25. data/bin/rake +29 -0
  26. data/bin/rspec +29 -0
  27. data/bin/rubocop +29 -0
  28. data/bin/setup +8 -0
  29. data/bin/srb +29 -0
  30. data/bin/srb-rbi +29 -0
  31. data/bin/tapioca +29 -0
  32. data/exe/muina +11 -0
  33. data/lefthook.yml +39 -0
  34. data/lib/muina/action/params_factory.rb +17 -0
  35. data/lib/muina/action/step/command.rb +31 -0
  36. data/lib/muina/action/step/failure.rb +18 -0
  37. data/lib/muina/action/step/query.rb +31 -0
  38. data/lib/muina/action/step/result.rb +51 -0
  39. data/lib/muina/action/step.rb +13 -0
  40. data/lib/muina/action.rb +73 -0
  41. data/lib/muina/any.rb +7 -0
  42. data/lib/muina/classes.rb +7 -0
  43. data/lib/muina/module.rb +6 -0
  44. data/lib/muina/parameters.rb +7 -0
  45. data/lib/muina/params.rb +19 -0
  46. data/lib/muina/private_creation.rb +12 -0
  47. data/lib/muina/result/factory.rb +37 -0
  48. data/lib/muina/result/failure.rb +31 -0
  49. data/lib/muina/result/null.rb +25 -0
  50. data/lib/muina/result/success.rb +31 -0
  51. data/lib/muina/result.rb +17 -0
  52. data/lib/muina/service.rb +37 -0
  53. data/lib/muina/symbol_hash.rb +7 -0
  54. data/lib/muina/unit.rb +10 -0
  55. data/lib/muina/untyped_array.rb +7 -0
  56. data/lib/muina/untyped_hash.rb +7 -0
  57. data/lib/muina/value.rb +16 -0
  58. data/lib/muina/version.rb +7 -0
  59. data/lib/muina.rb +42 -0
  60. data/muina.gemspec +35 -0
  61. data/rbi/muina.rbi +268 -0
  62. data/sorbet/config +2 -0
  63. data/sorbet/rbi/gems/actionpack@6.1.4.rbi +5045 -0
  64. data/sorbet/rbi/gems/actionview@6.1.4.rbi +2416 -0
  65. data/sorbet/rbi/gems/activesupport@6.1.4.rbi +3778 -0
  66. data/sorbet/rbi/gems/ast@2.4.2.rbi +54 -0
  67. data/sorbet/rbi/gems/awesome_print@1.9.2.rbi +322 -0
  68. data/sorbet/rbi/gems/builder@3.2.4.rbi +8 -0
  69. data/sorbet/rbi/gems/byebug@11.1.3.rbi +18 -0
  70. data/sorbet/rbi/gems/coderay@1.1.3.rbi +8 -0
  71. data/sorbet/rbi/gems/colorize@0.8.1.rbi +39 -0
  72. data/sorbet/rbi/gems/commander@4.6.0.rbi +8 -0
  73. data/sorbet/rbi/gems/concurrent-ruby@1.1.9.rbi +2403 -0
  74. data/sorbet/rbi/gems/crass@1.0.6.rbi +123 -0
  75. data/sorbet/rbi/gems/diff-lcs@1.4.4.rbi +185 -0
  76. data/sorbet/rbi/gems/docile@1.4.0.rbi +54 -0
  77. data/sorbet/rbi/gems/erubi@1.10.0.rbi +36 -0
  78. data/sorbet/rbi/gems/erubis@2.7.0.rbi +8 -0
  79. data/sorbet/rbi/gems/faker@2.18.0.rbi +2469 -0
  80. data/sorbet/rbi/gems/ffi@1.15.3.rbi +8 -0
  81. data/sorbet/rbi/gems/flay@2.12.1.rbi +178 -0
  82. data/sorbet/rbi/gems/flog@4.6.4.rbi +70 -0
  83. data/sorbet/rbi/gems/formatador@0.3.0.rbi +8 -0
  84. data/sorbet/rbi/gems/guard-compat@1.2.1.rbi +49 -0
  85. data/sorbet/rbi/gems/guard-rspec@4.7.3.rbi +233 -0
  86. data/sorbet/rbi/gems/guard-rubocop@1.4.0.rbi +66 -0
  87. data/sorbet/rbi/gems/guard-shell@0.7.2.rbi +69 -0
  88. data/sorbet/rbi/gems/guard@2.18.0.rbi +617 -0
  89. data/sorbet/rbi/gems/highline@2.0.3.rbi +8 -0
  90. data/sorbet/rbi/gems/i18n@1.8.10.rbi +616 -0
  91. data/sorbet/rbi/gems/io-console@0.5.9.rbi +8 -0
  92. data/sorbet/rbi/gems/irb@1.3.6.rbi +452 -0
  93. data/sorbet/rbi/gems/lefthook@0.7.6.rbi +8 -0
  94. data/sorbet/rbi/gems/listen@3.6.0.rbi +476 -0
  95. data/sorbet/rbi/gems/loofah@2.10.0.rbi +223 -0
  96. data/sorbet/rbi/gems/lumberjack@1.2.8.rbi +431 -0
  97. data/sorbet/rbi/gems/method_source@1.0.0.rbi +8 -0
  98. data/sorbet/rbi/gems/minitest@5.14.4.rbi +344 -0
  99. data/sorbet/rbi/gems/mutant-license@0.1.1.1.4043027289354708743625974235631451632228.0.rbi +8 -0
  100. data/sorbet/rbi/gems/mutant-rspec@0.10.32.rbi +8 -0
  101. data/sorbet/rbi/gems/mutant@0.10.32.rbi +4154 -0
  102. data/sorbet/rbi/gems/nenv@0.3.0.rbi +88 -0
  103. data/sorbet/rbi/gems/nokogiri@1.11.7.rbi +1422 -0
  104. data/sorbet/rbi/gems/notiffany@0.1.3.rbi +331 -0
  105. data/sorbet/rbi/gems/parallel@1.20.1.rbi +113 -0
  106. data/sorbet/rbi/gems/parlour@6.0.1.rbi +1726 -0
  107. data/sorbet/rbi/gems/parser@3.0.2.0.rbi +1683 -0
  108. data/sorbet/rbi/gems/path_expander@1.1.0.rbi +24 -0
  109. data/sorbet/rbi/gems/polyfill@1.9.0.rbi +393 -0
  110. data/sorbet/rbi/gems/pry@0.14.1.rbi +8 -0
  111. data/sorbet/rbi/gems/racc@1.5.2.rbi +47 -0
  112. data/sorbet/rbi/gems/rack-test@1.1.0.rbi +272 -0
  113. data/sorbet/rbi/gems/rack@2.2.3.rbi +1618 -0
  114. data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +92 -0
  115. data/sorbet/rbi/gems/rails-html-sanitizer@1.3.0.rbi +183 -0
  116. data/sorbet/rbi/gems/rainbow@3.0.0.rbi +153 -0
  117. data/sorbet/rbi/gems/rake@13.0.6.rbi +808 -0
  118. data/sorbet/rbi/gems/rb-fsevent@0.11.0.rbi +8 -0
  119. data/sorbet/rbi/gems/rb-inotify@0.10.1.rbi +8 -0
  120. data/sorbet/rbi/gems/regexp_parser@2.1.1.rbi +1120 -0
  121. data/sorbet/rbi/gems/reline@0.2.6.rbi +662 -0
  122. data/sorbet/rbi/gems/rexml@3.2.5.rbi +672 -0
  123. data/sorbet/rbi/gems/rspec-core@3.10.1.rbi +2509 -0
  124. data/sorbet/rbi/gems/rspec-expectations@3.10.1.rbi +1574 -0
  125. data/sorbet/rbi/gems/rspec-mocks@3.10.2.rbi +1462 -0
  126. data/sorbet/rbi/gems/rspec-support@3.10.2.rbi +509 -0
  127. data/sorbet/rbi/gems/rspec@3.10.0.rbi +38 -0
  128. data/sorbet/rbi/gems/rubocop-ast@1.8.0.rbi +2194 -0
  129. data/sorbet/rbi/gems/rubocop-performance@1.11.4.rbi +899 -0
  130. data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +118 -0
  131. data/sorbet/rbi/gems/rubocop-rspec@2.4.0.rbi +1805 -0
  132. data/sorbet/rbi/gems/rubocop-sorbet@0.6.2.rbi +288 -0
  133. data/sorbet/rbi/gems/rubocop@1.18.4.rbi +13197 -0
  134. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +405 -0
  135. data/sorbet/rbi/gems/ruby_parser@3.16.0.rbi +4528 -0
  136. data/sorbet/rbi/gems/safe_type@1.1.1.rbi +157 -0
  137. data/sorbet/rbi/gems/sexp_processor@4.15.3.rbi +359 -0
  138. data/sorbet/rbi/gems/shellany@0.0.1.rbi +28 -0
  139. data/sorbet/rbi/gems/simplecov-html@0.12.3.rbi +89 -0
  140. data/sorbet/rbi/gems/simplecov@0.21.2.rbi +577 -0
  141. data/sorbet/rbi/gems/simplecov_json_formatter@0.1.3.rbi +8 -0
  142. data/sorbet/rbi/gems/sorbet-coerce@0.5.0.rbi +42 -0
  143. data/sorbet/rbi/gems/sorbet-rails@0.7.4.rbi +8 -0
  144. data/sorbet/rbi/gems/sorbet-struct-comparable@1.1.0.rbi +17 -0
  145. data/sorbet/rbi/gems/spoom@1.1.1.rbi +1193 -0
  146. data/sorbet/rbi/gems/tapioca@0.4.23.rbi +1826 -0
  147. data/sorbet/rbi/gems/thor@1.1.0.rbi +838 -0
  148. data/sorbet/rbi/gems/tzinfo@2.0.4.rbi +856 -0
  149. data/sorbet/rbi/gems/unicode-display_width@2.0.0.rbi +26 -0
  150. data/sorbet/rbi/gems/unparser@0.6.0.rbi +2037 -0
  151. data/sorbet/rbi/gems/zeitwerk@2.4.2.rbi +173 -0
  152. data/sorbet/rbi/todo.rbi +8 -0
  153. data/sorbet/rbi/typed_params.rbi +7 -0
  154. data/sorbet/tapioca/require.rb +16 -0
  155. metadata +269 -0
data/bin/bundle ADDED
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'bundle' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "rubygems"
12
+
13
+ m = Module.new do
14
+ module_function
15
+
16
+ def invoked_as_script?
17
+ File.expand_path($0) == File.expand_path(__FILE__)
18
+ end
19
+
20
+ def env_var_version
21
+ ENV["BUNDLER_VERSION"]
22
+ end
23
+
24
+ def cli_arg_version
25
+ return unless invoked_as_script? # don't want to hijack other binstubs
26
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27
+ bundler_version = nil
28
+ update_index = nil
29
+ ARGV.each_with_index do |a, i|
30
+ if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31
+ bundler_version = a
32
+ end
33
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34
+ bundler_version = $1
35
+ update_index = i
36
+ end
37
+ bundler_version
38
+ end
39
+
40
+ def gemfile
41
+ gemfile = ENV["BUNDLE_GEMFILE"]
42
+ return gemfile if gemfile && !gemfile.empty?
43
+
44
+ File.expand_path("../../Gemfile", __FILE__)
45
+ end
46
+
47
+ def lockfile
48
+ lockfile =
49
+ case File.basename(gemfile)
50
+ when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
51
+ else "#{gemfile}.lock"
52
+ end
53
+ File.expand_path(lockfile)
54
+ end
55
+
56
+ def lockfile_version
57
+ return unless File.file?(lockfile)
58
+ lockfile_contents = File.read(lockfile)
59
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60
+ Regexp.last_match(1)
61
+ end
62
+
63
+ def bundler_version
64
+ @bundler_version ||=
65
+ env_var_version || cli_arg_version ||
66
+ lockfile_version
67
+ end
68
+
69
+ def bundler_requirement
70
+ return "#{Gem::Requirement.default}.a" unless bundler_version
71
+
72
+ bundler_gem_version = Gem::Version.new(bundler_version)
73
+
74
+ requirement = bundler_gem_version.approximate_recommendation
75
+
76
+ return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0")
77
+
78
+ requirement += ".a" if bundler_gem_version.prerelease?
79
+
80
+ requirement
81
+ end
82
+
83
+ def load_bundler!
84
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
85
+
86
+ activate_bundler
87
+ end
88
+
89
+ def activate_bundler
90
+ gem_error = activation_error_handling do
91
+ gem "bundler", bundler_requirement
92
+ end
93
+ return if gem_error.nil?
94
+ require_error = activation_error_handling do
95
+ require "bundler/version"
96
+ end
97
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
98
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
99
+ exit 42
100
+ end
101
+
102
+ def activation_error_handling
103
+ yield
104
+ nil
105
+ rescue StandardError, LoadError => e
106
+ e
107
+ end
108
+ end
109
+
110
+ m.load_bundler!
111
+
112
+ if m.invoked_as_script?
113
+ load Gem.bin_path("bundler", "bundle")
114
+ end
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'muina'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/flay ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'flay' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path('bundle', __dir__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require 'rubygems'
27
+ require 'bundler/setup'
28
+
29
+ load Gem.bin_path('flay', 'flay')
data/bin/flog ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'flog' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("flog", "flog")
data/bin/guard ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'guard' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("guard", "guard")
data/bin/irb ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'irb' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("irb", "irb")
data/bin/lefthook ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'lefthook' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path('bundle', __dir__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require 'rubygems'
27
+ require 'bundler/setup'
28
+
29
+ load Gem.bin_path('lefthook', 'lefthook')
data/bin/mutant ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'mutant' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path('bundle', __dir__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require 'rubygems'
27
+ require 'bundler/setup'
28
+
29
+ load Gem.bin_path('mutant', 'mutant')
data/bin/parlour ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'parlour' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("parlour", "parlour")
data/bin/rake ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rake' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rake", "rake")
data/bin/rspec ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path('bundle', __dir__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require 'rubygems'
27
+ require 'bundler/setup'
28
+
29
+ load Gem.bin_path('rspec-core', 'rspec')
data/bin/rubocop ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rubocop' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path('bundle', __dir__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require 'rubygems'
27
+ require 'bundler/setup'
28
+
29
+ load Gem.bin_path('rubocop', 'rubocop')
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/bin/srb ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'srb' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path('bundle', __dir__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require 'rubygems'
27
+ require 'bundler/setup'
28
+
29
+ load Gem.bin_path('sorbet', 'srb')
data/bin/srb-rbi ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'srb-rbi' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path('bundle', __dir__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require 'rubygems'
27
+ require 'bundler/setup'
28
+
29
+ load Gem.bin_path('sorbet', 'srb-rbi')
data/bin/tapioca ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'tapioca' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require 'pathname'
12
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path('bundle', __dir__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require 'rubygems'
27
+ require 'bundler/setup'
28
+
29
+ load Gem.bin_path('tapioca', 'tapioca')
data/exe/muina ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ # typed: strict
3
+ # frozen_string_literal: true
4
+
5
+ require 'fileutils'
6
+ require_relative '../lib/muina/version'
7
+
8
+ src = File.expand_path("#{File.dirname(__FILE__)}/../rbi/muina.rbi")
9
+ dst = File.expand_path("#{Dir.pwd}/sorbet/rbi/gems/muina@#{Muina::VERSION}.rbi")
10
+
11
+ FileUtils.cp src, dst
data/lefthook.yml ADDED
@@ -0,0 +1,39 @@
1
+ ---
2
+ pre-commit:
3
+ parallel: true
4
+ commands:
5
+ flay:
6
+ run: bin/flay -spec
7
+ rspec:
8
+ run: bin/rspec
9
+ rubocop:
10
+ run: bin/rubocop -fs
11
+ sorbet:
12
+ run: bin/srb tc
13
+
14
+
15
+ audit:
16
+ parallel: true
17
+ commands:
18
+ rspec:
19
+ run: bin/rspec
20
+ rubocop:
21
+ run: bin/rubocop -fs
22
+ sorbet:
23
+ run: bin/srb tc
24
+ flay:
25
+ run: bin/flay -spec
26
+
27
+ full_audit:
28
+ parallel: true
29
+ commands:
30
+ flay:
31
+ run: bin/flay -spec
32
+ mutant:
33
+ run: bin/mutant run
34
+ rspec:
35
+ run: bin/rspec
36
+ rubocop:
37
+ run: bin/rubocop -fs
38
+ sorbet:
39
+ run: bin/srb tc
@@ -0,0 +1,17 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Muina
5
+ class Action
6
+ # Cast params to ActionController::Parameters
7
+ module ParamsFactory
8
+ def self.build(params)
9
+ if params.instance_of?(Hash)
10
+ ActionController::Parameters.new(params)
11
+ else
12
+ params
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,31 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Muina
5
+ class Action
6
+ class Step < Value
7
+ # Commands are meant to run code with side effects and return no value.
8
+ class Command < self
9
+ def call(action = Object.new)
10
+ return if action.instance_variable_get(:@__failure__)
11
+
12
+ case result = Muina::Result() { action.instance_eval(&step) }
13
+ when Muina::Result::Success then success
14
+ when Muina::Result::Failure then failure(action, result)
15
+ else nil
16
+ end
17
+ end
18
+
19
+ private
20
+
21
+ def success
22
+ # noop
23
+ end
24
+
25
+ def failure(action, result)
26
+ action.instance_variable_set(:@__failure__, result)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,18 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Muina
5
+ class Action
6
+ class Step < Value
7
+ # Failures wrap the result into the Failure side of the Result Monad and won't run if result is already set
8
+ class Failure < self
9
+ def call(action = nil)
10
+ return if action.instance_variable_get(:@__result__) || !action.instance_variable_get(:@__failure__)
11
+
12
+ result = Muina::Failure(Muina::Result() { action.instance_eval(&step) }.value!)
13
+ action.instance_variable_set(:@__failure__, result)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,31 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Muina
5
+ class Action
6
+ class Step < Value
7
+ # Queries are meant to run side effect free code and return the resulting value wrapped in a Result::Success
8
+ class Query < self
9
+ const :name, Symbol
10
+
11
+ def call(action = Object.new)
12
+ return if action.instance_variable_get(:@__failure__)
13
+
14
+ case result = Muina::Result() { action.instance_eval(&step) }
15
+ when Muina::Result::Success then success(action, result)
16
+ when Muina::Result::Failure then failure(action, result)
17
+ else nil
18
+ end
19
+ end
20
+
21
+ def success(action, result)
22
+ action.instance_variable_set("@#{name}", result.value!)
23
+ end
24
+
25
+ def failure(action, result)
26
+ action.instance_variable_set(:@__failure__, result)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end