hanami 0.9.2 → 1.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/FEATURES.md +5 -0
  4. data/hanami.gemspec +8 -8
  5. data/lib/hanami.rb +25 -1
  6. data/lib/hanami/app.rb +4 -0
  7. data/lib/hanami/application.rb +1 -14
  8. data/lib/hanami/application_configuration.rb +2 -37
  9. data/lib/hanami/cli_base.rb +15 -0
  10. data/lib/hanami/cli_sub_commands/destroy.rb +2 -2
  11. data/lib/hanami/cli_sub_commands/generate.rb +2 -1
  12. data/lib/hanami/commands/generate/abstract.rb +5 -0
  13. data/lib/hanami/commands/generate/mailer.rb +2 -2
  14. data/lib/hanami/commands/generate/model.rb +24 -8
  15. data/lib/hanami/commands/new/abstract.rb +1 -1
  16. data/lib/hanami/commands/new/container.rb +1 -0
  17. data/lib/hanami/common_logger.rb +73 -0
  18. data/lib/hanami/components.rb +11 -0
  19. data/lib/hanami/components/app/controller.rb +1 -0
  20. data/lib/hanami/components/components.rb +73 -20
  21. data/lib/hanami/configuration.rb +12 -0
  22. data/lib/hanami/env.rb +2 -0
  23. data/lib/hanami/environment.rb +5 -1
  24. data/lib/hanami/generators/app/application.rb.tt +0 -30
  25. data/lib/hanami/generators/application/container/Gemfile.tt +0 -1
  26. data/lib/hanami/generators/application/container/config/boot.rb.tt +2 -0
  27. data/lib/hanami/generators/application/container/config/environment.rb.tt +14 -5
  28. data/lib/hanami/generators/database_config.rb +1 -1
  29. data/lib/hanami/generators/mailer/{mailer_spec.rb.tt → mailer_spec.rb.minitest.tt} +0 -0
  30. data/lib/hanami/generators/mailer/mailer_spec.rb.rspec.tt +5 -0
  31. data/lib/hanami/generators/model/migration.rb.tt +10 -0
  32. data/lib/hanami/mailer/glue.rb +4 -46
  33. data/lib/hanami/server.rb +4 -12
  34. data/lib/hanami/static.rb +4 -8
  35. data/lib/hanami/version.rb +1 -1
  36. metadata +25 -62
  37. data/lib/hanami/components/app/logger.rb +0 -30
  38. data/lib/hanami/config/logger.rb +0 -200
  39. data/lib/hanami/generators/application/app/.env.development.tt +0 -4
  40. data/lib/hanami/generators/application/app/.env.test.tt +0 -4
  41. data/lib/hanami/generators/application/app/.gitignore +0 -0
  42. data/lib/hanami/generators/application/app/.gitkeep +0 -1
  43. data/lib/hanami/generators/application/app/Gemfile.tt +0 -57
  44. data/lib/hanami/generators/application/app/Rakefile.minitest.tt +0 -12
  45. data/lib/hanami/generators/application/app/Rakefile.rspec.tt +0 -9
  46. data/lib/hanami/generators/application/app/apps/.gitkeep.tt +0 -1
  47. data/lib/hanami/generators/application/app/capybara.rb.rspec.tt +0 -8
  48. data/lib/hanami/generators/application/app/config.ru.tt +0 -3
  49. data/lib/hanami/generators/application/app/config/application.rb.tt +0 -347
  50. data/lib/hanami/generators/application/app/config/environment.rb.tt +0 -4
  51. data/lib/hanami/generators/application/app/config/initializers/.gitkeep +0 -0
  52. data/lib/hanami/generators/application/app/config/routes.rb.tt +0 -5
  53. data/lib/hanami/generators/application/app/db/.gitkeep +0 -1
  54. data/lib/hanami/generators/application/app/favicon.ico +0 -0
  55. data/lib/hanami/generators/application/app/features_helper.rb.minitest.tt +0 -11
  56. data/lib/hanami/generators/application/app/features_helper.rb.rspec.tt +0 -12
  57. data/lib/hanami/generators/application/app/gitignore.tt +0 -2
  58. data/lib/hanami/generators/application/app/gitignore_with_db.tt +0 -4
  59. data/lib/hanami/generators/application/app/gitignore_with_sqlite.tt +0 -3
  60. data/lib/hanami/generators/application/app/hanamirc.tt +0 -4
  61. data/lib/hanami/generators/application/app/lib/app_name.rb.tt +0 -35
  62. data/lib/hanami/generators/application/app/lib/chirp/entities/.gitkeep +0 -1
  63. data/lib/hanami/generators/application/app/lib/chirp/repositories/.gitkeep +0 -1
  64. data/lib/hanami/generators/application/app/rspec.rspec.tt +0 -2
  65. data/lib/hanami/generators/application/app/schema.sql.tt +0 -0
  66. data/lib/hanami/generators/application/app/spec_helper.rb.minitest.tt +0 -7
  67. data/lib/hanami/generators/application/app/spec_helper.rb.rspec.tt +0 -104
  68. data/lib/hanami/generators/application/app/templates/application.html.erb.tt +0 -10
  69. data/lib/hanami/generators/application/app/templates/application.html.haml.tt +0 -7
  70. data/lib/hanami/generators/application/app/templates/application.html.slim.tt +0 -8
  71. data/lib/hanami/generators/application/app/views/application_layout.rb.tt +0 -7
@@ -1,4 +0,0 @@
1
- require 'bundler/setup'
2
- require 'hanami/setup'
3
- require_relative '../lib/<%= config[:app_name] %>'
4
- require_relative '../config/application'
@@ -1,5 +0,0 @@
1
- # Configure your routes here
2
- # See: http://hanamirb.org/guides/routing/overview/
3
- #
4
- # Example:
5
- # get '/hello', to: ->(env) { [200, {}, ['Hello from Hanami!']] }
@@ -1,11 +0,0 @@
1
- # Require this file for feature tests
2
- require_relative './spec_helper'
3
-
4
- require 'capybara'
5
- require 'capybara/dsl'
6
-
7
- Capybara.app = <%= config[:classified_app_name] %>::Application.new
8
-
9
- class MiniTest::Spec
10
- include Capybara::DSL
11
- end
@@ -1,12 +0,0 @@
1
- # Require this file for feature tests
2
- require_relative './spec_helper'
3
-
4
- require 'capybara'
5
- require 'capybara/rspec'
6
-
7
- RSpec.configure do |config|
8
- config.include RSpec::FeatureExampleGroup
9
-
10
- config.include Capybara::DSL, feature: true
11
- config.include Capybara::RSpecMatchers, feature: true
12
- end
@@ -1,2 +0,0 @@
1
- /public/assets*
2
- /tmp
@@ -1,4 +0,0 @@
1
- /db/<%= config[:app_name] %>_development
2
- /db/<%= config[:app_name] %>_test
3
- /public/assets*
4
- /tmp
@@ -1,3 +0,0 @@
1
- /db/*.sqlite
2
- /public/assets*
3
- /tmp
@@ -1,4 +0,0 @@
1
- <%= Hanami::Hanamirc::PROJECT_NAME %>=<%= config[:app_name] %>
2
- <%= Hanami::Hanamirc::ARCHITECTURE_KEY %>=<%= Hanami::Hanamirc::APP_ARCHITECTURE %>
3
- <%= Hanami::Hanamirc::TEST_KEY %>=<%= config[:test] %>
4
- <%= Hanami::Hanamirc::TEMPLATE_KEY %>=<%= config[:template] %>
@@ -1,35 +0,0 @@
1
- require 'hanami/model'
2
- require 'hanami/mailer'
3
- Dir["#{ __dir__ }/<%= config[:app_name] %>/**/*.rb"].each { |file| require_relative file }
4
-
5
- Hanami::Model.configure do
6
- # Database adapter
7
- #
8
- # Available options:
9
- #
10
- # * SQL adapter
11
- # adapter :sql, 'sqlite://db/<%= config[:app_name] %>_development.sqlite3'
12
- # adapter :sql, 'postgres://localhost/<%= config[:app_name] %>_development'
13
- # adapter :sql, 'mysql://localhost/<%= config[:app_name] %>_development'
14
- #
15
- adapter :<%= config[:database_config][:type] %>, ENV['DATABASE_URL']
16
-
17
- <%- if config[:database_config][:type] == :sql -%>
18
- ##
19
- # Migrations
20
- #
21
- migrations 'db/migrations'
22
- schema 'db/schema.sql'
23
- <%- end -%>
24
- end.load!
25
-
26
- Hanami::Mailer.configure do
27
- root "#{ __dir__ }/<%= config[:app_name] %>/mailers"
28
-
29
- # See http://hanamirb.org/guides/mailers/delivery
30
- delivery do
31
- development :test
32
- test :test
33
- # production :smtp, address: ENV['SMTP_PORT'], port: 1025
34
- end
35
- end.load!
@@ -1,2 +0,0 @@
1
- --color
2
- --require spec_helper
@@ -1,7 +0,0 @@
1
- # Require this file for unit tests
2
- ENV['HANAMI_ENV'] ||= 'test'
3
-
4
- require_relative '../config/environment'
5
- require 'minitest/autorun'
6
-
7
- Hanami.boot
@@ -1,104 +0,0 @@
1
- # Require this file for unit tests
2
- ENV['HANAMI_ENV'] ||= 'test'
3
-
4
- require_relative '../config/environment'
5
- Hanami.boot
6
-
7
- Dir[__dir__ + '/support/**/*.rb'].each { |f| require f }
8
-
9
- # This file was generated by the `rspec --init` command. Conventionally, all
10
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
11
- # The generated `.rspec` file contains `--require spec_helper` which will cause
12
- # this file to always be loaded, without a need to explicitly require it in any
13
- # files.
14
- #
15
- # Given that it is always loaded, you are encouraged to keep this file as
16
- # light-weight as possible. Requiring heavyweight dependencies from this file
17
- # will add to the boot time of your test suite on EVERY test run, even for an
18
- # individual file that may not need all of that loaded. Instead, consider making
19
- # a separate helper file that requires the additional dependencies and performs
20
- # the additional setup, and require it from the spec files that actually need
21
- # it.
22
- #
23
- # The `.rspec` file also contains a few flags that are not defaults but that
24
- # users commonly want.
25
- #
26
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
27
- RSpec.configure do |config|
28
- # rspec-expectations config goes here. You can use an alternate
29
- # assertion/expectation library such as wrong or the stdlib/minitest
30
- # assertions if you prefer.
31
- config.expect_with :rspec do |expectations|
32
- # This option will default to `true` in RSpec 4. It makes the `description`
33
- # and `failure_message` of custom matchers include text for helper methods
34
- # defined using `chain`, e.g.:
35
- # be_bigger_than(2).and_smaller_than(4).description
36
- # # => "be bigger than 2 and smaller than 4"
37
- # ...rather than:
38
- # # => "be bigger than 2"
39
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
40
- end
41
-
42
- # rspec-mocks config goes here. You can use an alternate test double
43
- # library (such as bogus or mocha) by changing the `mock_with` option here.
44
- config.mock_with :rspec do |mocks|
45
- # Prevents you from mocking or stubbing a method that does not exist on
46
- # a real object. This is generally recommended, and will default to
47
- # `true` in RSpec 4.
48
- mocks.verify_partial_doubles = true
49
- end
50
-
51
- # The settings below are suggested to provide a good initial experience
52
- # with RSpec, but feel free to customize to your heart's content.
53
- =begin
54
- # These two settings work together to allow you to limit a spec run
55
- # to individual examples or groups you care about by tagging them with
56
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
57
- # get run.
58
- config.filter_run :focus
59
- config.run_all_when_everything_filtered = true
60
-
61
- # Allows RSpec to persist some state between runs in order to support
62
- # the `--only-failures` and `--next-failure` CLI options. We recommend
63
- # you configure your source control system to ignore this file.
64
- config.example_status_persistence_file_path = "spec/examples.txt"
65
-
66
- # Limits the available syntax to the non-monkey patched syntax that is
67
- # recommended. For more details, see:
68
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
69
- # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
70
- # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
71
- config.disable_monkey_patching!
72
-
73
- # This setting enables warnings. It's recommended, but in many cases may
74
- # be too noisy due to issues in dependencies.
75
- config.warnings = false
76
-
77
- # Many RSpec users commonly either run the entire suite or an individual
78
- # file, and it's useful to allow more verbose output when running an
79
- # individual spec file.
80
- if config.files_to_run.one?
81
- # Use the documentation formatter for detailed output,
82
- # unless a formatter has already been configured
83
- # (e.g. via a command-line flag).
84
- config.default_formatter = 'doc'
85
- end
86
-
87
- # Print the 10 slowest examples and example groups at the
88
- # end of the spec run, to help surface which specs are running
89
- # particularly slow.
90
- config.profile_examples = 10
91
-
92
- # Run specs in random order to surface order dependencies. If you find an
93
- # order dependency and want to debug it, you can fix the order by providing
94
- # the seed, which is printed after each run.
95
- # --seed 1234
96
- config.order = :random
97
-
98
- # Seed global randomization in this process using the `--seed` CLI option.
99
- # Setting this allows you to use `--seed` to deterministically reproduce
100
- # test failures related to randomization by passing the same `--seed` value
101
- # as the one that triggered the failure.
102
- Kernel.srand config.seed
103
- =end
104
- end
@@ -1,10 +0,0 @@
1
- <!doctype HTML>
2
- <html>
3
- <head>
4
- <title><%= config[:classified_app_name] %></title>
5
- <%%= favicon %>
6
- </head>
7
- <body>
8
- <%%= yield %>
9
- </body>
10
- </html>
@@ -1,7 +0,0 @@
1
- !!!
2
- %html
3
- %head
4
- %title <%= config[:classified_app_name] %>
5
- = favicon
6
- %body
7
- = yield
@@ -1,8 +0,0 @@
1
- doctype html
2
- html
3
- head
4
- title
5
- | <%= config[:classified_app_name] %>
6
- = favicon
7
- body
8
- = yield
@@ -1,7 +0,0 @@
1
- module <%= config[:classified_app_name] %>
2
- module Views
3
- class ApplicationLayout
4
- include <%= config[:classified_app_name] %>::Layout
5
- end
6
- end
7
- end