From a0140d15d610a944c71364d7234dbb5ff7e57619 Mon Sep 17 00:00:00 2001 From: Luca Guidi Date: Wed, 20 Jan 2016 17:06:26 +0100 Subject: [PATCH] Lotus => Hanami --- .gitignore | 2 +- .travis.yml | 20 +- CHANGELOG.md | 98 ++--- CONTRIBUTING.md | 6 +- FEATURES.md | 52 +-- Gemfile | 18 +- README.md | 73 ++-- bin/{lotus => hanami} | 4 +- lotusrb.gemspec => hanami.gemspec | 28 +- lib/{lotus.rb => hanami.rb} | 36 +- .../action/csrf_protection.rb | 10 +- .../action/routing_helpers.rb | 10 +- lib/{lotus => hanami}/application.rb | 64 +-- lib/{lotus => hanami}/application_name.rb | 8 +- lib/hanami/cli.rb | 119 ++++++ .../cli_sub_commands/assets.rb | 10 +- lib/{lotus => hanami}/cli_sub_commands/db.rb | 34 +- lib/hanami/cli_sub_commands/destroy.rb | 102 +++++ lib/hanami/cli_sub_commands/generate.rb | 127 ++++++ .../commands/assets/precompile.rb | 10 +- lib/{lotus => hanami}/commands/console.rb | 12 +- lib/{lotus => hanami}/commands/db/abstract.rb | 4 +- lib/hanami/commands/db/apply.rb | 14 + lib/{lotus => hanami}/commands/db/console.rb | 16 +- lib/hanami/commands/db/create.rb | 14 + lib/hanami/commands/db/drop.rb | 14 + lib/{lotus => hanami}/commands/db/migrate.rb | 8 +- lib/hanami/commands/db/prepare.rb | 14 + lib/hanami/commands/db/version.rb | 14 + .../commands/generate/abstract.rb | 30 +- .../commands/generate/action.rb | 10 +- .../commands/generate/app.rb | 8 +- .../commands/generate/mailer.rb | 4 +- .../commands/generate/migration.rb | 8 +- .../commands/generate/model.rb | 4 +- .../commands/new/abstract.rb | 36 +- lib/{lotus => hanami}/commands/new/app.rb | 10 +- .../commands/new/container.rb | 14 +- lib/{lotus => hanami}/commands/routes.rb | 12 +- lib/{lotus => hanami}/commands/server.rb | 8 +- lib/{lotus => hanami}/config/configure.rb | 4 +- lib/{lotus => hanami}/config/cookies.rb | 8 +- .../config/framework_configuration.rb | 2 +- lib/{lotus => hanami}/config/load_paths.rb | 4 +- lib/{lotus => hanami}/config/mapper.rb | 6 +- lib/{lotus => hanami}/config/mapping.rb | 4 +- lib/{lotus => hanami}/config/routes.rb | 4 +- lib/{lotus => hanami}/config/security.rb | 6 +- lib/{lotus => hanami}/config/sessions.rb | 6 +- lib/{lotus => hanami}/configuration.rb | 384 +++++++++--------- lib/{lotus => hanami}/container.rb | 18 +- lib/{lotus => hanami}/environment.rb | 106 ++--- lib/hanami/frameworks.rb | 14 + .../generators/action/action.rb.tt | 0 .../generators/action/action_spec.minitest.tt | 0 .../generators/action/action_spec.rspec.tt | 0 .../action/action_without_view.rb.tt | 0 .../generators/action/template.tt | 0 .../generators/action/view.rb.tt | 0 .../generators/action/view_spec.minitest.tt | 2 +- .../generators/action/view_spec.rspec.tt | 2 +- .../generators/app/.gitkeep.tt | 0 .../generators/app/application.rb.tt | 26 +- .../app/config/initializers/.gitkeep | 0 lib/hanami/generators/app/config/routes.rb.tt | 2 + .../generators/app/favicon.ico | Bin .../app/templates/application.html.erb.tt | 0 .../app/views/application_layout.rb.tt | 0 .../application/app/.env.development.tt | 0 .../generators/application/app/.env.test.tt | 0 .../generators/application/app/.env.tt | 0 .../generators/application/app/.gitignore | 0 .../generators/application/app/.gitkeep | 0 .../generators/application/app/Gemfile.tt | 37 ++ .../application/app/Rakefile.minitest.tt | 2 +- .../application/app}/Rakefile.rspec.tt | 2 +- .../application/app/apps/.gitkeep.tt | 0 .../application/app/capybara.rb.rspec.tt | 0 .../generators/application/app/config.ru.tt | 0 .../application/app/config/application.rb.tt | 26 +- .../application/app/config/environment.rb.tt | 2 +- .../app/config/initializers/.gitkeep | 0 .../application/app/config/routes.rb.tt | 2 + .../generators/application/app/db/.gitkeep | 0 .../generators/application/app/favicon.ico | Bin .../app/features_helper.rb.minitest.tt | 0 .../app/features_helper.rb.rspec.tt | 0 .../generators/application/app/gitignore.tt | 0 .../application/app/gitignore_with_db.tt | 0 .../generators/application/app/hanamirc.tt | 3 + .../application/app/lib/app_name.rb.tt | 10 +- .../app/lib/chirp/entities/.gitkeep | 0 .../app/lib/chirp/repositories/.gitkeep | 0 .../application/app/lib/config/mapping.rb.tt | 0 .../generators/application/app/rspec.rspec.tt | 0 .../generators/application/app/schema.sql.tt | 0 .../app/spec_helper.rb.minitest.tt | 4 +- .../application/app/spec_helper.rb.rspec.tt | 4 +- .../app/templates/application.html.erb.tt | 0 .../app/views/application_layout.rb.tt | 0 .../application/container/.env.development.tt | 0 .../application/container/.env.test.tt | 0 .../generators/application/container/.env.tt | 0 .../application/container/.gitignore | 0 .../generators/application/container/.gitkeep | 0 .../application/container/Gemfile.tt | 36 ++ .../container/Rakefile.minitest.tt | 2 +- .../application/container}/Rakefile.rspec.tt | 2 +- .../container/capybara.rb.rspec.tt | 2 +- .../application/container/config.ru.tt | 2 +- .../container/config/environment.rb.tt | 4 +- .../container/config/initializers/.gitkeep | 0 .../application/container/db/.gitkeep | 0 .../container/features_helper.rb.minitest.tt | 2 +- .../container/features_helper.rb.rspec.tt | 0 .../application/container/gitignore.tt | 0 .../container/gitignore_with_db.tt | 0 .../application/container/hanamirc.tt | 3 + .../application/container/lib/app_name.rb.tt | 10 +- .../container/lib/chirp/entities/.gitkeep | 0 .../container/lib/chirp/mailers/.gitkeep | 0 .../lib/chirp/mailers/templates/.gitkeep | 0 .../container/lib/chirp/repositories/.gitkeep | 0 .../container/lib/config/mapping.rb.tt | 0 .../application/container/rspec.rspec.tt | 0 .../application/container/schema.sql.tt | 0 .../container/spec_helper.rb.minitest.tt | 4 +- .../container/spec_helper.rb.rspec.tt | 4 +- .../generators/database_config.rb | 8 +- .../generators/generatable.rb | 6 +- lib/{lotus => hanami}/generators/generator.rb | 2 +- .../generators/mailer/mailer.rb.tt | 2 +- .../generators/mailer/mailer_spec.rb.tt | 0 .../generators/mailer/template.html.tt | 0 .../generators/mailer/template.txt.tt | 0 .../generators/migration/migration.rb.tt | 4 + .../generators/model/entity.rb.tt | 2 +- .../generators/model/entity_spec.minitest.tt | 0 .../generators/model/entity_spec.rspec.tt | 0 .../generators/model/repository.rb.tt | 2 +- .../model/repository_spec.minitest.tt | 0 .../generators/model/repository_spec.rspec.tt | 0 .../generators/test_framework.rb | 8 +- lib/{lotus/lotusrc.rb => hanami/hanamirc.rb} | 62 +-- lib/{lotus => hanami}/loader.rb | 68 ++-- lib/{lotus => hanami}/mailer/glue.rb | 10 +- lib/{lotus => hanami}/middleware.rb | 28 +- lib/{lotus => hanami}/rake_helper.rb | 22 +- lib/hanami/rake_tasks.rb | 2 + lib/{lotus => hanami}/rendering_policy.rb | 14 +- lib/hanami/repositories/car_repository.rb | 3 + lib/hanami/repositories/name_repository.rb | 3 + lib/hanami/root.rb | 7 + lib/{lotus => hanami}/routes.rb | 38 +- lib/{lotus => hanami}/routing/default.rb | 4 +- lib/hanami/setup.rb | 3 + lib/{lotus => hanami}/static.rb | 14 +- .../templates/default.html.erb | 0 lib/hanami/templates/welcome.html.erb | 53 +++ lib/{lotus => hanami}/version.rb | 4 +- lib/{lotus => hanami}/views/default.rb | 6 +- .../views/default_template_finder.rb | 2 +- lib/{lotus => hanami}/views/null_view.rb | 2 +- lib/{lotus => hanami}/welcome.rb | 8 +- lib/lotus/cli.rb | 119 ------ lib/lotus/cli_sub_commands/destroy.rb | 102 ----- lib/lotus/cli_sub_commands/generate.rb | 127 ------ lib/lotus/commands/db/apply.rb | 14 - lib/lotus/commands/db/create.rb | 14 - lib/lotus/commands/db/drop.rb | 14 - lib/lotus/commands/db/prepare.rb | 14 - lib/lotus/commands/db/version.rb | 14 - lib/lotus/frameworks.rb | 14 - lib/lotus/generators/app/config/routes.rb.tt | 2 - .../generators/application/app/Gemfile.tt | 37 -- .../application/app/config/routes.rb.tt | 2 - .../generators/application/app/lotusrc.tt | 3 - .../application/container/Gemfile.tt | 36 -- .../application/container/lotusrc.tt | 3 - .../generators/migration/migration.rb.tt | 4 - lib/lotus/rake_tasks.rb | 2 - lib/lotus/repositories/car_repository.rb | 3 - lib/lotus/repositories/name_repository.rb | 3 - lib/lotus/root.rb | 7 - lib/lotus/setup.rb | 3 - lib/lotus/templates/welcome.html.erb | 53 --- lib/lotusrb.rb | 1 - test/application_name_test.rb | 24 +- test/application_test.rb | 14 +- test/cli_test.rb | 88 ++-- test/commands/console_test.rb | 38 +- test/commands/generate/action_test.rb | 114 +++--- test/commands/generate/app_test.rb | 28 +- test/commands/generate/mailer_test.rb | 28 +- test/commands/generate/migration_test.rb | 20 +- test/commands/generate/model_test.rb | 22 +- test/commands/new/app_test.rb | 26 +- test/commands/new/container_test.rb | 50 +-- test/commands/routes_test.rb | 20 +- test/commands/server_test.rb | 54 +-- test/config/cookies_test.rb | 26 +- test/config/framework_configuration_test.rb | 14 +- test/config/load_paths_test.rb | 4 +- test/config/mapper_test.rb | 4 +- test/config/mapping_test.rb | 4 +- test/config/routes_test.rb | 4 +- test/config/sessions_test.rb | 14 +- test/configuration_test.rb | 72 ++-- test/container_test.rb | 26 +- test/controller/csrf_protection_test.rb | 32 +- test/env_test.rb | 28 +- test/environment_test.rb | 168 ++++---- test/fixtures.rb | 54 +-- test/fixtures/.env | 2 +- .../{lotusrc/with_minitest => .hanamirc} | 0 test/fixtures/body_parsers/.hanamirc | 3 + test/fixtures/body_parsers/application.rb | 6 +- test/fixtures/cdn/cdn/Gemfile | 20 +- test/fixtures/cdn/cdn/apps/web/application.rb | 22 +- test/fixtures/cdn/cdn/config.ru | 2 +- test/fixtures/cdn/cdn/config/environment.rb | 4 +- test/fixtures/cdn/cdn/spec/features_helper.rb | 2 +- test/fixtures/cdn/cdn/spec/spec_helper.rb | 4 +- .../cdn/cdn/spec/web/views/home/index_spec.rb | 2 +- test/fixtures/cdn/cdn_app/Gemfile | 20 +- .../cdn/cdn_app/config/application.rb | 22 +- .../cdn/cdn_app/config/environment.rb | 2 +- test/fixtures/cdn/cdn_app/config/routes.rb | 2 +- test/fixtures/cdn/cdn_app/spec/spec_helper.rb | 4 +- .../cdn/cdn_app/spec/views/home/index_spec.rb | 2 +- .../apps/web/app/entities/book.rb | 2 +- .../web/app/repositories/book_repository.rb | 2 +- .../apps/web/app/views/application_layout.rb | 2 +- .../collaboration/apps/web/application.rb | 16 +- .../web/assets/javascripts/application.js | 2 +- .../web/vendor/another_assets_path/bar.js | 2 +- .../collaboration/vendor/assets/hanami.js | 1 + .../collaboration/vendor/assets/lotus.js | 1 - .../application/new_app/Gemfile.minitest | 4 +- .../application/new_app/Gemfile.rspec | 4 +- .../application/new_app/Rakefile.minitest | 2 +- .../application/new_app/Rakefile.rspec | 2 +- .../application/new_app/config/application.rb | 26 +- .../application/new_app/config/environment.rb | 2 +- .../application/new_app/config/routes.rb | 2 +- .../application/new_app/lib/new_app.rb | 10 +- .../new_app/spec/spec_helper.minitest.rb | 4 +- .../new_app/spec/spec_helper.rspec.rb | 4 +- .../new_container/Gemfile.filesystem | 4 +- .../application/new_container/Gemfile.head | 20 +- .../new_container/Gemfile.jdbc:mysql2 | 4 +- .../new_container/Gemfile.jdbc:postgres | 4 +- .../new_container/Gemfile.jdbc:sqlite3 | 4 +- .../application/new_container/Gemfile.memory | 4 +- .../new_container/Gemfile.minitest | 4 +- .../application/new_container/Gemfile.mysql2 | 4 +- .../new_container/Gemfile.postgres | 4 +- .../application/new_container/Gemfile.rspec | 4 +- .../application/new_container/Gemfile.sqlite3 | 4 +- .../new_container/Rakefile.minitest | 2 +- .../application/new_container/Rakefile.rspec | 2 +- .../application/new_container/config.ru | 2 +- .../new_container/config/environment.rb | 4 +- .../config/environment_mypath.rb | 4 +- .../lib/new_container.filesystem.rb | 10 +- .../new_container/lib/new_container.memory.rb | 10 +- .../new_container/lib/new_container.mysql2.rb | 10 +- .../lib/new_container.postgres.rb | 10 +- .../new_container/lib/new_container.rb | 10 +- .../lib/new_container.sqlite3.rb | 10 +- .../spec/features_helper.minitest.rb | 2 +- .../spec/spec_helper.minitest.rb | 4 +- .../new_container/spec/spec_helper.rspec.rb | 4 +- .../generate/action/view_spec.app.minitest.rb | 2 +- .../generate/action/view_spec.app.rspec.rb | 2 +- .../action/view_spec.container.minitest.rb | 2 +- .../action/view_spec.container.rspec.rb | 2 +- .../commands/generate/app/application.rb | 26 +- .../commands/generate/app/environment.rb | 4 +- .../app/environment_with_app_added.rb | 4 +- .../app/environment_with_app_added_url.rb | 4 +- test/fixtures/commands/generate/app/routes.rb | 2 +- .../generate/mailer/forgot_password.rb | 2 +- .../commands/generate/migration/migration.rb | 2 +- test/fixtures/commands/generate/model/car.rb | 2 +- .../commands/generate/model/car_repository.rb | 2 +- test/fixtures/config.ru | 6 +- test/fixtures/configurable/.hanamirc | 3 + test/fixtures/configurable/application.rb | 2 +- test/fixtures/cookies/.hanamirc | 3 + test/fixtures/cookies/application.rb | 6 +- test/fixtures/furnitures/.hanamirc | 3 + test/fixtures/furnitures/application.rb | 4 +- .../assets/javascripts/application.js | 2 +- .../.lotusrc => hanamirc/exists/.hanamirc} | 0 .../{lotusrc => hanamirc}/no_exists/.gitkeep | 0 test/fixtures/hanamirc/with_minitest | 3 + .../fixtures/{lotusrc => hanamirc}/with_rspec | 0 test/fixtures/information_tech/.hanamirc | 3 + .../app/controllers/hardware_controller.rb | 8 +- .../information_tech/app/views/app_layout.rb | 2 +- .../app/views/hardware/index.rb | 2 +- test/fixtures/information_tech/application.rb | 4 +- .../assets/javascripts/application.js | 2 +- test/fixtures/lint/.hanamirc | 3 + test/fixtures/lint/application.rb | 4 +- .../microservices/apps/backend/application.rb | 2 +- .../backend/assets/javascripts/application.js | 2 +- .../apps/frontend/application.rb | 2 +- .../assets/javascripts/application.js | 2 +- .../apps/frontend/vendor/assets/custom.js | 2 +- test/fixtures/microservices/config.ru | 2 +- test/fixtures/middleware_stack/.hanamirc | 3 + test/fixtures/middleware_stack/application.rb | 2 +- test/fixtures/one_file/.hanamirc | 3 + test/fixtures/one_file/application.rb | 2 +- test/fixtures/rake/rake_tasks/Gemfile | 20 +- test/fixtures/rake/rake_tasks/Rakefile | 2 +- .../rake/rake_tasks/apps/web/application.rb | 26 +- .../rake/rake_tasks/apps/web/config/routes.rb | 2 +- test/fixtures/rake/rake_tasks/config.ru | 2 +- .../rake/rake_tasks/config/environment.rb | 4 +- .../migrations/20151217091454_create_users.rb | 2 +- .../rake/rake_tasks/lib/rake_tasks.rb | 10 +- .../lib/rake_tasks/entities/user.rb | 2 +- .../repositories/user_repository.rb | 2 +- .../rake/rake_tasks/spec/features_helper.rb | 2 +- .../rake/rake_tasks/spec/spec_helper.rb | 4 +- .../spec/web/views/users/show_spec.rb | 2 +- test/fixtures/rake/rake_tasks_app/Gemfile | 20 +- test/fixtures/rake/rake_tasks_app/Rakefile | 2 +- .../rake/rake_tasks_app/config/application.rb | 26 +- .../rake/rake_tasks_app/config/environment.rb | 2 +- .../rake/rake_tasks_app/config/routes.rb | 2 +- .../migrations/20151217104223_create_users.rb | 2 +- .../rake/rake_tasks_app/lib/rake_tasks_app.rb | 10 +- .../lib/rake_tasks_app/entities/user.rb | 2 +- .../repositories/user_repository.rb | 2 +- .../rake/rake_tasks_app/spec/spec_helper.rb | 4 +- .../spec/views/users/show_spec.rb | 2 +- .../security_headers/apps/web/.hanamirc | 3 + .../apps/web/app/entities/book.rb | 2 +- .../web/app/repositories/book_repository.rb | 2 +- .../apps/web/app/views/application_layout.rb | 2 +- .../security_headers/apps/web/application.rb | 8 +- test/fixtures/sessions/.hanamirc | 3 + test/fixtures/sessions/application.rb | 2 +- .../home.css.sassc | Bin 2584 -> 2590 bytes test/fixtures/static_assets/Gemfile | 21 +- .../static_assets/apps/admin/application.rb | 14 +- .../static_assets/apps/admin/config/routes.rb | 2 +- .../static_assets/apps/web/application.rb | 16 +- test/fixtures/static_assets/config.ru | 2 +- .../static_assets/config/environment.rb | 4 +- .../static_assets/lib/static_assets.rb | 8 +- .../static_assets/spec/features_helper.rb | 2 +- .../static_assets/spec/spec_helper.rb | 4 +- .../spec/web/views/home/index_spec.rb | 2 +- .../home.css.sassc | Bin 2591 -> 2597 bytes test/fixtures/static_assets_app/Gemfile | 21 +- .../static_assets_app/config/application.rb | 14 +- .../static_assets_app/config/environment.rb | 2 +- .../static_assets_app/config/routes.rb | 2 +- .../lib/static_assets_app.rb | 8 +- .../static_assets_app/spec/spec_helper.rb | 4 +- .../spec/views/home/index_spec.rb | 2 +- test/fixtures/streaming/.hanamirc | 3 + test/fixtures/streaming/application.rb | 2 +- test/fixtures/streaming/config.ru | 2 +- test/fixtures/welcome_app/.hanamirc | 3 + test/fixtures/welcome_app/application.rb | 2 +- test/generators/database_config_test.rb | 10 +- test/generators/test_framework_test.rb | 32 +- ...tus_setup_test.rb => hanami_setup_test.rb} | 12 +- test/{lotusrc_test.rb => hanamirc_test.rb} | 22 +- .../assets_digest_mode/test_application.rb | 8 +- .../assets_digest_mode/test_container.rb | 10 +- .../assets_precompile/test_application.rb | 8 +- .../assets_precompile/test_container.rb | 8 +- test/integration/cdn/test_application.rb | 8 +- test/integration/cdn/test_container.rb | 10 +- test/integration/cli/database_test.rb | 54 +-- test/integration/configuration_test.rb | 2 +- test/integration/container_force_ssl_test.rb | 10 +- test/integration/container_test.rb | 6 +- test/integration/cookies_test.rb | 8 +- test/integration/full_stack_test.rb | 2 +- test/integration/headers_test.rb | 2 +- test/integration/microservices_test.rb | 4 +- .../integration/modulized_application_test.rb | 2 +- test/integration/one_file_test.rb | 2 +- test/integration/rake/test_application.rb | 12 +- test/integration/rake/test_container.rb | 12 +- test/integration/sessions_test.rb | 12 +- .../static_assets/test_application.rb | 6 +- .../static_assets/test_container.rb | 8 +- .../integration/top_level_application_test.rb | 2 +- test/integration/welcome_page_test.rb | 6 +- test/loader_test.rb | 20 +- test/middleware_test.rb | 6 +- test/rake_helper_test.rb | 6 +- test/root_test.rb | 6 +- test/routes_test.rb | 20 +- test/support/helper.rb | 2 +- test/support/isolated.rb | 2 +- test/test_helper.rb | 30 +- test/version_test.rb | 4 +- 407 files changed, 2500 insertions(+), 2479 deletions(-) rename bin/{lotus => hanami} (50%) rename lotusrb.gemspec => hanami.gemspec (60%) rename lib/{lotus.rb => hanami.rb} (60%) rename lib/{lotus => hanami}/action/csrf_protection.rb (94%) rename lib/{lotus => hanami}/action/routing_helpers.rb (79%) rename lib/{lotus => hanami}/application.rb (75%) rename lib/{lotus => hanami}/application_name.rb (92%) create mode 100644 lib/hanami/cli.rb rename lib/{lotus => hanami}/cli_sub_commands/assets.rb (64%) rename lib/{lotus => hanami}/cli_sub_commands/db.rb (77%) create mode 100644 lib/hanami/cli_sub_commands/destroy.rb create mode 100644 lib/hanami/cli_sub_commands/generate.rb rename lib/{lotus => hanami}/commands/assets/precompile.rb (78%) rename lib/{lotus => hanami}/commands/console.rb (88%) rename lib/{lotus => hanami}/commands/db/abstract.rb (81%) create mode 100644 lib/hanami/commands/db/apply.rb rename lib/{lotus => hanami}/commands/db/console.rb (58%) create mode 100644 lib/hanami/commands/db/create.rb create mode 100644 lib/hanami/commands/db/drop.rb rename lib/{lotus => hanami}/commands/db/migrate.rb (60%) create mode 100644 lib/hanami/commands/db/prepare.rb create mode 100644 lib/hanami/commands/db/version.rb rename lib/{lotus => hanami}/commands/generate/abstract.rb (58%) rename lib/{lotus => hanami}/commands/generate/action.rb (96%) rename lib/{lotus => hanami}/commands/generate/app.rb (95%) rename lib/{lotus => hanami}/commands/generate/mailer.rb (98%) rename lib/{lotus => hanami}/commands/generate/migration.rb (85%) rename lib/{lotus => hanami}/commands/generate/model.rb (97%) rename lib/{lotus => hanami}/commands/new/abstract.rb (74%) rename lib/{lotus => hanami}/commands/new/app.rb (95%) rename lib/{lotus => hanami}/commands/new/container.rb (90%) rename lib/{lotus => hanami}/commands/routes.rb (72%) rename lib/{lotus => hanami}/commands/server.rb (92%) rename lib/{lotus => hanami}/config/configure.rb (87%) rename lib/{lotus => hanami}/config/cookies.rb (89%) rename lib/{lotus => hanami}/config/framework_configuration.rb (98%) rename lib/{lotus => hanami}/config/load_paths.rb (90%) rename lib/{lotus => hanami}/config/mapper.rb (88%) rename lib/{lotus => hanami}/config/mapping.rb (80%) rename lib/{lotus => hanami}/config/routes.rb (84%) rename lib/{lotus => hanami}/config/security.rb (91%) rename lib/{lotus => hanami}/config/sessions.rb (94%) rename lib/{lotus => hanami}/configuration.rb (81%) rename lib/{lotus => hanami}/container.rb (73%) rename lib/{lotus => hanami}/environment.rb (81%) create mode 100644 lib/hanami/frameworks.rb rename lib/{lotus => hanami}/generators/action/action.rb.tt (100%) rename lib/{lotus => hanami}/generators/action/action_spec.minitest.tt (100%) rename lib/{lotus => hanami}/generators/action/action_spec.rspec.tt (100%) rename lib/{lotus => hanami}/generators/action/action_without_view.rb.tt (100%) rename lib/{lotus => hanami}/generators/action/template.tt (100%) rename lib/{lotus => hanami}/generators/action/view.rb.tt (100%) rename lib/{lotus => hanami}/generators/action/view_spec.minitest.tt (84%) rename lib/{lotus => hanami}/generators/action/view_spec.rspec.tt (81%) rename lib/{lotus => hanami}/generators/app/.gitkeep.tt (100%) rename lib/{lotus => hanami}/generators/app/application.rb.tt (91%) rename lib/{lotus => hanami}/generators/app/config/initializers/.gitkeep (100%) create mode 100644 lib/hanami/generators/app/config/routes.rb.tt rename lib/{lotus => hanami}/generators/app/favicon.ico (100%) rename lib/{lotus => hanami}/generators/app/templates/application.html.erb.tt (100%) rename lib/{lotus => hanami}/generators/app/views/application_layout.rb.tt (100%) rename lib/{lotus => hanami}/generators/application/app/.env.development.tt (100%) rename lib/{lotus => hanami}/generators/application/app/.env.test.tt (100%) rename lib/{lotus => hanami}/generators/application/app/.env.tt (100%) rename lib/{lotus => hanami}/generators/application/app/.gitignore (100%) rename lib/{lotus => hanami}/generators/application/app/.gitkeep (100%) create mode 100644 lib/hanami/generators/application/app/Gemfile.tt rename lib/{lotus => hanami}/generators/application/app/Rakefile.minitest.tt (85%) rename lib/{lotus/generators/application/container => hanami/generators/application/app}/Rakefile.rspec.tt (78%) rename lib/{lotus => hanami}/generators/application/app/apps/.gitkeep.tt (100%) rename lib/{lotus => hanami}/generators/application/app/capybara.rb.rspec.tt (100%) rename lib/{lotus => hanami}/generators/application/app/config.ru.tt (100%) rename lib/{lotus => hanami}/generators/application/app/config/application.rb.tt (91%) rename lib/{lotus => hanami}/generators/application/app/config/environment.rb.tt (85%) rename lib/{lotus => hanami}/generators/application/app/config/initializers/.gitkeep (100%) create mode 100644 lib/hanami/generators/application/app/config/routes.rb.tt rename lib/{lotus => hanami}/generators/application/app/db/.gitkeep (100%) rename lib/{lotus => hanami}/generators/application/app/favicon.ico (100%) rename lib/{lotus => hanami}/generators/application/app/features_helper.rb.minitest.tt (100%) rename lib/{lotus => hanami}/generators/application/app/features_helper.rb.rspec.tt (100%) rename lib/{lotus => hanami}/generators/application/app/gitignore.tt (100%) rename lib/{lotus => hanami}/generators/application/app/gitignore_with_db.tt (100%) create mode 100644 lib/hanami/generators/application/app/hanamirc.tt rename lib/{lotus => hanami}/generators/application/app/lib/app_name.rb.tt (90%) rename lib/{lotus => hanami}/generators/application/app/lib/chirp/entities/.gitkeep (100%) rename lib/{lotus => hanami}/generators/application/app/lib/chirp/repositories/.gitkeep (100%) rename lib/{lotus => hanami}/generators/application/app/lib/config/mapping.rb.tt (100%) rename lib/{lotus => hanami}/generators/application/app/rspec.rspec.tt (100%) rename lib/{lotus => hanami}/generators/application/app/schema.sql.tt (100%) rename lib/{lotus => hanami}/generators/application/app/spec_helper.rb.minitest.tt (64%) rename lib/{lotus => hanami}/generators/application/app/spec_helper.rb.rspec.tt (98%) rename lib/{lotus => hanami}/generators/application/app/templates/application.html.erb.tt (100%) rename lib/{lotus => hanami}/generators/application/app/views/application_layout.rb.tt (100%) rename lib/{lotus => hanami}/generators/application/container/.env.development.tt (100%) rename lib/{lotus => hanami}/generators/application/container/.env.test.tt (100%) rename lib/{lotus => hanami}/generators/application/container/.env.tt (100%) rename lib/{lotus => hanami}/generators/application/container/.gitignore (100%) rename lib/{lotus => hanami}/generators/application/container/.gitkeep (100%) create mode 100644 lib/hanami/generators/application/container/Gemfile.tt rename lib/{lotus => hanami}/generators/application/container/Rakefile.minitest.tt (85%) rename lib/{lotus/generators/application/app => hanami/generators/application/container}/Rakefile.rspec.tt (78%) rename lib/{lotus => hanami}/generators/application/container/capybara.rb.rspec.tt (74%) rename lib/{lotus => hanami}/generators/application/container/config.ru.tt (55%) rename lib/{lotus => hanami}/generators/application/container/config/environment.rb.tt (64%) rename lib/{lotus => hanami}/generators/application/container/config/initializers/.gitkeep (100%) rename lib/{lotus => hanami}/generators/application/container/db/.gitkeep (100%) rename lib/{lotus => hanami}/generators/application/container/features_helper.rb.minitest.tt (81%) rename lib/{lotus => hanami}/generators/application/container/features_helper.rb.rspec.tt (100%) rename lib/{lotus => hanami}/generators/application/container/gitignore.tt (100%) rename lib/{lotus => hanami}/generators/application/container/gitignore_with_db.tt (100%) create mode 100644 lib/hanami/generators/application/container/hanamirc.tt rename lib/{lotus => hanami}/generators/application/container/lib/app_name.rb.tt (90%) rename lib/{lotus => hanami}/generators/application/container/lib/chirp/entities/.gitkeep (100%) rename lib/{lotus => hanami}/generators/application/container/lib/chirp/mailers/.gitkeep (100%) rename lib/{lotus => hanami}/generators/application/container/lib/chirp/mailers/templates/.gitkeep (100%) rename lib/{lotus => hanami}/generators/application/container/lib/chirp/repositories/.gitkeep (100%) rename lib/{lotus => hanami}/generators/application/container/lib/config/mapping.rb.tt (100%) rename lib/{lotus => hanami}/generators/application/container/rspec.rspec.tt (100%) rename lib/{lotus => hanami}/generators/application/container/schema.sql.tt (100%) rename lib/{lotus => hanami}/generators/application/container/spec_helper.rb.minitest.tt (64%) rename lib/{lotus => hanami}/generators/application/container/spec_helper.rb.rspec.tt (98%) rename lib/{lotus => hanami}/generators/database_config.rb (94%) rename lib/{lotus => hanami}/generators/generatable.rb (86%) rename lib/{lotus => hanami}/generators/generator.rb (98%) rename lib/{lotus => hanami}/generators/mailer/mailer.rb.tt (84%) rename lib/{lotus => hanami}/generators/mailer/mailer_spec.rb.tt (100%) rename lib/{lotus => hanami}/generators/mailer/template.html.tt (100%) rename lib/{lotus => hanami}/generators/mailer/template.txt.tt (100%) create mode 100644 lib/hanami/generators/migration/migration.rb.tt rename lib/{lotus => hanami}/generators/model/entity.rb.tt (59%) rename lib/{lotus => hanami}/generators/model/entity_spec.minitest.tt (100%) rename lib/{lotus => hanami}/generators/model/entity_spec.rspec.tt (100%) rename lib/{lotus => hanami}/generators/model/repository.rb.tt (61%) rename lib/{lotus => hanami}/generators/model/repository_spec.minitest.tt (100%) rename lib/{lotus => hanami}/generators/model/repository_spec.rspec.tt (100%) rename lib/{lotus => hanami}/generators/test_framework.rb (83%) rename lib/{lotus/lotusrc.rb => hanami/hanamirc.rb} (61%) rename lib/{lotus => hanami}/loader.rb (75%) rename lib/{lotus => hanami}/mailer/glue.rb (80%) rename lib/{lotus => hanami}/middleware.rb (82%) rename lib/{lotus => hanami}/rake_helper.rb (71%) create mode 100644 lib/hanami/rake_tasks.rb rename lib/{lotus => hanami}/rendering_policy.rb (84%) create mode 100644 lib/hanami/repositories/car_repository.rb create mode 100644 lib/hanami/repositories/name_repository.rb create mode 100644 lib/hanami/root.rb rename lib/{lotus => hanami}/routes.rb (76%) rename lib/{lotus => hanami}/routing/default.rb (92%) create mode 100644 lib/hanami/setup.rb rename lib/{lotus => hanami}/static.rb (82%) rename lib/{lotus => hanami}/templates/default.html.erb (100%) create mode 100644 lib/hanami/templates/welcome.html.erb rename lib/{lotus => hanami}/version.rb (54%) rename lib/{lotus => hanami}/views/default.rb (88%) rename lib/{lotus => hanami}/views/default_template_finder.rb (96%) rename lib/{lotus => hanami}/views/null_view.rb (94%) rename lib/{lotus => hanami}/welcome.rb (84%) delete mode 100644 lib/lotus/cli.rb delete mode 100644 lib/lotus/cli_sub_commands/destroy.rb delete mode 100644 lib/lotus/cli_sub_commands/generate.rb delete mode 100644 lib/lotus/commands/db/apply.rb delete mode 100644 lib/lotus/commands/db/create.rb delete mode 100644 lib/lotus/commands/db/drop.rb delete mode 100644 lib/lotus/commands/db/prepare.rb delete mode 100644 lib/lotus/commands/db/version.rb delete mode 100644 lib/lotus/frameworks.rb delete mode 100644 lib/lotus/generators/app/config/routes.rb.tt delete mode 100644 lib/lotus/generators/application/app/Gemfile.tt delete mode 100644 lib/lotus/generators/application/app/config/routes.rb.tt delete mode 100644 lib/lotus/generators/application/app/lotusrc.tt delete mode 100644 lib/lotus/generators/application/container/Gemfile.tt delete mode 100644 lib/lotus/generators/application/container/lotusrc.tt delete mode 100644 lib/lotus/generators/migration/migration.rb.tt delete mode 100644 lib/lotus/rake_tasks.rb delete mode 100644 lib/lotus/repositories/car_repository.rb delete mode 100644 lib/lotus/repositories/name_repository.rb delete mode 100644 lib/lotus/root.rb delete mode 100644 lib/lotus/setup.rb delete mode 100644 lib/lotus/templates/welcome.html.erb delete mode 100644 lib/lotusrb.rb rename test/fixtures/{lotusrc/with_minitest => .hanamirc} (100%) create mode 100644 test/fixtures/body_parsers/.hanamirc create mode 100644 test/fixtures/collaboration/vendor/assets/hanami.js delete mode 100644 test/fixtures/collaboration/vendor/assets/lotus.js create mode 100644 test/fixtures/configurable/.hanamirc create mode 100644 test/fixtures/cookies/.hanamirc create mode 100644 test/fixtures/furnitures/.hanamirc rename test/fixtures/{lotusrc/exists/.lotusrc => hanamirc/exists/.hanamirc} (100%) rename test/fixtures/{lotusrc => hanamirc}/no_exists/.gitkeep (100%) create mode 100644 test/fixtures/hanamirc/with_minitest rename test/fixtures/{lotusrc => hanamirc}/with_rspec (100%) create mode 100644 test/fixtures/information_tech/.hanamirc create mode 100644 test/fixtures/lint/.hanamirc create mode 100644 test/fixtures/middleware_stack/.hanamirc create mode 100644 test/fixtures/one_file/.hanamirc create mode 100644 test/fixtures/security_headers/apps/web/.hanamirc create mode 100644 test/fixtures/sessions/.hanamirc create mode 100644 test/fixtures/streaming/.hanamirc create mode 100644 test/fixtures/welcome_app/.hanamirc rename test/{lotus_setup_test.rb => hanami_setup_test.rb} (69%) rename test/{lotusrc_test.rb => hanamirc_test.rb} (71%) diff --git a/.gitignore b/.gitignore index e3e7d5a2..6e000a1a 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,7 @@ tmp mkmf.log .greenbar .DS_Store -.lotusrc +.hanamirc test/fixtures/static_assets/public/assets* test/fixtures/static_assets_app/public/assets* test/fixtures/rake/rake_tasks/public/assets* diff --git a/.travis.yml b/.travis.yml index f9d305b9..0284317d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,23 +10,8 @@ script: - 'bundle install' - './script/ci' rvm: - - 2.0.0 - - 2.1.0 - - 2.1.1 - - 2.1.2 - - 2.1.3 - - 2.1.4 - - 2.1.5 - - 2.1.6 - - 2.1.7 - - 2.1.8 - - 2.2.0 - - 2.2.1 - - 2.2.2 - - 2.2.3 - - 2.2.4 - - 2.3.0 - - rbx-2 + - 2.2 + - 2.3 - jruby-9000 - jruby-9.0.1.0 - jruby-9.0.3.0 @@ -35,7 +20,6 @@ rvm: matrix: allow_failures: - - rvm: rbx-2 - rvm: jruby-head - rvm: ruby-head - rvm: jruby-9000 diff --git a/CHANGELOG.md b/CHANGELOG.md index 471d2333..efc5d979 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# Lotus +# Hanami A complete web framework for Ruby ## v0.6.1 - 2016-01-19 @@ -7,7 +7,7 @@ A complete web framework for Ruby - [Anton Davydov] Fix project creation when name contains dashes (eg. `"awesome-project" => "AwesomeProject"`) - [Anton Davydov] Ensure to add assets related entries to `.gitignore` when a project is generated with the `--database` flag - [deepj] Avoid blank lines in generated `Gemfile` -- [trexnix] Fix for `lotus destroy app`: it doesn't cause a syntax error in `config/application.rb` anymore +- [trexnix] Fix for `hanami destroy app`: it doesn't cause a syntax error in `config/application.rb` anymore - [Serg Ikonnikov & Trung Lê] Ensure console to use the bundled engine ## v0.6.0 - 2016-01-12 @@ -15,18 +15,18 @@ A complete web framework for Ruby - [Luca Guidi] Introduced configurable assets compressors - [Luca Guidi] Introduced "CDN mode" in order to serve static assets via Content Distribution Networks - [Luca Guidi] Introduced "Digest mode" in production in order to generate and serve assets with checksum suffix -- [Luca Guidi] Introduced `lotus assets precompile` command to precompile, minify and append checksum suffix to static assets +- [Luca Guidi] Introduced `hanami assets precompile` command to precompile, minify and append checksum suffix to static assets - [Luca Guidi] Send `Content-Cache` HTTP header when serving static assets in production mode - [Luca Guidi] Support new env var `SERVE_STATIC_ASSETS="true"` in order to serve static assets for the entire project - [Luca Guidi] Generate new applications by including `Web::Assets::Helpers` in `view.prepare` block - [Luca Guidi] Introduced new Rake tasks `:preload` and `:environment` - [Luca Guidi] Introduced new Rake tasks `db:migrate` and `assets:precompile` for Rails/Heroku compatibility -- [Tadeu Valentt & Lucas Allan Amorin] Added `lotus destroy` command for apps, models, actions, migrations and mailers +- [Tadeu Valentt & Lucas Allan Amorin] Added `hanami destroy` command for apps, models, actions, migrations and mailers - [Lucas Allan Amorim] Custom initializers (`apps/web/config/initializers`) they are ran when the project is loaded and about to start - [Trung Lê] Generate mailer templates directory for new projects (eg. `lib/bookshelf/mailers/templates`) -- [Tadeu Valentt] Alias `--database` as `-d` for `lotus new` -- [Tadeu Valentt] Alias `--arch` as `-a` for `lotus new` -- [Sean Collins] Let `lotus generate action` to guess HTTP method (`--method` arg) according to RESTful conventions +- [Tadeu Valentt] Alias `--database` as `-d` for `hanami new` +- [Tadeu Valentt] Alias `--arch` as `-a` for `hanami new` +- [Sean Collins] Let `hanami generate action` to guess HTTP method (`--method` arg) according to RESTful conventions - [Gonzalo Rodríguez-Baltanás Díaz] Generate new applications with default favicon ### Fixed @@ -35,13 +35,13 @@ A complete web framework for Ruby - [Lucas Allan Amorim] Add `bundler` as a runtime dependency - [Lucas Allan Amorim] Ensure to load properly Bundler dependencies when starting the application - [Luca Guidi] Ensure sessions to be always available for other middleware in Rack stack of single applications -- [Ken Gullaksen] Ensure to specify `LOTUS_PORT` env var from `.env` -- [Andrey Deryabin] Fix `lotus new .` and prevent to generate the project in a subdirectory of current one +- [Ken Gullaksen] Ensure to specify `HANAMI_PORT` env var from `.env` +- [Andrey Deryabin] Fix `hanami new .` and prevent to generate the project in a subdirectory of current one - [Jason Charnes] Validate entity name for model generator -- [Caius Durling] Fixed generator for nested actions (eg. `lotus generate action web domains/certs#index`) +- [Caius Durling] Fixed generator for nested actions (eg. `hanami generate action web domains/certs#index`) - [Tadeu Valentt] Prevent to generate migrations with the same name - [Luca Guidi] Ensure RSpec examples to be generated with `RSpec.describe` instead of only `describe` -- [Andrey Deryabin] Avoid `lotus` command to generate unnecessary `.lotusrc` files +- [Andrey Deryabin] Avoid `hanami` command to generate unnecessary `.hanamirc` files - [Jason Charnes] Convert camel case application name into snake case when generating actions (eg. `BeautifulBlossoms` to `beautiful_blossoms`) - [Alfonso Uceda Pompa] Convert dasherized names into underscored names when generating projects (eg. `awesome-project` to `awesome_project`) @@ -64,7 +64,7 @@ A complete web framework for Ruby ### Fixed - [Luca Guidi] Handle conflicts between directories with the same name while serving static assets - [Derk-Jan Karrenbeld] Include default value `font-src: self` for CSP HTTP header -- [Cam Huynh] Make CLI arguments immutable for `Lotus::Environment` +- [Cam Huynh] Make CLI arguments immutable for `Hanami::Environment` - [Andrii Ponomarov] Disable welcome page in test environment - [Alfonso Uceda Pompa] Print error message and exit when no name is provided to model generator @@ -73,14 +73,14 @@ A complete web framework for Ruby ## v0.4.1 - 2015-07-10 ### Added -- [Trung Lê] Alias `--database` as `--db` for `lotus new` +- [Trung Lê] Alias `--database` as `--db` for `hanami new` ### Fixed -- [Alfonso Uceda Pompa] Ensure to load correctly apps in `lotus console` +- [Alfonso Uceda Pompa] Ensure to load correctly apps in `hanami console` - [Alfonso Uceda Pompa] Ensure to not duplicate prefix for Container mounted apps (eg `/admin/admin/dashboard`) - [Alfonso Uceda Pompa] Ensure generator for "application" architecture to generate session secret -- [Alfonso Uceda Pompa & Trung Lê & Hiếu Nguyễn] Exit unsuccessfully when `lotus generate model` doesn't receive a mandatory name for model -- [Miguel Molina] Exit unsuccessfully when `lotus new --database` receives an unknown value +- [Alfonso Uceda Pompa & Trung Lê & Hiếu Nguyễn] Exit unsuccessfully when `hanami generate model` doesn't receive a mandatory name for model +- [Miguel Molina] Exit unsuccessfully when `hanami new --database` receives an unknown value - [Luca Guidi] Ensure to prepend sessions middleware, so other Rack components can have access to HTTP session ## v0.4.0 - 2015-06-23 @@ -94,20 +94,20 @@ A complete web framework for Ruby ### Fixed - [Alfonso Uceda Pompa] Fix generated routes for Container applications mounted on a path different from `/`. -- [Luca Guidi] Reading `.lotusrc` pollutes `ENV` with unwanted variables. +- [Luca Guidi] Reading `.hanamirc` pollutes `ENV` with unwanted variables. - [Alfonso Uceda Pompa] Added sqlite extension to SQLite/SQLite3 database URL. ### Changed - [Luca Guidi] `.env`, `.env.development` and `.env.test` are generated and expected to be placed at the root of the project. - [Luca Guidi] Remove database mapping from generated apps. - [Trung Lê & Luca Guidi] Remove default generated from new apps. -- [Luca Guidi] New projects should depend on `lotus-model ~> 0.4` +- [Luca Guidi] New projects should depend on `hanami-model ~> 0.4` ## v0.3.2 - 2015-05-22 ### Added - [Alfonso Uceda Pompa] Automatic secure cookies if the current connection is using HTTPS. - [Alfonso Uceda Pompa] Routing helpers for actions (via `#routes`). -- [My Mai] Introduced `Lotus.root`. It returns the top level directory of the project. +- [My Mai] Introduced `Hanami.root`. It returns the top level directory of the project. ### Fixed - [Ngọc Nguyễn] Model generator should use new RSpec syntax. @@ -118,9 +118,9 @@ A complete web framework for Ruby ## v0.3.1 - 2015-05-15 ### Added -- [Hiếu Nguyễn] Introduced application generator (eg. `bundle exec lotus generate app admin` creates `apps/admin`). -- [Ngọc Nguyễn] Introduced model generator (eg. `bundle exec lotus generate model user` creates entity, repository and test files). -- [Ngọc Nguyễn] Introduced `Lotus.env`, `Lotus.env?` for current environment introspection (eg. `Lotus.env?(:test)` or `Lotus.env?(:staging, :production)`) +- [Hiếu Nguyễn] Introduced application generator (eg. `bundle exec hanami generate app admin` creates `apps/admin`). +- [Ngọc Nguyễn] Introduced model generator (eg. `bundle exec hanami generate model user` creates entity, repository and test files). +- [Ngọc Nguyễn] Introduced `Hanami.env`, `Hanami.env?` for current environment introspection (eg. `Hanami.env?(:test)` or `Hanami.env?(:staging, :production)`) - [Miguel Molina] Skip view creation when an action is generated via `--skip-view` CLI arg. ### Fixed @@ -128,14 +128,14 @@ A complete web framework for Ruby ## v0.3.0 - 2015-03-23 ### Added -- [Luca Guidi] Introduced action generator. Eg. `bundle exec lotus generate action web dashboard#index` -- [Alfonso Uceda Pompa] Allow to specify default coookies options in application configuration. Eg. `cookies true, { domain: 'lotusrb.org' }` -- [Tom Kadwill] Include `Lotus::Helpers` in views. -- [Linus Pettersson] Allow to specify `--database` CLI option when generate a new project. Eg. `lotus new bookshelf --database=postgresql` +- [Luca Guidi] Introduced action generator. Eg. `bundle exec hanami generate action web dashboard#index` +- [Alfonso Uceda Pompa] Allow to specify default coookies options in application configuration. Eg. `cookies true, { domain: 'hanamirb.org' }` +- [Tom Kadwill] Include `Hanami::Helpers` in views. +- [Linus Pettersson] Allow to specify `--database` CLI option when generate a new project. Eg. `hanami new bookshelf --database=postgresql` - [Linus Pettersson] Initialize a Git repository when generating a new project -- [Alfonso Uceda Pompa] Produce `.lotusrc` when generating a new project +- [Alfonso Uceda Pompa] Produce `.hanamirc` when generating a new project - [Alfonso Uceda Pompa] Security HTTP headers. `X-Frame-Options` and `Content-Security-Policy` are now enabled by default. -- [Linus Pettersson] Database console. Run with `bundle exec lotus db console` +- [Linus Pettersson] Database console. Run with `bundle exec hanami db console` - [Luca Guidi] Dynamic finders for relative and absolute routes. It implements method missing: `Web::Routes.home_path` will resolve to `Web::Routes.path(:home)`. ### Changed @@ -145,35 +145,35 @@ A complete web framework for Ruby ## v0.2.1 - 2015-02-06 ### Added -- [Huy Đỗ] Introduced `Lotus::Logger` -- [Jimmy Zhang] `lotus new` accepts a `--path` argument -- [Jimmy Zhang] Project generator for the current directory (`lotus new .`). This is useful to provide a web deliverable for existing Ruby gems. +- [Huy Đỗ] Introduced `Hanami::Logger` +- [Jimmy Zhang] `hanami new` accepts a `--path` argument +- [Jimmy Zhang] Project generator for the current directory (`hanami new .`). This is useful to provide a web deliverable for existing Ruby gems. - [Trung Lê] Add example mapping file for project generator: `lib/config/mapping.rb` - [Hiếu Nguyễn] RSpec support for project generator: `--test=rspec` or `--test=minitest` (default) ### Fixed -- [Luca Guidi] `lotus version` to previx `v` (eg `v0.2.1`) +- [Luca Guidi] `hanami version` to previx `v` (eg `v0.2.1`) - [Rob Yurkowski] Ensure project name doesn't contain special or forbidden characters - [Luca Guidi] Ensure all the applications are loaded in console - [Trung Lê] Container architecture: preload only `lib//**/*.rb` -- [Hiếu Nguyễn] Fixed `lotus new` to print usage when project name isn't provided +- [Hiếu Nguyễn] Fixed `hanami new` to print usage when project name isn't provided ## v0.2.0 - 2014-06-23 ### Added -- [Luca Guidi] Introduced `lotus new` as a command to generate projects. It supports "container" architecture for now. -- [Luca Guidi] Show a welcome page when one mounted Lotus application doesn't have routes -- [Luca Guidi] Introduced `Lotus::Application.preload!` to preload all the Lotus applications in a given Ruby process. (Bulk `Lotus::Application.load!`) +- [Luca Guidi] Introduced `hanami new` as a command to generate projects. It supports "container" architecture for now. +- [Luca Guidi] Show a welcome page when one mounted Hanami application doesn't have routes +- [Luca Guidi] Introduced `Hanami::Application.preload!` to preload all the Hanami applications in a given Ruby process. (Bulk `Hanami::Application.load!`) - [Trung Lê] Allow browsers to fake non `GET`/`POST` requests via `Rack::MethodOverride` - [Josue Abreu] Allow to define body parses for non `GET` HTTP requests (`body_parsers` configuration) - [Alfonso Uceda Pompa] Allow to toggle static assets serving (`serve_assets` configuration) - [Alfonso Uceda Pompa] Allow to serve assets from multiple sources (`assets` configuration) - [Luca Guidi] Allow to configure `ENV` vars with per environment `.env` files -- [Alfonso Uceda Pompa] Introduced `lotus routes` command +- [Alfonso Uceda Pompa] Introduced `hanami routes` command - [Luca Guidi] Allow to configure low level settings for MVC frameworks (`model`, `view` and `controller` configuration) -- [Luca Guidi] Introduced `Lotus::Container` -- [Trung Lê] Include `Lotus::Presenter` as part of the duplicated modules -- [Trung Lê] Include `Lotus::Entity` and `Lotus::Repository` as part of the duplicated modules -- [Luca Guidi] Introduced code reloading for `lotus server` +- [Luca Guidi] Introduced `Hanami::Container` +- [Trung Lê] Include `Hanami::Presenter` as part of the duplicated modules +- [Trung Lê] Include `Hanami::Entity` and `Hanami::Repository` as part of the duplicated modules +- [Luca Guidi] Introduced code reloading for `hanami server` - [Trung Lê] Allow to configure database adapter (`adapter` configuration) - [Luca Guidi & Trung Lê] Allow to configure database mapping (`mapping` configuration) - [Piotr Kurek] Introduced custom templates for non successful responses @@ -182,10 +182,10 @@ A complete web framework for Ruby - [Josue Abreu] Allow to configure cookies (`cookies` configuration) - [Piotr Kurek] Allow to yield multiple configurations per application, according to the current environment - [David Celis] Allow to configure Rack middleware stack (`middleware` configuration) -- [David Celis] Introduced `lotus console` command. It runs the REPL configured in `Gemfile` (eg. pry or ripl). Defaults to IRb. -- [Luca Guidi] Introduced `Lotus::Environment` which holds the informations about the current environment, and CLI arguments -- [Luca Guidi] Introduced `Lotus::Application.load!` to load and configure an application without requiring user defined code (controllers, views, etc.) -- [Leonard Garvey] Introduced `lotus server` command. It runs the application with the Rack server declared in `Gemfile` (eg. puma, thin, unicorn). It defaults to `WEBRick`. +- [David Celis] Introduced `hanami console` command. It runs the REPL configured in `Gemfile` (eg. pry or ripl). Defaults to IRb. +- [Luca Guidi] Introduced `Hanami::Environment` which holds the informations about the current environment, and CLI arguments +- [Luca Guidi] Introduced `Hanami::Application.load!` to load and configure an application without requiring user defined code (controllers, views, etc.) +- [Leonard Garvey] Introduced `hanami server` command. It runs the application with the Rack server declared in `Gemfile` (eg. puma, thin, unicorn). It defaults to `WEBRick`. - [Luca Guidi] Official support for MRI 2.1 and 2.2 ### Changed @@ -196,8 +196,8 @@ A complete web framework for Ruby ## v0.1.0 - 2014-06-23 ### Added -- [Luca Guidi] Allow to run multiple Lotus applications in the same Ruby process (framework duplication) -- [Luca Guidi] Introduced `Lotus::Routes` as factory to generate application URLs +- [Luca Guidi] Allow to run multiple Hanami applications in the same Ruby process (framework duplication) +- [Luca Guidi] Introduced `Hanami::Routes` as factory to generate application URLs - [Luca Guidi] Allow to configure scheme, host and port (`scheme`, `host` and `port` configuration) - [Luca Guidi] Allow to configure a layout to use for all the views of an application (`layout` configuration) - [Luca Guidi] Allow to configure routes (`routes` configuration) @@ -205,6 +205,6 @@ A complete web framework for Ruby - [Luca Guidi] Allow to serve static files (`assets` configuration) - [Luca Guidi] Render default pages for non successful responses (eg `404` or `500`) - [Luca Guidi] Allow to configure the root of an application (`root` configuration) -- [Luca Guidi] Introduced `Lotus::Configuration` -- [Luca Guidi] Introduced `Lotus::Application` +- [Luca Guidi] Introduced `Hanami::Configuration` +- [Luca Guidi] Introduced `Hanami::Application` - [Luca Guidi] Official support for MRI 2.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6143111b..55771ae1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -Lotus is an open source project and we would love you to help us make it better. +Hanami is an open source project and we would love you to help us make it better. ## Reporting Issues @@ -21,7 +21,7 @@ but we just don't know. ## Pull requests -We accept pull requests to Lotus for: +We accept pull requests to Hanami for: * Adding documentation * Fixing bugs @@ -47,6 +47,6 @@ request; Questions, clarifications, and so on. Some things that will increase the chance that your pull request is accepted: -* Use Lotus idioms +* Use Hanami idioms * Include tests that fail without your code, and pass with it * Update the documentation, guides, etc. diff --git a/FEATURES.md b/FEATURES.md index d3f8e177..5c757000 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -1,4 +1,4 @@ -# Lotus +# Hanami ### A complete web framework for Ruby ## Features @@ -20,16 +20,16 @@ * `asset_url` - Content Delivery Network (CDN) support for static assets (CDN mode) - Checksum suffix for static assets in production mode (Digest mode) -- Support for third party gems as assets distribution channel (eg. `lotus-jquery`) -- CLI: `lotus assets` command `precompile`: preprocess, minify and append checksum suffix -- CLI: `lotus destroy` destroy apps, models, actions, migrations and mailers +- Support for third party gems as assets distribution channel (eg. `hanami-jquery`) +- CLI: `hanami assets` command `precompile`: preprocess, minify and append checksum suffix +- CLI: `hanami destroy` destroy apps, models, actions, migrations and mailers - Custom initializers (`apps/web/config/initializers`) - Rake tasks `:preload` and `:environment` ## v0.5.0 - 2015-09-30 - Mailers -- CLI: `lotus generate mailer` +- CLI: `hanami generate mailer` - SQL joins - Custom coercers for data mapper @@ -39,7 +39,7 @@ - Application architecture - Database migrations -- CLI: `lotus db` commands: `create`, `drop`, `prepare`, `migrate`, `version`, `apply`. +- CLI: `hanami db` commands: `create`, `drop`, `prepare`, `migrate`, `version`, `apply`. - HTML5 Form helpers - Cross Site Request Forgery (CSRF) protection - Force SSL @@ -50,26 +50,26 @@ - Automatic secure cookies - Routing helpers for actions - Send files from actions -- `Lotus.root` returns top level directory of the project. +- `Hanami.root` returns top level directory of the project. ## v0.3.1 - 2015-05-15 -- CLI: `lotus generate app admin` creates a new application (`apps/admin`). -- CLI: `lotus generate model user`. It generates entity, repository and related unit test files. -- `Lotus.env` and `Lotus.env?` for current environment introspection (eg. `Lotus.env?(:test)` or `Lotus.env?(:staging, :production)`) +- CLI: `hanami generate app admin` creates a new application (`apps/admin`). +- CLI: `hanami generate model user`. It generates entity, repository and related unit test files. +- `Hanami.env` and `Hanami.env?` for current environment introspection (eg. `Hanami.env?(:test)` or `Hanami.env?(:staging, :production)`) - Allow repositories to execute raw query/commands against database - Automatic timestamps update for entities -– Dirty Tracking for entities (via `Lotus::Entity::DirtyTracking`) +– Dirty Tracking for entities (via `Hanami::Entity::DirtyTracking`) - Nested RESTful resource(s) - String pluralization and singularization ## v0.3.0 - 2015-03-23 -- CLI: `lotus generate action web dashboard#index`. It generates an action, a view, a template, a route and related unit test files. -- CLI: `lotus db console`. It starts a database REPL. +- CLI: `hanami generate action web dashboard#index`. It generates an action, a view, a template, a route and related unit test files. +- CLI: `hanami db console`. It starts a database REPL. - Full featured HTML5 markup generator for views (Eg. `html.div { p "Hello World" }`) - Routing helpers in views and templates (Eg. `routes.home_path`). -- `lotus new` supports `--database` (Eg. `lotus new bookshelf --database=postgresql`). +- `hanami new` supports `--database` (Eg. `hanami new bookshelf --database=postgresql`). - Initialize a Git repository when generate a new application - Security: XSS (Cross Site Scripting) protections - Security: Clickhijacking protection @@ -85,23 +85,23 @@ ## v0.2.1 - 2015-02-06 - Allow entities to include validations. -- `lotus new .` to generate a Lotus application for an existing code base (Eg. a gem that needs a web UI). -- `lotus new` supports `--path` (for destination directory), `--test` (to generate Minitest or RSpec boilerplate). -- Lotus logger +- `hanami new .` to generate a Hanami application for an existing code base (Eg. a gem that needs a web UI). +- `hanami new` supports `--path` (for destination directory), `--test` (to generate Minitest or RSpec boilerplate). +- Hanami logger ## v0.2.0 - 2014-12-23 - Support Minitest as default testing framework (`bundle exec rake` runs the entire test suite of an application). - Support for _Method Override_ technique. - Custom templates for non successful responses (Eg. `404.html.erb`). -- Support distinct `.env` files for each Lotus environment. -- Allow to configure multiple applications and handle Lotus environments accordingly. +- Support distinct `.env` files for each Hanami environment. +- Allow to configure multiple applications and handle Hanami environments accordingly. - Allow to configure middleware stack, routes, database mapping and adapter for each application. - Show a welcome page with instructions for new generated apps. -- CLI: `lotus routes`. It prints all the routes available for all the applications. -- CLI: `lotus new`. It generates a new application which can run multiple Lotus applications (_Container_ architecture). -- CLI: `lotus console`. It starts a Ruby REPL. It supports IRB (default), Pry and Ripl. -- CLI: `lotus server`. It starts a web server that supports code reloading. It supports all the Rack web servers (default: WEBRick). +- CLI: `hanami routes`. It prints all the routes available for all the applications. +- CLI: `hanami new`. It generates a new application which can run multiple Hanami applications (_Container_ architecture). +- CLI: `hanami console`. It starts a Ruby REPL. It supports IRB (default), Pry and Ripl. +- CLI: `hanami server`. It starts a web server that supports code reloading. It supports all the Rack web servers (default: WEBRick). - Database adapters: File system (default for new apps) - Allow to share code for all the views and actions of an application - Reusable validations framework (mixin). It supports: coercions and presence, format, acceptance, size, inclusion, exclusion, confirmation validations. @@ -117,10 +117,10 @@ ## v0.1.0 - 2014-06-23 -- Run multiple Lotus applications in the same Ruby process +- Run multiple Hanami applications in the same Ruby process - Serve static files - Render default pages for non successful responses (404, 500, etc.) -- Support multiple Lotus environments (development, test and production) +- Support multiple Hanami environments (development, test and production) - Full stack applications - Data mapper - Database adapters: Memory and SQL @@ -148,7 +148,7 @@ - Nested route namespaces - RESTful resource(s), including collection and member actions - Named routes, routes constraints, variables, catch-all -- Compatibility with Lotus::Controller +- Compatibility with Hanami::Controller - HTTP redirect from the router - HTTP routing compatible with Rack - Thread safety diff --git a/Gemfile b/Gemfile index a0bae398..a579f5ac 100644 --- a/Gemfile +++ b/Gemfile @@ -8,15 +8,15 @@ if !ENV['TRAVIS'] end gem 'sass' -gem 'lotus-utils', '~> 0.6', require: false, github: 'lotus/utils', branch: '0.6.x' -gem 'lotus-validations', '~> 0.4', require: false, github: 'lotus/validations', branch: '0.4.x' -gem 'lotus-router', '~> 0.5', require: false, github: 'lotus/router', branch: '0.5.x' -gem 'lotus-controller', '~> 0.5', require: false, github: 'lotus/controller', branch: '0.5.x' -gem 'lotus-view', '~> 0.5', require: false, github: 'lotus/view', branch: '0.5.x' -gem 'lotus-model', '~> 0.5', require: false, github: 'lotus/model', branch: '0.5.x' -gem 'lotus-helpers', '~> 0.2', require: false, github: 'lotus/helpers', branch: '0.2.x' -gem 'lotus-mailer', '~> 0.1', require: false, github: 'lotus/mailer', branch: '0.1.x' -gem 'lotus-assets', '~> 0.1', require: false, github: 'lotus/assets', branch: '0.1.x' +gem 'hanami-utils', '~> 0.7', require: false, github: 'hanami/utils', branch: '0.7.x' +gem 'hanami-validations', '~> 0.5', require: false, github: 'hanami/validations', branch: '0.5.x' +gem 'hanami-router', '~> 0.6', require: false, github: 'hanami/router', branch: '0.6.x' +gem 'hanami-controller', '~> 0.6', require: false, github: 'hanami/controller', branch: '0.6.x' +gem 'hanami-view', '~> 0.6', require: false, github: 'hanami/view', branch: '0.6.x' +gem 'hanami-model', '~> 0.6', require: false, github: 'hanami/model', branch: '0.6.x' +gem 'hanami-helpers', '~> 0.3', require: false, github: 'hanami/helpers', branch: '0.3.x' +gem 'hanami-mailer', '~> 0.2', require: false, github: 'hanami/mailer', branch: '0.2.x' +gem 'hanami-assets', '~> 0.2', require: false, github: 'hanami/assets', branch: '0.2.x' platforms :ruby do gem 'sqlite3' diff --git a/README.md b/README.md index de4e24e3..8f3bb0e2 100644 --- a/README.md +++ b/README.md @@ -1,69 +1,69 @@ -# Lotus +# Hanami -A complete web framework for Ruby +The web, with simplicity. ## Frameworks -Lotus combines small yet powerful frameworks: +Hanami combines small yet powerful frameworks: -* [**Lotus::Utils**](https://github.com/lotus/utils) - Ruby core extensions and class utilities -* [**Lotus::Router**](https://github.com/lotus/router) - Rack compatible HTTP router for Ruby -* [**Lotus::Validations**](https://github.com/lotus/validations) - Validations mixin for Ruby objects -* [**Lotus::Helpers**](https://github.com/lotus/helpers) - View helpers for Ruby applications -* [**Lotus::Mailer**](https://github.com/lotus/mailer) - Mail for Ruby applications -* [**Lotus::Model**](https://github.com/lotus/model) - Persistence with entities, repositories and data mapper -* [**Lotus::Assets**](https://github.com/lotus/assets) - Assets management for Ruby -* [**Lotus::View**](https://github.com/lotus/view) - Presentation with a separation between views and templates -* [**Lotus::Controller**](https://github.com/lotus/controller) - Full featured, fast and testable actions for Rack +* [**Hanami::Utils**](https://github.com/hanami/utils) - Ruby core extensions and class utilities +* [**Hanami::Router**](https://github.com/hanami/router) - Rack compatible HTTP router for Ruby +* [**Hanami::Validations**](https://github.com/hanami/validations) - Validations mixin for Ruby objects +* [**Hanami::Helpers**](https://github.com/hanami/helpers) - View helpers for Ruby applications +* [**Hanami::Mailer**](https://github.com/hanami/mailer) - Mail for Ruby applications +* [**Hanami::Model**](https://github.com/hanami/model) - Persistence with entities, repositories and data mapper +* [**Hanami::Assets**](https://github.com/hanami/assets) - Assets management for Ruby +* [**Hanami::View**](https://github.com/hanami/view) - Presentation with a separation between views and templates +* [**Hanami::Controller**](https://github.com/hanami/controller) - Full featured, fast and testable actions for Rack -These components are designed to be used independently or together in a Lotus application. +These components are designed to be used independently or together in a Hanami application. If you aren't familiar with them, please take time to go through their READMEs. ## Status -[![Gem Version](https://badge.fury.io/rb/lotusrb.svg)](http://badge.fury.io/rb/lotusrb) -[![Build Status](https://secure.travis-ci.org/lotus/lotus.svg?branch=master)](http://travis-ci.org/lotus/lotus?branch=master) -[![Coverage](https://coveralls.io/repos/lotus/lotus/badge.svg?branch=master)](https://coveralls.io/r/lotus/lotus) -[![Code Climate](https://codeclimate.com/github/lotus/lotus.svg)](https://codeclimate.com/github/lotus/lotus) -[![Dependencies](https://gemnasium.com/lotus/lotus.svg)](https://gemnasium.com/lotus/lotus) -[![Inline docs](http://inch-ci.org/github/lotus/lotus.svg)](http://inch-ci.org/github/lotus/lotus) +[![Gem Version](https://badge.fury.io/rb/hanami.svg)](http://badge.fury.io/rb/hanami) +[![Build Status](https://secure.travis-ci.org/hanami/hanami.svg?branch=master)](http://travis-ci.org/hanami/hanami?branch=master) +[![Coverage](https://coveralls.io/repos/hanami/hanami/badge.svg?branch=master)](https://coveralls.io/r/hanami/hanami) +[![Code Climate](https://codeclimate.com/github/hanami/hanami.svg)](https://codeclimate.com/github/hanami/hanami) +[![Dependencies](https://gemnasium.com/hanami/hanami.svg)](https://gemnasium.com/hanami/hanami) +[![Inline docs](http://inch-ci.org/github/hanami/hanami.svg)](http://inch-ci.org/github/hanami/hanami) ## Contact -* Home page: http://lotusrb.org -* Community: http://lotusrb.org/community -* Guides: http://lotusrb.org/guides -* Mailing List: http://lotusrb.org/mailing-list -* API Doc: http://rdoc.info/gems/lotusrb -* Bugs/Issues: https://github.com/lotus/lotus/issues -* Support: http://stackoverflow.com/questions/tagged/lotus-ruby -* Forum: https://discuss.lotusrb.org -* Chat: http://chat.lotusrb.org +* Home page: http://hanamirb.org +* Community: http://hanamirb.org/community +* Guides: http://hanamirb.org/guides +* Mailing List: http://hanamirb.org/mailing-list +* API Doc: http://rdoc.info/gems/hanami +* Bugs/Issues: https://github.com/hanami/hanami/issues +* Support: http://stackoverflow.com/questions/tagged/hanami +* Forum: https://discuss.hanamirb.org +* Chat: http://chat.hanamirb.org ## Rubies -__Lotus__ supports Ruby (MRI) 2+ +__Hanami__ supports Ruby (MRI) 2+ ## Installation ```shell -% gem install lotusrb +% gem install hanami ``` ## Usage ```shell -% lotus new bookshelf +% hanami new bookshelf % cd bookshelf && bundle -% bundle exec lotus server # visit http://localhost:2300 +% bundle exec hanami server # visit http://localhost:2300 ``` -Please follow along with the [Getting Started guide](http://lotusrb.org/guides/getting-started). +Please follow along with the [Getting Started guide](http://hanamirb.org/guides/getting-started). ## Community We strive for a Community made of **inclusive, helpful and smart people**. -We have a [Code of Conduct](http://lotusrb.org/community/#code-of-conduct) to handle controversial cases. +We have a [Code of Conduct](http://hanamirb.org/community/#code-of-conduct) to handle controversial cases. In general, we expect **you** to be **nice** with other people. Our hope is for a great software and a great Community. @@ -85,7 +85,7 @@ This Code of Conduct is adapted from the Contributor Covenant, version 1.1.0, av ## Contributing -1. Fork it ( https://github.com/lotus/lotus/fork ) +1. Fork it ( https://github.com/hanami/hanami/fork ) 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) @@ -93,8 +93,9 @@ This Code of Conduct is adapted from the Contributor Covenant, version 1.1.0, av ## Versioning -__Lotus__ uses [Semantic Versioning 2.0.0](http://semver.org) +__Hanami__ uses [Semantic Versioning 2.0.0](http://semver.org) ## Copyright Copyright © 2014-2016 Luca Guidi – Released under MIT License +This project was formerly known as Lotus (`lotusrb`). diff --git a/bin/lotus b/bin/hanami similarity index 50% rename from bin/lotus rename to bin/hanami index 8a302f92..59b64142 100755 --- a/bin/lotus +++ b/bin/hanami @@ -1,5 +1,5 @@ #!/usr/bin/env ruby require 'bundler' -require 'lotus/cli' -Lotus::Cli.start +require 'hanami/cli' +Hanami::Cli.start diff --git a/lotusrb.gemspec b/hanami.gemspec similarity index 60% rename from lotusrb.gemspec rename to hanami.gemspec index e42e2910..2f9b4fd4 100644 --- a/lotusrb.gemspec +++ b/hanami.gemspec @@ -1,31 +1,31 @@ # coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'lotus/version' +require 'hanami/version' Gem::Specification.new do |spec| - spec.name = 'lotusrb' - spec.version = Lotus::VERSION + spec.name = 'hanami' + spec.version = Hanami::VERSION spec.authors = ['Luca Guidi', 'Trung Lê', 'Alfonso Uceda Pompa'] spec.email = ['me@lucaguidi.com', 'trung.le@ruby-journal.com', 'uceda73@gmail.com'] - spec.summary = %q{A complete web framework for Ruby} - spec.description = %q{A complete web framework for Ruby} - spec.homepage = 'http://lotusrb.org' + spec.summary = %q{The web, with simplicity.} + spec.description = %q{Hanami is a simple and complete web framework for Ruby} + spec.homepage = 'http://hanamirb.org' spec.license = 'MIT' - spec.files = `git ls-files -z -- lib/* bin/* LICENSE.md README.md CHANGELOG.md FEATURES.md lotusrb.gemspec`.split("\x0") + spec.files = `git ls-files -z -- lib/* bin/* LICENSE.md README.md CHANGELOG.md FEATURES.md hanami.gemspec`.split("\x0") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test)/}) spec.require_paths = ['lib'] spec.required_ruby_version = '>= 2.0.0' - spec.add_dependency 'lotus-utils', '~> 0.6' - spec.add_dependency 'lotus-router', '~> 0.5' - spec.add_dependency 'lotus-controller', '~> 0.5' - spec.add_dependency 'lotus-view', '~> 0.5' - spec.add_dependency 'lotus-helpers', '~> 0.2', '>= 0.2.6' - spec.add_dependency 'lotus-mailer', '~> 0.1' - spec.add_dependency 'lotus-assets', '~> 0.1' + spec.add_dependency 'hanami-utils', '~> 0.7' + spec.add_dependency 'hanami-router', '~> 0.6' + spec.add_dependency 'hanami-controller', '~> 0.6' + spec.add_dependency 'hanami-view', '~> 0.6' + spec.add_dependency 'hanami-helpers', '~> 0.3' + spec.add_dependency 'hanami-mailer', '~> 0.2' + spec.add_dependency 'hanami-assets', '~> 0.2' spec.add_dependency 'shotgun', '~> 0.9' spec.add_dependency 'dotenv', '~> 2.0' spec.add_dependency 'thor', '~> 0.19' diff --git a/lib/lotus.rb b/lib/hanami.rb similarity index 60% rename from lib/lotus.rb rename to lib/hanami.rb index 4c6c337e..e3724413 100644 --- a/lib/lotus.rb +++ b/lib/hanami.rb @@ -1,14 +1,14 @@ -require 'lotus/version' -require 'lotus/application' -require 'lotus/container' -require 'lotus/environment' +require 'hanami/version' +require 'hanami/application' +require 'hanami/container' +require 'hanami/environment' # A complete web framework for Ruby # # @since 0.1.0 # -# @see http://lotusrb.org -module Lotus +# @see http://hanamirb.org +module Hanami DEFAULT_PUBLIC_DIRECTORY = 'public'.freeze # Return root of the project (top level directory). @@ -18,7 +18,7 @@ module Lotus # @since 0.3.2 # # @example - # Lotus.root # => # + # Hanami.root # => # def self.root environment.root end @@ -33,10 +33,10 @@ module Lotus # # @since 0.3.1 # - # @see Lotus::Environment#environment + # @see Hanami::Environment#environment # # @example - # Lotus.env => "development" + # Hanami.env => "development" def self.env environment.environment end @@ -50,28 +50,28 @@ module Lotus # # @since 0.3.1 # - # @see Lotus.env + # @see Hanami.env # # @example Single name - # puts ENV['LOTUS_ENV'] # => "development" + # puts ENV['HANAMI_ENV'] # => "development" # - # Lotus.env?(:development) # => true - # Lotus.env?('development') # => true + # Hanami.env?(:development) # => true + # Hanami.env?('development') # => true # - # Lotus.env?(:production) # => false + # Hanami.env?(:production) # => false # # @example Multiple names - # puts ENV['LOTUS_ENV'] # => "development" + # puts ENV['HANAMI_ENV'] # => "development" # - # Lotus.env?(:development, :test) # => true - # Lotus.env?(:production, :staging) # => false + # Hanami.env?(:development, :test) # => true + # Hanami.env?(:production, :staging) # => false def self.env?(*names) environment.environment?(*names) end # Return environment # - # @return [Lotus::Environment] environment + # @return [Hanami::Environment] environment # # @api private # @since 0.3.2 diff --git a/lib/lotus/action/csrf_protection.rb b/lib/hanami/action/csrf_protection.rb similarity index 94% rename from lib/lotus/action/csrf_protection.rb rename to lib/hanami/action/csrf_protection.rb index c2d24f1c..880b2c44 100644 --- a/lib/lotus/action/csrf_protection.rb +++ b/lib/hanami/action/csrf_protection.rb @@ -1,6 +1,6 @@ require 'securerandom' -module Lotus +module Hanami module Action # Invalid CSRF Token # @@ -18,7 +18,7 @@ module Lotus # # If the param matches with the challenge token, the flow can continue. # Otherwise the application detects an attack attempt, it reset the session - # and Lotus::Action::InvalidCSRFTokenError is raised. + # and Hanami::Action::InvalidCSRFTokenError is raised. # # We can specify a custom handling strategy, by overriding #handle_invalid_csrf_token. # @@ -70,7 +70,7 @@ module Lotus module CSRFProtection # Session and params key for CSRF token. # - # This key is shared with lotus-controller and lotus-helpers + # This key is shared with hanami-controller and hanami-helpers # # @since 0.4.0 # @api private @@ -95,7 +95,7 @@ module Lotus def self.included(action) action.class_eval do before :set_csrf_token, :verify_csrf_token - end unless Lotus.env?(:test) + end unless Hanami.env?(:test) end private @@ -155,7 +155,7 @@ module Lotus # # Override this method, for custom handling. # - # @raise [Lotus::Action::InvalidCSRFTokenError] + # @raise [Hanami::Action::InvalidCSRFTokenError] # # @since 0.4.0 def handle_invalid_csrf_token diff --git a/lib/lotus/action/routing_helpers.rb b/lib/hanami/action/routing_helpers.rb similarity index 79% rename from lib/lotus/action/routing_helpers.rb rename to lib/hanami/action/routing_helpers.rb index c8b74dfb..594f2037 100644 --- a/lib/lotus/action/routing_helpers.rb +++ b/lib/hanami/action/routing_helpers.rb @@ -1,18 +1,18 @@ -require 'lotus/utils/string' +require 'hanami/utils/string' -module Lotus +module Hanami module Action - # Routing helper for full stack Lotus web applications. + # Routing helper for full stack Hanami web applications. # # For a given application called Web::Application, at runtime - # Lotus creates a routes factory called Web::Routes. + # Hanami creates a routes factory called Web::Routes. # # Included by default in every controller. # # @since 0.3.2 # # @example Usage in controller - # require 'lotus' + # require 'hanami' # # module Web::Controllers::Protected # class Index diff --git a/lib/lotus/application.rb b/lib/hanami/application.rb similarity index 75% rename from lib/lotus/application.rb rename to lib/hanami/application.rb index 846a3c26..68979fd1 100644 --- a/lib/lotus/application.rb +++ b/lib/hanami/application.rb @@ -1,21 +1,21 @@ -require 'lotus/utils/class_attribute' -require 'lotus/frameworks' -require 'lotus/configuration' -require 'lotus/loader' -require 'lotus/logger' -require 'lotus/rendering_policy' -require 'lotus/middleware' +require 'hanami/utils/class_attribute' +require 'hanami/frameworks' +require 'hanami/configuration' +require 'hanami/loader' +require 'hanami/logger' +require 'hanami/rendering_policy' +require 'hanami/middleware' -module Lotus - # A full stack Lotus application +module Hanami + # A full stack Hanami application # # @since 0.1.0 # # @example - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # end # end class Application @@ -29,7 +29,7 @@ module Lotus super base.class_eval do - include Lotus::Utils::ClassAttribute + include Hanami::Utils::ClassAttribute class_attribute :configuration self.configuration = Configuration.new @@ -40,7 +40,7 @@ module Lotus end end - # Registry of Lotus applications in the current Ruby process + # Registry of Hanami applications in the current Ruby process # # @return [Set] a set of all the registered applications # @@ -60,13 +60,13 @@ module Lotus # # @since 0.1.0 # - # @see Lotus::Configuration + # @see Hanami::Configuration # # @example - # require 'lotus' + # require 'hanami' # # module Bookshelf - # Application < Lotus::Application + # Application < Hanami::Application # configure do # # ... # end @@ -78,16 +78,16 @@ module Lotus # Return the routes for this application # - # @return [Lotus::Router] a route set + # @return [Hanami::Router] a route set # # @since 0.1.0 # - # @see Lotus::Configuration#routes + # @see Hanami::Configuration#routes attr_reader :routes # Set the routes for this application # - # @param [Lotus::Router] + # @param [Hanami::Router] # # @since 0.1.0 # @api private @@ -95,7 +95,7 @@ module Lotus # Rendering policy # - # @param [Lotus::RenderingPolicy] + # @param [Hanami::RenderingPolicy] # # @since 0.2.0 # @api private @@ -103,7 +103,7 @@ module Lotus # Initialize and load a new instance of the application # - # @return [Lotus::Application] a new instance of the application + # @return [Hanami::Application] a new instance of the application # # @since 0.1.0 def initialize(options = {}) @@ -114,16 +114,16 @@ module Lotus # Eager load the application configuration, by activating the framework # duplication mechanisms. # - # @param application [Lotus::Application, Class] + # @param application [Hanami::Application, Class] # @return void # # @since 0.1.1 # # @example - # require 'lotus' + # require 'hanami' # # module OneFile - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # routes do # get '/', to: 'dashboard#index' @@ -144,13 +144,13 @@ module Lotus # end # end def self.load!(application = self) - Lotus::Loader.new(application).load! + Hanami::Loader.new(application).load! end # Preload all the registered applications, by yielding their configurations # and preparing the frameworks. # - # This is useful for testing suites, where we want to make Lotus frameworks + # This is useful for testing suites, where we want to make Hanami frameworks # ready, but not preload applications code. # # This allows to test components such as views or actions in isolation and @@ -188,7 +188,7 @@ module Lotus # @since 0.1.0 # @api private # - # @see Lotus::Application.configuration + # @see Hanami::Application.configuration def configuration self.class.configuration end @@ -202,7 +202,7 @@ module Lotus end # Process a request. - # This method makes Lotus applications compatible with the Rack protocol. + # This method makes Hanami applications compatible with the Rack protocol. # # @param env [Hash] a Rack env # @@ -211,20 +211,20 @@ module Lotus # @since 0.1.0 # # @see http://rack.github.io - # @see Lotus::RenderingPolicy#render - # @see Lotus::Application#middleware + # @see Hanami::RenderingPolicy#render + # @see Hanami::Application#middleware def call(env) renderer.render(env, middleware.call(env)) end # Rack middleware stack # - # @return [Lotus::Middleware] the middleware stack + # @return [Hanami::Middleware] the middleware stack # # @since 0.1.0 # @api private # - # @see Lotus::Middleware + # @see Hanami::Middleware def middleware @middleware ||= configuration.middleware end diff --git a/lib/lotus/application_name.rb b/lib/hanami/application_name.rb similarity index 92% rename from lib/lotus/application_name.rb rename to lib/hanami/application_name.rb index 05aac795..961e5e8d 100644 --- a/lib/lotus/application_name.rb +++ b/lib/hanami/application_name.rb @@ -1,4 +1,4 @@ -module Lotus +module Hanami # An application name. # # @since 0.2.1 @@ -7,7 +7,7 @@ module Lotus # A list of words that are prohibited from forming the application name # # @since 0.2.1 - RESERVED_WORDS = %w(lotus).freeze + RESERVED_WORDS = %w(hanami).freeze # Initialize and check against reserved words # @@ -24,7 +24,7 @@ module Lotus # which is the default output. It must also be transformable into an # environment variable. # - # @return [Lotus::ApplicationName] a new instance of the application name + # @return [Hanami::ApplicationName] a new instance of the application name # # @since 0.2.1 def initialize(name) @@ -64,7 +64,7 @@ module Lotus # @return [TrueClass, FalseClass] the result of the check # # @example - # Lotus::ApplicationName.invalid?("lotus") # => true + # Hanami::ApplicationName.invalid?("hanami") # => true # # @since 0.2.1 def self.invalid?(name) diff --git a/lib/hanami/cli.rb b/lib/hanami/cli.rb new file mode 100644 index 00000000..eba2f509 --- /dev/null +++ b/lib/hanami/cli.rb @@ -0,0 +1,119 @@ +require 'thor' +require 'hanami/commands/console' +require 'hanami/commands/new/app' +require 'hanami/commands/new/container' + +module Hanami + class Cli < Thor + # include Thor::Actions + + desc 'version', 'prints Hanami version' + long_desc <<-EOS + `hanami version` prints the version of the bundled hanami gem. + EOS + def version + require 'hanami/version' + puts "v#{ Hanami::VERSION }" + end + + desc 'server', 'starts a hanami server' + long_desc <<-EOS + `hanami server` starts a server for the current hanami project. + + $ > hanami server + + $ > hanami server -p 4500 + EOS + method_option :port, aliases: '-p', desc: 'The port to run the server on, ' + method_option :server, desc: 'choose a specific Rack::Handler, e.g. webrick, thin etc' + method_option :rackup, desc: 'a rackup configuration file path to load (config.ru)' + method_option :host, desc: 'the host address to bind to' + method_option :debug, desc: 'turn on debug output' + method_option :warn, desc: 'turn on warnings' + method_option :daemonize, desc: 'if true, the server will daemonize itself (fork, detach, etc)' + method_option :pid, desc: 'path to write a pid file after daemonize' + method_option :environment, desc: 'path to environment configuration (config/environment.rb)' + method_option :code_reloading, desc: 'code reloading', type: :boolean, default: true + method_option :help, desc: 'displays the usage message' + def server + if options[:help] + invoke :help, ['server'] + else + require 'hanami/commands/server' + Hanami::Commands::Server.new(options).start + end + end + + desc 'console', 'starts a hanami console' + long_desc <<-EOS + `hanami console` starts the interactive hanami console. + + $ > hanami console --engine=pry + EOS + method_option :environment, desc: 'path to environment configuration (config/environment.rb)' + method_option :engine, desc: "choose a specific console engine: (#{Hanami::Commands::Console::ENGINES.keys.join('/')})" + method_option :help, desc: 'displays the usage method' + def console + if options[:help] + invoke :help, ['console'] + else + Hanami::Commands::Console.new(options).start + end + end + + desc 'new APPLICATION_NAME', 'generate a new hanami project' + long_desc <<-EOS + `hanami new` creates a new hanami project. + You can specify various options such as the database to be used as well as the path and architecture. + + $ > hanami new fancy_app --application_name=admin + + $ > hanami new fancy_app --arch=app + + $ > hanami new fancy_app --hanami-head=true + EOS + method_option :database, aliases: ['-d', '--db'], desc: "application database (#{Hanami::Generators::DatabaseConfig::SUPPORTED_ENGINES.keys.join('/')})", default: Hanami::Generators::DatabaseConfig::DEFAULT_ENGINE + method_option :architecture, aliases: ['-a', '--arch'], desc: 'project architecture (container/app)', default: Hanami::Commands::New::Abstract::DEFAULT_ARCHITECTURE + method_option :application_name, desc: 'application name, only for container', default: Hanami::Commands::New::Container::DEFAULT_APPLICATION_NAME + method_option :application_base_url, desc: 'application base url', default: Hanami::Commands::New::Abstract::DEFAULT_APPLICATION_BASE_URL + method_option :test, desc: "project test framework (#{Hanami::Generators::TestFramework::VALID_FRAMEWORKS.join('/')})", default: Hanami::Hanamirc::DEFAULT_TEST_SUITE + method_option :hanami_head, desc: 'use Hanami HEAD (true/false)', type: :boolean, default: false + method_option :help, desc: 'displays the usage method' + def new(application_name) + if options[:help] + invoke :help, ['new'] + elsif options[:architecture] == 'app' + Hanami::Commands::New::App.new(options, application_name).start + else + Hanami::Commands::New::Container.new(options, application_name).start + end + end + + desc 'routes', 'prints the routes' + long_desc <<-EOS + `hanami routes` outputs all the registered routes to the console. + EOS + method_option :environment, desc: 'path to environment configuration (config/environment.rb)' + method_option :help, desc: 'displays the usage method' + def routes + if options[:help] + invoke :help, ['routes'] + else + require 'hanami/commands/routes' + Hanami::Commands::Routes.new(options).start + end + end + + require 'hanami/cli_sub_commands/db' + register Hanami::CliSubCommands::DB, 'db', 'db [SUBCOMMAND]', 'manage set of DB operations' + + require 'hanami/cli_sub_commands/generate' + register Hanami::CliSubCommands::Generate, 'generate', 'generate [SUBCOMMAND]', 'generate hanami classes' + + require 'hanami/cli_sub_commands/destroy' + register Hanami::CliSubCommands::Destroy, 'destroy', 'destroy [SUBCOMMAND]', 'destroy hanami classes' + + require 'hanami/cli_sub_commands/assets' + register Hanami::CliSubCommands::Assets, 'assets', 'assets [SUBCOMMAND]', 'manage assets' + end +end diff --git a/lib/lotus/cli_sub_commands/assets.rb b/lib/hanami/cli_sub_commands/assets.rb similarity index 64% rename from lib/lotus/cli_sub_commands/assets.rb rename to lib/hanami/cli_sub_commands/assets.rb index 2d3d3b2f..b4f81465 100644 --- a/lib/lotus/cli_sub_commands/assets.rb +++ b/lib/hanami/cli_sub_commands/assets.rb @@ -1,10 +1,10 @@ -module Lotus +module Hanami class CliSubCommands # A set of subcommands related to assets # # It is run with: # - # `bundle exec lotus assets` + # `bundle exec hanami assets` # # @since 0.6.0 # @api private @@ -13,8 +13,8 @@ module Lotus desc 'precompile', 'precompile assets for deployment' def precompile - require 'lotus/commands/assets/precompile' - Lotus::Commands::Assets::Precompile.new(options, environment).start + require 'hanami/commands/assets/precompile' + Hanami::Commands::Assets::Precompile.new(options, environment).start end private @@ -22,7 +22,7 @@ module Lotus # @since 0.6.0 # @api private def environment - Lotus::Environment.new(options) + Hanami::Environment.new(options) end end end diff --git a/lib/lotus/cli_sub_commands/db.rb b/lib/hanami/cli_sub_commands/db.rb similarity index 77% rename from lib/lotus/cli_sub_commands/db.rb rename to lib/hanami/cli_sub_commands/db.rb index 135ea477..761a96ed 100644 --- a/lib/lotus/cli_sub_commands/db.rb +++ b/lib/hanami/cli_sub_commands/db.rb @@ -1,10 +1,10 @@ -module Lotus +module Hanami class CliSubCommands # A set of subcommands related to DB # # It is run with: # - # `bundle exec lotus db` + # `bundle exec hanami db` # # @since 0.6.0 # @api private @@ -17,8 +17,8 @@ module Lotus if options[:help] invoke :help, ['console'] else - require 'lotus/commands/db/console' - Lotus::Commands::DB::Console.new(options, name).start + require 'hanami/commands/db/console' + Hanami::Commands::DB::Console.new(options, name).start end end @@ -29,8 +29,8 @@ module Lotus invoke :help, ['create'] else assert_allowed_environment! - require 'lotus/commands/db/create' - Lotus::Commands::DB::Create.new(options).start + require 'hanami/commands/db/create' + Hanami::Commands::DB::Create.new(options).start end end @@ -41,8 +41,8 @@ module Lotus invoke :help, ['drop'] else assert_allowed_environment! - require 'lotus/commands/db/drop' - Lotus::Commands::DB::Drop.new(options).start + require 'hanami/commands/db/drop' + Hanami::Commands::DB::Drop.new(options).start end end @@ -52,8 +52,8 @@ module Lotus if options[:help] invoke :help, ['migrate'] else - require 'lotus/commands/db/migrate' - Lotus::Commands::DB::Migrate.new(options, version).start + require 'hanami/commands/db/migrate' + Hanami::Commands::DB::Migrate.new(options, version).start end end @@ -64,8 +64,8 @@ module Lotus invoke :help, ['apply'] else assert_development_environment! - require 'lotus/commands/db/apply' - Lotus::Commands::DB::Apply.new(options).start + require 'hanami/commands/db/apply' + Hanami::Commands::DB::Apply.new(options).start end end @@ -76,8 +76,8 @@ module Lotus invoke :help, ['prepare'] else assert_allowed_environment! - require 'lotus/commands/db/prepare' - Lotus::Commands::DB::Prepare.new(options).start + require 'hanami/commands/db/prepare' + Hanami::Commands::DB::Prepare.new(options).start end end @@ -89,8 +89,8 @@ module Lotus if options[:help] invoke :help, ['version'] else - require 'lotus/commands/db/version' - Lotus::Commands::DB::Version.new(options).start + require 'hanami/commands/db/version' + Hanami::Commands::DB::Version.new(options).start end end @@ -99,7 +99,7 @@ module Lotus # @since 0.6.0 # @api private def environment - Lotus::Environment.new(options) + Hanami::Environment.new(options) end # @since 0.6.0 diff --git a/lib/hanami/cli_sub_commands/destroy.rb b/lib/hanami/cli_sub_commands/destroy.rb new file mode 100644 index 00000000..e2cc6baa --- /dev/null +++ b/lib/hanami/cli_sub_commands/destroy.rb @@ -0,0 +1,102 @@ +require 'hanami/routing/route' +require 'hanami/commands/generate/action' + +module Hanami + class CliSubCommands + class Destroy < Thor + include Thor::Actions + namespace :destroy + + desc 'action APPLICATION_NAME CONTROLLER_NAME#ACTION_NAME', 'destroy a hanami action' + long_desc <<-EOS + `hanami destroy action` will destroy an an action, view and template along with specs and a route. + + For Application architecture the application name is 'app'. For Container architecture the default application is called 'web'. + + > $ hanami destroy action app cars#index + + > $ hanami destroy action other-app cars#index + + > $ hanami destroy action web cars#create --method=post + EOS + + method_option :method, desc: "The HTTP method used when the route was generated. Must be one of (#{Hanami::Routing::Route::VALID_HTTP_VERBS.join('/')})", default: Hanami::Commands::Generate::Action::DEFAULT_HTTP_METHOD + method_option :url, desc: 'Relative URL for action, will be used for the route', default: nil + method_option :template, desc: 'Extension used when the template was generated. Default is defined through your .hanamirc file.' + + def actions(application_name, controller_and_action_name) + if options[:help] + invoke :help, ['action'] + else + Hanami::Commands::Generate::Action.new(options, application_name, controller_and_action_name).destroy.start + end + end + + desc 'migration NAME', 'destroy a migration' + long_desc <<-EOS + `hanami destroy migration` will destroy a migration file. + + > $ hanami destroy migration create_books + EOS + + def migration(name) + if options[:help] + invoke :help, ['migration'] + else + require 'hanami/commands/generate/migration' + Hanami::Commands::Generate::Migration.new(options, name).destroy.start + end + end + + desc 'model NAME', 'destroy an entity' + long_desc <<-EOS + `hanami destroy model` will destroy an entity along with repository + and corresponding tests + + > $ hanami generate model car + EOS + + def model(name) + if options[:help] + invoke :help, ['model'] + else + require 'hanami/commands/generate/model' + Hanami::Commands::Generate::Model.new(options, name).destroy.start + end + end + + desc 'application NAME', 'destroy an application' + long_desc <<-EOS + `hanami destroy application` will destroy an application, along with templates and specs. + + > $ hanami destroy application api + EOS + def application(name) + if options[:help] + invoke :help, ['app'] + else + require 'hanami/commands/generate/app' + Hanami::Commands::Generate::App.new(options, name).destroy.start + end + end + + desc 'mailer NAME', 'destroy a mailer' + long_desc <<-EOS + `hanami destroy mailer` will destroy a mailer, along with templates and specs. + + > $ hanami destroy mailer forgot_password + EOS + + def mailer(name) + if options[:help] + invoke :help, ['mailer'] + else + require 'hanami/commands/generate/mailer' + + options[:behavior] = :revoke + Hanami::Commands::Generate::Mailer.new(options, name).destroy.start + end + end + end + end +end diff --git a/lib/hanami/cli_sub_commands/generate.rb b/lib/hanami/cli_sub_commands/generate.rb new file mode 100644 index 00000000..712ec7b8 --- /dev/null +++ b/lib/hanami/cli_sub_commands/generate.rb @@ -0,0 +1,127 @@ +require 'hanami/routing/route' +require 'hanami/commands/generate/action' +require 'hanami/commands/generate/mailer' + +module Hanami + class CliSubCommands + # A set of generator subcommands + # + # It is run with: + # + # `bundle exec hanami generate` + # + # @since 0.6.0 + # @api private + class Generate < Thor + include Thor::Actions + + namespace :generate + + # @since 0.6.0 + # @api private + desc 'action APPLICATION_NAME CONTROLLER_NAME#ACTION_NAME', 'generate a hanami action' + long_desc <<-EOS + `hanami generate action` generates an an action, view and template along with specs and a route. + + For Application architecture the application name is 'app'. For Container architecture the default application is called 'web'. + + > $ hanami generate action app cars#index + + > $ hanami generate action other-app cars#index + + > $ hanami generate action web cars#create --method=post + EOS + method_option :method, desc: "The HTTP method to be used for the generated route. Must be one of (#{Hanami::Routing::Route::VALID_HTTP_VERBS.join('/')})", default: Hanami::Commands::Generate::Action::DEFAULT_HTTP_METHOD + method_option :url, desc: 'Relative URL for action, will be used for the route', default: nil + method_option :test, desc: 'Defines the testing Framework to be used. Default is defined through your .hanamirc file.' + method_option :skip_view, desc: 'Skip the generation of the view. Also skips template generation.', default: false, type: :boolean + method_option :template, desc: 'Extension to be used for the generated template. Default is defined through your .hanamirc file.' + def actions(application_name = nil, controller_and_action_name) + if Hanami::Environment.new(options).container? && application_name.nil? + msg = "ERROR: \"hanami generate action\" was called with arguments [\"#{controller_and_action_name}\"]\n" \ + "Usage: \"hanami action APPLICATION_NAME CONTROLLER_NAME#ACTION_NAME\"" + fail Error, msg + end + + if options[:help] + invoke :help, ['action'] + else + Hanami::Commands::Generate::Action.new(options, application_name, controller_and_action_name).start + end + end + + desc 'migration NAME', 'generate a migration' + long_desc <<-EOS + `hanami generate migration` will generate an empty migration file. + + > $ hanami generate migration do_something + EOS + def migration(name) + if options[:help] + invoke :help, ['migration'] + else + require 'hanami/commands/generate/migration' + Hanami::Commands::Generate::Migration.new(options, name).start + end + end + + desc 'model NAME', 'generate an entity' + long_desc <<-EOS + `hanami generate model` will generate an entity along with repository + and corresponding tests. The name of the model can contain slashes to + indicate module names. + + > $ hanami generate model car + + > $ hanami generate model vehicles/car + EOS + method_option :test, desc: 'Defines the testing Framework to be used. Default is defined through your .hanamirc file.' + def model(name) + if options[:help] + invoke :help, ['model'] + else + require 'hanami/commands/generate/model' + Hanami::Commands::Generate::Model.new(options, name).start + end + end + + desc 'mailer NAME', 'generate a mailer' + long_desc <<-EOS + `hanami generate mailer` will generate an empty mailer, along with templates and specs. + + > $ hanami generate mailer forgot_password + > $ hanami generate mailer forgot_password --to "'log@bookshelf.com'" --from "'support@bookshelf.com'" --subject "'New Password'" + EOS + method_option :to, desc: 'sender email', default: Hanami::Commands::Generate::Mailer::DEFAULT_TO + method_option :from, desc: 'sendee email', default: Hanami::Commands::Generate::Mailer::DEFAULT_FROM + method_option :subject, desc: 'email subject', default: Hanami::Commands::Generate::Mailer::DEFAULT_SUBJECT + def mailer(name) + if options[:help] + invoke :help, ['mailer'] + else + Hanami::Commands::Generate::Mailer.new(options, name).start + end + end + + desc 'app APPLICATION_NAME', 'generate an app' + long_desc <<-EOS + `hanami generate app` creates a new app inside the 'apps' directory. + + It can only be called for hanami applications with container architecture. + + > $ hanami generate app admin + + > $ hanami generate app reporting --application_base_url=/reports + EOS + method_option :application_base_url, desc: 'Base URL for the new app. If missing, then it is inferred from APPLICATION_NAME' + def app(application_name) + if options[:help] + invoke :help, ['app'] + else + require 'hanami/commands/generate/app' + Hanami::Commands::Generate::App.new(options, application_name).start + end + end + end + end +end diff --git a/lib/lotus/commands/assets/precompile.rb b/lib/hanami/commands/assets/precompile.rb similarity index 78% rename from lib/lotus/commands/assets/precompile.rb rename to lib/hanami/commands/assets/precompile.rb index 68ad7417..1ac3d8ef 100644 --- a/lib/lotus/commands/assets/precompile.rb +++ b/lib/hanami/commands/assets/precompile.rb @@ -1,6 +1,6 @@ -require 'lotus/assets' +require 'hanami/assets' -module Lotus +module Hanami module Commands class Assets class Precompile @@ -20,14 +20,14 @@ module Lotus @environment.require_application_environment if @environment.container? - Lotus::Container.new + Hanami::Container.new else - Lotus::Application.preload! + Hanami::Application.preload! end end def precompile - Lotus::Assets.deploy + Hanami::Assets.deploy end end end diff --git a/lib/lotus/commands/console.rb b/lib/hanami/commands/console.rb similarity index 88% rename from lib/lotus/commands/console.rb rename to lib/hanami/commands/console.rb index 18c9bb2e..4cdb0b77 100644 --- a/lib/lotus/commands/console.rb +++ b/lib/hanami/commands/console.rb @@ -1,10 +1,10 @@ -module Lotus +module Hanami module Commands # REPL that supports different engines. # # It is run with: # - # `bundle exec lotus console` + # `bundle exec hanami console` # # @since 0.1.0 # @api private @@ -30,9 +30,9 @@ module Lotus # @param options [Hash] Environment's options # # @since 0.1.0 - # @see Lotus::Environment#initialize + # @see Hanami::Environment#initialize def initialize(options) - @environment = Lotus::Environment.new(options) + @environment = Hanami::Environment.new(options) @options = @environment.to_options end @@ -80,9 +80,9 @@ module Lotus # @api private def load_application if @environment.container? - Lotus::Container.new + Hanami::Container.new else - Lotus::Application.preload_applications! + Hanami::Application.preload_applications! end end end diff --git a/lib/lotus/commands/db/abstract.rb b/lib/hanami/commands/db/abstract.rb similarity index 81% rename from lib/lotus/commands/db/abstract.rb rename to lib/hanami/commands/db/abstract.rb index cc7fe44d..30b8abf6 100644 --- a/lib/lotus/commands/db/abstract.rb +++ b/lib/hanami/commands/db/abstract.rb @@ -1,4 +1,4 @@ -module Lotus +module Hanami module Commands class DB class Abstract @@ -6,7 +6,7 @@ module Lotus def initialize(options) @options = options - @environment = Lotus::Environment.new(options) + @environment = Hanami::Environment.new(options) @environment.require_application_environment end diff --git a/lib/hanami/commands/db/apply.rb b/lib/hanami/commands/db/apply.rb new file mode 100644 index 00000000..f6d5a5ac --- /dev/null +++ b/lib/hanami/commands/db/apply.rb @@ -0,0 +1,14 @@ +require 'hanami/commands/db/abstract' + +module Hanami + module Commands + class DB + class Apply < Abstract + def start + require 'hanami/model/migrator' + Hanami::Model::Migrator.apply + end + end + end + end +end diff --git a/lib/lotus/commands/db/console.rb b/lib/hanami/commands/db/console.rb similarity index 58% rename from lib/lotus/commands/db/console.rb rename to lib/hanami/commands/db/console.rb index 5df3ab28..7471ea30 100644 --- a/lib/lotus/commands/db/console.rb +++ b/lib/hanami/commands/db/console.rb @@ -1,7 +1,7 @@ -require 'lotus/utils/class' -require 'lotus/commands/db/abstract' +require 'hanami/utils/class' +require 'hanami/commands/db/abstract' -module Lotus +module Hanami module Commands class DB class Console < Abstract @@ -21,11 +21,11 @@ module Lotus def config if name - app_constant = Lotus::Utils::Class.load_from_pattern!(Lotus::Utils::String.new(name).classify) - Lotus::Utils::Class.load_from_pattern!("#{app_constant}::Application").load! - Lotus::Utils::Class.load_from_pattern!("#{app_constant}::Model").configuration + app_constant = Hanami::Utils::Class.load_from_pattern!(Hanami::Utils::String.new(name).classify) + Hanami::Utils::Class.load_from_pattern!("#{app_constant}::Application").load! + Hanami::Utils::Class.load_from_pattern!("#{app_constant}::Model").configuration else - Lotus::Model.configuration + Hanami::Model.configuration end end @@ -38,7 +38,7 @@ module Lotus end def adapter_class - Lotus::Utils::Class.load_from_pattern!(adapter_config.class_name, Lotus::Model::Adapters) + Hanami::Utils::Class.load_from_pattern!(adapter_config.class_name, Hanami::Model::Adapters) end def connection_string diff --git a/lib/hanami/commands/db/create.rb b/lib/hanami/commands/db/create.rb new file mode 100644 index 00000000..72e36020 --- /dev/null +++ b/lib/hanami/commands/db/create.rb @@ -0,0 +1,14 @@ +require 'hanami/commands/db/abstract' + +module Hanami + module Commands + class DB + class Create < Abstract + def start + require 'hanami/model/migrator' + Hanami::Model::Migrator.create + end + end + end + end +end diff --git a/lib/hanami/commands/db/drop.rb b/lib/hanami/commands/db/drop.rb new file mode 100644 index 00000000..e21fb49c --- /dev/null +++ b/lib/hanami/commands/db/drop.rb @@ -0,0 +1,14 @@ +require 'hanami/commands/db/abstract' + +module Hanami + module Commands + class DB + class Drop < Abstract + def start + require 'hanami/model/migrator' + Hanami::Model::Migrator.drop + end + end + end + end +end diff --git a/lib/lotus/commands/db/migrate.rb b/lib/hanami/commands/db/migrate.rb similarity index 60% rename from lib/lotus/commands/db/migrate.rb rename to lib/hanami/commands/db/migrate.rb index 6f03123f..15512b41 100644 --- a/lib/lotus/commands/db/migrate.rb +++ b/lib/hanami/commands/db/migrate.rb @@ -1,6 +1,6 @@ -require 'lotus/commands/db/abstract' +require 'hanami/commands/db/abstract' -module Lotus +module Hanami module Commands class DB class Migrate < Abstract @@ -10,8 +10,8 @@ module Lotus end def start - require 'lotus/model/migrator' - Lotus::Model::Migrator.migrate(version: @version) + require 'hanami/model/migrator' + Hanami::Model::Migrator.migrate(version: @version) end end end diff --git a/lib/hanami/commands/db/prepare.rb b/lib/hanami/commands/db/prepare.rb new file mode 100644 index 00000000..0da8e8b8 --- /dev/null +++ b/lib/hanami/commands/db/prepare.rb @@ -0,0 +1,14 @@ +require 'hanami/commands/db/abstract' + +module Hanami + module Commands + class DB + class Prepare < Abstract + def start + require 'hanami/model/migrator' + Hanami::Model::Migrator.prepare + end + end + end + end +end diff --git a/lib/hanami/commands/db/version.rb b/lib/hanami/commands/db/version.rb new file mode 100644 index 00000000..3cbd8236 --- /dev/null +++ b/lib/hanami/commands/db/version.rb @@ -0,0 +1,14 @@ +require 'hanami/commands/db/abstract' + +module Hanami + module Commands + class DB + class Version < Abstract + def start + require 'hanami/model/migrator' + puts Hanami::Model::Migrator.version + end + end + end + end +end diff --git a/lib/lotus/commands/generate/abstract.rb b/lib/hanami/commands/generate/abstract.rb similarity index 58% rename from lib/lotus/commands/generate/abstract.rb rename to lib/hanami/commands/generate/abstract.rb index b757cfb5..69b6f088 100644 --- a/lib/lotus/commands/generate/abstract.rb +++ b/lib/hanami/commands/generate/abstract.rb @@ -1,20 +1,20 @@ -require 'lotus/environment' -require 'lotus/generators/generatable' -require 'lotus/generators/test_framework' -require 'lotus/version' -require 'lotus/utils/string' +require 'hanami/environment' +require 'hanami/generators/generatable' +require 'hanami/generators/test_framework' +require 'hanami/version' +require 'hanami/utils/string' -module Lotus +module Hanami module Commands class Generate class Abstract - include Lotus::Generators::Generatable + include Hanami::Generators::Generatable attr_reader :options, :target_path def initialize(options) - @options = Lotus::Utils::Hash.new(options).symbolize! + @options = Hanami::Utils::Hash.new(options).symbolize! assert_options! @target_path = Pathname.pwd @@ -28,19 +28,19 @@ module Lotus private def test_framework - @test_framework ||= Lotus::Generators::TestFramework.new(lotusrc, options[:test]) + @test_framework ||= Hanami::Generators::TestFramework.new(hanamirc, options[:test]) end - def lotusrc_options - lotusrc.options + def hanamirc_options + hanamirc.options end - def lotusrc - @lotusrc ||= Lotusrc.new(target_path) + def hanamirc + @hanamirc ||= Hanamirc.new(target_path) end def environment - @environment ||= Lotus::Environment.new(options) + @environment ||= Hanami::Environment.new(options) end def template_engine @@ -48,7 +48,7 @@ module Lotus end def default_template_engine - lotusrc_options.fetch(:template) + hanamirc_options.fetch(:template) end def assert_options! diff --git a/lib/lotus/commands/generate/action.rb b/lib/hanami/commands/generate/action.rb similarity index 96% rename from lib/lotus/commands/generate/action.rb rename to lib/hanami/commands/generate/action.rb index c5aacf1e..9d5d51ba 100644 --- a/lib/lotus/commands/generate/action.rb +++ b/lib/hanami/commands/generate/action.rb @@ -1,7 +1,7 @@ -require 'lotus/commands/generate/abstract' -require 'lotus/routing/route' +require 'hanami/commands/generate/abstract' +require 'hanami/routing/route' -module Lotus +module Hanami module Commands class Generate class Action < Abstract @@ -179,8 +179,8 @@ module Lotus # @since 0.5.0 # @api private def assert_http_method! - if !Lotus::Routing::Route::VALID_HTTP_VERBS.include?(http_method.upcase) - existing_http_methods = Lotus::Routing::Route::VALID_HTTP_VERBS + if !Hanami::Routing::Route::VALID_HTTP_VERBS.include?(http_method.upcase) + existing_http_methods = Hanami::Routing::Route::VALID_HTTP_VERBS raise ArgumentError.new("Unknown HTTP method '#{http_method}', please use one of #{ existing_http_methods.join('/') }.") end end diff --git a/lib/lotus/commands/generate/app.rb b/lib/hanami/commands/generate/app.rb similarity index 95% rename from lib/lotus/commands/generate/app.rb rename to lib/hanami/commands/generate/app.rb index 300b186b..e93735b6 100644 --- a/lib/lotus/commands/generate/app.rb +++ b/lib/hanami/commands/generate/app.rb @@ -1,8 +1,8 @@ -require 'lotus/commands/generate/abstract' -require 'lotus/application_name' +require 'hanami/commands/generate/abstract' +require 'hanami/application_name' require 'securerandom' -module Lotus +module Hanami module Commands class Generate class App < Abstract @@ -65,7 +65,7 @@ module Lotus end def add_mount_app - generator.inject_into_file base_path.join('config/environment.rb'), after: /Lotus::Container.configure do/ do |match| + generator.inject_into_file base_path.join('config/environment.rb'), after: /Hanami::Container.configure do/ do |match| "\n mount #{ classified_app_name }::Application, at: '#{ application_base_url }'" end end diff --git a/lib/lotus/commands/generate/mailer.rb b/lib/hanami/commands/generate/mailer.rb similarity index 98% rename from lib/lotus/commands/generate/mailer.rb rename to lib/hanami/commands/generate/mailer.rb index 2e9a61aa..e273bbb0 100644 --- a/lib/lotus/commands/generate/mailer.rb +++ b/lib/hanami/commands/generate/mailer.rb @@ -1,6 +1,6 @@ -require "lotus/commands/generate/abstract" +require "hanami/commands/generate/abstract" -module Lotus +module Hanami module Commands class Generate # @since 0.5.0 diff --git a/lib/lotus/commands/generate/migration.rb b/lib/hanami/commands/generate/migration.rb similarity index 85% rename from lib/lotus/commands/generate/migration.rb rename to lib/hanami/commands/generate/migration.rb index 092b3686..b3641d36 100644 --- a/lib/lotus/commands/generate/migration.rb +++ b/lib/hanami/commands/generate/migration.rb @@ -1,6 +1,6 @@ -require 'lotus/commands/generate/abstract' +require 'hanami/commands/generate/abstract' -module Lotus +module Hanami module Commands class Generate class Migration < Abstract @@ -42,14 +42,14 @@ module Lotus end def existing_migration_path - Dir.glob("#{Lotus::Model.configuration.migrations}/[0-9]*_#{underscored_name}.rb").first + Dir.glob("#{Hanami::Model.configuration.migrations}/[0-9]*_#{underscored_name}.rb").first end def new_migration_path timestamp = Time.now.utc.strftime(TIMESTAMP_FORMAT) filename = FILENAME_PATTERN % { timestamp: timestamp, name: underscored_name} - Lotus::Model.configuration.migrations.join(filename) + Hanami::Model.configuration.migrations.join(filename) end def assert_migration_name! diff --git a/lib/lotus/commands/generate/model.rb b/lib/hanami/commands/generate/model.rb similarity index 97% rename from lib/lotus/commands/generate/model.rb rename to lib/hanami/commands/generate/model.rb index 03db0f42..57ea1688 100644 --- a/lib/lotus/commands/generate/model.rb +++ b/lib/hanami/commands/generate/model.rb @@ -1,6 +1,6 @@ -require 'lotus/commands/generate/abstract' +require 'hanami/commands/generate/abstract' -module Lotus +module Hanami module Commands class Generate class Model < Abstract diff --git a/lib/lotus/commands/new/abstract.rb b/lib/hanami/commands/new/abstract.rb similarity index 74% rename from lib/lotus/commands/new/abstract.rb rename to lib/hanami/commands/new/abstract.rb index 651aba23..d58dc3bf 100644 --- a/lib/lotus/commands/new/abstract.rb +++ b/lib/hanami/commands/new/abstract.rb @@ -1,16 +1,16 @@ require 'shellwords' -require 'lotus/application_name' -require 'lotus/generators/database_config' -require 'lotus/generators/generatable' -require 'lotus/generators/test_framework' -require 'lotus/utils/hash' +require 'hanami/application_name' +require 'hanami/generators/database_config' +require 'hanami/generators/generatable' +require 'hanami/generators/test_framework' +require 'hanami/utils/hash' -module Lotus +module Hanami module Commands class New class Abstract - include Lotus::Generators::Generatable + include Hanami::Generators::Generatable DEFAULT_ARCHITECTURE = 'container'.freeze DEFAULT_APPLICATION_BASE_URL = '/'.freeze @@ -18,16 +18,16 @@ module Lotus attr_reader :options, :target_path, :database_config def initialize(options, name) - @options = Lotus::Utils::Hash.new(options).symbolize! + @options = Hanami::Utils::Hash.new(options).symbolize! @name = name - @options[:database] ||= Lotus::Generators::DatabaseConfig::DEFAULT_ENGINE + @options[:database] ||= Hanami::Generators::DatabaseConfig::DEFAULT_ENGINE assert_options! assert_name! assert_architecture! - @lotus_model_version = '~> 0.5' - @database_config = Lotus::Generators::DatabaseConfig.new(options[:database], app_name) + @hanami_model_version = '~> 0.5' + @database_config = Hanami::Generators::DatabaseConfig.new(options[:database], app_name) end def start @@ -42,11 +42,11 @@ module Lotus private def test_framework - @test_framework ||= Lotus::Generators::TestFramework.new(lotusrc, options[:test]) + @test_framework ||= Hanami::Generators::TestFramework.new(hanamirc, options[:test]) end - def lotusrc - @lotusrc ||= Lotusrc.new(Pathname.new('.')) + def hanamirc + @hanamirc ||= Hanamirc.new(Pathname.new('.')) end def start_in_app_dir @@ -89,12 +89,12 @@ module Lotus File.directory?(target.join('.git')) end - def lotus_model_version - @lotus_model_version + def hanami_model_version + @hanami_model_version end - def lotus_head? - options.fetch(:lotus_head, false) + def hanami_head? + options.fetch(:hanami_head, false) end def architecture diff --git a/lib/lotus/commands/new/app.rb b/lib/hanami/commands/new/app.rb similarity index 95% rename from lib/lotus/commands/new/app.rb rename to lib/hanami/commands/new/app.rb index 44dc3526..8426f29a 100644 --- a/lib/lotus/commands/new/app.rb +++ b/lib/hanami/commands/new/app.rb @@ -1,6 +1,6 @@ -require 'lotus/commands/new/abstract' +require 'hanami/commands/new/abstract' -module Lotus +module Hanami module Commands class New class App < Abstract @@ -23,11 +23,11 @@ module Lotus upcase_app_name: upcase_app_name, classified_app_name: classified_app_name, application_base_url: application_base_url, - lotus_head: lotus_head?, + hanami_head: hanami_head?, test: test_framework.framework, database: database_config.type, database_config: database_config.to_hash, - lotus_model_version: lotus_model_version, + hanami_model_version: hanami_model_version, } end @@ -38,7 +38,7 @@ module Lotus private def add_application_templates - add_mapping('lotusrc.tt', '.lotusrc') + add_mapping('hanamirc.tt', '.hanamirc') add_mapping('.env.tt', '.env') add_mapping('.env.development.tt', '.env.development') add_mapping('.env.test.tt', '.env.test') diff --git a/lib/lotus/commands/new/container.rb b/lib/hanami/commands/new/container.rb similarity index 90% rename from lib/lotus/commands/new/container.rb rename to lib/hanami/commands/new/container.rb index 43a27091..dee1001d 100644 --- a/lib/lotus/commands/new/container.rb +++ b/lib/hanami/commands/new/container.rb @@ -1,7 +1,7 @@ -require 'lotus/commands/generate/app' -require 'lotus/commands/new/abstract' +require 'hanami/commands/generate/app' +require 'hanami/commands/new/abstract' -module Lotus +module Hanami module Commands class New class Container < Abstract @@ -19,11 +19,11 @@ module Lotus def template_options { app_name: app_name, - lotus_head: lotus_head?, + hanami_head: hanami_head?, test: test_framework.framework, database: database_config.type, database_config: database_config.to_hash, - lotus_model_version: lotus_model_version, + hanami_model_version: hanami_model_version, } end @@ -35,7 +35,7 @@ module Lotus private def add_application_templates - add_mapping('lotusrc.tt', '.lotusrc') + add_mapping('hanamirc.tt', '.hanamirc') add_mapping('.env.tt', '.env') add_mapping('.env.development.tt', '.env.development') add_mapping('.env.test.tt', '.env.test') @@ -80,7 +80,7 @@ module Lotus end def generate_app - Lotus::Commands::Generate::App.new(app_options, app_slice_name).start + Hanami::Commands::Generate::App.new(app_options, app_slice_name).start end def app_options diff --git a/lib/lotus/commands/routes.rb b/lib/hanami/commands/routes.rb similarity index 72% rename from lib/lotus/commands/routes.rb rename to lib/hanami/commands/routes.rb index b36d7234..69155b6a 100644 --- a/lib/lotus/commands/routes.rb +++ b/lib/hanami/commands/routes.rb @@ -1,10 +1,10 @@ -module Lotus +module Hanami module Commands # Display application/container routes. # # It is run with: # - # `bundle exec lotus routes` + # `bundle exec hanami routes` # # @since 0.1.0 # @api private @@ -12,9 +12,9 @@ module Lotus # @param options [Hash] Environment's options # # @since 0.1.0 - # @see Lotus::Environment#initialize + # @see Hanami::Environment#initialize def initialize(options) - @environment = Lotus::Environment.new(options) + @environment = Hanami::Environment.new(options) @environment.require_application_environment end @@ -31,9 +31,9 @@ module Lotus # @api private def app if @environment.container? - Lotus::Container.new + Hanami::Container.new else - Lotus::Application.applications.first.new + Hanami::Application.applications.first.new end end end diff --git a/lib/lotus/commands/server.rb b/lib/hanami/commands/server.rb similarity index 92% rename from lib/lotus/commands/server.rb rename to lib/hanami/commands/server.rb index b0d6a3ff..d30aab7d 100644 --- a/lib/lotus/commands/server.rb +++ b/lib/hanami/commands/server.rb @@ -1,12 +1,12 @@ require 'rack' -module Lotus +module Hanami module Commands # Rack compatible server. # # It is run with: # - # `bundle exec lotus server` + # `bundle exec hanami server` # # It runs the application, by using the server specified in your `Gemfile` # (eg. Puma or Unicorn). @@ -22,9 +22,9 @@ module Lotus # @param options [Hash] Environment's options # # @since 0.1.0 - # @see Lotus::Environment#initialize + # @see Hanami::Environment#initialize def initialize(options) - @_env = Lotus::Environment.new(options) + @_env = Hanami::Environment.new(options) @options = _extract_options(@_env) if code_reloading? diff --git a/lib/lotus/config/configure.rb b/lib/hanami/config/configure.rb similarity index 87% rename from lib/lotus/config/configure.rb rename to lib/hanami/config/configure.rb index 3a664d55..adac99b7 100644 --- a/lib/lotus/config/configure.rb +++ b/lib/hanami/config/configure.rb @@ -1,6 +1,6 @@ -require 'lotus/config/mapper' +require 'hanami/config/mapper' -module Lotus +module Hanami module Config # Define configuration of application of # a specific environment diff --git a/lib/lotus/config/cookies.rb b/lib/hanami/config/cookies.rb similarity index 89% rename from lib/lotus/config/cookies.rb rename to lib/hanami/config/cookies.rb index 16760d5e..aa064a54 100644 --- a/lib/lotus/config/cookies.rb +++ b/lib/hanami/config/cookies.rb @@ -1,4 +1,4 @@ -module Lotus +module Hanami module Config # Cookies configuration # @@ -21,7 +21,7 @@ module Lotus # Eg. alert(document.cookie) will fail # # @param options [Hash, TrueClass, FalseClass] optional cookies options - # @param configuration [Lotus::Configuration] the application configuration + # @param configuration [Hanami::Configuration] the application configuration # # @since 0.3.0 # @api private @@ -31,7 +31,7 @@ module Lotus # # @example Enable cookies with boolean # module Web - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # # ... # cookies true @@ -41,7 +41,7 @@ module Lotus # # @example Enable cookies with options # module Web - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # # ... # cookies max_age: 300 diff --git a/lib/lotus/config/framework_configuration.rb b/lib/hanami/config/framework_configuration.rb similarity index 98% rename from lib/lotus/config/framework_configuration.rb rename to lib/hanami/config/framework_configuration.rb index 9c646bb6..504c850f 100644 --- a/lib/lotus/config/framework_configuration.rb +++ b/lib/hanami/config/framework_configuration.rb @@ -1,4 +1,4 @@ -module Lotus +module Hanami module Config # Collects all the settings for a given framework configuration and then # forwards them when the application is loaded. diff --git a/lib/lotus/config/load_paths.rb b/lib/hanami/config/load_paths.rb similarity index 90% rename from lib/lotus/config/load_paths.rb rename to lib/hanami/config/load_paths.rb index 992c3799..ae3e2396 100644 --- a/lib/lotus/config/load_paths.rb +++ b/lib/hanami/config/load_paths.rb @@ -1,6 +1,6 @@ -require 'lotus/utils/load_paths' +require 'hanami/utils/load_paths' -module Lotus +module Hanami module Config # Define the load paths where the application should load # diff --git a/lib/lotus/config/mapper.rb b/lib/hanami/config/mapper.rb similarity index 88% rename from lib/lotus/config/mapper.rb rename to lib/hanami/config/mapper.rb index 1ce2c816..cf05d6bc 100644 --- a/lib/lotus/config/mapper.rb +++ b/lib/hanami/config/mapper.rb @@ -1,8 +1,8 @@ -require 'lotus/utils/kernel' +require 'hanami/utils/kernel' -module Lotus +module Hanami module Config - # Define a mapping for Lotus::Model + # Define a mapping for Hanami::Model # # @since 0.1.0 # @api private diff --git a/lib/lotus/config/mapping.rb b/lib/hanami/config/mapping.rb similarity index 80% rename from lib/lotus/config/mapping.rb rename to lib/hanami/config/mapping.rb index 5ddb364c..6bb5e2b3 100644 --- a/lib/lotus/config/mapping.rb +++ b/lib/hanami/config/mapping.rb @@ -1,6 +1,6 @@ -require 'lotus/config/mapper' +require 'hanami/config/mapper' -module Lotus +module Hanami module Config class Mapping < Mapper private diff --git a/lib/lotus/config/routes.rb b/lib/hanami/config/routes.rb similarity index 84% rename from lib/lotus/config/routes.rb rename to lib/hanami/config/routes.rb index ab5a3470..ffb7777c 100644 --- a/lib/lotus/config/routes.rb +++ b/lib/hanami/config/routes.rb @@ -1,6 +1,6 @@ -require 'lotus/config/mapper' +require 'hanami/config/mapper' -module Lotus +module Hanami module Config # Defines a route set # diff --git a/lib/lotus/config/security.rb b/lib/hanami/config/security.rb similarity index 91% rename from lib/lotus/config/security.rb rename to lib/hanami/config/security.rb index 4158907a..659f9770 100644 --- a/lib/lotus/config/security.rb +++ b/lib/hanami/config/security.rb @@ -1,4 +1,4 @@ -module Lotus +module Hanami module Config # Security policies are stored here. # @@ -7,13 +7,13 @@ module Lotus # @since 0.3.0 # @api private # - # @see Lotus::Loader#_configure_controller_framework! + # @see Hanami::Loader#_configure_controller_framework! X_FRAME_OPTIONS_HEADER = 'X-Frame-Options'.freeze # @since 0.3.0 # @api private # - # @see Lotus::Loader#_configure_controller_framework! + # @see Hanami::Loader#_configure_controller_framework! CONTENT_SECURITY_POLICY_HEADER = 'Content-Security-Policy'.freeze # X-Frame-Options headers' value diff --git a/lib/lotus/config/sessions.rb b/lib/hanami/config/sessions.rb similarity index 94% rename from lib/lotus/config/sessions.rb rename to lib/hanami/config/sessions.rb index cf264e4d..91c48437 100644 --- a/lib/lotus/config/sessions.rb +++ b/lib/hanami/config/sessions.rb @@ -1,7 +1,7 @@ require 'ipaddr' -require 'lotus/utils/string' +require 'hanami/utils/string' -module Lotus +module Hanami module Config # Sessions configuration # @@ -25,7 +25,7 @@ module Lotus # # @param adapter [Symbol,String,Class] the session adapter # @param options [Hash] the optional session options - # @param configuration [Lotus::Configuration] the application configuration + # @param configuration [Hanami::Configuration] the application configuration # # @since 0.2.0 # @api private diff --git a/lib/lotus/configuration.rb b/lib/hanami/configuration.rb similarity index 81% rename from lib/lotus/configuration.rb rename to lib/hanami/configuration.rb index 7b8bdfb4..5b8fbe83 100644 --- a/lib/lotus/configuration.rb +++ b/lib/hanami/configuration.rb @@ -1,29 +1,29 @@ -require 'lotus/utils/kernel' -require 'lotus/utils/deprecation' -require 'lotus/environment' -require 'lotus/config/framework_configuration' -require 'lotus/config/load_paths' -require 'lotus/config/routes' -require 'lotus/config/mapping' -require 'lotus/config/sessions' -require 'lotus/config/configure' -require 'lotus/config/security' -require 'lotus/config/cookies' +require 'hanami/utils/kernel' +require 'hanami/utils/deprecation' +require 'hanami/environment' +require 'hanami/config/framework_configuration' +require 'hanami/config/load_paths' +require 'hanami/config/routes' +require 'hanami/config/mapping' +require 'hanami/config/sessions' +require 'hanami/config/configure' +require 'hanami/config/security' +require 'hanami/config/cookies' -module Lotus - # Configuration for a Lotus application +module Hanami + # Configuration for a Hanami application # # @since 0.1.0 class Configuration # @since 0.2.0 # @api private # - # @see Lotus::Configuration#ssl? + # @see Hanami::Configuration#ssl? SSL_SCHEME = 'https'.freeze # Initialize a new configuration instance # - # @return [Lotus::Configuration] + # @return [Hanami::Configuration] # # @since 0.1.0 # @api private @@ -72,17 +72,17 @@ module Lotus # Returns the security policy # - # @return [Lotus::Config::Security] + # @return [Hanami::Config::Security] # # @since 0.3.0 # - # @see Lotus::Config::Security + # @see Hanami::Config::Security # # @example Getting values - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # security.x_frame_options "ALLOW ALL" # security.content_security_policy "script-src 'self' https://apis.example.com" @@ -94,10 +94,10 @@ module Lotus # Bookshelf::Application.configuration.security.content_security_policy # => "script-src 'self' https://apis.example.com" # # @example Setting values - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # security.x_frame_options "ALLOW ALL" # security.content_security_policy "script-src 'self' https://apis.example.com" @@ -114,7 +114,7 @@ module Lotus # # @since 0.4.0 # - # @see Lotus::Routing::ForceSsl + # @see Hanami::Routing::ForceSsl def force_ssl(value = nil) if value @force_ssl = value @@ -150,20 +150,20 @@ module Lotus # @see http://www.ruby-doc.org/core-2.1.2/Dir.html#method-c-pwd # # @example Getting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # end # end # # Bookshelf::Application.configuration.root # => # # # @example Setting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # root '/path/to/another/root' # end @@ -185,7 +185,7 @@ module Lotus # This value isn't set at the init time, but when the configuration is # loaded with `#load!`. # - # Lotus applications are namespaced: all the controllers and views live + # Hanami applications are namespaced: all the controllers and views live # under the application module, without polluting the global namespace. # However, if for some reason, you want top level classes, set this value # to `Object` (which is the top level namespace for Ruby). @@ -205,10 +205,10 @@ module Lotus # @since 0.1.0 # # @example Getting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # end # end # @@ -218,10 +218,10 @@ module Lotus # # eg. Bookshelf::Controllers::Dashboard # # @example Setting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # namespace Object # end @@ -240,7 +240,7 @@ module Lotus end end - # A Lotus::Layout for this application + # A Hanami::Layout for this application # # By default it's `nil`. # @@ -263,14 +263,14 @@ module Lotus # # @since 0.1.0 # - # @see http://rdoc.info/gems/lotus-view/Lotus/Layout - # @see http://rdoc.info/gems/lotus-view/Lotus/View/Configuration:layout + # @see http://rdoc.info/gems/hanami-view/Hanami/Layout + # @see http://rdoc.info/gems/hanami-view/Hanami/View/Configuration:layout # # @example Getting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # end # end # @@ -279,10 +279,10 @@ module Lotus # # All the views will render without a layout # # @example Setting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # layout :application # end @@ -310,7 +310,7 @@ module Lotus # # => Bookshelf::Views::ApplicationLayout # # Bookshelf::Views::Dashboard::JsonIndex.layout - # # => Lotus::View::Rendering::NullLayout + # # => Hanami::View::Rendering::NullLayout def layout(value = nil) if value @layout = value @@ -340,14 +340,14 @@ module Lotus # # @since 0.1.0 # - # @see Lotus::Configuration#root - # @see http://rdoc.info/gems/lotus-view/Lotus/View/Configuration:root + # @see Hanami::Configuration#root + # @see http://rdoc.info/gems/hanami-view/Hanami/View/Configuration:root # # @example Getting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # end # end # @@ -355,10 +355,10 @@ module Lotus # # => # # # @example Setting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # templates 'app/templates' # end @@ -384,15 +384,15 @@ module Lotus # # @overload assets # Gets the value - # @return [Lotus::Config::Assets] assets root + # @return [Hanami::Config::Assets] assets root # # @since 0.1.0 # # @example Getting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # end # end # @@ -400,10 +400,10 @@ module Lotus # # => # # # @example Adding new assets paths - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # assets do # sources << [ @@ -415,7 +415,7 @@ module Lotus # end # # Bookshelf::Application.configuration.assets - # # => #, @paths=["public"]> + # # => #, @paths=["public"]> def assets(&blk) if @assets @assets.__add(&blk) @@ -437,32 +437,32 @@ module Lotus # # @overload cookies # Gets the value. - # @return [Lotus::Config::Cookies] + # @return [Hanami::Config::Cookies] # # @example Getting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # end # end # # Bookshelf::Application.configuration.cookies - # # => #true, :secure=>false}> + # # => #true, :secure=>false}> # # @example Setting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do - # cookies domain: 'lotusrb.org' + # cookies domain: 'hanamirb.org' # end # end # end # # Bookshelf::Application.configuration.cookies - # # => #'lotusrb.org'}, @default_options={:domain=>'lotusrb.org', :httponly=>true, :secure=>false}> + # # => #'hanamirb.org'}, @default_options={:domain=>'hanamirb.org', :httponly=>true, :secure=>false}> def cookies(options = nil) if options.nil? @cookies ||= Config::Cookies.new(self, options) @@ -498,29 +498,29 @@ module Lotus # # @overload sessions # Gets the value. - # @return [Lotus::Config::Sessions] sessions configuration + # @return [Hanami::Config::Sessions] sessions configuration # # @since 0.2.0 # - # @see Lotus::Configuration#host - # @see Lotus::Configuration#scheme + # @see Hanami::Configuration#host + # @see Hanami::Configuration#scheme # # @example Getting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # end # end # # Bookshelf::Application.configuration.sessions - # # => # + # # => # # # @example Setting the value with symbol - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # sessions :cookie, secret: 'abc123' # end @@ -528,13 +528,13 @@ module Lotus # end # # Bookshelf::Application.configuration.sessions - # # => #"localhost", :secure=>false}> + # # => #"localhost", :secure=>false}> # # @example Disabling previusly enabled sessions - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # sessions :cookie # sessions false @@ -543,7 +543,7 @@ module Lotus # end # # Bookshelf::Application.configuration.sessions - # # => # + # # => # # def sessions(adapter = nil, options = {}) if adapter.nil? @@ -559,28 +559,28 @@ module Lotus # By default it's empty in order to allow developers to decide their own # app structure. # - # @return [Lotus::Config::LoadPaths] a set of load paths + # @return [Hanami::Config::LoadPaths] a set of load paths # # @since 0.1.0 # - # @see Lotus::Configuration#root + # @see Hanami::Configuration#root # # @example Getting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # end # end # # Bookshelf::Application.configuration.load_paths - # # => # + # # => # # # @example Setting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # load_paths << [ # 'app/controllers', @@ -591,7 +591,7 @@ module Lotus # end # # Bookshelf::Application.configuration.assets - # # => # + # # => # def load_paths @load_paths ||= Config::LoadPaths.new end @@ -617,17 +617,17 @@ module Lotus # # @overload routes # Gets the value - # @return [Lotus::Config::Routes] the set of routes + # @return [Hanami::Config::Routes] the set of routes # # @since 0.1.0 # - # @see http://rdoc.info/gems/lotus-router/Lotus/Router + # @see http://rdoc.info/gems/hanami-router/Hanami/Router # # @example Getting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # end # end # @@ -635,10 +635,10 @@ module Lotus # # => nil # # @example Setting the value, by passing a block - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # routes do # get '/', to: 'dashboard#index' @@ -649,13 +649,13 @@ module Lotus # end # # Bookshelf::Application.configuration.routes - # # => #, @path=#> + # # => #, @path=#> # # @example Setting the value, by passing a relative path - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # routes 'config/routes' # end @@ -663,7 +663,7 @@ module Lotus # end # # Bookshelf::Application.configuration.routes - # # => #> + # # => #> def routes(path = nil, &blk) if path or block_given? @routes = Config::Routes.new(root, path, &blk) @@ -695,10 +695,10 @@ module Lotus # @since 0.2.0 # # @example Getting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # end # end # @@ -706,10 +706,10 @@ module Lotus # # => [] # # @example Setting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # body_parsers :json, XmlParser.new # end @@ -720,10 +720,10 @@ module Lotus # # => [:json, XmlParser.new] # # @example Setting a new value after one is set. - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # body_parsers :json # body_parsers XmlParser.new @@ -754,13 +754,13 @@ module Lotus # @since 0.2.0 # # @see http://rdoc.info/gems/rack/Rack/Static - # @see Lotus::Middleware#use + # @see Hanami::Middleware#use # # @example - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # middleware.use Rack::MethodOverride, nil, 'max-age=0, private, must-revalidate' # middleware.use Rack::ETag @@ -768,7 +768,7 @@ module Lotus # end # end def middleware - @middleware ||= Lotus::Middleware.new(self) + @middleware ||= Hanami::Middleware.new(self) end # Application collection mapping. @@ -792,17 +792,17 @@ module Lotus # # @overload mapping # Gets the value - # @return [Lotus::Config::Mapping] the set of mappings + # @return [Hanami::Config::Mapping] the set of mappings # # @since 0.2.0 # - # @see http://rdoc.info/gems/lotus-model/Lotus/Mapper + # @see http://rdoc.info/gems/hanami-model/Hanami/Mapper # # @example Getting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # end # end # @@ -810,10 +810,10 @@ module Lotus # # => nil # # @example Setting the value, by passing a block - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # mapping do # collection :users do @@ -828,13 +828,13 @@ module Lotus # end # # Bookshelf::Application.configuration.mapping - # # => #, @path=#> + # # => #, @path=#> # # @example Setting the value, by passing a relative path - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # mapping 'config/mapping' # end @@ -842,7 +842,7 @@ module Lotus # end # # Bookshelf::Application.configuration.mapping - # # => #> + # # => #> def mapping(path = nil, &blk) if path or block_given? @mapping = Config::Mapping.new(root, path, &blk) @@ -872,14 +872,14 @@ module Lotus # # @since 0.2.0 # - # @see Lotus::Configuration#adapter - # @see http://rdoc.info/gems/lotus-model/Lotus/Model/Configuration:adapter + # @see Hanami::Configuration#adapter + # @see http://rdoc.info/gems/hanami-model/Hanami/Model/Configuration:adapter # # @example - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # adapter type: :sql, uri: 'sqlite3://uri' # end @@ -901,7 +901,7 @@ module Lotus # # The given format must be coercible to a symbol, and be a valid mime type # alias. If it isn't, at the runtime the framework will raise a - # `Lotus::Controller::UnknownFormatError`. + # `Hanami::Controller::UnknownFormatError`. # # By default this value is `:html`. # @@ -920,23 +920,23 @@ module Lotus # # @since 0.5.0 # - # @see http://rdoc.info/gems/lotus-controller/Lotus/Controller/Configuration#default_request_format + # @see http://rdoc.info/gems/hanami-controller/Hanami/Controller/Configuration#default_request_format # # @example Getting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # end # end # # Bookshelf::Application.configuration.default_request_format # => :html # # @example Setting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # default_request_format :json # end @@ -956,7 +956,7 @@ module Lotus # # The given format must be coercible to a symbol, and be a valid mime type # alias. If it isn't, at the runtime the framework will raise a - # `Lotus::Controller::UnknownFormatError`. + # `Hanami::Controller::UnknownFormatError`. # # By default this value is `:html`. # @@ -975,23 +975,23 @@ module Lotus # # @since 0.5.0 # - # @see http://rdoc.info/gems/lotus-controller/Lotus/Controller/Configuration#default_response_format + # @see http://rdoc.info/gems/hanami-controller/Hanami/Controller/Configuration#default_response_format # # @example Getting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # end # end # # Bookshelf::Application.configuration.default_response_format # => :html # # @example Setting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # default_response_format :json # end @@ -1014,7 +1014,7 @@ module Lotus # # @deprecated Use {#default_request_format} instead. def default_format(format = nil) - Lotus::Utils::Deprecation.new('default_format is deprecated, please use default_request_format') + Hanami::Utils::Deprecation.new('default_format is deprecated, please use default_request_format') default_request_format(format) end @@ -1040,20 +1040,20 @@ module Lotus # @see http://en.wikipedia.org/wiki/URI_scheme # # @example Getting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # end # end # # Bookshelf::Application.configuration.scheme # => "http" # # @example Setting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # scheme 'https' # end @@ -1075,7 +1075,7 @@ module Lotus # # @since 0.2.0 # - # @see Lotus::Configuration#scheme + # @see Hanami::Configuration#scheme def ssl? scheme == SSL_SCHEME end @@ -1102,20 +1102,20 @@ module Lotus # @see http://en.wikipedia.org/wiki/URI_scheme # # @example Getting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # end # end # # Bookshelf::Application.configuration.host # => "localhost" # # @example Setting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # host 'bookshelf.org' # end @@ -1154,20 +1154,20 @@ module Lotus # @see http://en.wikipedia.org/wiki/URI_scheme # # @example Getting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # end # end # # Bookshelf::Application.configuration.port # => 2300 # # @example Setting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # port 8080 # end @@ -1185,7 +1185,7 @@ module Lotus # Defines a relative pattern to find controllers. # - # Lotus supports multiple architectures (aka application structures), this + # Hanami supports multiple architectures (aka application structures), this # setting helps to understand the namespace where to find applications' # controllers and actions. # @@ -1213,13 +1213,13 @@ module Lotus # # @since 0.1.0 # - # @see Lotus::Configuration#view_pattern + # @see Hanami::Configuration#view_pattern # # @example Getting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # routes do # get '/', to: 'dashboard#index' @@ -1246,10 +1246,10 @@ module Lotus # # GET '/' # => Bookshelf::Controllers::Dashboard::Index # # @example Setting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # controller_pattern "%{controller}Controller::%{action}" # @@ -1277,10 +1277,10 @@ module Lotus # # GET '/' # => Bookshelf::DashboardController::Index # # @example Setting the value for a top level name structure - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # namespace Object # controller_pattern "%{controller}Controller::%{action}" @@ -1317,7 +1317,7 @@ module Lotus # Defines a relative pattern to find views:. # - # Lotus supports multiple architectures (aka application structures), this + # Hanami supports multiple architectures (aka application structures), this # setting helps to understand the namespace where to find applications' # views:. # @@ -1345,13 +1345,13 @@ module Lotus # # @since 0.1.0 # - # @see Lotus::Configuration#controller_pattern + # @see Hanami::Configuration#controller_pattern # # @example Getting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # routes do # get '/', to: 'dashboard#index' @@ -1376,10 +1376,10 @@ module Lotus # # GET '/' # => Bookshelf::Views::Dashboard::Index # # @example Setting the value - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # view_pattern "%{controller}::%{action}" # @@ -1404,10 +1404,10 @@ module Lotus # # GET '/' # => Bookshelf::Dashboard::Index # # @example Setting the value for a top level name structure - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # namespace Object # view_pattern "%{controller}::%{action}" @@ -1460,14 +1460,14 @@ module Lotus # # @since 0.2.0 # - # @see http://rdoc.info/gems/lotus-controller/Lotus/Controller/Configuration:handle_exceptions + # @see http://rdoc.info/gems/hanami-controller/Hanami/Controller/Configuration:handle_exceptions # @see http://httpstatus.es/500 # # @example Enabled (default) - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # routes do # get '/error', to: 'error#index' @@ -1491,10 +1491,10 @@ module Lotus # # GET '/error' # => 500 - Internal Server Error # # @example Disabled - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # handle_exceptions false # @@ -1526,27 +1526,27 @@ module Lotus end end - # It lazily collects all the low level settings for Lotus::Model's + # It lazily collects all the low level settings for Hanami::Model's # configuration and applies them when the application is loaded. # - # NOTE: This forwards all the configurations to Lotus::Model, without + # NOTE: This forwards all the configurations to Hanami::Model, without # checking them. Before to use this feature, please have a look at the - # current Lotus::Model version installed. + # current Hanami::Model version installed. # # NOTE: This may override some configurations of your application. # - # @return [Lotus::Config::FrameworkConfiguration] the configuration + # @return [Hanami::Config::FrameworkConfiguration] the configuration # # @since 0.2.0 # - # @see http://www.rubydoc.info/gems/lotus-model/Lotus/Model/Configuration + # @see http://www.rubydoc.info/gems/hanami-model/Hanami/Model/Configuration # # @example Define a setting - # require 'lotus' - # require 'lotus/model' + # require 'hanami' + # require 'hanami/model' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # model.adapter type: :memory, uri: 'memory://localhost/database' # end @@ -1554,11 +1554,11 @@ module Lotus # end # # @example Override a setting - # require 'lotus' - # require 'lotus/model' + # require 'hanami' + # require 'hanami/model' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # adapter type: :sql, uri: 'postgres://localhost/database' # model.adapter type: :memory, uri: 'memory://localhost/database' @@ -1571,26 +1571,26 @@ module Lotus @model ||= Config::FrameworkConfiguration.new end - # It lazily collects all the low level settings for Lotus::Controller's + # It lazily collects all the low level settings for Hanami::Controller's # configuration and applies them when the application is loaded. # - # NOTE: This forwards all the configurations to Lotus::Controller, without + # NOTE: This forwards all the configurations to Hanami::Controller, without # checking them. Before to use this feature, please have a look at the - # current Lotus::Controller version installed. + # current Hanami::Controller version installed. # # NOTE: This may override some configurations of your application. # - # @return [Lotus::Config::FrameworkConfiguration] the configuration + # @return [Hanami::Config::FrameworkConfiguration] the configuration # # @since 0.2.0 # - # @see http://www.rubydoc.info/gems/lotus-controller/Lotus/Controller/Configuration + # @see http://www.rubydoc.info/gems/hanami-controller/Hanami/Controller/Configuration # # @example Define a setting - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # controller.default_request_format :json # end @@ -1598,10 +1598,10 @@ module Lotus # end # # @example Override a setting - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # handle_exceptions false # controller.handle_exceptions true @@ -1614,26 +1614,26 @@ module Lotus @controller ||= Config::FrameworkConfiguration.new end - # It lazily collects all the low level settings for Lotus::View's + # It lazily collects all the low level settings for Hanami::View's # configuration and applies them when the application is loaded. # - # NOTE: This forwards all the configurations to Lotus::View, without + # NOTE: This forwards all the configurations to Hanami::View, without # checking them. Before to use this feature, please have a look at the - # current Lotus::View version installed. + # current Hanami::View version installed. # # NOTE: This may override some configurations of your application. # - # @return [Lotus::Config::FrameworkConfiguration] the configuration + # @return [Hanami::Config::FrameworkConfiguration] the configuration # # @since 0.2.0 # - # @see http://www.rubydoc.info/gems/lotus-view/Lotus/View/Configuration + # @see http://www.rubydoc.info/gems/hanami-view/Hanami/View/Configuration # # @example Define a setting - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # view.layout :application # end @@ -1641,10 +1641,10 @@ module Lotus # end # # @example Override a setting - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # layout :application # view.layout :backend @@ -1661,17 +1661,17 @@ module Lotus # # This logger instance will be used to set the logger available on application module # - # If no logger instance is defined, a Lotus::Logger will be set by default + # If no logger instance is defined, a Hanami::Logger will be set by default # # @return [Logger, NilClass] logger instance # # @since 0.5.0 # # @example Define a logger - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # logger Logger.new(STDOUT) # end diff --git a/lib/lotus/container.rb b/lib/hanami/container.rb similarity index 73% rename from lib/lotus/container.rb rename to lib/hanami/container.rb index 21cd752f..04161735 100644 --- a/lib/lotus/container.rb +++ b/lib/hanami/container.rb @@ -1,19 +1,19 @@ require 'thread' require 'rack/builder' -require 'lotus/router' +require 'hanami/router' -module Lotus +module Hanami class Container - class Router < ::Lotus::Router + class Router < ::Hanami::Router def mount(app, options) - app = app.new(path_prefix: options.fetch(:at)) if lotus_app?(app) + app = app.new(path_prefix: options.fetch(:at)) if hanami_app?(app) super(app, options) end private - def lotus_app?(app) - app.ancestors.include? Lotus::Application + def hanami_app?(app) + app.ancestors.include? Hanami::Application end end @@ -48,9 +48,9 @@ module Lotus @builder = ::Rack::Builder.new @routes = Router.new(&@@configuration) - if Lotus.environment.serve_static_assets? - require 'lotus/static' - @builder.use Lotus::Static + if Hanami.environment.serve_static_assets? + require 'hanami/static' + @builder.use Hanami::Static end @builder.run @routes diff --git a/lib/lotus/environment.rb b/lib/hanami/environment.rb similarity index 81% rename from lib/lotus/environment.rb rename to lib/hanami/environment.rb index 4f0a845b..af37514b 100644 --- a/lib/lotus/environment.rb +++ b/lib/hanami/environment.rb @@ -1,12 +1,12 @@ require 'thread' require 'pathname' require 'dotenv' -require 'lotus/utils' -require 'lotus/utils/hash' -require 'lotus/lotusrc' +require 'hanami/utils' +require 'hanami/utils/hash' +require 'hanami/hanamirc' -module Lotus - # Define and expose information about the Lotus environment. +module Hanami + # Define and expose information about the Hanami environment. # # @since 0.1.0 # @api private @@ -17,13 +17,13 @@ module Lotus # @api private RACK_ENV = 'RACK_ENV'.freeze - # Standard Lotus ENV key + # Standard Hanami ENV key # # @since 0.1.0 # @api private - LOTUS_ENV = 'LOTUS_ENV'.freeze + HANAMI_ENV = 'HANAMI_ENV'.freeze - # Default Lotus environment + # Default Hanami environment # # @since 0.1.0 # @api private @@ -59,11 +59,11 @@ module Lotus # @api private DEFAULT_CONFIG = 'config'.freeze - # Standard Lotus host ENV key + # Standard Hanami host ENV key # # @since 0.1.0 # @api private - LOTUS_HOST = 'LOTUS_HOST'.freeze + HANAMI_HOST = 'HANAMI_HOST'.freeze # Default HTTP host # @@ -77,13 +77,13 @@ module Lotus # @api private LISTEN_ALL_HOST = '0.0.0.0'.freeze - # Standard Lotus port ENV key + # Standard Hanami port ENV key # # @since 0.1.0 # @api private - LOTUS_PORT = 'LOTUS_PORT'.freeze + HANAMI_PORT = 'HANAMI_PORT'.freeze - # Default Lotus HTTP port + # Default Hanami HTTP port # # @since 0.1.0 # @api private @@ -131,13 +131,13 @@ module Lotus # @api private SERVE_STATIC_ASSETS_ENABLED = 'true'.freeze - # Initialize a Lotus environment + # Initialize a Hanami environment # # It accepts an optional set of configurations from the CLI commands. # Those settings override the defaults defined by this object. # - # When initialized, it sets standard `ENV` variables for Rack and Lotus, - # such as `RACK_ENV` and `LOTUS_ENV`. + # When initialized, it sets standard `ENV` variables for Rack and Hanami, + # such as `RACK_ENV` and `HANAMI_ENV`. # # It also evaluates configuration from `.env` and `.env.` # located under the config directory. All the settings in those files will @@ -149,12 +149,12 @@ module Lotus # @param options [Hash] override default options for various environment # attributes # - # @return [Lotus::Environment] the environment + # @return [Hanami::Environment] the environment # - # @see Lotus::Commands::Console - # @see Lotus::Commands::Routes - # @see Lotus::Commands::Server - # @see Lotus::Environment#config + # @see Hanami::Commands::Console + # @see Hanami::Commands::Routes + # @see Hanami::Commands::Server + # @see Hanami::Environment#config # # @example Define ENV variables from .env # @@ -171,29 +171,29 @@ module Lotus # # % cat .env.development # # FOO="ok" # - # require 'lotus/environment' + # require 'hanami/environment' # - # env = Lotus::Environment.new + # env = Hanami::Environment.new # env.environment # => "development" # # # Framework defined ENV vars - # ENV['LOTUS_ENV'] # => "development" + # ENV['HANAMI_ENV'] # => "development" # ENV['RACK_ENV'] # => "development" # - # ENV['LOTUS_HOST'] # => "localhost" - # ENV['LOTUS_PORT'] # => "2300" + # ENV['HANAMI_HOST'] # => "localhost" + # ENV['HANAMI_PORT'] # => "2300" # # # User defined ENV vars # ENV['FOO'] # => "ok" # ENV['XYZ'] # => "yes" # - # # Lotus::Environment evaluates `.env` first as master configuration. + # # Hanami::Environment evaluates `.env` first as master configuration. # # Then it evaluates `.env.development` because the current environment # # is "development". The settings defined in this last file override # # the one defined in the parent (eg `FOO` is overwritten). All the # # other settings (eg `XYZ`) will be left untouched. def initialize(options = {}) - @options = Lotus::Lotusrc.new(root).options + @options = Hanami::Hanamirc.new(root).options @options.merge! Utils::Hash.new(options.clone).symbolize! @mutex = Mutex.new @mutex.synchronize { set_env_vars! } @@ -203,25 +203,25 @@ module Lotus # # In order to decide the value, it looks up to the following `ENV` vars: # - # * LOTUS_ENV + # * HANAMI_ENV # * RACK_ENV # # If those are missing it falls back to the defalt one: `"development"`. # - # Rack environment `"deployment"` is translated to Lotus `"production"`. + # Rack environment `"deployment"` is translated to Hanami `"production"`. # # @return [String] the current environment # # @since 0.1.0 # - # @see Lotus::Environment::DEFAULT_ENV + # @see Hanami::Environment::DEFAULT_ENV def environment - @environment ||= ENV[LOTUS_ENV] || rack_env || DEFAULT_ENV + @environment ||= ENV[HANAMI_ENV] || rack_env || DEFAULT_ENV end # @since 0.3.1 # - # @see Lotus.env?(name) + # @see Hanami.env?(name) def environment?(*names) names.map(&:to_s).include?(environment) end @@ -241,7 +241,7 @@ module Lotus # Application's root # # It defaults to the current working directory. - # Lotus assumes that all the commands are executed from there. + # Hanami assumes that all the commands are executed from there. # # @return [Pathname] application's root # @@ -267,8 +267,8 @@ module Lotus # # @since 0.2.0 # - # @see Lotus::Environment::DEFAULT_CONFIG - # @see Lotus::Environment#root + # @see Hanami::Environment::DEFAULT_CONFIG + # @see Hanami::Environment#root def config @config ||= root.join(@options.fetch(:config) { DEFAULT_CONFIG }) end @@ -278,7 +278,7 @@ module Lotus # In order to decide the value, it looks up the following sources: # # * CLI option `host` - # * LOTUS_HOST ENV var + # * HANAMI_HOST ENV var # # If those are missing it falls back to the following defaults: # @@ -289,11 +289,11 @@ module Lotus # # @since 0.1.0 # - # @see Lotus::Environment::DEFAULT_HOST - # @see Lotus::Environment::LISTEN_ALL_HOST + # @see Hanami::Environment::DEFAULT_HOST + # @see Hanami::Environment::LISTEN_ALL_HOST def host @host ||= @options.fetch(:host) { - ENV[LOTUS_HOST] || default_host + ENV[HANAMI_HOST] || default_host } end @@ -302,7 +302,7 @@ module Lotus # In order to decide the value, it looks up the following sources: # # * CLI option `port` - # * LOTUS_PORT ENV var + # * HANAMI_PORT ENV var # # If those are missing it falls back to the default one: `2300`. # @@ -310,9 +310,9 @@ module Lotus # # @since 0.1.0 # - # @see Lotus::Environment::DEFAULT_PORT + # @see Hanami::Environment::DEFAULT_PORT def port - @port ||= @options.fetch(:port) { ENV[LOTUS_PORT] || DEFAULT_PORT }.to_i + @port ||= @options.fetch(:port) { ENV[HANAMI_PORT] || DEFAULT_PORT }.to_i end # Path to the Rack configuration file @@ -349,7 +349,7 @@ module Lotus # # @since 0.1.0 # - # @see Lotus::Environment::DEFAULT_ENVIRONMENT_CONFIG + # @see Hanami::Environment::DEFAULT_ENVIRONMENT_CONFIG def env_config root.join(@options.fetch(:environment) { config.join(DEFAULT_ENVIRONMENT_CONFIG) }) end @@ -380,8 +380,8 @@ module Lotus # # @since 0.2.0 # - # @see Lotus::Commands::Server - # @see Lotus::Environment::CODE_RELOADING + # @see Hanami::Commands::Server + # @see Hanami::Environment::CODE_RELOADING def code_reloading? # JRuby doesn't implement fork that's why shotgun cannot be used. if Utils.jruby? @@ -396,7 +396,7 @@ module Lotus # @api private def architecture @options.fetch(:architecture) { - puts "Cannot recognize Lotus architecture, please check `.lotusrc'" + puts "Cannot recognize Hanami architecture, please check `.hanamirc'" exit 1 } end @@ -426,7 +426,7 @@ module Lotus # Serialize the most relevant settings into a Hash # - # @return [Lotus::Utils::Hash] + # @return [Hanami::Utils::Hash] # # @since 0.1.0 # @api private @@ -447,15 +447,15 @@ module Lotus # @api private def set_env_vars! set_application_env_vars! - set_lotus_env_vars! + set_hanami_env_vars! end # @since 0.2.0 # @api private - def set_lotus_env_vars! - ENV[LOTUS_ENV] = ENV[RACK_ENV] = environment - ENV[LOTUS_HOST] = host - ENV[LOTUS_PORT] = port.to_s + def set_hanami_env_vars! + ENV[HANAMI_ENV] = ENV[RACK_ENV] = environment + ENV[HANAMI_HOST] = host + ENV[HANAMI_PORT] = port.to_s end # @since 0.2.0 diff --git a/lib/hanami/frameworks.rb b/lib/hanami/frameworks.rb new file mode 100644 index 00000000..01ebe5b2 --- /dev/null +++ b/lib/hanami/frameworks.rb @@ -0,0 +1,14 @@ +require 'hanami/router' +require 'hanami/view' +require 'hanami/controller' +require 'hanami/action/glue' +require 'hanami/action/csrf_protection' +require 'hanami/mailer' +require 'hanami/mailer/glue' +require 'hanami/assets' + +Hanami::Controller.configure do + prepare do + include Hanami::Action::Glue + end +end diff --git a/lib/lotus/generators/action/action.rb.tt b/lib/hanami/generators/action/action.rb.tt similarity index 100% rename from lib/lotus/generators/action/action.rb.tt rename to lib/hanami/generators/action/action.rb.tt diff --git a/lib/lotus/generators/action/action_spec.minitest.tt b/lib/hanami/generators/action/action_spec.minitest.tt similarity index 100% rename from lib/lotus/generators/action/action_spec.minitest.tt rename to lib/hanami/generators/action/action_spec.minitest.tt diff --git a/lib/lotus/generators/action/action_spec.rspec.tt b/lib/hanami/generators/action/action_spec.rspec.tt similarity index 100% rename from lib/lotus/generators/action/action_spec.rspec.tt rename to lib/hanami/generators/action/action_spec.rspec.tt diff --git a/lib/lotus/generators/action/action_without_view.rb.tt b/lib/hanami/generators/action/action_without_view.rb.tt similarity index 100% rename from lib/lotus/generators/action/action_without_view.rb.tt rename to lib/hanami/generators/action/action_without_view.rb.tt diff --git a/lib/lotus/generators/action/template.tt b/lib/hanami/generators/action/template.tt similarity index 100% rename from lib/lotus/generators/action/template.tt rename to lib/hanami/generators/action/template.tt diff --git a/lib/lotus/generators/action/view.rb.tt b/lib/hanami/generators/action/view.rb.tt similarity index 100% rename from lib/lotus/generators/action/view.rb.tt rename to lib/hanami/generators/action/view.rb.tt diff --git a/lib/lotus/generators/action/view_spec.minitest.tt b/lib/hanami/generators/action/view_spec.minitest.tt similarity index 84% rename from lib/lotus/generators/action/view_spec.minitest.tt rename to lib/hanami/generators/action/view_spec.minitest.tt index c9fd790c..54c598b0 100644 --- a/lib/lotus/generators/action/view_spec.minitest.tt +++ b/lib/hanami/generators/action/view_spec.minitest.tt @@ -3,7 +3,7 @@ require_relative '<%= config[:relative_view_path] %>' describe <%= config[:app] %>::Views::<%= config[:controller] %>::<%= config[:action] %> do let(:exposures) { Hash[foo: 'bar'] } - let(:template) { Lotus::View::Template.new('<%= config[:template_path] %>') } + let(:template) { Hanami::View::Template.new('<%= config[:template_path] %>') } let(:view) { <%= config[:app] %>::Views::<%= config[:controller] %>::<%= config[:action] %>.new(template, exposures) } let(:rendered) { view.render } diff --git a/lib/lotus/generators/action/view_spec.rspec.tt b/lib/hanami/generators/action/view_spec.rspec.tt similarity index 81% rename from lib/lotus/generators/action/view_spec.rspec.tt rename to lib/hanami/generators/action/view_spec.rspec.tt index f493ba7b..62731e2e 100644 --- a/lib/lotus/generators/action/view_spec.rspec.tt +++ b/lib/hanami/generators/action/view_spec.rspec.tt @@ -2,7 +2,7 @@ require_relative '<%= config[:relative_view_path] %>' RSpec.describe <%= config[:app] %>::Views::<%= config[:controller] %>::<%= config[:action] %> do let(:exposures) { Hash[foo: 'bar'] } - let(:template) { Lotus::View::Template.new('<%= config[:template_path] %>') } + let(:template) { Hanami::View::Template.new('<%= config[:template_path] %>') } let(:view) { described_class.new(template, exposures) } let(:rendered) { view.render } diff --git a/lib/lotus/generators/app/.gitkeep.tt b/lib/hanami/generators/app/.gitkeep.tt similarity index 100% rename from lib/lotus/generators/app/.gitkeep.tt rename to lib/hanami/generators/app/.gitkeep.tt diff --git a/lib/lotus/generators/app/application.rb.tt b/lib/hanami/generators/app/application.rb.tt similarity index 91% rename from lib/lotus/generators/app/application.rb.tt rename to lib/hanami/generators/app/application.rb.tt index 294a92f2..62aa67d8 100644 --- a/lib/lotus/generators/app/application.rb.tt +++ b/lib/hanami/generators/app/application.rb.tt @@ -1,8 +1,8 @@ -require 'lotus/helpers' -require 'lotus/assets' +require 'hanami/helpers' +require 'hanami/assets' module <%= config[:classified_app_name] %> - class Application < Lotus::Application + class Application < Hanami::Application configure do ## # BASIC @@ -23,7 +23,7 @@ module <%= config[:classified_app_name] %> # Handle exceptions with HTTP statuses (true) or don't catch them (false). # Defaults to true. - # See: http://www.rubydoc.info/gems/lotus-controller/#Exceptions_management + # See: http://www.rubydoc.info/gems/hanami-controller/#Exceptions_management # # handle_exceptions true @@ -32,7 +32,7 @@ module <%= config[:classified_app_name] %> # # Routes definitions for this application - # See: http://www.rubydoc.info/gems/lotus-router#Usage + # See: http://www.rubydoc.info/gems/hanami-router#Usage # routes 'config/routes' @@ -127,7 +127,7 @@ module <%= config[:classified_app_name] %> # * :yui # * :closure # - # See: http://lotusrb.org/guides/assets/compressors + # See: http://hanamirb.org/guides/assets/compressors # # In order to skip JavaScript compression comment the following line javascript_compressor :builtin @@ -140,7 +140,7 @@ module <%= config[:classified_app_name] %> # * :yui # * :sass # - # See: http://lotusrb.org/guides/assets/compressors + # See: http://hanamirb.org/guides/assets/compressors # # In order to skip stylesheet compression comment the following line stylesheet_compressor :builtin @@ -209,7 +209,7 @@ module <%= config[:classified_app_name] %> # Configure the code that will yield each time <%= config[:classified_app_name] %>::Action is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-controller#Configuration + # See: http://www.rubydoc.info/gems/hanami-controller#Configuration controller.prepare do # include MyAuthentication # included in all the actions # before :authenticate! # run an authentication before callback @@ -218,9 +218,9 @@ module <%= config[:classified_app_name] %> # Configure the code that will yield each time <%= config[:classified_app_name] %>::View is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-view#Configuration + # See: http://www.rubydoc.info/gems/hanami-view#Configuration view.prepare do - include Lotus::Helpers + include Hanami::Helpers include <%= config[:classified_app_name] %>::Assets::Helpers end end @@ -252,17 +252,17 @@ module <%= config[:classified_app_name] %> assets do # Don't compile static assets in production mode (eg. Sass, ES6) # - # See: http://www.rubydoc.info/gems/lotus-assets#Configuration + # See: http://www.rubydoc.info/gems/hanami-assets#Configuration compile false # Use digest file name for asset paths # - # See: http://lotusrb.org/guides/assets/digest + # See: http://hanamirb.org/guides/assets/digest digest true # Content Delivery Network (CDN) # - # See: http://lotusrb.org/guides/assets/content-delivery-network + # See: http://hanamirb.org/guides/assets/content-delivery-network # # scheme 'https' # host 'cdn.example.org' diff --git a/lib/lotus/generators/app/config/initializers/.gitkeep b/lib/hanami/generators/app/config/initializers/.gitkeep similarity index 100% rename from lib/lotus/generators/app/config/initializers/.gitkeep rename to lib/hanami/generators/app/config/initializers/.gitkeep diff --git a/lib/hanami/generators/app/config/routes.rb.tt b/lib/hanami/generators/app/config/routes.rb.tt new file mode 100644 index 00000000..550325cb --- /dev/null +++ b/lib/hanami/generators/app/config/routes.rb.tt @@ -0,0 +1,2 @@ +# Configure your routes here +# See: http://www.rubydoc.info/gems/hanami-router/#Usage \ No newline at end of file diff --git a/lib/lotus/generators/app/favicon.ico b/lib/hanami/generators/app/favicon.ico similarity index 100% rename from lib/lotus/generators/app/favicon.ico rename to lib/hanami/generators/app/favicon.ico diff --git a/lib/lotus/generators/app/templates/application.html.erb.tt b/lib/hanami/generators/app/templates/application.html.erb.tt similarity index 100% rename from lib/lotus/generators/app/templates/application.html.erb.tt rename to lib/hanami/generators/app/templates/application.html.erb.tt diff --git a/lib/lotus/generators/app/views/application_layout.rb.tt b/lib/hanami/generators/app/views/application_layout.rb.tt similarity index 100% rename from lib/lotus/generators/app/views/application_layout.rb.tt rename to lib/hanami/generators/app/views/application_layout.rb.tt diff --git a/lib/lotus/generators/application/app/.env.development.tt b/lib/hanami/generators/application/app/.env.development.tt similarity index 100% rename from lib/lotus/generators/application/app/.env.development.tt rename to lib/hanami/generators/application/app/.env.development.tt diff --git a/lib/lotus/generators/application/app/.env.test.tt b/lib/hanami/generators/application/app/.env.test.tt similarity index 100% rename from lib/lotus/generators/application/app/.env.test.tt rename to lib/hanami/generators/application/app/.env.test.tt diff --git a/lib/lotus/generators/application/app/.env.tt b/lib/hanami/generators/application/app/.env.tt similarity index 100% rename from lib/lotus/generators/application/app/.env.tt rename to lib/hanami/generators/application/app/.env.tt diff --git a/lib/lotus/generators/application/app/.gitignore b/lib/hanami/generators/application/app/.gitignore similarity index 100% rename from lib/lotus/generators/application/app/.gitignore rename to lib/hanami/generators/application/app/.gitignore diff --git a/lib/lotus/generators/application/app/.gitkeep b/lib/hanami/generators/application/app/.gitkeep similarity index 100% rename from lib/lotus/generators/application/app/.gitkeep rename to lib/hanami/generators/application/app/.gitkeep diff --git a/lib/hanami/generators/application/app/Gemfile.tt b/lib/hanami/generators/application/app/Gemfile.tt new file mode 100644 index 00000000..490b2315 --- /dev/null +++ b/lib/hanami/generators/application/app/Gemfile.tt @@ -0,0 +1,37 @@ +source 'https://rubygems.org' + +gem 'bundler' +gem 'rake' + +<%- if config[:hanami_head] -%> +gem 'hanami-utils', require: false, github: 'hanami/utils' +gem 'hanami-router', require: false, github: 'hanami/router' +gem 'hanami-validations', require: false, github: 'hanami/validations' +gem 'hanami-helpers', require: false, github: 'hanami/helpers' +gem 'hanami-controller', require: false, github: 'hanami/controller' +gem 'hanami-view', require: false, github: 'hanami/view' +gem 'hanami-model', require: false, github: 'hanami/model' +gem 'hanami-mailer', require: false, github: 'hanami/mailer' +gem 'hanami-assets', require: false, github: 'hanami/assets' +gem 'hanami', github: 'hanami/hanami' +<%- else -%> +gem 'hanami', '<%= Hanami::VERSION %>' +gem 'hanami-model', '<%= config[:hanami_model_version] %>' +<%- end -%> + +<%- if config[:database_config][:gem] -%> +gem '<%= config[:database_config][:gem] %>' +<%- end -%> + +group :test do +<%- if config[:test] == 'rspec' -%> + gem 'rspec' +<%- else -%> + gem 'minitest' +<%- end -%> + gem 'capybara' +end + +group :production do + # gem 'puma' +end diff --git a/lib/lotus/generators/application/app/Rakefile.minitest.tt b/lib/hanami/generators/application/app/Rakefile.minitest.tt similarity index 85% rename from lib/lotus/generators/application/app/Rakefile.minitest.tt rename to lib/hanami/generators/application/app/Rakefile.minitest.tt index 0bc82960..554937b4 100644 --- a/lib/lotus/generators/application/app/Rakefile.minitest.tt +++ b/lib/hanami/generators/application/app/Rakefile.minitest.tt @@ -1,5 +1,5 @@ require 'rake' -require 'lotus/rake_tasks' +require 'hanami/rake_tasks' require 'rake/testtask' Rake::TestTask.new do |t| diff --git a/lib/lotus/generators/application/container/Rakefile.rspec.tt b/lib/hanami/generators/application/app/Rakefile.rspec.tt similarity index 78% rename from lib/lotus/generators/application/container/Rakefile.rspec.tt rename to lib/hanami/generators/application/app/Rakefile.rspec.tt index 95423250..c8493fe2 100644 --- a/lib/lotus/generators/application/container/Rakefile.rspec.tt +++ b/lib/hanami/generators/application/app/Rakefile.rspec.tt @@ -1,5 +1,5 @@ require 'rake' -require 'lotus/rake_tasks' +require 'hanami/rake_tasks' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) diff --git a/lib/lotus/generators/application/app/apps/.gitkeep.tt b/lib/hanami/generators/application/app/apps/.gitkeep.tt similarity index 100% rename from lib/lotus/generators/application/app/apps/.gitkeep.tt rename to lib/hanami/generators/application/app/apps/.gitkeep.tt diff --git a/lib/lotus/generators/application/app/capybara.rb.rspec.tt b/lib/hanami/generators/application/app/capybara.rb.rspec.tt similarity index 100% rename from lib/lotus/generators/application/app/capybara.rb.rspec.tt rename to lib/hanami/generators/application/app/capybara.rb.rspec.tt diff --git a/lib/lotus/generators/application/app/config.ru.tt b/lib/hanami/generators/application/app/config.ru.tt similarity index 100% rename from lib/lotus/generators/application/app/config.ru.tt rename to lib/hanami/generators/application/app/config.ru.tt diff --git a/lib/lotus/generators/application/app/config/application.rb.tt b/lib/hanami/generators/application/app/config/application.rb.tt similarity index 91% rename from lib/lotus/generators/application/app/config/application.rb.tt rename to lib/hanami/generators/application/app/config/application.rb.tt index 28d5affb..5a1df097 100644 --- a/lib/lotus/generators/application/app/config/application.rb.tt +++ b/lib/hanami/generators/application/app/config/application.rb.tt @@ -1,8 +1,8 @@ -require 'lotus/helpers' -require 'lotus/assets' +require 'hanami/helpers' +require 'hanami/assets' module <%= config[:classified_app_name] %> - class Application < Lotus::Application + class Application < Hanami::Application configure do ## # BASIC @@ -23,7 +23,7 @@ module <%= config[:classified_app_name] %> # Handle exceptions with HTTP statuses (true) or don't catch them (false). # Defaults to true. - # See: http://www.rubydoc.info/gems/lotus-controller/ + # See: http://www.rubydoc.info/gems/hanami-controller/ # Exceptions_management # @@ -34,7 +34,7 @@ module <%= config[:classified_app_name] %> # # Routes definitions for this application - # See: http://www.rubydoc.info/gems/lotus-router#Usage + # See: http://www.rubydoc.info/gems/hanami-router#Usage # routes 'config/routes' @@ -124,7 +124,7 @@ module <%= config[:classified_app_name] %> # * :yui # * :closure # - # See: http://lotusrb.org/guides/assets/compressors + # See: http://hanamirb.org/guides/assets/compressors # # In order to skip JavaScript compression comment the following line javascript_compressor :builtin @@ -137,7 +137,7 @@ module <%= config[:classified_app_name] %> # * :yui # * :sass # - # See: http://lotusrb.org/guides/assets/compressors + # See: http://hanamirb.org/guides/assets/compressors # # In order to skip stylesheet compression comment the following line stylesheet_compressor :builtin @@ -206,7 +206,7 @@ module <%= config[:classified_app_name] %> # Configure the code that will yield each time <%= config[:classified_app_name] %>::Action is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-controller#Configuration + # See: http://www.rubydoc.info/gems/hanami-controller#Configuration controller.prepare do # include MyAuthentication # included in all the actions # before :authenticate! # run an authentication before callback @@ -215,9 +215,9 @@ module <%= config[:classified_app_name] %> # Configure the code that will yield each time <%= config[:classified_app_name] %>::View is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-view#Configuration + # See: http://www.rubydoc.info/gems/hanami-view#Configuration view.prepare do - include Lotus::Helpers + include Hanami::Helpers include <%= config[:classified_app_name] %>::Assets::Helpers end end @@ -249,17 +249,17 @@ module <%= config[:classified_app_name] %> assets do # Don't compile static assets in production mode (eg. Sass, ES6) # - # See: http://www.rubydoc.info/gems/lotus-assets#Configuration + # See: http://www.rubydoc.info/gems/hanami-assets#Configuration compile false # Use digest file name for asset paths # - # See: http://lotusrb.org/guides/assets/digest + # See: http://hanamirb.org/guides/assets/digest digest true # Content Delivery Network (CDN) # - # See: http://lotusrb.org/guides/assets/content-delivery-network + # See: http://hanamirb.org/guides/assets/content-delivery-network # # scheme 'https' # host 'cdn.example.org' diff --git a/lib/lotus/generators/application/app/config/environment.rb.tt b/lib/hanami/generators/application/app/config/environment.rb.tt similarity index 85% rename from lib/lotus/generators/application/app/config/environment.rb.tt rename to lib/hanami/generators/application/app/config/environment.rb.tt index d9a1c71b..82a6e86c 100644 --- a/lib/lotus/generators/application/app/config/environment.rb.tt +++ b/lib/hanami/generators/application/app/config/environment.rb.tt @@ -1,5 +1,5 @@ require 'rubygems' require 'bundler/setup' -require 'lotus/setup' +require 'hanami/setup' require_relative '../lib/<%= config[:app_name] %>' require_relative '../config/application' diff --git a/lib/lotus/generators/application/app/config/initializers/.gitkeep b/lib/hanami/generators/application/app/config/initializers/.gitkeep similarity index 100% rename from lib/lotus/generators/application/app/config/initializers/.gitkeep rename to lib/hanami/generators/application/app/config/initializers/.gitkeep diff --git a/lib/hanami/generators/application/app/config/routes.rb.tt b/lib/hanami/generators/application/app/config/routes.rb.tt new file mode 100644 index 00000000..fa85d5d3 --- /dev/null +++ b/lib/hanami/generators/application/app/config/routes.rb.tt @@ -0,0 +1,2 @@ +# Configure your routes here +# See: http://www.rubydoc.info/gems/hanami-router/#Usage diff --git a/lib/lotus/generators/application/app/db/.gitkeep b/lib/hanami/generators/application/app/db/.gitkeep similarity index 100% rename from lib/lotus/generators/application/app/db/.gitkeep rename to lib/hanami/generators/application/app/db/.gitkeep diff --git a/lib/lotus/generators/application/app/favicon.ico b/lib/hanami/generators/application/app/favicon.ico similarity index 100% rename from lib/lotus/generators/application/app/favicon.ico rename to lib/hanami/generators/application/app/favicon.ico diff --git a/lib/lotus/generators/application/app/features_helper.rb.minitest.tt b/lib/hanami/generators/application/app/features_helper.rb.minitest.tt similarity index 100% rename from lib/lotus/generators/application/app/features_helper.rb.minitest.tt rename to lib/hanami/generators/application/app/features_helper.rb.minitest.tt diff --git a/lib/lotus/generators/application/app/features_helper.rb.rspec.tt b/lib/hanami/generators/application/app/features_helper.rb.rspec.tt similarity index 100% rename from lib/lotus/generators/application/app/features_helper.rb.rspec.tt rename to lib/hanami/generators/application/app/features_helper.rb.rspec.tt diff --git a/lib/lotus/generators/application/app/gitignore.tt b/lib/hanami/generators/application/app/gitignore.tt similarity index 100% rename from lib/lotus/generators/application/app/gitignore.tt rename to lib/hanami/generators/application/app/gitignore.tt diff --git a/lib/lotus/generators/application/app/gitignore_with_db.tt b/lib/hanami/generators/application/app/gitignore_with_db.tt similarity index 100% rename from lib/lotus/generators/application/app/gitignore_with_db.tt rename to lib/hanami/generators/application/app/gitignore_with_db.tt diff --git a/lib/hanami/generators/application/app/hanamirc.tt b/lib/hanami/generators/application/app/hanamirc.tt new file mode 100644 index 00000000..f16a0a01 --- /dev/null +++ b/lib/hanami/generators/application/app/hanamirc.tt @@ -0,0 +1,3 @@ +<%= Hanami::Hanamirc::ARCHITECTURE_KEY %>=<%= Hanami::Hanamirc::APP_ARCHITECTURE %> +<%= Hanami::Hanamirc::TEST_KEY %>=<%= config[:test] %> +<%= Hanami::Hanamirc::TEMPLATE_KEY %>=<%= Hanami::Hanamirc::DEFAULT_TEMPLATE %> diff --git a/lib/lotus/generators/application/app/lib/app_name.rb.tt b/lib/hanami/generators/application/app/lib/app_name.rb.tt similarity index 90% rename from lib/lotus/generators/application/app/lib/app_name.rb.tt rename to lib/hanami/generators/application/app/lib/app_name.rb.tt index cb2d8347..3543da0e 100644 --- a/lib/lotus/generators/application/app/lib/app_name.rb.tt +++ b/lib/hanami/generators/application/app/lib/app_name.rb.tt @@ -1,8 +1,8 @@ -require 'lotus/model' -require 'lotus/mailer' +require 'hanami/model' +require 'hanami/mailer' Dir["#{ __dir__ }/<%= config[:app_name] %>/**/*.rb"].each { |file| require_relative file } -Lotus::Model.configure do +Hanami::Model.configure do # Database adapter # # Available options: @@ -47,10 +47,10 @@ Lotus::Model.configure do end end.load! -Lotus::Mailer.configure do +Hanami::Mailer.configure do root "#{ __dir__ }/<%= config[:app_name] %>/mailers" - # See http://lotusrb.org/guides/mailers/delivery + # See http://hanamirb.org/guides/mailers/delivery delivery do development :test test :test diff --git a/lib/lotus/generators/application/app/lib/chirp/entities/.gitkeep b/lib/hanami/generators/application/app/lib/chirp/entities/.gitkeep similarity index 100% rename from lib/lotus/generators/application/app/lib/chirp/entities/.gitkeep rename to lib/hanami/generators/application/app/lib/chirp/entities/.gitkeep diff --git a/lib/lotus/generators/application/app/lib/chirp/repositories/.gitkeep b/lib/hanami/generators/application/app/lib/chirp/repositories/.gitkeep similarity index 100% rename from lib/lotus/generators/application/app/lib/chirp/repositories/.gitkeep rename to lib/hanami/generators/application/app/lib/chirp/repositories/.gitkeep diff --git a/lib/lotus/generators/application/app/lib/config/mapping.rb.tt b/lib/hanami/generators/application/app/lib/config/mapping.rb.tt similarity index 100% rename from lib/lotus/generators/application/app/lib/config/mapping.rb.tt rename to lib/hanami/generators/application/app/lib/config/mapping.rb.tt diff --git a/lib/lotus/generators/application/app/rspec.rspec.tt b/lib/hanami/generators/application/app/rspec.rspec.tt similarity index 100% rename from lib/lotus/generators/application/app/rspec.rspec.tt rename to lib/hanami/generators/application/app/rspec.rspec.tt diff --git a/lib/lotus/generators/application/app/schema.sql.tt b/lib/hanami/generators/application/app/schema.sql.tt similarity index 100% rename from lib/lotus/generators/application/app/schema.sql.tt rename to lib/hanami/generators/application/app/schema.sql.tt diff --git a/lib/lotus/generators/application/app/spec_helper.rb.minitest.tt b/lib/hanami/generators/application/app/spec_helper.rb.minitest.tt similarity index 64% rename from lib/lotus/generators/application/app/spec_helper.rb.minitest.tt rename to lib/hanami/generators/application/app/spec_helper.rb.minitest.tt index ee100aac..09bd2290 100644 --- a/lib/lotus/generators/application/app/spec_helper.rb.minitest.tt +++ b/lib/hanami/generators/application/app/spec_helper.rb.minitest.tt @@ -1,7 +1,7 @@ # Require this file for unit tests -ENV['LOTUS_ENV'] ||= 'test' +ENV['HANAMI_ENV'] ||= 'test' require_relative '../config/environment' require 'minitest/autorun' -Lotus::Application.preload! +Hanami::Application.preload! diff --git a/lib/lotus/generators/application/app/spec_helper.rb.rspec.tt b/lib/hanami/generators/application/app/spec_helper.rb.rspec.tt similarity index 98% rename from lib/lotus/generators/application/app/spec_helper.rb.rspec.tt rename to lib/hanami/generators/application/app/spec_helper.rb.rspec.tt index 910a4ff5..b2bb380c 100644 --- a/lib/lotus/generators/application/app/spec_helper.rb.rspec.tt +++ b/lib/hanami/generators/application/app/spec_helper.rb.rspec.tt @@ -1,8 +1,8 @@ # Require this file for unit tests -ENV['LOTUS_ENV'] ||= 'test' +ENV['HANAMI_ENV'] ||= 'test' require_relative '../config/environment' -Lotus::Application.preload! +Hanami::Application.preload! Dir[__dir__ + '/support/**/*.rb'].each { |f| require f } diff --git a/lib/lotus/generators/application/app/templates/application.html.erb.tt b/lib/hanami/generators/application/app/templates/application.html.erb.tt similarity index 100% rename from lib/lotus/generators/application/app/templates/application.html.erb.tt rename to lib/hanami/generators/application/app/templates/application.html.erb.tt diff --git a/lib/lotus/generators/application/app/views/application_layout.rb.tt b/lib/hanami/generators/application/app/views/application_layout.rb.tt similarity index 100% rename from lib/lotus/generators/application/app/views/application_layout.rb.tt rename to lib/hanami/generators/application/app/views/application_layout.rb.tt diff --git a/lib/lotus/generators/application/container/.env.development.tt b/lib/hanami/generators/application/container/.env.development.tt similarity index 100% rename from lib/lotus/generators/application/container/.env.development.tt rename to lib/hanami/generators/application/container/.env.development.tt diff --git a/lib/lotus/generators/application/container/.env.test.tt b/lib/hanami/generators/application/container/.env.test.tt similarity index 100% rename from lib/lotus/generators/application/container/.env.test.tt rename to lib/hanami/generators/application/container/.env.test.tt diff --git a/lib/lotus/generators/application/container/.env.tt b/lib/hanami/generators/application/container/.env.tt similarity index 100% rename from lib/lotus/generators/application/container/.env.tt rename to lib/hanami/generators/application/container/.env.tt diff --git a/lib/lotus/generators/application/container/.gitignore b/lib/hanami/generators/application/container/.gitignore similarity index 100% rename from lib/lotus/generators/application/container/.gitignore rename to lib/hanami/generators/application/container/.gitignore diff --git a/lib/lotus/generators/application/container/.gitkeep b/lib/hanami/generators/application/container/.gitkeep similarity index 100% rename from lib/lotus/generators/application/container/.gitkeep rename to lib/hanami/generators/application/container/.gitkeep diff --git a/lib/hanami/generators/application/container/Gemfile.tt b/lib/hanami/generators/application/container/Gemfile.tt new file mode 100644 index 00000000..9ace3882 --- /dev/null +++ b/lib/hanami/generators/application/container/Gemfile.tt @@ -0,0 +1,36 @@ +source 'https://rubygems.org' + +gem 'bundler' +gem 'rake' +<%- if config[:hanami_head] -%> +gem 'hanami-utils', require: false, github: 'hanami/utils' +gem 'hanami-router', require: false, github: 'hanami/router' +gem 'hanami-validations', require: false, github: 'hanami/validations' +gem 'hanami-helpers', require: false, github: 'hanami/helpers' +gem 'hanami-controller', require: false, github: 'hanami/controller' +gem 'hanami-view', require: false, github: 'hanami/view' +gem 'hanami-model', require: false, github: 'hanami/model' +gem 'hanami-mailer', require: false, github: 'hanami/mailer' +gem 'hanami-assets', require: false, github: 'hanami/assets' +gem 'hanami', github: 'hanami/hanami' +<%- else -%> +gem 'hanami', '<%= Hanami::VERSION %>' +gem 'hanami-model', '<%= config[:hanami_model_version] %>' +<%- end -%> + +<%- if config[:database_config][:gem] %> +gem '<%= config[:database_config][:gem] %>' +<%- end -%> + +group :test do +<%- if config[:test] == 'rspec' -%> + gem 'rspec' +<%- else -%> + gem 'minitest' +<%- end -%> + gem 'capybara' +end + +group :production do + # gem 'puma' +end diff --git a/lib/lotus/generators/application/container/Rakefile.minitest.tt b/lib/hanami/generators/application/container/Rakefile.minitest.tt similarity index 85% rename from lib/lotus/generators/application/container/Rakefile.minitest.tt rename to lib/hanami/generators/application/container/Rakefile.minitest.tt index 0bc82960..554937b4 100644 --- a/lib/lotus/generators/application/container/Rakefile.minitest.tt +++ b/lib/hanami/generators/application/container/Rakefile.minitest.tt @@ -1,5 +1,5 @@ require 'rake' -require 'lotus/rake_tasks' +require 'hanami/rake_tasks' require 'rake/testtask' Rake::TestTask.new do |t| diff --git a/lib/lotus/generators/application/app/Rakefile.rspec.tt b/lib/hanami/generators/application/container/Rakefile.rspec.tt similarity index 78% rename from lib/lotus/generators/application/app/Rakefile.rspec.tt rename to lib/hanami/generators/application/container/Rakefile.rspec.tt index 95423250..c8493fe2 100644 --- a/lib/lotus/generators/application/app/Rakefile.rspec.tt +++ b/lib/hanami/generators/application/container/Rakefile.rspec.tt @@ -1,5 +1,5 @@ require 'rake' -require 'lotus/rake_tasks' +require 'hanami/rake_tasks' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) diff --git a/lib/lotus/generators/application/container/capybara.rb.rspec.tt b/lib/hanami/generators/application/container/capybara.rb.rspec.tt similarity index 74% rename from lib/lotus/generators/application/container/capybara.rb.rspec.tt rename to lib/hanami/generators/application/container/capybara.rb.rspec.tt index b787e7d2..d63b0a3c 100644 --- a/lib/lotus/generators/application/container/capybara.rb.rspec.tt +++ b/lib/hanami/generators/application/container/capybara.rb.rspec.tt @@ -2,7 +2,7 @@ module RSpec module FeatureExampleGroup def self.included(group) group.metadata[:type] = :feature - Capybara.app = Lotus::Container.new + Capybara.app = Hanami::Container.new end end end diff --git a/lib/lotus/generators/application/container/config.ru.tt b/lib/hanami/generators/application/container/config.ru.tt similarity index 55% rename from lib/lotus/generators/application/container/config.ru.tt rename to lib/hanami/generators/application/container/config.ru.tt index 8a3577bb..a9db2fb5 100644 --- a/lib/lotus/generators/application/container/config.ru.tt +++ b/lib/hanami/generators/application/container/config.ru.tt @@ -1,3 +1,3 @@ require './config/environment' -run Lotus::Container.new +run Hanami::Container.new diff --git a/lib/lotus/generators/application/container/config/environment.rb.tt b/lib/hanami/generators/application/container/config/environment.rb.tt similarity index 64% rename from lib/lotus/generators/application/container/config/environment.rb.tt rename to lib/hanami/generators/application/container/config/environment.rb.tt index b916ccc3..7798a74b 100644 --- a/lib/lotus/generators/application/container/config/environment.rb.tt +++ b/lib/hanami/generators/application/container/config/environment.rb.tt @@ -1,7 +1,7 @@ require 'rubygems' require 'bundler/setup' -require 'lotus/setup' +require 'hanami/setup' require_relative '../lib/<%= config[:app_name] %>' -Lotus::Container.configure do +Hanami::Container.configure do end diff --git a/lib/lotus/generators/application/container/config/initializers/.gitkeep b/lib/hanami/generators/application/container/config/initializers/.gitkeep similarity index 100% rename from lib/lotus/generators/application/container/config/initializers/.gitkeep rename to lib/hanami/generators/application/container/config/initializers/.gitkeep diff --git a/lib/lotus/generators/application/container/db/.gitkeep b/lib/hanami/generators/application/container/db/.gitkeep similarity index 100% rename from lib/lotus/generators/application/container/db/.gitkeep rename to lib/hanami/generators/application/container/db/.gitkeep diff --git a/lib/lotus/generators/application/container/features_helper.rb.minitest.tt b/lib/hanami/generators/application/container/features_helper.rb.minitest.tt similarity index 81% rename from lib/lotus/generators/application/container/features_helper.rb.minitest.tt rename to lib/hanami/generators/application/container/features_helper.rb.minitest.tt index 8ff1d023..0fed7124 100644 --- a/lib/lotus/generators/application/container/features_helper.rb.minitest.tt +++ b/lib/hanami/generators/application/container/features_helper.rb.minitest.tt @@ -4,7 +4,7 @@ require_relative './spec_helper' require 'capybara' require 'capybara/dsl' -Capybara.app = Lotus::Container.new +Capybara.app = Hanami::Container.new class MiniTest::Spec include Capybara::DSL diff --git a/lib/lotus/generators/application/container/features_helper.rb.rspec.tt b/lib/hanami/generators/application/container/features_helper.rb.rspec.tt similarity index 100% rename from lib/lotus/generators/application/container/features_helper.rb.rspec.tt rename to lib/hanami/generators/application/container/features_helper.rb.rspec.tt diff --git a/lib/lotus/generators/application/container/gitignore.tt b/lib/hanami/generators/application/container/gitignore.tt similarity index 100% rename from lib/lotus/generators/application/container/gitignore.tt rename to lib/hanami/generators/application/container/gitignore.tt diff --git a/lib/lotus/generators/application/container/gitignore_with_db.tt b/lib/hanami/generators/application/container/gitignore_with_db.tt similarity index 100% rename from lib/lotus/generators/application/container/gitignore_with_db.tt rename to lib/hanami/generators/application/container/gitignore_with_db.tt diff --git a/lib/hanami/generators/application/container/hanamirc.tt b/lib/hanami/generators/application/container/hanamirc.tt new file mode 100644 index 00000000..cb724365 --- /dev/null +++ b/lib/hanami/generators/application/container/hanamirc.tt @@ -0,0 +1,3 @@ +<%= Hanami::Hanamirc::ARCHITECTURE_KEY %>=<%= Hanami::Hanamirc::DEFAULT_ARCHITECTURE %> +<%= Hanami::Hanamirc::TEST_KEY %>=<%= config[:test] %> +<%= Hanami::Hanamirc::TEMPLATE_KEY %>=<%= Hanami::Hanamirc::DEFAULT_TEMPLATE %> diff --git a/lib/lotus/generators/application/container/lib/app_name.rb.tt b/lib/hanami/generators/application/container/lib/app_name.rb.tt similarity index 90% rename from lib/lotus/generators/application/container/lib/app_name.rb.tt rename to lib/hanami/generators/application/container/lib/app_name.rb.tt index 2c856030..0280f9cb 100644 --- a/lib/lotus/generators/application/container/lib/app_name.rb.tt +++ b/lib/hanami/generators/application/container/lib/app_name.rb.tt @@ -1,8 +1,8 @@ -require 'lotus/model' -require 'lotus/mailer' +require 'hanami/model' +require 'hanami/mailer' Dir["#{ __dir__ }/<%= config[:app_name] %>/**/*.rb"].each { |file| require_relative file } -Lotus::Model.configure do +Hanami::Model.configure do ## # Database adapter # @@ -48,10 +48,10 @@ Lotus::Model.configure do end end.load! -Lotus::Mailer.configure do +Hanami::Mailer.configure do root "#{ __dir__ }/<%= config[:app_name] %>/mailers" - # See http://lotusrb.org/guides/mailers/delivery + # See http://hanamirb.org/guides/mailers/delivery delivery do development :test test :test diff --git a/lib/lotus/generators/application/container/lib/chirp/entities/.gitkeep b/lib/hanami/generators/application/container/lib/chirp/entities/.gitkeep similarity index 100% rename from lib/lotus/generators/application/container/lib/chirp/entities/.gitkeep rename to lib/hanami/generators/application/container/lib/chirp/entities/.gitkeep diff --git a/lib/lotus/generators/application/container/lib/chirp/mailers/.gitkeep b/lib/hanami/generators/application/container/lib/chirp/mailers/.gitkeep similarity index 100% rename from lib/lotus/generators/application/container/lib/chirp/mailers/.gitkeep rename to lib/hanami/generators/application/container/lib/chirp/mailers/.gitkeep diff --git a/lib/lotus/generators/application/container/lib/chirp/mailers/templates/.gitkeep b/lib/hanami/generators/application/container/lib/chirp/mailers/templates/.gitkeep similarity index 100% rename from lib/lotus/generators/application/container/lib/chirp/mailers/templates/.gitkeep rename to lib/hanami/generators/application/container/lib/chirp/mailers/templates/.gitkeep diff --git a/lib/lotus/generators/application/container/lib/chirp/repositories/.gitkeep b/lib/hanami/generators/application/container/lib/chirp/repositories/.gitkeep similarity index 100% rename from lib/lotus/generators/application/container/lib/chirp/repositories/.gitkeep rename to lib/hanami/generators/application/container/lib/chirp/repositories/.gitkeep diff --git a/lib/lotus/generators/application/container/lib/config/mapping.rb.tt b/lib/hanami/generators/application/container/lib/config/mapping.rb.tt similarity index 100% rename from lib/lotus/generators/application/container/lib/config/mapping.rb.tt rename to lib/hanami/generators/application/container/lib/config/mapping.rb.tt diff --git a/lib/lotus/generators/application/container/rspec.rspec.tt b/lib/hanami/generators/application/container/rspec.rspec.tt similarity index 100% rename from lib/lotus/generators/application/container/rspec.rspec.tt rename to lib/hanami/generators/application/container/rspec.rspec.tt diff --git a/lib/lotus/generators/application/container/schema.sql.tt b/lib/hanami/generators/application/container/schema.sql.tt similarity index 100% rename from lib/lotus/generators/application/container/schema.sql.tt rename to lib/hanami/generators/application/container/schema.sql.tt diff --git a/lib/lotus/generators/application/container/spec_helper.rb.minitest.tt b/lib/hanami/generators/application/container/spec_helper.rb.minitest.tt similarity index 64% rename from lib/lotus/generators/application/container/spec_helper.rb.minitest.tt rename to lib/hanami/generators/application/container/spec_helper.rb.minitest.tt index ee100aac..09bd2290 100644 --- a/lib/lotus/generators/application/container/spec_helper.rb.minitest.tt +++ b/lib/hanami/generators/application/container/spec_helper.rb.minitest.tt @@ -1,7 +1,7 @@ # Require this file for unit tests -ENV['LOTUS_ENV'] ||= 'test' +ENV['HANAMI_ENV'] ||= 'test' require_relative '../config/environment' require 'minitest/autorun' -Lotus::Application.preload! +Hanami::Application.preload! diff --git a/lib/lotus/generators/application/container/spec_helper.rb.rspec.tt b/lib/hanami/generators/application/container/spec_helper.rb.rspec.tt similarity index 98% rename from lib/lotus/generators/application/container/spec_helper.rb.rspec.tt rename to lib/hanami/generators/application/container/spec_helper.rb.rspec.tt index 910a4ff5..b2bb380c 100644 --- a/lib/lotus/generators/application/container/spec_helper.rb.rspec.tt +++ b/lib/hanami/generators/application/container/spec_helper.rb.rspec.tt @@ -1,8 +1,8 @@ # Require this file for unit tests -ENV['LOTUS_ENV'] ||= 'test' +ENV['HANAMI_ENV'] ||= 'test' require_relative '../config/environment' -Lotus::Application.preload! +Hanami::Application.preload! Dir[__dir__ + '/support/**/*.rb'].each { |f| require f } diff --git a/lib/lotus/generators/database_config.rb b/lib/hanami/generators/database_config.rb similarity index 94% rename from lib/lotus/generators/database_config.rb rename to lib/hanami/generators/database_config.rb index a5e7374f..b8699d2c 100644 --- a/lib/lotus/generators/database_config.rb +++ b/lib/hanami/generators/database_config.rb @@ -1,6 +1,6 @@ require 'shellwords' -module Lotus +module Hanami module Generators class DatabaseConfig @@ -49,11 +49,11 @@ module Lotus private def platform - Lotus::Utils.jruby? ? :jruby : :mri + Hanami::Utils.jruby? ? :jruby : :mri end def platform_prefix - 'jdbc:'.freeze if Lotus::Utils.jruby? + 'jdbc:'.freeze if Hanami::Utils.jruby? end def uri @@ -70,7 +70,7 @@ module Lotus def base_uri case engine when 'mysql', 'mysql2' - if Lotus::Utils.jruby? + if Hanami::Utils.jruby? "mysql://localhost/#{ name }" else "mysql2://localhost/#{ name }" diff --git a/lib/lotus/generators/generatable.rb b/lib/hanami/generators/generatable.rb similarity index 86% rename from lib/lotus/generators/generatable.rb rename to lib/hanami/generators/generatable.rb index 54fd7a0f..ee6a36b8 100644 --- a/lib/lotus/generators/generatable.rb +++ b/lib/hanami/generators/generatable.rb @@ -1,6 +1,6 @@ -require 'lotus/generators/generator' +require 'hanami/generators/generator' -module Lotus +module Hanami module Generators module Generatable @@ -15,7 +15,7 @@ module Lotus end def generator - @generator ||= Lotus::Generators::Generator.new(template_source_path, target_path) + @generator ||= Hanami::Generators::Generator.new(template_source_path, target_path) end def map_templates diff --git a/lib/lotus/generators/generator.rb b/lib/hanami/generators/generator.rb similarity index 98% rename from lib/lotus/generators/generator.rb rename to lib/hanami/generators/generator.rb index 814b80ee..eef60256 100644 --- a/lib/lotus/generators/generator.rb +++ b/lib/hanami/generators/generator.rb @@ -1,7 +1,7 @@ require 'thor' require 'forwardable' -module Lotus +module Hanami module Generators class Generator diff --git a/lib/lotus/generators/mailer/mailer.rb.tt b/lib/hanami/generators/mailer/mailer.rb.tt similarity index 84% rename from lib/lotus/generators/mailer/mailer.rb.tt rename to lib/hanami/generators/mailer/mailer.rb.tt index eaa4b596..83d85256 100644 --- a/lib/lotus/generators/mailer/mailer.rb.tt +++ b/lib/hanami/generators/mailer/mailer.rb.tt @@ -1,5 +1,5 @@ class Mailers::<%= config[:mailer] %> - include Lotus::Mailer + include Hanami::Mailer from <%= config[:from] %> to <%= config[:to] %> diff --git a/lib/lotus/generators/mailer/mailer_spec.rb.tt b/lib/hanami/generators/mailer/mailer_spec.rb.tt similarity index 100% rename from lib/lotus/generators/mailer/mailer_spec.rb.tt rename to lib/hanami/generators/mailer/mailer_spec.rb.tt diff --git a/lib/lotus/generators/mailer/template.html.tt b/lib/hanami/generators/mailer/template.html.tt similarity index 100% rename from lib/lotus/generators/mailer/template.html.tt rename to lib/hanami/generators/mailer/template.html.tt diff --git a/lib/lotus/generators/mailer/template.txt.tt b/lib/hanami/generators/mailer/template.txt.tt similarity index 100% rename from lib/lotus/generators/mailer/template.txt.tt rename to lib/hanami/generators/mailer/template.txt.tt diff --git a/lib/hanami/generators/migration/migration.rb.tt b/lib/hanami/generators/migration/migration.rb.tt new file mode 100644 index 00000000..5619b543 --- /dev/null +++ b/lib/hanami/generators/migration/migration.rb.tt @@ -0,0 +1,4 @@ +Hanami::Model.migration do + change do + end +end diff --git a/lib/lotus/generators/model/entity.rb.tt b/lib/hanami/generators/model/entity.rb.tt similarity index 59% rename from lib/lotus/generators/model/entity.rb.tt rename to lib/hanami/generators/model/entity.rb.tt index 460007a4..13545eab 100644 --- a/lib/lotus/generators/model/entity.rb.tt +++ b/lib/hanami/generators/model/entity.rb.tt @@ -1,3 +1,3 @@ class <%= config[:model_name] %> - include Lotus::Entity + include Hanami::Entity end diff --git a/lib/lotus/generators/model/entity_spec.minitest.tt b/lib/hanami/generators/model/entity_spec.minitest.tt similarity index 100% rename from lib/lotus/generators/model/entity_spec.minitest.tt rename to lib/hanami/generators/model/entity_spec.minitest.tt diff --git a/lib/lotus/generators/model/entity_spec.rspec.tt b/lib/hanami/generators/model/entity_spec.rspec.tt similarity index 100% rename from lib/lotus/generators/model/entity_spec.rspec.tt rename to lib/hanami/generators/model/entity_spec.rspec.tt diff --git a/lib/lotus/generators/model/repository.rb.tt b/lib/hanami/generators/model/repository.rb.tt similarity index 61% rename from lib/lotus/generators/model/repository.rb.tt rename to lib/hanami/generators/model/repository.rb.tt index 8fc4dc2a..46447030 100644 --- a/lib/lotus/generators/model/repository.rb.tt +++ b/lib/hanami/generators/model/repository.rb.tt @@ -1,3 +1,3 @@ class <%= config[:model_name] %>Repository - include Lotus::Repository + include Hanami::Repository end diff --git a/lib/lotus/generators/model/repository_spec.minitest.tt b/lib/hanami/generators/model/repository_spec.minitest.tt similarity index 100% rename from lib/lotus/generators/model/repository_spec.minitest.tt rename to lib/hanami/generators/model/repository_spec.minitest.tt diff --git a/lib/lotus/generators/model/repository_spec.rspec.tt b/lib/hanami/generators/model/repository_spec.rspec.tt similarity index 100% rename from lib/lotus/generators/model/repository_spec.rspec.tt rename to lib/hanami/generators/model/repository_spec.rspec.tt diff --git a/lib/lotus/generators/test_framework.rb b/lib/hanami/generators/test_framework.rb similarity index 83% rename from lib/lotus/generators/test_framework.rb rename to lib/hanami/generators/test_framework.rb index f8988e80..c69c7cf4 100644 --- a/lib/lotus/generators/test_framework.rb +++ b/lib/hanami/generators/test_framework.rb @@ -1,5 +1,5 @@ -require 'lotus/lotusrc' -module Lotus +require 'hanami/hanamirc' +module Hanami module Generators class TestFramework RSPEC = 'rspec'.freeze @@ -8,8 +8,8 @@ module Lotus attr_reader :framework - def initialize(lotusrc, framework) - @framework = (framework || lotusrc.options.fetch(:test)) + def initialize(hanamirc, framework) + @framework = (framework || hanamirc.options.fetch(:test)) assert_framework! end diff --git a/lib/lotus/lotusrc.rb b/lib/hanami/hanamirc.rb similarity index 61% rename from lib/lotus/lotusrc.rb rename to lib/hanami/hanamirc.rb index 626c2f5b..28c3aa75 100644 --- a/lib/lotus/lotusrc.rb +++ b/lib/hanami/hanamirc.rb @@ -1,27 +1,27 @@ require 'pathname' require 'dotenv/parser' -require 'lotus/utils/hash' +require 'hanami/utils/hash' -module Lotus - # Read the .lotusrc file in the root of the application +module Hanami + # Read the .hanamirc file in the root of the application # # @since 0.3.0 # @api private - class Lotusrc - # Lotusrc name file + class Hanamirc + # Hanamirc name file # # @since 0.3.0 # @api private # - # @see Lotus::Lotusrc#path_file - FILE_NAME = '.lotusrc'.freeze + # @see Hanami::Hanamirc#path_file + FILE_NAME = '.hanamirc'.freeze # Architecture default value # # @since 0.3.0 # @api private # - # @see Lotus::Lotusrc#options + # @see Hanami::Hanamirc#options DEFAULT_ARCHITECTURE = 'container'.freeze # Application architecture value @@ -30,12 +30,12 @@ module Lotus # @api private APP_ARCHITECTURE = 'app'.freeze - # Architecture key for writing the lotusrc file + # Architecture key for writing the hanamirc file # # @since 0.3.0 # @api private # - # @see Lotus::Lotusrc::DEFAULT_OPTIONS + # @see Hanami::Hanamirc::DEFAULT_OPTIONS ARCHITECTURE_KEY = 'architecture'.freeze # Test suite default value @@ -43,15 +43,15 @@ module Lotus # @since 0.3.0 # @api private # - # @see Lotus::Lotusrc::DEFAULT_OPTIONS + # @see Hanami::Hanamirc::DEFAULT_OPTIONS DEFAULT_TEST_SUITE = 'minitest'.freeze - # Test suite key for writing the lotusrc file + # Test suite key for writing the hanamirc file # # @since 0.3.0 # @api private # - # @see Lotus::Lotusrc::DEFAULT_OPTIONS + # @see Hanami::Hanamirc::DEFAULT_OPTIONS TEST_KEY = 'test'.freeze # Template default value @@ -59,60 +59,60 @@ module Lotus # @since 0.3.0 # @api private # - # @see Lotus::Lotusrc::DEFAULT_OPTIONS + # @see Hanami::Hanamirc::DEFAULT_OPTIONS DEFAULT_TEMPLATE = 'erb'.freeze - # Template key for writing the lotusrc file + # Template key for writing the hanamirc file # # @since 0.3.0 # @api private # - # @see Lotus::Lotusrc::DEFAULT_OPTIONS + # @see Hanami::Hanamirc::DEFAULT_OPTIONS TEMPLATE_KEY = 'template'.freeze - # Default values for writing the lotusrc file + # Default values for writing the hanamirc file # # @since 0.5.1 # @api private # - # @see Lotus::Lotusrc#options + # @see Hanami::Hanamirc#options DEFAULT_OPTIONS = Utils::Hash.new({ ARCHITECTURE_KEY => DEFAULT_ARCHITECTURE, TEST_KEY => DEFAULT_TEST_SUITE, TEMPLATE_KEY => DEFAULT_TEMPLATE }).symbolize!.freeze - # Initialize Lotusrc class with application's root and environment options. + # Initialize Hanamirc class with application's root and environment options. # # @param root [Pathname] Application's root # - # @see Lotus::Environment#initialize + # @see Hanami::Environment#initialize def initialize(root) @root = root end - # Read lotusrc file (if exists) and parse it's values or return default. + # Read hanamirc file (if exists) and parse it's values or return default. # - # @return [Lotus::Utils::Hash] parsed values + # @return [Hanami::Utils::Hash] parsed values # # @example Default values if file doesn't exist - # Lotus::Lotusrc.new(Pathname.new(Dir.pwd)).options + # Hanami::Hanamirc.new(Pathname.new(Dir.pwd)).options # # => { architecture: 'container', test: 'minitest', template: 'erb' } # # @example Custom values if file doesn't exist # options = { architect: 'application', test: 'rspec', template: 'slim' } - # Lotus::Lotusrc.new(Pathname.new(Dir.pwd), options).options + # Hanami::Hanamirc.new(Pathname.new(Dir.pwd), options).options # # => { architecture: 'application', test: 'rspec', template: 'slim' } def options @options ||= symbolize(DEFAULT_OPTIONS.merge(file_options)) end - # Check if lotusrc file exists + # Check if hanamirc file exists # # @since 0.3.0 # @api private # - # @return [Boolean] lotusrc file's path existing + # @return [Boolean] hanamirc file's path existing def exists? path_file.exist? end @@ -127,24 +127,24 @@ module Lotus symbolize(exists? ? Dotenv::Parser.call(content) : {}) end - # Return the lotusrc file's path + # Return the hanamirc file's path # # @since 0.3.0 # @api private # - # @return [Pathname] lotusrc file's path + # @return [Pathname] hanamirc file's path # - # @see Lotus::Lotusrc::FILE_NAME + # @see Hanami::Hanamirc::FILE_NAME def path_file @root.join FILE_NAME end - # Return the content of lotusrc file + # Return the content of hanamirc file # # @since 0.3.0 # @api private # - # @return [String] content of lotusrc file + # @return [String] content of hanamirc file def content path_file.read end diff --git a/lib/lotus/loader.rb b/lib/hanami/loader.rb similarity index 75% rename from lib/lotus/loader.rb rename to lib/hanami/loader.rb index 17ee9596..5f8e14e7 100644 --- a/lib/lotus/loader.rb +++ b/lib/hanami/loader.rb @@ -1,13 +1,13 @@ -require 'lotus/utils/class' -require 'lotus/utils/kernel' -require 'lotus/utils/string' -require 'lotus/routes' -require 'lotus/routing/default' -require 'lotus/action/session' -require 'lotus/config/security' -require 'lotus/action/routing_helpers' +require 'hanami/utils/class' +require 'hanami/utils/kernel' +require 'hanami/utils/string' +require 'hanami/routes' +require 'hanami/routing/default' +require 'hanami/action/session' +require 'hanami/config/security' +require 'hanami/action/routing_helpers' -module Lotus +module Hanami # Load an application # # @since 0.1.0 @@ -43,7 +43,7 @@ module Lotus end def configure_frameworks! - _configure_model_framework! if defined?(Lotus::Model) + _configure_model_framework! if defined?(Hanami::Model) _configure_controller_framework! _configure_view_framework! _configure_assets_framework! @@ -53,30 +53,30 @@ module Lotus def _configure_controller_framework! config = configuration unless namespace.const_defined?('Controller') - controller = Lotus::Controller.duplicate(namespace) do + controller = Hanami::Controller.duplicate(namespace) do handle_exceptions config.handle_exceptions default_request_format config.default_request_format default_response_format config.default_response_format default_headers({ - Lotus::Config::Security::X_FRAME_OPTIONS_HEADER => config.security.x_frame_options, - Lotus::Config::Security::CONTENT_SECURITY_POLICY_HEADER => config.security.content_security_policy + Hanami::Config::Security::X_FRAME_OPTIONS_HEADER => config.security.x_frame_options, + Hanami::Config::Security::CONTENT_SECURITY_POLICY_HEADER => config.security.content_security_policy }) default_headers.merge!(STRICT_TRANSPORT_SECURITY_HEADER => STRICT_TRANSPORT_SECURITY_DEFAULT_VALUE) if config.force_ssl if config.cookies.enabled? - require 'lotus/action/cookies' - prepare { include Lotus::Action::Cookies } + require 'hanami/action/cookies' + prepare { include Hanami::Action::Cookies } cookies config.cookies.default_options end if config.sessions.enabled? prepare do - include Lotus::Action::Session - include Lotus::Action::CSRFProtection + include Hanami::Action::Session + include Hanami::Action::CSRFProtection end end - prepare { include Lotus::Action::RoutingHelpers } + prepare { include Hanami::Action::RoutingHelpers } config.controller.__apply(self) end @@ -88,7 +88,7 @@ module Lotus def _configure_view_framework! config = configuration unless namespace.const_defined?('View') - view = Lotus::View.duplicate(namespace) do + view = Hanami::View.duplicate(namespace) do root config.templates layout config.layout @@ -103,17 +103,17 @@ module Lotus config = configuration unless application_module.const_defined?('Assets') - assets = Lotus::Assets.duplicate(namespace) do + assets = Hanami::Assets.duplicate(namespace) do root config.root scheme config.scheme host config.host port config.port - public_directory Lotus.public_directory + public_directory Hanami.public_directory prefix Utils::PathPrefix.new('/assets').join(config.path_prefix) - manifest Lotus.public_directory.join('assets.json') + manifest Hanami.public_directory.join('assets.json') compile true config.assets.__apply(self) @@ -129,8 +129,8 @@ module Lotus def _configure_model_framework! config = configuration - if _lotus_model_loaded? && !application_module.const_defined?('Model') - model = Lotus::Model.duplicate(application_module) do + if _hanami_model_loaded? && !application_module.const_defined?('Model') + model = Hanami::Model.duplicate(application_module) do adapter(config.adapter) if config.adapter mapping(&config.mapping) if config.mapping @@ -144,7 +144,7 @@ module Lotus def _configure_logger! unless application_module.const_defined?('Logger', false) if configuration.logger.nil? - configuration.logger Lotus::Logger.new(application_module.to_s) + configuration.logger Hanami::Logger.new(application_module.to_s) end application_module.const_set('Logger', configuration.logger) end @@ -177,18 +177,18 @@ module Lotus end def _load_model_framework? - if _lotus_model_loaded? && application_module.const_defined?('Model') + if _hanami_model_loaded? && application_module.const_defined?('Model') model = application_module.const_get('Model') model.configuration.adapter end end - def _lotus_model_loaded? - defined?(Lotus::Model) + def _hanami_model_loaded? + defined?(Hanami::Model) end - def _lotus_mailer_loaded? - defined?(Lotus::Mailer) + def _hanami_mailer_loaded? + defined?(Hanami::Mailer) end def load_configuration_load_paths! @@ -218,7 +218,7 @@ module Lotus def _assign_routes_to_application_module! unless application_module.const_defined?('Routes') - routes = Lotus::Routes.new(application_routes) + routes = Hanami::Routes.new(application_routes) application_module.const_set('Routes', routes) end end @@ -230,9 +230,9 @@ module Lotus end def application_routes - resolver = Lotus::Routing::EndpointResolver.new(pattern: configuration.controller_pattern, namespace: namespace) - default_app = Lotus::Routing::Default.new - Lotus::Router.new( + resolver = Hanami::Routing::EndpointResolver.new(pattern: configuration.controller_pattern, namespace: namespace) + default_app = Hanami::Routing::Default.new + Hanami::Router.new( parsers: configuration.body_parsers, resolver: resolver, default_app: default_app, diff --git a/lib/lotus/mailer/glue.rb b/lib/hanami/mailer/glue.rb similarity index 80% rename from lib/lotus/mailer/glue.rb rename to lib/hanami/mailer/glue.rb index d0895692..d0fa9ba3 100644 --- a/lib/lotus/mailer/glue.rb +++ b/lib/hanami/mailer/glue.rb @@ -1,9 +1,9 @@ -require 'lotus/utils/basic_object' +require 'hanami/utils/basic_object' -module Lotus::Mailer +module Hanami::Mailer # @since 0.5.0 # @api private - class Delivery < ::Lotus::Utils::BasicObject + class Delivery < ::Hanami::Utils::BasicObject # @since 0.5.0 # @api private def initialize(env, &blk) @@ -49,7 +49,7 @@ module Lotus::Mailer # @api private def delivery(&blk) raise ArgumentError unless block_given? - delivery_method(*Lotus::Mailer::Delivery.new(Lotus.env, &blk).to_config) + delivery_method(*Hanami::Mailer::Delivery.new(Hanami.env, &blk).to_config) end end @@ -63,6 +63,6 @@ end module Mailers end -Lotus::Mailer.configure do +Hanami::Mailer.configure do namespace Mailers end diff --git a/lib/lotus/middleware.rb b/lib/hanami/middleware.rb similarity index 82% rename from lib/lotus/middleware.rb rename to lib/hanami/middleware.rb index 9856d18f..cc1aafd4 100644 --- a/lib/lotus/middleware.rb +++ b/lib/hanami/middleware.rb @@ -1,4 +1,4 @@ -module Lotus +module Hanami # Rack middleware stack for an application # # @since 0.1.0 @@ -6,14 +6,14 @@ module Lotus class Middleware # Instantiate a middleware stack # - # @param configuration [Lotus::Configuration] the application's configuration + # @param configuration [Hanami::Configuration] the application's configuration # - # @return [Lotus::Middleware] the new stack + # @return [Hanami::Middleware] the new stack # # @since 0.1.0 # @api private # - # @see Lotus::Configuration + # @see Hanami::Configuration def initialize(configuration) @stack = [] @configuration = configuration @@ -21,9 +21,9 @@ module Lotus # Load the middleware stack # - # @param application [Lotus::Application] the application loading the middleware + # @param application [Hanami::Application] the application loading the middleware # - # @return [Lotus::Middleware] the loaded middleware stack + # @return [Hanami::Middleware] the loaded middleware stack # # @since 0.2.0 # @api private @@ -62,7 +62,7 @@ module Lotus # # @since 0.2.0 # - # @see Lotus::Middleware#prepend + # @see Hanami::Middleware#prepend def use(middleware, *args, &blk) @stack.push [middleware, args, blk] end @@ -77,7 +77,7 @@ module Lotus # # @since 0.6.0 # - # @see Lotus::Middleware#use + # @see Hanami::Middleware#use def prepend(middleware, *args, &blk) @stack.unshift [middleware, args, blk] end @@ -111,9 +111,9 @@ module Lotus # @api private # @since 0.2.0 def _load_default_welcome_page_for(application) - unless Lotus.env?(:test) || application.routes.defined? - require 'lotus/welcome' - use Lotus::Welcome + unless Hanami.env?(:test) || application.routes.defined? + require 'hanami/welcome' + use Hanami::Welcome end end @@ -132,11 +132,11 @@ module Lotus # @api private # @since 0.6.0 def _load_assets_middleware - env = Lotus.environment + env = Hanami.environment if !env.container? && env.serve_static_assets? - require 'lotus/static' - use Lotus::Static + require 'hanami/static' + use Hanami::Static end end end diff --git a/lib/lotus/rake_helper.rb b/lib/hanami/rake_helper.rb similarity index 71% rename from lib/lotus/rake_helper.rb rename to lib/hanami/rake_helper.rb index 91bddebc..3956ea3b 100644 --- a/lib/lotus/rake_helper.rb +++ b/lib/hanami/rake_helper.rb @@ -1,6 +1,6 @@ require 'rake' -module Lotus +module Hanami # Install Rake tasks in projects # # @since 0.6.0 @@ -19,14 +19,14 @@ module Lotus def install desc "Preload project configuration" task :preload do - require 'lotus/environment' - Lotus::Environment.new + require 'hanami/environment' + Hanami::Environment.new end desc "Load the full project" task environment: :preload do - require Lotus::Environment.new.env_config - Lotus::Application.preload_applications! + require Hanami::Environment.new.env_config + Hanami::Application.preload_applications! end # Ruby ecosystem compatibility @@ -42,25 +42,25 @@ module Lotus # === # # These Rake tasks aren't listed when someone runs `rake -T`, because we - # want to encourage developers to use `lotus` commands. + # want to encourage developers to use `hanami` commands. # # In order to migrate the database or precompile assets a developer should # use: # - # * lotus db migrate - # * lotus assets precompile + # * hanami db migrate + # * hanami assets precompile # - # This is the preferred way to run Lotus command line tasks. + # This is the preferred way to run Hanami command line tasks. # Please use them when you're in control of your deployment environment. namespace :db do task :migrate do - system "bundle exec lotus db migrate" + system "bundle exec hanami db migrate" end end namespace :assets do task :precompile do - system "bundle exec lotus assets precompile" + system "bundle exec hanami assets precompile" end end end diff --git a/lib/hanami/rake_tasks.rb b/lib/hanami/rake_tasks.rb new file mode 100644 index 00000000..e5621acf --- /dev/null +++ b/lib/hanami/rake_tasks.rb @@ -0,0 +1,2 @@ +require 'hanami/rake_helper' +Hanami::RakeHelper.install_tasks diff --git a/lib/lotus/rendering_policy.rb b/lib/hanami/rendering_policy.rb similarity index 84% rename from lib/lotus/rendering_policy.rb rename to lib/hanami/rendering_policy.rb index 2bbff1c0..091de4fc 100644 --- a/lib/lotus/rendering_policy.rb +++ b/lib/hanami/rendering_policy.rb @@ -1,8 +1,8 @@ -require 'lotus/utils/class' -require 'lotus/views/default' -require 'lotus/views/null_view' +require 'hanami/utils/class' +require 'hanami/views/default' +require 'hanami/views/null_view' -module Lotus +module Hanami # Rendering policy # # @since 0.1.0 @@ -12,7 +12,7 @@ module Lotus HEADERS = 1 BODY = 2 - LOTUS_ACTION = 'lotus.action'.freeze + HANAMI_ACTION = 'hanami.action'.freeze SUCCESSFUL_STATUSES = (200..201).freeze RENDERABLE_FORMATS = [:all, :html].freeze @@ -49,12 +49,12 @@ module Lotus def _render_status_page(action, response) if render_status_page?(action, response) - Lotus::Views::Default.render(@templates, response[STATUS], response: response, format: :html) + Hanami::Views::Default.render(@templates, response[STATUS], response: response, format: :html) end end def renderable?(env) - ((action = env.delete(LOTUS_ACTION)) && action.renderable? ) and action + ((action = env.delete(HANAMI_ACTION)) && action.renderable? ) and action end def successful?(response) diff --git a/lib/hanami/repositories/car_repository.rb b/lib/hanami/repositories/car_repository.rb new file mode 100644 index 00000000..50d8df57 --- /dev/null +++ b/lib/hanami/repositories/car_repository.rb @@ -0,0 +1,3 @@ +class CarRepository + include Hanami::Repository +end diff --git a/lib/hanami/repositories/name_repository.rb b/lib/hanami/repositories/name_repository.rb new file mode 100644 index 00000000..394184cf --- /dev/null +++ b/lib/hanami/repositories/name_repository.rb @@ -0,0 +1,3 @@ +class NameRepository + include Hanami::Repository +end diff --git a/lib/hanami/root.rb b/lib/hanami/root.rb new file mode 100644 index 00000000..4684279a --- /dev/null +++ b/lib/hanami/root.rb @@ -0,0 +1,7 @@ +require 'hanami/environment' + +module Hanami + def self.root + Hanami::Environment.new.root + end +end \ No newline at end of file diff --git a/lib/lotus/routes.rb b/lib/hanami/routes.rb similarity index 76% rename from lib/lotus/routes.rb rename to lib/hanami/routes.rb index 9271c6ae..a3d0e187 100644 --- a/lib/lotus/routes.rb +++ b/lib/hanami/routes.rb @@ -1,18 +1,18 @@ -require 'lotus/utils/escape' +require 'hanami/utils/escape' -module Lotus +module Hanami # Routes factory # - # A Lotus application has this factory instantiated by default and associated + # A Hanami application has this factory instantiated by default and associated # to the `Routes` constant, under the application namespace. # # @since 0.1.0 class Routes # Initialize the factory # - # @param routes [Lotus::Router] a routes set + # @param routes [Hanami::Router] a routes set # - # @return [Lotus::Routes] the factory + # @return [Hanami::Routes] the factory # # @since 0.1.0 def initialize(routes) @@ -25,19 +25,19 @@ module Lotus # @param args [Array,nil] an optional set of arguments that is passed down # to the wrapped route set. # - # @return [Lotus::Utils::Escape::SafeString] the corresponding relative URL + # @return [Hanami::Utils::Escape::SafeString] the corresponding relative URL # - # @raise Lotus::Routing::InvalidRouteException + # @raise Hanami::Routing::InvalidRouteException # # @since 0.1.0 # - # @see http://rdoc.info/gems/lotus-router/Lotus/Router#path-instance_method + # @see http://rdoc.info/gems/hanami-router/Hanami/Router#path-instance_method # # @example Basic example - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # routes do # get '/login', to: 'sessions#new', as: :login @@ -53,10 +53,10 @@ module Lotus # # => '/login?return_to=%2Fdashboard' # # @example Dynamic finders - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # routes do # get '/login', to: 'sessions#new', as: :login @@ -80,19 +80,19 @@ module Lotus # @param args [Array,nil] an optional set of arguments that is passed down # to the wrapped route set. # - # @return [Lotus::Utils::Escape::SafeString] the corresponding absolute URL + # @return [Hanami::Utils::Escape::SafeString] the corresponding absolute URL # - # @raise Lotus::Routing::InvalidRouteException + # @raise Hanami::Routing::InvalidRouteException # # @since 0.1.0 # - # @see http://rdoc.info/gems/lotus-router/Lotus/Router#url-instance_method + # @see http://rdoc.info/gems/hanami-router/Hanami/Router#url-instance_method # # @example Basic example - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # routes do # scheme 'https' @@ -111,10 +111,10 @@ module Lotus # # => 'https://bookshelf.org/login?return_to=%2Fdashboard' # # @example Dynamic finders - # require 'lotus' + # require 'hanami' # # module Bookshelf - # class Application < Lotus::Application + # class Application < Hanami::Application # configure do # routes do # scheme 'https' diff --git a/lib/lotus/routing/default.rb b/lib/hanami/routing/default.rb similarity index 92% rename from lib/lotus/routing/default.rb rename to lib/hanami/routing/default.rb index b4e89aa2..56695209 100644 --- a/lib/lotus/routing/default.rb +++ b/lib/hanami/routing/default.rb @@ -1,4 +1,4 @@ -module Lotus +module Hanami module Routing # The default Rack application that responds when a resource cannot be found. # @@ -10,7 +10,7 @@ module Lotus CONTENT_TYPE = 'Content-Type'.freeze class NullAction - include Lotus::Action + include Hanami::Action def call(env) end diff --git a/lib/hanami/setup.rb b/lib/hanami/setup.rb new file mode 100644 index 00000000..ca97186a --- /dev/null +++ b/lib/hanami/setup.rb @@ -0,0 +1,3 @@ +require 'hanami' + +Bundler.require(*Hanami::Environment.new.bundler_groups) diff --git a/lib/lotus/static.rb b/lib/hanami/static.rb similarity index 82% rename from lib/lotus/static.rb rename to lib/hanami/static.rb index 9d712ade..d4f91282 100644 --- a/lib/lotus/static.rb +++ b/lib/hanami/static.rb @@ -1,13 +1,13 @@ require 'rack/static' -require 'lotus/assets/compiler' +require 'hanami/assets/compiler' -module Lotus +module Hanami class Static < ::Rack::Static PATH_INFO = 'PATH_INFO'.freeze - PUBLIC_DIRECTORY = Lotus.public_directory.join('**', '*').to_s.freeze + PUBLIC_DIRECTORY = Hanami.public_directory.join('**', '*').to_s.freeze def initialize(app) - super(app, root: Lotus.public_directory, header_rules: _header_rules) + super(app, root: Hanami.public_directory, header_rules: _header_rules) @sources = _sources_from_applications end @@ -53,12 +53,12 @@ module Lotus def precompile(original, config) return unless original && config - Lotus::Assets::Compiler.compile(config, original) + Hanami::Assets::Compiler.compile(config, original) true end def _sources_from_applications - Lotus::Application.applications.each_with_object({}) do |application, result| + Hanami::Application.applications.each_with_object({}) do |application, result| config = _assets_configuration(application) result["#{ config.prefix }/"] = config end @@ -69,7 +69,7 @@ module Lotus end def _header_rules - unless Lotus.env?(:development, :test) + unless Hanami.env?(:development, :test) [[:all, {'Cache-Control' => 'public, max-age=31536000'}]] end end diff --git a/lib/lotus/templates/default.html.erb b/lib/hanami/templates/default.html.erb similarity index 100% rename from lib/lotus/templates/default.html.erb rename to lib/hanami/templates/default.html.erb diff --git a/lib/hanami/templates/welcome.html.erb b/lib/hanami/templates/welcome.html.erb new file mode 100644 index 00000000..10137fe7 --- /dev/null +++ b/lib/hanami/templates/welcome.html.erb @@ -0,0 +1,53 @@ + + + + Hanami — A complete web framework for Ruby + + + + +
+ +
+

A complete web framework for Ruby

+ +

Hanami is Open Source Software for MVC web development.
+ It's simple, fast and lightweight.

+ +

Please generate a new action with:
bundle exec hanami generate action<%= application_name %> home#index --url=/.

+ +
+ +
+ + + diff --git a/lib/lotus/version.rb b/lib/hanami/version.rb similarity index 54% rename from lib/lotus/version.rb rename to lib/hanami/version.rb index 421145ff..0dc1c2d4 100644 --- a/lib/lotus/version.rb +++ b/lib/hanami/version.rb @@ -1,6 +1,6 @@ -module Lotus +module Hanami # Defines the version # # @since 0.1.0 - VERSION = '0.6.1'.freeze + VERSION = '0.7.0'.freeze end diff --git a/lib/lotus/views/default.rb b/lib/hanami/views/default.rb similarity index 88% rename from lib/lotus/views/default.rb rename to lib/hanami/views/default.rb index 06a0ac45..8690455c 100644 --- a/lib/lotus/views/default.rb +++ b/lib/hanami/views/default.rb @@ -1,13 +1,13 @@ -require 'lotus/views/default_template_finder' +require 'hanami/views/default_template_finder' -module Lotus +module Hanami module Views # The default view that is rendered for non successful responses (200 and 201) # # @since 0.1.0 # @api private class Default - include Lotus::View + include Hanami::View configuration.reset! diff --git a/lib/lotus/views/default_template_finder.rb b/lib/hanami/views/default_template_finder.rb similarity index 96% rename from lib/lotus/views/default_template_finder.rb rename to lib/hanami/views/default_template_finder.rb index d3275263..699e8979 100644 --- a/lib/lotus/views/default_template_finder.rb +++ b/lib/hanami/views/default_template_finder.rb @@ -1,4 +1,4 @@ -module Lotus +module Hanami module Views class DefaultTemplateFinder < View::Rendering::TemplateFinder # Template Finder diff --git a/lib/lotus/views/null_view.rb b/lib/hanami/views/null_view.rb similarity index 94% rename from lib/lotus/views/null_view.rb rename to lib/hanami/views/null_view.rb index 66df27b0..dbacd45a 100644 --- a/lib/lotus/views/null_view.rb +++ b/lib/hanami/views/null_view.rb @@ -1,4 +1,4 @@ -module Lotus +module Hanami module Views # Null Object pattern for views # diff --git a/lib/lotus/welcome.rb b/lib/hanami/welcome.rb similarity index 84% rename from lib/lotus/welcome.rb rename to lib/hanami/welcome.rb index 567aceef..c5811a6c 100644 --- a/lib/lotus/welcome.rb +++ b/lib/hanami/welcome.rb @@ -1,9 +1,9 @@ require 'erb' require 'pathname' -require 'lotus/environment' -require 'lotus/utils/string' +require 'hanami/environment' +require 'hanami/utils/string' -module Lotus +module Hanami class Welcome def initialize(app) @root = Pathname.new(__dir__).join('templates').realpath @@ -27,7 +27,7 @@ module Lotus end def application_class - applications = Lotus::Application.applications.to_a + applications = Hanami::Application.applications.to_a applications.select do |app| @request_path.include? app.configuration.path_prefix.to_s end.first diff --git a/lib/lotus/cli.rb b/lib/lotus/cli.rb deleted file mode 100644 index 21173934..00000000 --- a/lib/lotus/cli.rb +++ /dev/null @@ -1,119 +0,0 @@ -require 'thor' -require 'lotus/commands/console' -require 'lotus/commands/new/app' -require 'lotus/commands/new/container' - -module Lotus - class Cli < Thor - # include Thor::Actions - - desc 'version', 'prints Lotus version' - long_desc <<-EOS - `lotus version` prints the version of the bundled lotus gem. - EOS - def version - require 'lotus/version' - puts "v#{ Lotus::VERSION }" - end - - desc 'server', 'starts a lotus server' - long_desc <<-EOS - `lotus server` starts a server for the current lotus project. - - $ > lotus server - - $ > lotus server -p 4500 - EOS - method_option :port, aliases: '-p', desc: 'The port to run the server on, ' - method_option :server, desc: 'choose a specific Rack::Handler, e.g. webrick, thin etc' - method_option :rackup, desc: 'a rackup configuration file path to load (config.ru)' - method_option :host, desc: 'the host address to bind to' - method_option :debug, desc: 'turn on debug output' - method_option :warn, desc: 'turn on warnings' - method_option :daemonize, desc: 'if true, the server will daemonize itself (fork, detach, etc)' - method_option :pid, desc: 'path to write a pid file after daemonize' - method_option :environment, desc: 'path to environment configuration (config/environment.rb)' - method_option :code_reloading, desc: 'code reloading', type: :boolean, default: true - method_option :help, desc: 'displays the usage message' - def server - if options[:help] - invoke :help, ['server'] - else - require 'lotus/commands/server' - Lotus::Commands::Server.new(options).start - end - end - - desc 'console', 'starts a lotus console' - long_desc <<-EOS - `lotus console` starts the interactive lotus console. - - $ > lotus console --engine=pry - EOS - method_option :environment, desc: 'path to environment configuration (config/environment.rb)' - method_option :engine, desc: "choose a specific console engine: (#{Lotus::Commands::Console::ENGINES.keys.join('/')})" - method_option :help, desc: 'displays the usage method' - def console - if options[:help] - invoke :help, ['console'] - else - Lotus::Commands::Console.new(options).start - end - end - - desc 'new APPLICATION_NAME', 'generate a new lotus project' - long_desc <<-EOS - `lotus new` creates a new lotus project. - You can specify various options such as the database to be used as well as the path and architecture. - - $ > lotus new fancy_app --application_name=admin - - $ > lotus new fancy_app --arch=app - - $ > lotus new fancy_app --lotus-head=true - EOS - method_option :database, aliases: ['-d', '--db'], desc: "application database (#{Lotus::Generators::DatabaseConfig::SUPPORTED_ENGINES.keys.join('/')})", default: Lotus::Generators::DatabaseConfig::DEFAULT_ENGINE - method_option :architecture, aliases: ['-a', '--arch'], desc: 'project architecture (container/app)', default: Lotus::Commands::New::Abstract::DEFAULT_ARCHITECTURE - method_option :application_name, desc: 'application name, only for container', default: Lotus::Commands::New::Container::DEFAULT_APPLICATION_NAME - method_option :application_base_url, desc: 'application base url', default: Lotus::Commands::New::Abstract::DEFAULT_APPLICATION_BASE_URL - method_option :test, desc: "project test framework (#{Lotus::Generators::TestFramework::VALID_FRAMEWORKS.join('/')})", default: Lotus::Lotusrc::DEFAULT_TEST_SUITE - method_option :lotus_head, desc: 'use Lotus HEAD (true/false)', type: :boolean, default: false - method_option :help, desc: 'displays the usage method' - def new(application_name) - if options[:help] - invoke :help, ['new'] - elsif options[:architecture] == 'app' - Lotus::Commands::New::App.new(options, application_name).start - else - Lotus::Commands::New::Container.new(options, application_name).start - end - end - - desc 'routes', 'prints the routes' - long_desc <<-EOS - `lotus routes` outputs all the registered routes to the console. - EOS - method_option :environment, desc: 'path to environment configuration (config/environment.rb)' - method_option :help, desc: 'displays the usage method' - def routes - if options[:help] - invoke :help, ['routes'] - else - require 'lotus/commands/routes' - Lotus::Commands::Routes.new(options).start - end - end - - require 'lotus/cli_sub_commands/db' - register Lotus::CliSubCommands::DB, 'db', 'db [SUBCOMMAND]', 'manage set of DB operations' - - require 'lotus/cli_sub_commands/generate' - register Lotus::CliSubCommands::Generate, 'generate', 'generate [SUBCOMMAND]', 'generate lotus classes' - - require 'lotus/cli_sub_commands/destroy' - register Lotus::CliSubCommands::Destroy, 'destroy', 'destroy [SUBCOMMAND]', 'destroy lotus classes' - - require 'lotus/cli_sub_commands/assets' - register Lotus::CliSubCommands::Assets, 'assets', 'assets [SUBCOMMAND]', 'manage assets' - end -end diff --git a/lib/lotus/cli_sub_commands/destroy.rb b/lib/lotus/cli_sub_commands/destroy.rb deleted file mode 100644 index 224c40cc..00000000 --- a/lib/lotus/cli_sub_commands/destroy.rb +++ /dev/null @@ -1,102 +0,0 @@ -require 'lotus/routing/route' -require 'lotus/commands/generate/action' - -module Lotus - class CliSubCommands - class Destroy < Thor - include Thor::Actions - namespace :destroy - - desc 'action APPLICATION_NAME CONTROLLER_NAME#ACTION_NAME', 'destroy a lotus action' - long_desc <<-EOS - `lotus destroy action` will destroy an an action, view and template along with specs and a route. - - For Application architecture the application name is 'app'. For Container architecture the default application is called 'web'. - - > $ lotus destroy action app cars#index - - > $ lotus destroy action other-app cars#index - - > $ lotus destroy action web cars#create --method=post - EOS - - method_option :method, desc: "The HTTP method used when the route was generated. Must be one of (#{Lotus::Routing::Route::VALID_HTTP_VERBS.join('/')})", default: Lotus::Commands::Generate::Action::DEFAULT_HTTP_METHOD - method_option :url, desc: 'Relative URL for action, will be used for the route', default: nil - method_option :template, desc: 'Extension used when the template was generated. Default is defined through your .lotusrc file.' - - def actions(application_name, controller_and_action_name) - if options[:help] - invoke :help, ['action'] - else - Lotus::Commands::Generate::Action.new(options, application_name, controller_and_action_name).destroy.start - end - end - - desc 'migration NAME', 'destroy a migration' - long_desc <<-EOS - `lotus destroy migration` will destroy a migration file. - - > $ lotus destroy migration create_books - EOS - - def migration(name) - if options[:help] - invoke :help, ['migration'] - else - require 'lotus/commands/generate/migration' - Lotus::Commands::Generate::Migration.new(options, name).destroy.start - end - end - - desc 'model NAME', 'destroy an entity' - long_desc <<-EOS - `lotus destroy model` will destroy an entity along with repository - and corresponding tests - - > $ lotus generate model car - EOS - - def model(name) - if options[:help] - invoke :help, ['model'] - else - require 'lotus/commands/generate/model' - Lotus::Commands::Generate::Model.new(options, name).destroy.start - end - end - - desc 'application NAME', 'destroy an application' - long_desc <<-EOS - `lotus destroy application` will destroy an application, along with templates and specs. - - > $ lotus destroy application api - EOS - def application(name) - if options[:help] - invoke :help, ['app'] - else - require 'lotus/commands/generate/app' - Lotus::Commands::Generate::App.new(options, name).destroy.start - end - end - - desc 'mailer NAME', 'destroy a mailer' - long_desc <<-EOS - `lotus destroy mailer` will destroy a mailer, along with templates and specs. - - > $ lotus destroy mailer forgot_password - EOS - - def mailer(name) - if options[:help] - invoke :help, ['mailer'] - else - require 'lotus/commands/generate/mailer' - - options[:behavior] = :revoke - Lotus::Commands::Generate::Mailer.new(options, name).destroy.start - end - end - end - end -end diff --git a/lib/lotus/cli_sub_commands/generate.rb b/lib/lotus/cli_sub_commands/generate.rb deleted file mode 100644 index fda23bd5..00000000 --- a/lib/lotus/cli_sub_commands/generate.rb +++ /dev/null @@ -1,127 +0,0 @@ -require 'lotus/routing/route' -require 'lotus/commands/generate/action' -require 'lotus/commands/generate/mailer' - -module Lotus - class CliSubCommands - # A set of generator subcommands - # - # It is run with: - # - # `bundle exec lotus generate` - # - # @since 0.6.0 - # @api private - class Generate < Thor - include Thor::Actions - - namespace :generate - - # @since 0.6.0 - # @api private - desc 'action APPLICATION_NAME CONTROLLER_NAME#ACTION_NAME', 'generate a lotus action' - long_desc <<-EOS - `lotus generate action` generates an an action, view and template along with specs and a route. - - For Application architecture the application name is 'app'. For Container architecture the default application is called 'web'. - - > $ lotus generate action app cars#index - - > $ lotus generate action other-app cars#index - - > $ lotus generate action web cars#create --method=post - EOS - method_option :method, desc: "The HTTP method to be used for the generated route. Must be one of (#{Lotus::Routing::Route::VALID_HTTP_VERBS.join('/')})", default: Lotus::Commands::Generate::Action::DEFAULT_HTTP_METHOD - method_option :url, desc: 'Relative URL for action, will be used for the route', default: nil - method_option :test, desc: 'Defines the testing Framework to be used. Default is defined through your .lotusrc file.' - method_option :skip_view, desc: 'Skip the generation of the view. Also skips template generation.', default: false, type: :boolean - method_option :template, desc: 'Extension to be used for the generated template. Default is defined through your .lotusrc file.' - def actions(application_name = nil, controller_and_action_name) - if Lotus::Environment.new(options).container? && application_name.nil? - msg = "ERROR: \"lotus generate action\" was called with arguments [\"#{controller_and_action_name}\"]\n" \ - "Usage: \"lotus action APPLICATION_NAME CONTROLLER_NAME#ACTION_NAME\"" - fail Error, msg - end - - if options[:help] - invoke :help, ['action'] - else - Lotus::Commands::Generate::Action.new(options, application_name, controller_and_action_name).start - end - end - - desc 'migration NAME', 'generate a migration' - long_desc <<-EOS - `lotus generate migration` will generate an empty migration file. - - > $ lotus generate migration do_something - EOS - def migration(name) - if options[:help] - invoke :help, ['migration'] - else - require 'lotus/commands/generate/migration' - Lotus::Commands::Generate::Migration.new(options, name).start - end - end - - desc 'model NAME', 'generate an entity' - long_desc <<-EOS - `lotus generate model` will generate an entity along with repository - and corresponding tests. The name of the model can contain slashes to - indicate module names. - - > $ lotus generate model car - - > $ lotus generate model vehicles/car - EOS - method_option :test, desc: 'Defines the testing Framework to be used. Default is defined through your .lotusrc file.' - def model(name) - if options[:help] - invoke :help, ['model'] - else - require 'lotus/commands/generate/model' - Lotus::Commands::Generate::Model.new(options, name).start - end - end - - desc 'mailer NAME', 'generate a mailer' - long_desc <<-EOS - `lotus generate mailer` will generate an empty mailer, along with templates and specs. - - > $ lotus generate mailer forgot_password - > $ lotus generate mailer forgot_password --to "'log@bookshelf.com'" --from "'support@bookshelf.com'" --subject "'New Password'" - EOS - method_option :to, desc: 'sender email', default: Lotus::Commands::Generate::Mailer::DEFAULT_TO - method_option :from, desc: 'sendee email', default: Lotus::Commands::Generate::Mailer::DEFAULT_FROM - method_option :subject, desc: 'email subject', default: Lotus::Commands::Generate::Mailer::DEFAULT_SUBJECT - def mailer(name) - if options[:help] - invoke :help, ['mailer'] - else - Lotus::Commands::Generate::Mailer.new(options, name).start - end - end - - desc 'app APPLICATION_NAME', 'generate an app' - long_desc <<-EOS - `lotus generate app` creates a new app inside the 'apps' directory. - - It can only be called for lotus applications with container architecture. - - > $ lotus generate app admin - - > $ lotus generate app reporting --application_base_url=/reports - EOS - method_option :application_base_url, desc: 'Base URL for the new app. If missing, then it is inferred from APPLICATION_NAME' - def app(application_name) - if options[:help] - invoke :help, ['app'] - else - require 'lotus/commands/generate/app' - Lotus::Commands::Generate::App.new(options, application_name).start - end - end - end - end -end diff --git a/lib/lotus/commands/db/apply.rb b/lib/lotus/commands/db/apply.rb deleted file mode 100644 index 02982224..00000000 --- a/lib/lotus/commands/db/apply.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'lotus/commands/db/abstract' - -module Lotus - module Commands - class DB - class Apply < Abstract - def start - require 'lotus/model/migrator' - Lotus::Model::Migrator.apply - end - end - end - end -end diff --git a/lib/lotus/commands/db/create.rb b/lib/lotus/commands/db/create.rb deleted file mode 100644 index a9a62e0b..00000000 --- a/lib/lotus/commands/db/create.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'lotus/commands/db/abstract' - -module Lotus - module Commands - class DB - class Create < Abstract - def start - require 'lotus/model/migrator' - Lotus::Model::Migrator.create - end - end - end - end -end diff --git a/lib/lotus/commands/db/drop.rb b/lib/lotus/commands/db/drop.rb deleted file mode 100644 index 083a3eeb..00000000 --- a/lib/lotus/commands/db/drop.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'lotus/commands/db/abstract' - -module Lotus - module Commands - class DB - class Drop < Abstract - def start - require 'lotus/model/migrator' - Lotus::Model::Migrator.drop - end - end - end - end -end diff --git a/lib/lotus/commands/db/prepare.rb b/lib/lotus/commands/db/prepare.rb deleted file mode 100644 index dceffc70..00000000 --- a/lib/lotus/commands/db/prepare.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'lotus/commands/db/abstract' - -module Lotus - module Commands - class DB - class Prepare < Abstract - def start - require 'lotus/model/migrator' - Lotus::Model::Migrator.prepare - end - end - end - end -end diff --git a/lib/lotus/commands/db/version.rb b/lib/lotus/commands/db/version.rb deleted file mode 100644 index 1c0321f6..00000000 --- a/lib/lotus/commands/db/version.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'lotus/commands/db/abstract' - -module Lotus - module Commands - class DB - class Version < Abstract - def start - require 'lotus/model/migrator' - puts Lotus::Model::Migrator.version - end - end - end - end -end diff --git a/lib/lotus/frameworks.rb b/lib/lotus/frameworks.rb deleted file mode 100644 index 9d8206ea..00000000 --- a/lib/lotus/frameworks.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'lotus/router' -require 'lotus/view' -require 'lotus/controller' -require 'lotus/action/glue' -require 'lotus/action/csrf_protection' -require 'lotus/mailer' -require 'lotus/mailer/glue' -require 'lotus/assets' - -Lotus::Controller.configure do - prepare do - include Lotus::Action::Glue - end -end diff --git a/lib/lotus/generators/app/config/routes.rb.tt b/lib/lotus/generators/app/config/routes.rb.tt deleted file mode 100644 index 3af730e6..00000000 --- a/lib/lotus/generators/app/config/routes.rb.tt +++ /dev/null @@ -1,2 +0,0 @@ -# Configure your routes here -# See: http://www.rubydoc.info/gems/lotus-router/#Usage \ No newline at end of file diff --git a/lib/lotus/generators/application/app/Gemfile.tt b/lib/lotus/generators/application/app/Gemfile.tt deleted file mode 100644 index cbd86722..00000000 --- a/lib/lotus/generators/application/app/Gemfile.tt +++ /dev/null @@ -1,37 +0,0 @@ -source 'https://rubygems.org' - -gem 'bundler' -gem 'rake' - -<%- if config[:lotus_head] -%> -gem 'lotus-utils', require: false, github: 'lotus/utils' -gem 'lotus-router', require: false, github: 'lotus/router' -gem 'lotus-validations', require: false, github: 'lotus/validations' -gem 'lotus-helpers', require: false, github: 'lotus/helpers' -gem 'lotus-controller', require: false, github: 'lotus/controller' -gem 'lotus-view', require: false, github: 'lotus/view' -gem 'lotus-model', require: false, github: 'lotus/model' -gem 'lotus-mailer', require: false, github: 'lotus/mailer' -gem 'lotus-assets', require: false, github: 'lotus/assets' -gem 'lotusrb', github: 'lotus/lotus' -<%- else -%> -gem 'lotusrb', '<%= Lotus::VERSION %>' -gem 'lotus-model', '<%= config[:lotus_model_version] %>' -<%- end -%> - -<%- if config[:database_config][:gem] -%> -gem '<%= config[:database_config][:gem] %>' -<%- end -%> - -group :test do -<%- if config[:test] == 'rspec' -%> - gem 'rspec' -<%- else -%> - gem 'minitest' -<%- end -%> - gem 'capybara' -end - -group :production do - # gem 'puma' -end diff --git a/lib/lotus/generators/application/app/config/routes.rb.tt b/lib/lotus/generators/application/app/config/routes.rb.tt deleted file mode 100644 index 9050f88f..00000000 --- a/lib/lotus/generators/application/app/config/routes.rb.tt +++ /dev/null @@ -1,2 +0,0 @@ -# Configure your routes here -# See: http://www.rubydoc.info/gems/lotus-router/#Usage diff --git a/lib/lotus/generators/application/app/lotusrc.tt b/lib/lotus/generators/application/app/lotusrc.tt deleted file mode 100644 index c961b38d..00000000 --- a/lib/lotus/generators/application/app/lotusrc.tt +++ /dev/null @@ -1,3 +0,0 @@ -<%= Lotus::Lotusrc::ARCHITECTURE_KEY %>=<%= Lotus::Lotusrc::APP_ARCHITECTURE %> -<%= Lotus::Lotusrc::TEST_KEY %>=<%= config[:test] %> -<%= Lotus::Lotusrc::TEMPLATE_KEY %>=<%= Lotus::Lotusrc::DEFAULT_TEMPLATE %> diff --git a/lib/lotus/generators/application/container/Gemfile.tt b/lib/lotus/generators/application/container/Gemfile.tt deleted file mode 100644 index d0f6014d..00000000 --- a/lib/lotus/generators/application/container/Gemfile.tt +++ /dev/null @@ -1,36 +0,0 @@ -source 'https://rubygems.org' - -gem 'bundler' -gem 'rake' -<%- if config[:lotus_head] -%> -gem 'lotus-utils', require: false, github: 'lotus/utils' -gem 'lotus-router', require: false, github: 'lotus/router' -gem 'lotus-validations', require: false, github: 'lotus/validations' -gem 'lotus-helpers', require: false, github: 'lotus/helpers' -gem 'lotus-controller', require: false, github: 'lotus/controller' -gem 'lotus-view', require: false, github: 'lotus/view' -gem 'lotus-model', require: false, github: 'lotus/model' -gem 'lotus-mailer', require: false, github: 'lotus/mailer' -gem 'lotus-assets', require: false, github: 'lotus/assets' -gem 'lotusrb', github: 'lotus/lotus' -<%- else -%> -gem 'lotusrb', '<%= Lotus::VERSION %>' -gem 'lotus-model', '<%= config[:lotus_model_version] %>' -<%- end -%> - -<%- if config[:database_config][:gem] %> -gem '<%= config[:database_config][:gem] %>' -<%- end -%> - -group :test do -<%- if config[:test] == 'rspec' -%> - gem 'rspec' -<%- else -%> - gem 'minitest' -<%- end -%> - gem 'capybara' -end - -group :production do - # gem 'puma' -end diff --git a/lib/lotus/generators/application/container/lotusrc.tt b/lib/lotus/generators/application/container/lotusrc.tt deleted file mode 100644 index a3cb033d..00000000 --- a/lib/lotus/generators/application/container/lotusrc.tt +++ /dev/null @@ -1,3 +0,0 @@ -<%= Lotus::Lotusrc::ARCHITECTURE_KEY %>=<%= Lotus::Lotusrc::DEFAULT_ARCHITECTURE %> -<%= Lotus::Lotusrc::TEST_KEY %>=<%= config[:test] %> -<%= Lotus::Lotusrc::TEMPLATE_KEY %>=<%= Lotus::Lotusrc::DEFAULT_TEMPLATE %> diff --git a/lib/lotus/generators/migration/migration.rb.tt b/lib/lotus/generators/migration/migration.rb.tt deleted file mode 100644 index a05e291f..00000000 --- a/lib/lotus/generators/migration/migration.rb.tt +++ /dev/null @@ -1,4 +0,0 @@ -Lotus::Model.migration do - change do - end -end diff --git a/lib/lotus/rake_tasks.rb b/lib/lotus/rake_tasks.rb deleted file mode 100644 index 7edd8c27..00000000 --- a/lib/lotus/rake_tasks.rb +++ /dev/null @@ -1,2 +0,0 @@ -require 'lotus/rake_helper' -Lotus::RakeHelper.install_tasks diff --git a/lib/lotus/repositories/car_repository.rb b/lib/lotus/repositories/car_repository.rb deleted file mode 100644 index f111d3d1..00000000 --- a/lib/lotus/repositories/car_repository.rb +++ /dev/null @@ -1,3 +0,0 @@ -class CarRepository - include Lotus::Repository -end diff --git a/lib/lotus/repositories/name_repository.rb b/lib/lotus/repositories/name_repository.rb deleted file mode 100644 index 2816b36d..00000000 --- a/lib/lotus/repositories/name_repository.rb +++ /dev/null @@ -1,3 +0,0 @@ -class NameRepository - include Lotus::Repository -end diff --git a/lib/lotus/root.rb b/lib/lotus/root.rb deleted file mode 100644 index 949c7356..00000000 --- a/lib/lotus/root.rb +++ /dev/null @@ -1,7 +0,0 @@ -require 'lotus/environment' - -module Lotus - def self.root - Lotus::Environment.new.root - end -end \ No newline at end of file diff --git a/lib/lotus/setup.rb b/lib/lotus/setup.rb deleted file mode 100644 index fec09b06..00000000 --- a/lib/lotus/setup.rb +++ /dev/null @@ -1,3 +0,0 @@ -require 'lotusrb' - -Bundler.require(*Lotus::Environment.new.bundler_groups) diff --git a/lib/lotus/templates/welcome.html.erb b/lib/lotus/templates/welcome.html.erb deleted file mode 100644 index 7fe7240a..00000000 --- a/lib/lotus/templates/welcome.html.erb +++ /dev/null @@ -1,53 +0,0 @@ - - - - Lotus — A complete web framework for Ruby - - - - -
- -
-

A complete web framework for Ruby

- -

Lotus is Open Source Software for MVC web development.
- It's simple, fast and lightweight.

- -

Please generate a new action with:
bundle exec lotus generate action<%= application_name %> home#index --url=/.

- -
- -
- - - diff --git a/lib/lotusrb.rb b/lib/lotusrb.rb deleted file mode 100644 index 8c9f02e9..00000000 --- a/lib/lotusrb.rb +++ /dev/null @@ -1 +0,0 @@ -require_relative 'lotus' diff --git a/test/application_name_test.rb b/test/application_name_test.rb index 4f2b0724..ab53c3a7 100644 --- a/test/application_name_test.rb +++ b/test/application_name_test.rb @@ -1,48 +1,48 @@ require 'test_helper' -require 'lotus/application_name' +require 'hanami/application_name' -describe Lotus::ApplicationName do +describe Hanami::ApplicationName do describe 'formats' do describe '#to_s' do it 'renders downcased' do - application_name = Lotus::ApplicationName.new('MY-APP') + application_name = Hanami::ApplicationName.new('MY-APP') application_name.to_s.must_equal 'my_app' end it 'renders trimmed' do - application_name = Lotus::ApplicationName.new(' my-app ') + application_name = Hanami::ApplicationName.new(' my-app ') application_name.to_s.must_equal 'my_app' end it 'renders internal spaces as underscores' do - application_name = Lotus::ApplicationName.new('my app') + application_name = Hanami::ApplicationName.new('my app') application_name.to_s.must_equal 'my_app' end it 'renders with underscores de-duplicated' do - application_name = Lotus::ApplicationName.new('my _app') + application_name = Hanami::ApplicationName.new('my _app') application_name.to_s.must_equal 'my_app' end end describe '#to_env_s' do it 'renders uppercased with non-alphanumeric characters as underscores' do - application_name = Lotus::ApplicationName.new('my-app') + application_name = Hanami::ApplicationName.new('my-app') application_name.to_env_s.must_equal 'MY_APP' end end end describe 'reserved words' do - it 'prohibits "lotus"' do - exception = -> { Lotus::ApplicationName.new('lotus') }.must_raise RuntimeError - exception.message.must_equal "application name must not be any one of the following: lotus" + it 'prohibits "hanami"' do + exception = -> { Hanami::ApplicationName.new('hanami') }.must_raise RuntimeError + exception.message.must_equal "application name must not be any one of the following: hanami" end describe '.invalid?' do - describe 'when name is "lotus"' do + describe 'when name is "hanami"' do it 'returns true' do - Lotus::ApplicationName.invalid?('lotus').must_equal true + Hanami::ApplicationName.invalid?('hanami').must_equal true end end end diff --git a/test/application_test.rb b/test/application_test.rb index 1f854107..829325a2 100644 --- a/test/application_test.rb +++ b/test/application_test.rb @@ -1,6 +1,6 @@ require 'test_helper' -describe Lotus::Application do +describe Hanami::Application do before do @application = CoffeeShop::Application.new end @@ -16,17 +16,17 @@ describe Lotus::Application do it 'yields the given block and returns a configuration' do configuration = CoffeeShop::Application.configuration - configuration.must_be_kind_of Lotus::Configuration + configuration.must_be_kind_of Hanami::Configuration configuration.root.must_equal Pathname.new(__dir__).join('../tmp/coffee_shop') end end describe 'subclasses' do before do - Lotus::Application.applications.clear + Hanami::Application.applications.clear module Foo - class Application < Lotus::Application + class Application < Hanami::Application def self.load!(application = self) @@loaded = true end @@ -45,11 +45,11 @@ describe Lotus::Application do end it 'register subclasses' do - Lotus::Application.applications.must_include(Foo::Application) + Hanami::Application.applications.must_include(Foo::Application) end it 'preloads registered subclasses' do - Lotus::Application.preload! + Hanami::Application.preload! Foo::Application.must_be :loaded? end end @@ -62,7 +62,7 @@ describe Lotus::Application do describe '#initialize' do it 'loads the frameworks and the application' do - @application.routes.must_be_kind_of(Lotus::Router) + @application.routes.must_be_kind_of(Hanami::Router) end end diff --git a/test/cli_test.rb b/test/cli_test.rb index d2cf81d9..7b75e1b8 100644 --- a/test/cli_test.rb +++ b/test/cli_test.rb @@ -1,13 +1,13 @@ require 'test_helper' -require 'lotus/cli' -require 'lotus/commands/generate/migration' -require 'lotus/commands/generate/model' -require 'lotus/commands/generate/action' -require 'lotus/commands/generate/app' -require 'lotus/commands/new/container' -require 'lotus/commands/new/app' +require 'hanami/cli' +require 'hanami/commands/generate/migration' +require 'hanami/commands/generate/model' +require 'hanami/commands/generate/action' +require 'hanami/commands/generate/app' +require 'hanami/commands/new/container' +require 'hanami/commands/new/app' -describe Lotus::Cli do +describe Hanami::Cli do let(:mock_without_method) { Minitest::Mock.new } describe 'new' do @@ -17,18 +17,18 @@ describe Lotus::Cli do 'application_name' => 'web', 'application_base_url' => '/', 'test' => 'minitest', - 'lotus_head' => false} + 'hanami_head' => false} } describe 'container' do it 'calls the generator with application name and defaults' do ARGV.replace(%w{new fancy-app}) - assert_cli_calls_command(Lotus::Commands::New::Container, default_options, 'fancy-app') + assert_cli_calls_command(Hanami::Commands::New::Container, default_options, 'fancy-app') end it 'does not call the generator if application name is missing' do ARGV.replace(%w{new}) - Lotus::Commands::New::Container.stub(:new, mock_without_method) do - capture_io { Lotus::Cli.start } + Hanami::Commands::New::Container.stub(:new, mock_without_method) do + capture_io { Hanami::Cli.start } end end @@ -38,10 +38,10 @@ describe Lotus::Cli do 'application_name' => 'admin', 'application_base_url' => '/web-admin', 'test' => 'rspec', - 'lotus_head' => true + 'hanami_head' => true ) - ARGV.replace(%w{new fancy-app --database=memory --application_name=admin --application_base_url=/web-admin --test=rspec --lotus_head=true}) - assert_cli_calls_command(Lotus::Commands::New::Container, options, 'fancy-app') + ARGV.replace(%w{new fancy-app --database=memory --application_name=admin --application_base_url=/web-admin --test=rspec --hanami_head=true}) + assert_cli_calls_command(Hanami::Commands::New::Container, options, 'fancy-app') end end @@ -50,13 +50,13 @@ describe Lotus::Cli do let(:options) { default_options.merge('architecture' => 'app')} it 'calls the generator with application name and defaults' do ARGV.replace(%w{new fancy-app --architecture=app}) - assert_cli_calls_command(Lotus::Commands::New::App, options, 'fancy-app') + assert_cli_calls_command(Hanami::Commands::New::App, options, 'fancy-app') end it 'does not call the generator if application name is missing' do ARGV.replace(%w{new --architecture=app}) - Lotus::Commands::New::Container.stub(:new, mock_without_method) do - capture_io { Lotus::Cli.start } + Hanami::Commands::New::Container.stub(:new, mock_without_method) do + capture_io { Hanami::Cli.start } end end @@ -66,10 +66,10 @@ describe Lotus::Cli do 'database' => 'memory', 'application_base_url' => '/web-admin', 'test' => 'rspec', - 'lotus_head' => true + 'hanami_head' => true ) - ARGV.replace(%w{new fancy-app --database=memory --application_base_url=/web-admin --test=rspec --lotus_head=true --architecture=app}) - assert_cli_calls_command(Lotus::Commands::New::App, options, 'fancy-app') + ARGV.replace(%w{new fancy-app --database=memory --application_base_url=/web-admin --test=rspec --hanami_head=true --architecture=app}) + assert_cli_calls_command(Hanami::Commands::New::App, options, 'fancy-app') end end end @@ -81,14 +81,14 @@ describe Lotus::Cli do it 'calls the generator with application and controller/action name' do ARGV.replace(%w{generate action app controller#action}) - assert_cli_calls_command(Lotus::Commands::Generate::Action, default_options, 'app', 'controller#action') + assert_cli_calls_command(Hanami::Commands::Generate::Action, default_options, 'app', 'controller#action') end it 'passes the supported options' do ARGV.replace(%w{generate action app controller#action --method=put --url=/foo --test=rspec --template=haml}) options = default_options.merge('method' => 'put', 'url' => '/foo', 'test' => 'rspec', 'template' => 'haml') - assert_cli_calls_command(Lotus::Commands::Generate::Action, options, 'app', 'controller#action') + assert_cli_calls_command(Hanami::Commands::Generate::Action, options, 'app', 'controller#action') end describe 'for container application' do @@ -97,8 +97,8 @@ describe Lotus::Cli do it 'raises an error when app and controller name are missing' do ARGV.replace(%w{generate action}) - Lotus::Commands::Generate::Action.stub(:new, mock_without_method) do - _, err = capture_io { Lotus::Cli.start } + Hanami::Commands::Generate::Action.stub(:new, mock_without_method) do + _, err = capture_io { Hanami::Cli.start } assert_match 'ERROR', err end end @@ -106,8 +106,8 @@ describe Lotus::Cli do it 'raises an error when controller name is missing' do ARGV.replace(%w{generate action foo}) - Lotus::Commands::Generate::Action.stub(:new, mock_without_method) do - _, err = capture_io { Lotus::Cli.start } + Hanami::Commands::Generate::Action.stub(:new, mock_without_method) do + _, err = capture_io { Hanami::Cli.start } assert_match 'ERROR', err end end @@ -115,8 +115,8 @@ describe Lotus::Cli do it 'raises an error when app name is missing' do ARGV.replace(%w{generate action controller#action}) - Lotus::Commands::Generate::Action.stub(:new, mock_without_method) do - _, err = capture_io { Lotus::Cli.start } + Hanami::Commands::Generate::Action.stub(:new, mock_without_method) do + _, err = capture_io { Hanami::Cli.start } assert_match 'ERROR', err end end @@ -131,8 +131,8 @@ describe Lotus::Cli do it 'it generates action when controller name is present' do ARGV.replace(%w{generate action controller#action}) - Lotus::Commands::Generate::Action.stub(:new, mock_without_method) do - _, err = capture_io { Lotus::Cli.start } + Hanami::Commands::Generate::Action.stub(:new, mock_without_method) do + _, err = capture_io { Hanami::Cli.start } refute_match 'ERROR', err end end @@ -140,8 +140,8 @@ describe Lotus::Cli do it 'raises error when controller name is missing' do ARGV.replace(%w{generate action}) - Lotus::Commands::Generate::Action.stub(:new, mock_without_method) do - _, err = capture_io { Lotus::Cli.start } + Hanami::Commands::Generate::Action.stub(:new, mock_without_method) do + _, err = capture_io { Hanami::Cli.start } assert_match 'ERROR', err end end @@ -152,13 +152,13 @@ describe Lotus::Cli do it 'calls the generator with migration name' do ARGV.replace(%w{generate migration add_thing}) - assert_cli_calls_command(Lotus::Commands::Generate::Migration, {}, 'add_thing') + assert_cli_calls_command(Hanami::Commands::Generate::Migration, {}, 'add_thing') end it 'does not call the generator when name is missing' do ARGV.replace(%w{generate migration}) - Lotus::Commands::Generate::Migration.stub(:new, mock_without_method) do - capture_io { Lotus::Cli.start } + Hanami::Commands::Generate::Migration.stub(:new, mock_without_method) do + capture_io { Hanami::Cli.start } end end end @@ -167,13 +167,13 @@ describe Lotus::Cli do it 'calls the generator with model name' do ARGV.replace(%w{generate model car}) - assert_cli_calls_command(Lotus::Commands::Generate::Model, {}, 'car') + assert_cli_calls_command(Hanami::Commands::Generate::Model, {}, 'car') end it 'does not call the generator when name is missing' do ARGV.replace(%w{generate model}) - Lotus::Commands::Generate::Model.stub(:new, mock_without_method) do - capture_io { Lotus::Cli.start } + Hanami::Commands::Generate::Model.stub(:new, mock_without_method) do + capture_io { Hanami::Cli.start } end end end @@ -181,7 +181,7 @@ describe Lotus::Cli do describe 'app' do it 'calls the generator with app name' do ARGV.replace(%w{generate app admin}) - assert_cli_calls_command(Lotus::Commands::Generate::App, {}, 'admin') + assert_cli_calls_command(Hanami::Commands::Generate::App, {}, 'admin') end @@ -189,17 +189,17 @@ describe Lotus::Cli do ARGV.replace(%w{generate app admin --application_base_url=/backend}) options = {'application_base_url' => '/backend'} - assert_cli_calls_command(Lotus::Commands::Generate::App, options, 'admin') + assert_cli_calls_command(Hanami::Commands::Generate::App, options, 'admin') end end end def setup_container_app - File.open('.lotusrc', 'w') { |file| file << "architecture=container"} + File.open('.hanamirc', 'w') { |file| file << "architecture=container"} end def setup_app_app - File.open('.lotusrc', 'w') { |file| file << "architecture=app"} + File.open('.hanamirc', 'w') { |file| file << "architecture=app"} end # Helper method to make sure that the Command class is called with good arguments. @@ -218,7 +218,7 @@ describe Lotus::Cli do end command_class.stub(:new, constructor_args_verifier) do - capture_io { Lotus::Cli.start } + capture_io { Hanami::Cli.start } end instance_mock.verify diff --git a/test/commands/console_test.rb b/test/commands/console_test.rb index 1baf9553..f7f19d1c 100644 --- a/test/commands/console_test.rb +++ b/test/commands/console_test.rb @@ -1,13 +1,13 @@ require 'test_helper' -require 'lotus/commands/console' +require 'hanami/commands/console' -describe Lotus::Commands::Console do +describe Hanami::Commands::Console do let(:opts) { Hash.new } - let(:console) { Lotus::Commands::Console.new(opts) } + let(:console) { Hanami::Commands::Console.new(opts) } before do Dir.chdir($pwd) - Lotus::Application.clear_registered_applications! + Hanami::Application.clear_registered_applications! end def stub_engine(engine) @@ -17,13 +17,13 @@ describe Lotus::Commands::Console do @remove_const = true end - Lotus::Utils::IO.silence_warnings do + Hanami::Utils::IO.silence_warnings do Object.const_set(engine, Module.new { def self.start; end }) end end def remove_engine(engine) - Lotus::Utils::IO.silence_warnings do + Hanami::Utils::IO.silence_warnings do Object.const_set(engine, @engine) end if @engine @@ -168,12 +168,12 @@ describe Lotus::Commands::Console do before do @old_pwd = Dir.pwd Dir.chdir 'test/fixtures/microservices' - Lotus::Container.class_variable_set(:@@configuration, Proc.new{}) + Hanami::Container.class_variable_set(:@@configuration, Proc.new{}) end after do Dir.chdir @old_pwd - Lotus::Container.remove_class_variable(:@@configuration) + Hanami::Container.remove_class_variable(:@@configuration) end it 'requires that file and starts a console session' do @@ -204,11 +204,11 @@ describe Lotus::Commands::Console do } before do - Lotus::Container.class_variable_set(:@@configuration, Proc.new{}) + Hanami::Container.class_variable_set(:@@configuration, Proc.new{}) end after do - Lotus::Container.remove_class_variable(:@@configuration) + Hanami::Container.remove_class_variable(:@@configuration) end it 'requires that file and starts a console session' do @@ -234,21 +234,21 @@ describe Lotus::Commands::Console do before do @old_main = TOPLEVEL_BINDING @main = Minitest::Mock.new - Lotus::Utils::IO.silence_warnings { TOPLEVEL_BINDING = @main } + Hanami::Utils::IO.silence_warnings { TOPLEVEL_BINDING = @main } @main.expect(:eval, TOPLEVEL_BINDING, ['self']) @engine = Minitest::Mock.new @engine.expect(:start, nil) - Lotus::Container.class_variable_set(:@@configuration, Proc.new{}) + Hanami::Container.class_variable_set(:@@configuration, Proc.new{}) end after do - Lotus::Utils::IO.silence_warnings { TOPLEVEL_BINDING = @old_main } - Lotus::Container.remove_class_variable(:@@configuration) + Hanami::Utils::IO.silence_warnings { TOPLEVEL_BINDING = @old_main } + Hanami::Container.remove_class_variable(:@@configuration) end it 'mixes convenience methods into the TOPLEVEL_BINDING' do - @main.expect(:include, true, [Lotus::Commands::Console::Methods]) + @main.expect(:include, true, [Hanami::Commands::Console::Methods]) opts[:environment] = 'test/fixtures/microservices/config/environment' console.stub(:engine, @engine) { console.start } @@ -259,19 +259,19 @@ describe Lotus::Commands::Console do end end -describe Lotus::Commands::Console::Methods do +describe Hanami::Commands::Console::Methods do describe '#reload!' do before do @binding = Class.new - @binding.send(:include, Lotus::Commands::Console::Methods) + @binding.send(:include, Hanami::Commands::Console::Methods) @old_kernel = Kernel - Lotus::Utils::IO.silence_warnings { Kernel = Minitest::Mock.new } + Hanami::Utils::IO.silence_warnings { Kernel = Minitest::Mock.new } Kernel.expect(:exec, true, ["#{$0} console"]) end after do - Lotus::Utils::IO.silence_warnings { Kernel = @old_kernel } + Hanami::Utils::IO.silence_warnings { Kernel = @old_kernel } end it 're-executes the running process' do diff --git a/test/commands/generate/action_test.rb b/test/commands/generate/action_test.rb index 5fd28879..0f800eec 100644 --- a/test/commands/generate/action_test.rb +++ b/test/commands/generate/action_test.rb @@ -1,31 +1,31 @@ require 'test_helper' -require 'lotus/commands/generate/action' +require 'hanami/commands/generate/action' require 'fileutils' -describe Lotus::Commands::Generate::Action do +describe Hanami::Commands::Generate::Action do describe 'with invalid arguments' do it 'requires application name' do with_temp_dir do |original_wd| setup_container_app - -> { Lotus::Commands::Generate::Action.new({}, nil, 'books#index') }.must_raise ArgumentError - -> { Lotus::Commands::Generate::Action.new({}, '', 'books#index') }.must_raise ArgumentError - -> { Lotus::Commands::Generate::Action.new({}, ' ', 'books#index') }.must_raise ArgumentError + -> { Hanami::Commands::Generate::Action.new({}, nil, 'books#index') }.must_raise ArgumentError + -> { Hanami::Commands::Generate::Action.new({}, '', 'books#index') }.must_raise ArgumentError + -> { Hanami::Commands::Generate::Action.new({}, ' ', 'books#index') }.must_raise ArgumentError end end it 'requires controller and action name' do with_temp_dir do |previus_wd| setup_container_app - -> { Lotus::Commands::Generate::Action.new({}, 'web', 'books') }.must_raise ArgumentError - -> { Lotus::Commands::Generate::Action.new({}, 'web', '') }.must_raise ArgumentError - -> { Lotus::Commands::Generate::Action.new({}, 'web', ' ') }.must_raise ArgumentError + -> { Hanami::Commands::Generate::Action.new({}, 'web', 'books') }.must_raise ArgumentError + -> { Hanami::Commands::Generate::Action.new({}, 'web', '') }.must_raise ArgumentError + -> { Hanami::Commands::Generate::Action.new({}, 'web', ' ') }.must_raise ArgumentError end end it 'verifies the method option' do with_temp_dir do |previus_wd| setup_container_app - -> { Lotus::Commands::Generate::Action.new({method: 'UnKnOwN'}, 'web', 'books#action') }.must_raise ArgumentError + -> { Hanami::Commands::Generate::Action.new({method: 'UnKnOwN'}, 'web', 'books#action') }.must_raise ArgumentError end end end @@ -34,7 +34,7 @@ describe Lotus::Commands::Generate::Action do it 'allows user to pass / instead of # between controller and action' do with_temp_dir do |original_wd| setup_container_app - command = Lotus::Commands::Generate::Action.new({}, 'web', 'books/index') + command = Hanami::Commands::Generate::Action.new({}, 'web', 'books/index') capture_io { command.start } assert_file_exists 'apps/web/templates/books/index.html.erb' @@ -45,7 +45,7 @@ describe Lotus::Commands::Generate::Action do it 'uses --template option as extension for the template' do with_temp_dir do |original_wd| setup_container_app - command = Lotus::Commands::Generate::Action.new({template: 'haml'}, 'web', 'books#index') + command = Hanami::Commands::Generate::Action.new({template: 'haml'}, 'web', 'books#index') capture_io { command.start } @@ -56,7 +56,7 @@ describe Lotus::Commands::Generate::Action do it "handles nested routes correctly" do with_temp_dir do |original_wd| setup_container_app - command = Lotus::Commands::Generate::Action.new({}, 'web', 'admin/books#index') + command = Hanami::Commands::Generate::Action.new({}, 'web', 'admin/books#index') capture_io { command.start } assert_file_exists 'apps/web/templates/admin/books/index.html.erb' @@ -65,7 +65,7 @@ describe Lotus::Commands::Generate::Action do with_temp_dir do |original_wd| setup_container_app - command = Lotus::Commands::Generate::Action.new({}, 'web', 'admin/books/index') + command = Hanami::Commands::Generate::Action.new({}, 'web', 'admin/books/index') capture_io { command.start } assert_file_exists 'apps/web/templates/admin/books/index.html.erb' @@ -77,8 +77,8 @@ describe Lotus::Commands::Generate::Action do it 'uses the --method option to specify HTTP method in the route' do with_temp_dir do |original_wd| setup_container_app - Lotus::Routing::Route::VALID_HTTP_VERBS.each do |m| - command = Lotus::Commands::Generate::Action.new({method: m}, 'web', 'books#index') + Hanami::Routing::Route::VALID_HTTP_VERBS.each do |m| + command = Hanami::Commands::Generate::Action.new({method: m}, 'web', 'books#index') capture_io { command.start } assert_file_includes('apps/web/config/routes.rb', "#{m.downcase} '/books', to: 'books#index'") @@ -90,7 +90,7 @@ describe Lotus::Commands::Generate::Action do with_temp_dir do |original_wd| setup_container_app - command = Lotus::Commands::Generate::Action.new({url: '/mybooks'}, 'web', 'books#index') + command = Hanami::Commands::Generate::Action.new({url: '/mybooks'}, 'web', 'books#index') capture_io { command.start } assert_file_includes('apps/web/config/routes.rb', "get '/mybooks', to: 'books#index'") @@ -102,7 +102,7 @@ describe Lotus::Commands::Generate::Action do it 'makes `index` route' do with_temp_dir do |original_wd| setup_container_app - command = Lotus::Commands::Generate::Action.new({}, 'web', 'books/index') + command = Hanami::Commands::Generate::Action.new({}, 'web', 'books/index') capture_io { command.start } assert_file_includes('apps/web/config/routes.rb', "get '/books', to: 'books#index") @@ -112,7 +112,7 @@ describe Lotus::Commands::Generate::Action do it 'makes `show` route' do with_temp_dir do |original_wd| setup_container_app - command = Lotus::Commands::Generate::Action.new({}, 'web', 'books/show') + command = Hanami::Commands::Generate::Action.new({}, 'web', 'books/show') capture_io { command.start } assert_file_includes('apps/web/config/routes.rb', "get '/books/:id', to: 'books#show'") @@ -122,7 +122,7 @@ describe Lotus::Commands::Generate::Action do it 'makes `new` route' do with_temp_dir do |original_wd| setup_container_app - command = Lotus::Commands::Generate::Action.new({}, 'web', 'books/new') + command = Hanami::Commands::Generate::Action.new({}, 'web', 'books/new') capture_io { command.start } assert_file_includes('apps/web/config/routes.rb', "get '/books/new', to: 'books#new'") @@ -132,7 +132,7 @@ describe Lotus::Commands::Generate::Action do it 'makes `create` route' do with_temp_dir do |original_wd| setup_container_app - command = Lotus::Commands::Generate::Action.new({}, 'web', 'books/create') + command = Hanami::Commands::Generate::Action.new({}, 'web', 'books/create') capture_io { command.start } assert_file_includes('apps/web/config/routes.rb', "post '/books', to: 'books#create'") @@ -142,7 +142,7 @@ describe Lotus::Commands::Generate::Action do it 'makes `edit` route' do with_temp_dir do |original_wd| setup_container_app - command = Lotus::Commands::Generate::Action.new({}, 'web', 'books/edit') + command = Hanami::Commands::Generate::Action.new({}, 'web', 'books/edit') capture_io { command.start } assert_file_includes('apps/web/config/routes.rb', "get '/books/:id/edit', to: 'books#edit'") @@ -152,7 +152,7 @@ describe Lotus::Commands::Generate::Action do it 'makes `update` route' do with_temp_dir do |original_wd| setup_container_app - command = Lotus::Commands::Generate::Action.new({}, 'web', 'books/update') + command = Hanami::Commands::Generate::Action.new({}, 'web', 'books/update') capture_io { command.start } assert_file_includes('apps/web/config/routes.rb', "patch '/books/:id', to: 'books#update'") @@ -162,7 +162,7 @@ describe Lotus::Commands::Generate::Action do it 'makes `destroy`' do with_temp_dir do |original_wd| setup_container_app - command = Lotus::Commands::Generate::Action.new({}, 'web', 'books/destroy') + command = Hanami::Commands::Generate::Action.new({}, 'web', 'books/destroy') capture_io { command.start } assert_file_includes('apps/web/config/routes.rb', "delete '/books/:id', to: 'books#destroy'") @@ -172,7 +172,7 @@ describe Lotus::Commands::Generate::Action do it 'does not override user specified http method' do with_temp_dir do |original_wd| setup_container_app - command = Lotus::Commands::Generate::Action.new({method: 'get'}, 'web', 'books/destroy') + command = Hanami::Commands::Generate::Action.new({method: 'get'}, 'web', 'books/destroy') capture_io { command.start } assert_file_includes('apps/web/config/routes.rb', "get '/books/:id', to: 'books#destroy'") @@ -182,7 +182,7 @@ describe Lotus::Commands::Generate::Action do it 'does not override user specified URL' do with_temp_dir do |original_wd| setup_container_app - command = Lotus::Commands::Generate::Action.new({url: '/books'}, 'web', 'books/destroy') + command = Hanami::Commands::Generate::Action.new({url: '/books'}, 'web', 'books/destroy') capture_io { command.start } assert_file_includes('apps/web/config/routes.rb', "delete '/books', to: 'books#destroy'") @@ -196,7 +196,7 @@ describe Lotus::Commands::Generate::Action do with_temp_dir do |original_wd| setup_container_app - command = Lotus::Commands::Generate::Action.new({}, 'web', 'books#index') + command = Hanami::Commands::Generate::Action.new({}, 'web', 'books#index') capture_io { command.start } assert_generated_container_action('minitest', original_wd) @@ -207,7 +207,7 @@ describe Lotus::Commands::Generate::Action do with_temp_dir do |original_wd| setup_underscored_container_app - command = Lotus::Commands::Generate::Action.new({}, 'app_v1', 'books#index') + command = Hanami::Commands::Generate::Action.new({}, 'app_v1', 'books#index') capture_io { command.start } assert_file_exists('spec/app_v1/controllers/books/index_spec.rb') @@ -223,7 +223,7 @@ describe Lotus::Commands::Generate::Action do with_temp_dir do |original_wd| setup_container_app - command = Lotus::Commands::Generate::Action.new({skip_view: true}, 'web', 'books#index') + command = Hanami::Commands::Generate::Action.new({skip_view: true}, 'web', 'books#index') capture_io { command.start } assert_generated_file(original_wd.join('test/fixtures/commands/generate/action/routes.get.rb'), 'apps/web/config/routes.rb') @@ -242,7 +242,7 @@ describe Lotus::Commands::Generate::Action do with_temp_dir do |original_wd| setup_container_app - command = Lotus::Commands::Generate::Action.new({test: 'rspec'}, 'web', 'books#index') + command = Hanami::Commands::Generate::Action.new({test: 'rspec'}, 'web', 'books#index') capture_io { command.start } assert_generated_container_action('rspec', original_wd) @@ -257,7 +257,7 @@ describe Lotus::Commands::Generate::Action do with_temp_dir do |original_wd| setup_app_app - command = Lotus::Commands::Generate::Action.new({}, 'testapp', 'books#index') + command = Hanami::Commands::Generate::Action.new({}, 'testapp', 'books#index') capture_io { command.start } assert_generated_app_action('minitest', original_wd) @@ -268,7 +268,7 @@ describe Lotus::Commands::Generate::Action do with_temp_dir do |original_wd| setup_app_app - command = Lotus::Commands::Generate::Action.new({skip_view: true}, 'testapp', 'books#index') + command = Hanami::Commands::Generate::Action.new({skip_view: true}, 'testapp', 'books#index') capture_io { command.start } assert_generated_file(original_wd.join('test/fixtures/commands/generate/action/routes.get.rb'), 'config/routes.rb') @@ -287,7 +287,7 @@ describe Lotus::Commands::Generate::Action do with_temp_dir do |original_wd| setup_app_app - command = Lotus::Commands::Generate::Action.new({test: 'rspec'}, 'testapp', 'books#index') + command = Hanami::Commands::Generate::Action.new({test: 'rspec'}, 'testapp', 'books#index') capture_io { command.start } assert_generated_app_action('rspec', original_wd) @@ -298,11 +298,11 @@ describe Lotus::Commands::Generate::Action do end describe 'with quoted arguments' do - # See https://github.com/lotus/lotus/issues/282 + # See https://github.com/hanami/hanami/issues/282 it 'accepts single quoted arguments' do with_temp_dir do |original_wd| setup_container_app - command = Lotus::Commands::Generate::Action.new({}, 'web', "'books#index'") + command = Hanami::Commands::Generate::Action.new({}, 'web', "'books#index'") capture_io { command.start } assert_generated_container_action('minitest', original_wd) @@ -312,7 +312,7 @@ describe Lotus::Commands::Generate::Action do it 'accepts double quoted arguments' do with_temp_dir do |original_wd| setup_container_app - command = Lotus::Commands::Generate::Action.new({}, 'web', '"books#index"') + command = Hanami::Commands::Generate::Action.new({}, 'web', '"books#index"') capture_io { command.start } assert_generated_container_action('minitest', original_wd) @@ -322,7 +322,7 @@ describe Lotus::Commands::Generate::Action do it 'accepts escaped arguments' do with_temp_dir do |original_wd| setup_container_app - command = Lotus::Commands::Generate::Action.new({}, 'web', 'books\#index') + command = Hanami::Commands::Generate::Action.new({}, 'web', 'books\#index') capture_io { command.start } assert_generated_container_action('minitest', original_wd) @@ -337,9 +337,9 @@ describe Lotus::Commands::Generate::Action do setup_container_app capture_io { - Lotus::Commands::Generate::Action.new({}, 'web', 'books#index').start + Hanami::Commands::Generate::Action.new({}, 'web', 'books#index').start - Lotus::Commands::Generate::Action.new({}, 'web', 'books#index').destroy.start + Hanami::Commands::Generate::Action.new({}, 'web', 'books#index').destroy.start } refute_file_exists('spec/web/controllers/books/index_spec.rb') @@ -357,9 +357,9 @@ describe Lotus::Commands::Generate::Action do setup_app_app capture_io { - Lotus::Commands::Generate::Action.new({}, 'testapp', 'books#index').start + Hanami::Commands::Generate::Action.new({}, 'testapp', 'books#index').start - Lotus::Commands::Generate::Action.new({}, 'testapp', 'books#index').destroy.start + Hanami::Commands::Generate::Action.new({}, 'testapp', 'books#index').destroy.start } refute_file_exists('spec/controllers/books/index_spec.rb') @@ -376,9 +376,9 @@ describe Lotus::Commands::Generate::Action do setup_container_app capture_io { - Lotus::Commands::Generate::Action.new({}, 'web', 'books#index').start + Hanami::Commands::Generate::Action.new({}, 'web', 'books#index').start - Lotus::Commands::Generate::Action.new({}, 'web', 'books#index').destroy.start + Hanami::Commands::Generate::Action.new({}, 'web', 'books#index').destroy.start } refute_file_includes('apps/web/config/routes.rb', "get '/books', to: 'books#index'") @@ -391,9 +391,9 @@ describe Lotus::Commands::Generate::Action do setup_container_app capture_io { - Lotus::Commands::Generate::Action.new({url: '/mybooks'}, 'web', 'books#index').start + Hanami::Commands::Generate::Action.new({url: '/mybooks'}, 'web', 'books#index').start - Lotus::Commands::Generate::Action.new({url: '/mybooks'}, 'web', 'books#index').destroy.start + Hanami::Commands::Generate::Action.new({url: '/mybooks'}, 'web', 'books#index').destroy.start } refute_file_includes('apps/web/config/routes.rb', "get '/mybooks', to: 'books#index'") @@ -407,9 +407,9 @@ describe Lotus::Commands::Generate::Action do setup_container_app capture_io { - Lotus::Commands::Generate::Action.new({method: 'post'}, 'web', 'books#index').start + Hanami::Commands::Generate::Action.new({method: 'post'}, 'web', 'books#index').start - Lotus::Commands::Generate::Action.new({method: 'post'}, 'web', 'books#index').destroy.start + Hanami::Commands::Generate::Action.new({method: 'post'}, 'web', 'books#index').destroy.start } refute_file_includes('apps/web/config/routes.rb', "post '/books', to: 'books#index'") @@ -423,9 +423,9 @@ describe Lotus::Commands::Generate::Action do setup_container_app capture_io { - Lotus::Commands::Generate::Action.new({template: 'haml'}, 'web', 'books#index').start + Hanami::Commands::Generate::Action.new({template: 'haml'}, 'web', 'books#index').start - Lotus::Commands::Generate::Action.new({template: 'haml'}, 'web', 'books#index').destroy.start + Hanami::Commands::Generate::Action.new({template: 'haml'}, 'web', 'books#index').destroy.start } refute_file_exists('apps/web/templates/books/index.html.haml') @@ -434,26 +434,26 @@ describe Lotus::Commands::Generate::Action do end end - describe 'respect lotusrc' do + describe 'respect hanamirc' do it 'creates rspec templates' do with_temp_dir do |original_wd| setup_container_app - FileUtils.cp original_wd.join('test', 'fixtures', 'lotusrc', 'with_rspec'), '.lotusrc' + FileUtils.cp original_wd.join('test', 'fixtures', 'hanamirc', 'with_rspec'), '.hanamirc' capture_io { - Lotus::Commands::Generate::Action.new({}, 'web', 'books#index').start + Hanami::Commands::Generate::Action.new({}, 'web', 'books#index').start } assert_generated_container_action('rspec', original_wd) end end - it 'accepts command arguments to override lotusrc' do + it 'accepts command arguments to override hanamirc' do with_temp_dir do |original_wd| setup_container_app - FileUtils.cp original_wd.join('test', 'fixtures', 'lotusrc', 'with_rspec'), '.lotusrc' + FileUtils.cp original_wd.join('test', 'fixtures', 'hanamirc', 'with_rspec'), '.hanamirc' capture_io { - Lotus::Commands::Generate::Action.new({test: 'minitest'}, 'web', 'books#index').start + Hanami::Commands::Generate::Action.new({test: 'minitest'}, 'web', 'books#index').start } assert_generated_container_action('minitest', original_wd) end @@ -480,21 +480,21 @@ describe Lotus::Commands::Generate::Action do end def setup_container_app - File.open('.lotusrc', 'w') { |file| file << "architecture=container"} + File.open('.hanamirc', 'w') { |file| file << "architecture=container"} FileUtils.mkdir_p('apps/web') # simulate existing app FileUtils.mkdir_p('apps/web/config') # simulate existing routes file to see if route is prepended File.open('apps/web/config/routes.rb', 'w') { |file| file << "get '/cars', to: 'cars#index'"} end def setup_underscored_container_app - File.open('.lotusrc', 'w') { |file| file << "architecture=container"} + File.open('.hanamirc', 'w') { |file| file << "architecture=container"} FileUtils.mkdir_p('apps/app_v1') # simulate existing app FileUtils.mkdir_p('apps/app_v1/config') # simulate existing routes file to see if route is prepended File.open('apps/app_v1/config/routes.rb', 'w') { |file| file << "get '/cars', to: 'cars#index'"} end def setup_app_app - File.open('.lotusrc', 'w') { |file| file << "architecture=app"} + File.open('.hanamirc', 'w') { |file| file << "architecture=app"} FileUtils.mkdir_p('app') # simulate existing app FileUtils.mkdir_p('config') # simulate existing routes file to see if route is prepended File.open('config/routes.rb', 'w') { |file| file << "get '/cars', to: 'cars#index'"} diff --git a/test/commands/generate/app_test.rb b/test/commands/generate/app_test.rb index 52f25267..c5eb373a 100644 --- a/test/commands/generate/app_test.rb +++ b/test/commands/generate/app_test.rb @@ -1,13 +1,13 @@ require 'test_helper' -require 'lotus/commands/generate/app' +require 'hanami/commands/generate/app' require 'fileutils' -describe Lotus::Commands::Generate::App do +describe Hanami::Commands::Generate::App do describe 'with invalid arguments' do it 'requires application name' do - -> { Lotus::Commands::Generate::App.new({}, nil) }.must_raise ArgumentError - -> { Lotus::Commands::Generate::App.new({}, '') }.must_raise ArgumentError - -> { Lotus::Commands::Generate::App.new({}, ' ') }.must_raise ArgumentError + -> { Hanami::Commands::Generate::App.new({}, nil) }.must_raise ArgumentError + -> { Hanami::Commands::Generate::App.new({}, '') }.must_raise ArgumentError + -> { Hanami::Commands::Generate::App.new({}, ' ') }.must_raise ArgumentError end end @@ -15,7 +15,7 @@ describe Lotus::Commands::Generate::App do it 'generates configuration and template files' do with_temp_dir do |original_wd| setup_container_app(original_wd) - command = Lotus::Commands::Generate::App.new({}, 'admin') + command = Hanami::Commands::Generate::App.new({}, 'admin') capture_io { command.start } # check 'require' and 'mount' @@ -37,7 +37,7 @@ describe Lotus::Commands::Generate::App do it 'generate the application with valid ruby syntax for dasherized name' do with_temp_dir do |original_wd| setup_container_app(original_wd) - command = Lotus::Commands::Generate::App.new({}, 'test-app') + command = Hanami::Commands::Generate::App.new({}, 'test-app') capture_io { command.start } content = File.read("config/environment.rb") @@ -46,14 +46,14 @@ describe Lotus::Commands::Generate::App do end it 'returns valid classified app name' do - command = Lotus::Commands::Generate::App.new({ architecture: 'container' }, 'awesome-test-app') + command = Hanami::Commands::Generate::App.new({ architecture: 'container' }, 'awesome-test-app') command.template_options[:classified_app_name].must_equal 'AwesomeTestApp' end it 'create files' do with_temp_dir do |original_wd| setup_container_app(original_wd) - command = Lotus::Commands::Generate::App.new({}, 'api') + command = Hanami::Commands::Generate::App.new({}, 'api') capture_io { command.start } assert_file_exists('apps/api/application.rb') @@ -76,7 +76,7 @@ describe Lotus::Commands::Generate::App do it 'allows to specify the url' do with_temp_dir do |original_wd| setup_container_app(original_wd) - command = Lotus::Commands::Generate::App.new({application_base_url: '/backend'}, 'admin') + command = Hanami::Commands::Generate::App.new({application_base_url: '/backend'}, 'admin') capture_io { command.start } assert_generated_file(original_wd.join('test', 'fixtures', 'commands', 'generate', 'app', 'environment_with_app_added_url.rb'), 'config/environment.rb') @@ -86,8 +86,8 @@ describe Lotus::Commands::Generate::App do it 'can not run for app architecture' do with_temp_dir do |original_wd| - File.open('.lotusrc', 'w') { |file| file << "architecture=app"} - -> { Lotus::Commands::Generate::App.new({}, 'admin') }.must_raise ArgumentError + File.open('.hanamirc', 'w') { |file| file << "architecture=app"} + -> { Hanami::Commands::Generate::App.new({}, 'admin') }.must_raise ArgumentError end end @@ -96,8 +96,8 @@ describe Lotus::Commands::Generate::App do with_temp_dir do |original_wd| setup_container_app(original_wd) capture_io { - Lotus::Commands::Generate::App.new({}, 'api').start - Lotus::Commands::Generate::App.new({}, 'api').destroy.start + Hanami::Commands::Generate::App.new({}, 'api').start + Hanami::Commands::Generate::App.new({}, 'api').destroy.start } refute_file_exists('apps/api/application.rb') refute_file_exists('apps/api/views/application_layout.rb') diff --git a/test/commands/generate/mailer_test.rb b/test/commands/generate/mailer_test.rb index cb65facb..95a25ff6 100644 --- a/test/commands/generate/mailer_test.rb +++ b/test/commands/generate/mailer_test.rb @@ -1,20 +1,20 @@ require 'test_helper' -require 'lotus/commands/generate/mailer' +require 'hanami/commands/generate/mailer' require 'fileutils' -describe Lotus::Commands::Generate::Mailer do +describe Hanami::Commands::Generate::Mailer do describe 'with invalid arguments' do it 'requires mailer name' do - -> { Lotus::Commands::Generate::Mailer.new({}, nil) }.must_raise ArgumentError - -> { Lotus::Commands::Generate::Mailer.new({}, '') }.must_raise ArgumentError - -> { Lotus::Commands::Generate::Mailer.new({}, ' ') }.must_raise ArgumentError + -> { Hanami::Commands::Generate::Mailer.new({}, nil) }.must_raise ArgumentError + -> { Hanami::Commands::Generate::Mailer.new({}, '') }.must_raise ArgumentError + -> { Hanami::Commands::Generate::Mailer.new({}, ' ') }.must_raise ArgumentError end end describe 'with valid arguments' do it 'underscores the mailer name' do with_temp_dir do |original_wd| - command = Lotus::Commands::Generate::Mailer.new({}, 'ForgotPassword') + command = Hanami::Commands::Generate::Mailer.new({}, 'ForgotPassword') capture_io { command.start } assert_generated_file(original_wd.join('test/fixtures/commands/generate/mailer/forgot_password.rb'), 'lib/testapp/mailers/forgot_password.rb') @@ -23,7 +23,7 @@ describe Lotus::Commands::Generate::Mailer do it 'uses --from option as the email sender' do with_temp_dir do |original_wd| - command = Lotus::Commands::Generate::Mailer.new({from: "'support@bookshelf.com'"}, 'ForgotPassword') + command = Hanami::Commands::Generate::Mailer.new({from: "'support@bookshelf.com'"}, 'ForgotPassword') capture_io { command.start } assert_file_includes('lib/testapp/mailers/forgot_password.rb', /from\s+'support@bookshelf.com'/) @@ -32,7 +32,7 @@ describe Lotus::Commands::Generate::Mailer do it 'uses --to option as the email sendee' do with_temp_dir do |original_wd| - command = Lotus::Commands::Generate::Mailer.new({to: "'log@bookshelf.com'"}, 'ForgotPassword') + command = Hanami::Commands::Generate::Mailer.new({to: "'log@bookshelf.com'"}, 'ForgotPassword') capture_io { command.start } assert_file_includes('lib/testapp/mailers/forgot_password.rb', /to\s+'log@bookshelf.com'/) @@ -41,7 +41,7 @@ describe Lotus::Commands::Generate::Mailer do it 'uses --subject option as the email subject' do with_temp_dir do |original_wd| - command = Lotus::Commands::Generate::Mailer.new({subject: "'New Password'"}, 'ForgotPassword') + command = Hanami::Commands::Generate::Mailer.new({subject: "'New Password'"}, 'ForgotPassword') capture_io { command.start } assert_file_includes('lib/testapp/mailers/forgot_password.rb', /subject\s+'New Password'/) @@ -50,7 +50,7 @@ describe Lotus::Commands::Generate::Mailer do it 'uses default options' do with_temp_dir do |original_wd| - command = Lotus::Commands::Generate::Mailer.new({}, 'ForgotPassword') + command = Hanami::Commands::Generate::Mailer.new({}, 'ForgotPassword') capture_io { command.start } assert_generated_file(original_wd.join('test/fixtures/commands/generate/mailer/forgot_password.rb'), 'lib/testapp/mailers/forgot_password.rb') @@ -62,7 +62,7 @@ describe Lotus::Commands::Generate::Mailer do skip('only one type of test framework is available') with_temp_dir do |original_wd| - command = Lotus::Commands::Generate::Mailer.new({test: 'rspec'}, 'ForgotPassword') + command = Hanami::Commands::Generate::Mailer.new({test: 'rspec'}, 'ForgotPassword') capture_io { command.start } assert_generated_mailer_and_spec('rspec', original_wd) @@ -73,7 +73,7 @@ describe Lotus::Commands::Generate::Mailer do describe 'with minitest (default)' do it 'creates mailer and spec files' do with_temp_dir do |original_wd| - command = Lotus::Commands::Generate::Mailer.new({}, 'ForgotPassword') + command = Hanami::Commands::Generate::Mailer.new({}, 'ForgotPassword') capture_io { command.start } assert_generated_mailer_and_spec('minitest', original_wd) @@ -86,9 +86,9 @@ describe Lotus::Commands::Generate::Mailer do it 'destroys mailer and spec files' do with_temp_dir do |original_wd| capture_io { - Lotus::Commands::Generate::Mailer.new({}, 'ForgotPassword').start + Hanami::Commands::Generate::Mailer.new({}, 'ForgotPassword').start - Lotus::Commands::Generate::Mailer.new({}, 'ForgotPassword').destroy.start + Hanami::Commands::Generate::Mailer.new({}, 'ForgotPassword').destroy.start } refute_file_exists('lib/testapp/mailers/forgot_password.rb') diff --git a/test/commands/generate/migration_test.rb b/test/commands/generate/migration_test.rb index 7410910d..4c8105b8 100644 --- a/test/commands/generate/migration_test.rb +++ b/test/commands/generate/migration_test.rb @@ -1,15 +1,15 @@ require 'test_helper' -require 'lotus/commands/generate/migration' +require 'hanami/commands/generate/migration' require 'fileutils' -describe Lotus::Commands::Generate::Migration do +describe Hanami::Commands::Generate::Migration do describe 'with invalid arguments' do it 'requires migration name' do with_temp_dir do setup_app - -> { Lotus::Commands::Generate::Migration.new({}, nil) }.must_raise ArgumentError - -> { Lotus::Commands::Generate::Migration.new({}, '') }.must_raise ArgumentError - -> { Lotus::Commands::Generate::Migration.new({}, ' ') }.must_raise ArgumentError + -> { Hanami::Commands::Generate::Migration.new({}, nil) }.must_raise ArgumentError + -> { Hanami::Commands::Generate::Migration.new({}, '') }.must_raise ArgumentError + -> { Hanami::Commands::Generate::Migration.new({}, ' ') }.must_raise ArgumentError end end end @@ -18,7 +18,7 @@ describe Lotus::Commands::Generate::Migration do it 'creates the migration file' do with_temp_dir do |original_wd| setup_app - command = Lotus::Commands::Generate::Migration.new({}, 'something') + command = Hanami::Commands::Generate::Migration.new({}, 'something') capture_io { command.start } assert_migration_exists('something') @@ -31,7 +31,7 @@ describe Lotus::Commands::Generate::Migration do it 'underscores the migration name' do with_temp_dir do |original_wd| setup_app - command = Lotus::Commands::Generate::Migration.new({}, 'SoMe-Thing-Strange') + command = Hanami::Commands::Generate::Migration.new({}, 'SoMe-Thing-Strange') capture_io { command.start } assert_migration_exists('so_me_thing_strange') @@ -45,11 +45,11 @@ describe Lotus::Commands::Generate::Migration do setup_app capture_io { - Lotus::Commands::Generate::Migration.new({}, 'create_books').start + Hanami::Commands::Generate::Migration.new({}, 'create_books').start - Lotus::Commands::Generate::Migration.new({}, 'create_users').start + Hanami::Commands::Generate::Migration.new({}, 'create_users').start - Lotus::Commands::Generate::Migration.new({}, 'create_books').destroy.start + Hanami::Commands::Generate::Migration.new({}, 'create_books').destroy.start } assert_migration_exists('create_users') diff --git a/test/commands/generate/model_test.rb b/test/commands/generate/model_test.rb index 8007203b..d1b47043 100644 --- a/test/commands/generate/model_test.rb +++ b/test/commands/generate/model_test.rb @@ -1,26 +1,26 @@ require 'test_helper' -require 'lotus/commands/generate/model' +require 'hanami/commands/generate/model' require 'fileutils' -describe Lotus::Commands::Generate::Model do +describe Hanami::Commands::Generate::Model do describe 'with invalid arguments' do it 'requires model name' do assert_exception_raised(ArgumentError, 'Model name nil or empty.') do - Lotus::Commands::Generate::Model.new({}, nil) + Hanami::Commands::Generate::Model.new({}, nil) end assert_exception_raised(ArgumentError, 'Model name nil or empty.') do - Lotus::Commands::Generate::Model.new({}, '') + Hanami::Commands::Generate::Model.new({}, '') end assert_exception_raised(ArgumentError, 'Model name nil or empty.') do - Lotus::Commands::Generate::Model.new({}, ' ') + Hanami::Commands::Generate::Model.new({}, ' ') end end it 'validates model name' do assert_exception_raised(ArgumentError, "Invalid model name. The model name shouldn't begin with a number.") do - Lotus::Commands::Generate::Model.new({}, 123) + Hanami::Commands::Generate::Model.new({}, 123) end end end @@ -28,7 +28,7 @@ describe Lotus::Commands::Generate::Model do describe 'sanitizes model name' do it 'downcases it' do with_temp_dir do |original_wd| - command = Lotus::Commands::Generate::Model.new({}, 'CaR') + command = Hanami::Commands::Generate::Model.new({}, 'CaR') capture_io { command.start } assert_generated_file(original_wd.join('test/fixtures/commands/generate/model/car.rb'), 'lib/testapp/entities/car.rb') end @@ -40,7 +40,7 @@ describe Lotus::Commands::Generate::Model do describe 'with rspec' do it 'creates model, repository and spec files' do with_temp_dir do |original_wd| - command = Lotus::Commands::Generate::Model.new({'test' => 'rspec'}, 'car') + command = Hanami::Commands::Generate::Model.new({'test' => 'rspec'}, 'car') capture_io { command.start } assert_generated_file(original_wd.join('test/fixtures/commands/generate/model/car_repository_spec.rspec.rb'), 'spec/testapp/repositories/car_repository_spec.rb') @@ -54,7 +54,7 @@ describe Lotus::Commands::Generate::Model do describe 'with minitest' do it 'creates model, repository and spec files' do with_temp_dir do |original_wd| - command = Lotus::Commands::Generate::Model.new({}, 'car') + command = Hanami::Commands::Generate::Model.new({}, 'car') capture_io { command.start } assert_generated_file(original_wd.join('test/fixtures/commands/generate/model/car_repository_spec.minitest.rb'), 'spec/testapp/repositories/car_repository_spec.rb') @@ -70,9 +70,9 @@ describe Lotus::Commands::Generate::Model do it 'destroys model, repository and spec files' do with_temp_dir do |original_wd| capture_io { - Lotus::Commands::Generate::Model.new({}, 'car').start + Hanami::Commands::Generate::Model.new({}, 'car').start - Lotus::Commands::Generate::Model.new({}, 'car').destroy.start + Hanami::Commands::Generate::Model.new({}, 'car').destroy.start } refute_file_exists('spec/testapp/repositories/car_repository_spec.rb') diff --git a/test/commands/new/app_test.rb b/test/commands/new/app_test.rb index 8b302234..c65ea8e1 100644 --- a/test/commands/new/app_test.rb +++ b/test/commands/new/app_test.rb @@ -1,33 +1,33 @@ require 'test_helper' -require 'lotus/commands/new/app' +require 'hanami/commands/new/app' require 'fileutils' -describe Lotus::Commands::New::App do +describe Hanami::Commands::New::App do describe 'with invalid arguments' do it 'requires application name' do with_temp_dir do |original_wd| - -> { Lotus::Commands::New::App.new({}, nil) }.must_raise ArgumentError - -> { Lotus::Commands::New::App.new({}, '') }.must_raise ArgumentError - -> { Lotus::Commands::New::App.new({}, ' ') }.must_raise ArgumentError - -> { Lotus::Commands::New::App.new({}, 'foo/bar') }.must_raise ArgumentError + -> { Hanami::Commands::New::App.new({}, nil) }.must_raise ArgumentError + -> { Hanami::Commands::New::App.new({}, '') }.must_raise ArgumentError + -> { Hanami::Commands::New::App.new({}, ' ') }.must_raise ArgumentError + -> { Hanami::Commands::New::App.new({}, 'foo/bar') }.must_raise ArgumentError end end it 'validates test option' do with_temp_dir do |original_wd| - -> { Lotus::Commands::New::App.new({test: 'unknown'}, nil) }.must_raise ArgumentError + -> { Hanami::Commands::New::App.new({test: 'unknown'}, nil) }.must_raise ArgumentError end end it 'validates database option' do with_temp_dir do |original_wd| - -> { Lotus::Commands::New::App.new({database: 'unknown'}, nil) }.must_raise ArgumentError + -> { Hanami::Commands::New::App.new({database: 'unknown'}, nil) }.must_raise ArgumentError end end it 'does not support application_name' do with_temp_dir do |original_wd| - -> { Lotus::Commands::New::App.new({application_name: 'application_name'}, nil) }.must_raise ArgumentError + -> { Hanami::Commands::New::App.new({application_name: 'application_name'}, nil) }.must_raise ArgumentError end end end @@ -36,7 +36,7 @@ describe Lotus::Commands::New::App do describe 'minitest' do it 'creates files' do with_temp_dir do |original_wd| - command = Lotus::Commands::New::App.new({}, 'new_app') + command = Hanami::Commands::New::App.new({}, 'new_app') capture_io { command.start } assert_generated_app('minitest', original_wd) @@ -47,7 +47,7 @@ describe Lotus::Commands::New::App do describe 'rspec' do it 'creates files' do with_temp_dir do |original_wd| - command = Lotus::Commands::New::App.new({'test' => 'rspec'}, 'new_app') + command = Hanami::Commands::New::App.new({'test' => 'rspec'}, 'new_app') capture_io { command.start } assert_generated_app('rspec', original_wd) @@ -56,7 +56,7 @@ describe Lotus::Commands::New::App do end it 'returns valid classified app name' do - command = Lotus::Commands::New::App.new({}, 'awesome-test-app') + command = Hanami::Commands::New::App.new({}, 'awesome-test-app') command.template_options[:classified_app_name].must_equal 'AwesomeTestApp' end end @@ -64,7 +64,7 @@ describe Lotus::Commands::New::App do def assert_generated_app(test_framework, original_wd) fixture_root = original_wd.join('test', 'fixtures', 'commands', 'application', 'new_app') Dir.chdir('new_app') do - assert_generated_file(fixture_root.join(".lotusrc.#{ test_framework }"), '.lotusrc') + assert_generated_file(fixture_root.join(".hanamirc.#{ test_framework }"), '.hanamirc') assert_generated_file(fixture_root.join('.env'), '.env') assert_file_includes('.env.development', diff --git a/test/commands/new/container_test.rb b/test/commands/new/container_test.rb index bd75b9ef..ced1db44 100644 --- a/test/commands/new/container_test.rb +++ b/test/commands/new/container_test.rb @@ -1,27 +1,27 @@ require 'test_helper' -require 'lotus/commands/new/container' +require 'hanami/commands/new/container' require 'fileutils' -describe Lotus::Commands::New::Container do +describe Hanami::Commands::New::Container do describe 'with invalid arguments' do it 'requires application name' do with_temp_dir do |original_wd| - -> { Lotus::Commands::New::Container.new({}, nil) }.must_raise ArgumentError - -> { Lotus::Commands::New::Container.new({}, '') }.must_raise ArgumentError - -> { Lotus::Commands::New::Container.new({}, ' ') }.must_raise ArgumentError - -> { Lotus::Commands::New::Container.new({}, 'foo/bar') }.must_raise ArgumentError + -> { Hanami::Commands::New::Container.new({}, nil) }.must_raise ArgumentError + -> { Hanami::Commands::New::Container.new({}, '') }.must_raise ArgumentError + -> { Hanami::Commands::New::Container.new({}, ' ') }.must_raise ArgumentError + -> { Hanami::Commands::New::Container.new({}, 'foo/bar') }.must_raise ArgumentError end end it 'validates test option' do with_temp_dir do |original_wd| - -> { Lotus::Commands::New::Container.new({test: 'unknown'}, nil) }.must_raise ArgumentError + -> { Hanami::Commands::New::Container.new({test: 'unknown'}, nil) }.must_raise ArgumentError end end it 'validates database option' do with_temp_dir do |original_wd| - -> { Lotus::Commands::New::Container.new({database: 'unknown'}, nil) }.must_raise ArgumentError + -> { Hanami::Commands::New::Container.new({database: 'unknown'}, nil) }.must_raise ArgumentError end end end @@ -29,7 +29,7 @@ describe Lotus::Commands::New::Container do describe 'serve static assets' do it 'sets env var to true for development and test' do with_temp_dir do |original_wd| - command = Lotus::Commands::New::Container.new({}, 'static_assets') + command = Hanami::Commands::New::Container.new({}, 'static_assets') capture_io { command.start } Dir.chdir('static_assets') do actual_content = File.read('.env.development') @@ -45,7 +45,7 @@ describe Lotus::Commands::New::Container do describe 'with valid arguments' do it 'application name with dash' do with_temp_dir do |original_wd| - command = Lotus::Commands::New::Container.new({}, 'new-container') + command = Hanami::Commands::New::Container.new({}, 'new-container') capture_io { command.start } Dir.chdir('new-container') do actual_content = File.read('.env.development') @@ -60,7 +60,7 @@ describe Lotus::Commands::New::Container do describe 'application name is a point' do it 'generates application in current folder' do with_temp_dir do |original_wd| - command = Lotus::Commands::New::Container.new({}, '.') + command = Hanami::Commands::New::Container.new({}, '.') capture_io { command.start } Dir.chdir('.') do actual_content = File.read('.env.development') @@ -74,11 +74,11 @@ describe Lotus::Commands::New::Container do end describe 'databases' do - let(:adapter_prefix) { 'jdbc:' if Lotus::Utils.jruby? } + let(:adapter_prefix) { 'jdbc:' if Hanami::Utils.jruby? } it 'generates specific files for memory' do with_temp_dir do |original_wd| - command = Lotus::Commands::New::Container.new({database: 'memory'}, 'new_container') + command = Hanami::Commands::New::Container.new({database: 'memory'}, 'new_container') capture_io { command.start } fixture_root = original_wd.join('test', 'fixtures', 'commands', 'application', 'new_container') @@ -98,7 +98,7 @@ describe Lotus::Commands::New::Container do it 'generates specific files for filesystem' do with_temp_dir do |original_wd| - command = Lotus::Commands::New::Container.new({ database: 'filesystem' }, 'new_container') + command = Hanami::Commands::New::Container.new({ database: 'filesystem' }, 'new_container') capture_io { command.start } fixture_root = original_wd.join('test', 'fixtures', 'commands', 'application', 'new_container') @@ -118,7 +118,7 @@ describe Lotus::Commands::New::Container do it 'generates specific files for sqlite3' do with_temp_dir do |original_wd| - command = Lotus::Commands::New::Container.new({ database: 'sqlite3' }, 'new_container') + command = Hanami::Commands::New::Container.new({ database: 'sqlite3' }, 'new_container') capture_io { command.start } fixture_root = original_wd.join('test', 'fixtures', 'commands', 'application', 'new_container') @@ -138,7 +138,7 @@ describe Lotus::Commands::New::Container do it 'generates specific files for postgres' do with_temp_dir do |original_wd| - command = Lotus::Commands::New::Container.new({ database: 'postgres' }, 'new_container') + command = Hanami::Commands::New::Container.new({ database: 'postgres' }, 'new_container') capture_io { command.start } fixture_root = original_wd.join('test', 'fixtures', 'commands', 'application', 'new_container') @@ -158,8 +158,8 @@ describe Lotus::Commands::New::Container do it 'generates specific files for mysql2' do with_temp_dir do |original_wd| - database = Lotus::Utils.jruby? ? :mysql : :mysql2 - command = Lotus::Commands::New::Container.new({ database: 'mysql2' }, 'new_container') + database = Hanami::Utils.jruby? ? :mysql : :mysql2 + command = Hanami::Commands::New::Container.new({ database: 'mysql2' }, 'new_container') capture_io { command.start } fixture_root = original_wd.join('test', 'fixtures', 'commands', 'application', 'new_container') @@ -179,7 +179,7 @@ describe Lotus::Commands::New::Container do it 'generates specific files for postgres' do with_temp_dir do |original_wd| - command = Lotus::Commands::New::Container.new({ database: 'postgres' }, 'new_container') + command = Hanami::Commands::New::Container.new({ database: 'postgres' }, 'new_container') capture_io { command.start } fixture_root = original_wd.join('test', 'fixtures', 'commands', 'application', 'new_container') @@ -198,10 +198,10 @@ describe Lotus::Commands::New::Container do end end - describe 'lotus head' do + describe 'hanami head' do it 'creates files' do with_temp_dir do |original_wd| - command = Lotus::Commands::New::Container.new({lotus_head: true}, 'new_container') + command = Hanami::Commands::New::Container.new({hanami_head: true}, 'new_container') capture_io { command.start } fixture_root = original_wd.join('test', 'fixtures', 'commands', 'application', 'new_container') @@ -215,7 +215,7 @@ describe Lotus::Commands::New::Container do describe 'mounted at a specific path' do it 'mounts at /mypath' do with_temp_dir do |original_wd| - command = Lotus::Commands::New::Container.new({application_base_url: '/mypath'}, 'new_container') + command = Hanami::Commands::New::Container.new({application_base_url: '/mypath'}, 'new_container') capture_io { command.start } fixture_root = original_wd.join('test', 'fixtures', 'commands', 'application', 'new_container') Dir.chdir('new_container') do @@ -228,7 +228,7 @@ describe Lotus::Commands::New::Container do describe 'with rspec' do it 'creates the app files' do with_temp_dir do |original_wd| - command = Lotus::Commands::New::Container.new({test: 'rspec'}, 'new_container') + command = Hanami::Commands::New::Container.new({test: 'rspec'}, 'new_container') capture_io { command.start } assert_generated_container('rspec', original_wd) @@ -239,7 +239,7 @@ describe Lotus::Commands::New::Container do describe 'with minitest' do it 'creates files' do with_temp_dir do |original_wd| - command = Lotus::Commands::New::Container.new({}, 'new_container') + command = Hanami::Commands::New::Container.new({}, 'new_container') capture_io { command.start } assert_generated_container('minitest', original_wd) @@ -251,7 +251,7 @@ describe Lotus::Commands::New::Container do def assert_generated_container(test_framework, original_wd) fixture_root = original_wd.join('test', 'fixtures', 'commands', 'application', 'new_container') Dir.chdir('new_container') do - assert_generated_file(fixture_root.join(".lotusrc.#{ test_framework }"), '.lotusrc') + assert_generated_file(fixture_root.join(".hanamirc.#{ test_framework }"), '.hanamirc') assert_generated_file(fixture_root.join('.env'), '.env') actual_content = File.read('.env.development') actual_content.must_include 'NEW_CONTAINER_DATABASE_URL="file:///db/new_container_development"' diff --git a/test/commands/routes_test.rb b/test/commands/routes_test.rb index 170d63e2..78a4b80f 100644 --- a/test/commands/routes_test.rb +++ b/test/commands/routes_test.rb @@ -1,11 +1,11 @@ require 'test_helper' -require 'lotus/commands/routes' -require 'lotus/container' +require 'hanami/commands/routes' +require 'hanami/container' -describe Lotus::Commands::Routes do +describe Hanami::Commands::Routes do let(:opts) { Hash.new } - let(:env) { Lotus::Environment.new(opts) } - let(:routes) { Lotus::Commands::Routes.new(env) } + let(:env) { Hanami::Environment.new(opts) } + let(:routes) { Hanami::Commands::Routes.new(env) } describe 'container architecture' do def architecture_options @@ -16,7 +16,7 @@ describe Lotus::Commands::Routes do let(:architecture) { 'container' } before do - Lotus::Container.configure do + Hanami::Container.configure do mount Backend::App, at: '/backend' mount RackApp, at: '/rackapp' mount TinyApp, at: '/' @@ -31,7 +31,7 @@ describe Lotus::Commands::Routes do %(GET, HEAD / TinyApp::Controllers::Home::Index) ] - actual = Lotus::Container.new.routes.inspector.to_s + actual = Hanami::Container.new.routes.inspector.to_s expectations.each do |expectation| actual.must_include(expectation) end @@ -48,9 +48,9 @@ describe Lotus::Commands::Routes do let(:architecture) { 'app' } before do - Lotus::Application.applications.clear + Hanami::Application.applications.clear - class MySingleApplication < Lotus::Application + class MySingleApplication < Hanami::Application configure do routes do get '/', to: 'home#index' @@ -67,7 +67,7 @@ describe Lotus::Commands::Routes do %(/welcome MySingleApplication::Controllers::Home::Welcome) ] - actual = Lotus::Application.applications.first.new.routes.inspector.to_s + actual = Hanami::Application.applications.first.new.routes.inspector.to_s expectations.each do |expectation| actual.must_include(expectation) end diff --git a/test/commands/server_test.rb b/test/commands/server_test.rb index 689a2bec..be8b408f 100644 --- a/test/commands/server_test.rb +++ b/test/commands/server_test.rb @@ -1,17 +1,17 @@ require 'test_helper' -require 'lotus/environment' -require 'lotus/commands/server' +require 'hanami/environment' +require 'hanami/commands/server' -describe Lotus::Commands::Server do +describe Hanami::Commands::Server do let(:opts) { Hash.new } before do - ENV['LOTUS_HOST'] = nil - ENV['LOTUS_PORT'] = nil - ENV['LOTUS_ENV'] = nil + ENV['HANAMI_HOST'] = nil + ENV['HANAMI_PORT'] = nil + ENV['HANAMI_ENV'] = nil ENV['RACK_ENV'] = nil - @server = Lotus::Commands::Server.new(opts) + @server = Hanami::Commands::Server.new(opts) end describe '#middleware' do @@ -47,19 +47,19 @@ describe Lotus::Commands::Server do end it 'sets an env var for that value' do - ENV['LOTUS_HOST'].must_equal 'localhost' + ENV['HANAMI_HOST'].must_equal 'localhost' end end describe 'when an option is specified' do - let(:opts) { Hash[host: 'lotusrb.dev'] } + let(:opts) { Hash[host: 'hanamirb.dev'] } it 'sets that value' do - @server.options.fetch(:Host).must_equal 'lotusrb.dev' + @server.options.fetch(:Host).must_equal 'hanamirb.dev' end it 'sets an env var for that value' do - ENV['LOTUS_HOST'].must_equal 'lotusrb.dev' + ENV['HANAMI_HOST'].must_equal 'hanamirb.dev' end end end @@ -71,7 +71,7 @@ describe Lotus::Commands::Server do end it 'sets an env var for that value' do - ENV['LOTUS_PORT'].must_equal '2300' + ENV['HANAMI_PORT'].must_equal '2300' end end @@ -83,7 +83,7 @@ describe Lotus::Commands::Server do end it 'sets an env var for that value' do - ENV['LOTUS_PORT'].must_equal '4000' + ENV['HANAMI_PORT'].must_equal '4000' end end end @@ -111,21 +111,21 @@ describe Lotus::Commands::Server do end it 'sets env vars with the same value' do - ENV['LOTUS_ENV'].must_equal 'development' + ENV['HANAMI_ENV'].must_equal 'development' ENV['RACK_ENV'].must_equal 'development' end end describe 'when an option is specified via RACK_ENV' do before do - ENV['LOTUS_ENV'] = nil + ENV['HANAMI_ENV'] = nil ENV['RACK_ENV'] = 'test' - @server = Lotus::Commands::Server.new(opts) + @server = Hanami::Commands::Server.new(opts) end after do ENV['RACK_ENV'] = nil - ENV['LOTUS_ENV'] = nil + ENV['HANAMI_ENV'] = nil end it 'returns that value' do @@ -133,21 +133,21 @@ describe Lotus::Commands::Server do end it 'sets env vars with the same value' do - ENV['LOTUS_ENV'].must_equal 'test' + ENV['HANAMI_ENV'].must_equal 'test' ENV['RACK_ENV'].must_equal 'test' end end - describe 'when an option is specified via LOTUS_ENV' do + describe 'when an option is specified via HANAMI_ENV' do before do ENV['RACK_ENV'] = nil - ENV['LOTUS_ENV'] = 'staging' - @server = Lotus::Commands::Server.new(opts) + ENV['HANAMI_ENV'] = 'staging' + @server = Hanami::Commands::Server.new(opts) end after do ENV['RACK_ENV'] = nil - ENV['LOTUS_ENV'] = nil + ENV['HANAMI_ENV'] = nil end it 'returns that value' do @@ -155,7 +155,7 @@ describe Lotus::Commands::Server do end it 'sets env vars with the same value' do - ENV['LOTUS_ENV'].must_equal 'staging' + ENV['HANAMI_ENV'].must_equal 'staging' ENV['RACK_ENV'].must_equal 'staging' end end @@ -163,16 +163,16 @@ describe Lotus::Commands::Server do describe 'when both the options are specified' do before do ENV['RACK_ENV'] = 'staging' - ENV['LOTUS_ENV'] = 'test' - @server = Lotus::Commands::Server.new(opts) + ENV['HANAMI_ENV'] = 'test' + @server = Hanami::Commands::Server.new(opts) end - it 'gives the precendence to LOTUS_ENV' do + it 'gives the precendence to HANAMI_ENV' do @server.options.fetch(:environment).must_equal 'test' end it 'sets env vars with the same value' do - ENV['LOTUS_ENV'].must_equal 'test' + ENV['HANAMI_ENV'].must_equal 'test' ENV['RACK_ENV'].must_equal 'test' end end diff --git a/test/config/cookies_test.rb b/test/config/cookies_test.rb index 5a496d44..e7aec5ae 100644 --- a/test/config/cookies_test.rb +++ b/test/config/cookies_test.rb @@ -1,62 +1,62 @@ require 'test_helper' -describe Lotus::Config::Cookies do - let(:config) { Lotus::Configuration.new } +describe Hanami::Config::Cookies do + let(:config) { Hanami::Configuration.new } describe '#enabled?' do it "is false when cookies aren't enabled" do - cookies = Lotus::Config::Cookies.new(config) + cookies = Hanami::Config::Cookies.new(config) cookies.enabled?.must_equal false - cookies = Lotus::Config::Cookies.new(config, false) + cookies = Hanami::Config::Cookies.new(config, false) cookies.enabled?.must_equal false end it 'is true when cookies are enabled' do - cookies = Lotus::Config::Cookies.new(config, true) + cookies = Hanami::Config::Cookies.new(config, true) cookies.enabled?.must_equal true end it 'is true if options are passed' do - cookies = Lotus::Config::Cookies.new(config, max_age: 300) + cookies = Hanami::Config::Cookies.new(config, max_age: 300) cookies.enabled?.must_equal true end end describe "#options" do it 'get options if they are passed' do - options = { domain: 'lotusrb.org', path: '/controller', secure: true, httponly: true } - cookies = Lotus::Config::Cookies.new(config, options) + options = { domain: 'hanamirb.org', path: '/controller', secure: true, httponly: true } + cookies = Hanami::Config::Cookies.new(config, options) cookies.default_options.must_equal options end it 'return httponly and secure by default' do - cookies = Lotus::Config::Cookies.new(config, true) + cookies = Hanami::Config::Cookies.new(config, true) cookies.default_options.must_equal({ httponly: true, secure: false }) end it 'disabling httponly' do - cookies = Lotus::Config::Cookies.new(config, httponly: false) + cookies = Hanami::Config::Cookies.new(config, httponly: false) cookies.default_options.must_equal({ httponly: false, secure: false }) end it 'enabling secure by default' do config.scheme 'https' - cookies = Lotus::Config::Cookies.new(config, {}) + cookies = Hanami::Config::Cookies.new(config, {}) cookies.default_options.must_equal({ httponly: true, secure: true }) end it 'disabling secure with scheme https' do config.scheme 'https' - cookies = Lotus::Config::Cookies.new(config, { secure: false }) + cookies = Hanami::Config::Cookies.new(config, { secure: false }) cookies.default_options.must_equal({ httponly: true, secure: false }) end it 'enabling secure with scheme http' do config.scheme 'http' - cookies = Lotus::Config::Cookies.new(config, { secure: true }) + cookies = Hanami::Config::Cookies.new(config, { secure: true }) cookies.default_options.must_equal({ httponly: true, secure: true }) end diff --git a/test/config/framework_configuration_test.rb b/test/config/framework_configuration_test.rb index 673bd7b3..cd5bf70f 100644 --- a/test/config/framework_configuration_test.rb +++ b/test/config/framework_configuration_test.rb @@ -1,10 +1,10 @@ require 'test_helper' -describe Lotus::Config::FrameworkConfiguration do +describe Hanami::Config::FrameworkConfiguration do describe '#__apply' do it 'allows to instantiate without a block' do framework = FakeFrameworkConfiguration.new - config = Lotus::Config::FrameworkConfiguration.new + config = Hanami::Config::FrameworkConfiguration.new config.__apply(framework) @@ -15,7 +15,7 @@ describe Lotus::Config::FrameworkConfiguration do it 'applies block passed to constructor' do expected = '/admin' framework = FakeFrameworkConfiguration.new - config = Lotus::Config::FrameworkConfiguration.new do + config = Hanami::Config::FrameworkConfiguration.new do prefix expected end @@ -28,7 +28,7 @@ describe Lotus::Config::FrameworkConfiguration do it 'applies block passed with __add' do expected = '.rb' framework = FakeFrameworkConfiguration.new - config = Lotus::Config::FrameworkConfiguration.new + config = Hanami::Config::FrameworkConfiguration.new config.__add { suffix expected } config.__apply(framework) @@ -40,7 +40,7 @@ describe Lotus::Config::FrameworkConfiguration do it 'applies Prock passed with __add' do expected = '.css' framework = FakeFrameworkConfiguration.new - config = Lotus::Config::FrameworkConfiguration.new + config = Hanami::Config::FrameworkConfiguration.new config.__add(&Proc.new { suffix expected }) config.__apply(framework) @@ -54,7 +54,7 @@ describe Lotus::Config::FrameworkConfiguration do expected_suffix = '.js' framework = FakeFrameworkConfiguration.new - config = Lotus::Config::FrameworkConfiguration.new do + config = Hanami::Config::FrameworkConfiguration.new do prefix '/admin' suffix expected_suffix end @@ -69,7 +69,7 @@ describe Lotus::Config::FrameworkConfiguration do describe '#__add' do it 'returns self' do - config = Lotus::Config::FrameworkConfiguration.new + config = Hanami::Config::FrameworkConfiguration.new actual = config.__add { } actual.must_equal config diff --git a/test/config/load_paths_test.rb b/test/config/load_paths_test.rb index 6900b548..116a00e6 100644 --- a/test/config/load_paths_test.rb +++ b/test/config/load_paths_test.rb @@ -1,9 +1,9 @@ require 'test_helper' -describe Lotus::Config::LoadPaths do +describe Hanami::Config::LoadPaths do describe '#load!' do it 'recursively loads all the ruby files in the paths' do - paths = Lotus::Config::LoadPaths.new + paths = Hanami::Config::LoadPaths.new paths << '../fixtures/mail_app/app' paths.load!(Pathname(__dir__)) diff --git a/test/config/mapper_test.rb b/test/config/mapper_test.rb index dc0b7e66..66f644ad 100644 --- a/test/config/mapper_test.rb +++ b/test/config/mapper_test.rb @@ -1,10 +1,10 @@ require 'test_helper' -describe Lotus::Config::Mapper do +describe Hanami::Config::Mapper do describe '#to_proc' do describe 'when only path is given' do before do - @mapping = Lotus::Config::Mapper.new(Pathname.new(__dir__), path) + @mapping = Hanami::Config::Mapper.new(Pathname.new(__dir__), path) end describe "and it's nil" do diff --git a/test/config/mapping_test.rb b/test/config/mapping_test.rb index bea9c243..ddd7bb53 100644 --- a/test/config/mapping_test.rb +++ b/test/config/mapping_test.rb @@ -1,10 +1,10 @@ require 'test_helper' -describe Lotus::Config::Mapping do +describe Hanami::Config::Mapping do describe '#to_proc' do describe 'when only path is given' do before do - @mapping = Lotus::Config::Mapping.new(Pathname.new(__dir__), path) + @mapping = Hanami::Config::Mapping.new(Pathname.new(__dir__), path) end describe "and it's nil" do diff --git a/test/config/routes_test.rb b/test/config/routes_test.rb index 0f89aa34..04fdfe40 100644 --- a/test/config/routes_test.rb +++ b/test/config/routes_test.rb @@ -1,10 +1,10 @@ require 'test_helper' -describe Lotus::Config::Routes do +describe Hanami::Config::Routes do describe '#to_proc' do describe 'when only path is given' do before do - @routes = Lotus::Config::Routes.new(Pathname.new(__dir__), path) + @routes = Hanami::Config::Routes.new(Pathname.new(__dir__), path) end describe "and it's nil" do diff --git a/test/config/sessions_test.rb b/test/config/sessions_test.rb index 59f16b72..c78b4a65 100644 --- a/test/config/sessions_test.rb +++ b/test/config/sessions_test.rb @@ -1,14 +1,14 @@ require 'test_helper' -describe Lotus::Config::Sessions do +describe Hanami::Config::Sessions do describe '#enabled?' do it 'is false unless identifier is provided' do - sessions = Lotus::Config::Sessions.new + sessions = Hanami::Config::Sessions.new sessions.wont_be :enabled? end it 'is true when identifier is provided' do - sessions = Lotus::Config::Sessions.new('Cookie') + sessions = Hanami::Config::Sessions.new('Cookie') sessions.must_be :enabled? end end @@ -24,14 +24,14 @@ describe Lotus::Config::Sessions do describe 'provided with class as identifier' do it 'returns class' do - sessions = Lotus::Config::Sessions.new(SessionMiddleware) + sessions = Hanami::Config::Sessions.new(SessionMiddleware) sessions.middleware.must_equal [SessionMiddleware, {}] end end describe 'provided with string as identifier' do it 'returns string' do - sessions = Lotus::Config::Sessions.new('SessionMiddleware') + sessions = Hanami::Config::Sessions.new('SessionMiddleware') sessions.middleware.must_equal ['SessionMiddleware', {}] end end @@ -49,7 +49,7 @@ describe Lotus::Config::Sessions do end it 'returns symbol as class name under Rack::Session namespace' do - sessions = Lotus::Config::Sessions.new(:some_storage) + sessions = Hanami::Config::Sessions.new(:some_storage) sessions.middleware.must_equal ['Rack::Session::SomeStorage', {}] end end @@ -57,7 +57,7 @@ describe Lotus::Config::Sessions do describe 'with options' do it 'returns passed options' do options = { domain: 'example.com' } - sessions = Lotus::Config::Sessions.new('Cookie', options) + sessions = Hanami::Config::Sessions.new('Cookie', options) sessions.middleware.must_equal ['Cookie', options] end end diff --git a/test/configuration_test.rb b/test/configuration_test.rb index 01253320..984598e1 100644 --- a/test/configuration_test.rb +++ b/test/configuration_test.rb @@ -1,18 +1,18 @@ require 'test_helper' -require 'lotus/router' +require 'hanami/router' -describe Lotus::Configuration do +describe Hanami::Configuration do before do module MockApp end ENV['RACK_ENV'] = nil - ENV['LOTUS_ENV'] = nil - ENV['LOTUS_HOST'] = nil - ENV['LOTUS_PORT'] = nil + ENV['HANAMI_ENV'] = nil + ENV['HANAMI_HOST'] = nil + ENV['HANAMI_PORT'] = nil @namespace = MockApp - @configuration = Lotus::Configuration.new + @configuration = Hanami::Configuration.new Dir.chdir($pwd) end @@ -36,12 +36,12 @@ describe Lotus::Configuration do describe 'when ENV is set' do before do - ENV['LOTUS_ENV'] = 'environment' - @configuration = Lotus::Configuration.new + ENV['HANAMI_ENV'] = 'environment' + @configuration = Hanami::Configuration.new end after do - ENV['LOTUS_ENV'] = nil + ENV['HANAMI_ENV'] = nil end it 'sets config based on env' do @@ -239,7 +239,7 @@ describe Lotus::Configuration do it 'sets the routes' do @configuration.routes(&routes) - router = Lotus::Router.new(&@configuration.routes) + router = Hanami::Router.new(&@configuration.routes) router.path(:root).must_equal '/' end end @@ -251,7 +251,7 @@ describe Lotus::Configuration do it 'sets the routes' do @configuration.routes(path) - router = Lotus::Router.new(&@configuration.routes) + router = Hanami::Router.new(&@configuration.routes) router.path(:root).must_equal '/' end end @@ -263,7 +263,7 @@ describe Lotus::Configuration do @configuration.routes(path) -> { - Lotus::Router.new(&@configuration.routes) + Hanami::Router.new(&@configuration.routes) }.must_raise ArgumentError end end @@ -307,8 +307,8 @@ describe Lotus::Configuration do describe '#middleware' do - it 'returns a new instance of Lotus::Middleware' do - @configuration.middleware.must_be_instance_of Lotus::Middleware + it 'returns a new instance of Hanami::Middleware' do + @configuration.middleware.must_be_instance_of Hanami::Middleware end end @@ -319,8 +319,8 @@ describe Lotus::Configuration do # it 'sets the database mapping' do # @configuration.mapping(&mapping) - # mapper = Lotus::Model::Mapper.new(&@configuration.mapping) - # mapper.collection(:customers).must_be_kind_of Lotus::Model::Mapping::Collection + # mapper = Hanami::Model::Mapper.new(&@configuration.mapping) + # mapper.collection(:customers).must_be_kind_of Hanami::Model::Mapping::Collection # end # end @@ -331,8 +331,8 @@ describe Lotus::Configuration do # it 'sets the routes' do # @configuration.mapping(path) - # mapper = Lotus::Model::Mapper.new(&@configuration.mapping) - # mapper.collection(:customers).must_be_kind_of Lotus::Model::Mapping::Collection + # mapper = Hanami::Model::Mapper.new(&@configuration.mapping) + # mapper.collection(:customers).must_be_kind_of Hanami::Model::Mapping::Collection # end # end @@ -343,7 +343,7 @@ describe Lotus::Configuration do # @configuration.mapping(path) # -> { - # Lotus::Model::Mapper.new(&@configuration.mapping) + # Hanami::Model::Mapper.new(&@configuration.mapping) # }.must_raise ArgumentError # end # end @@ -504,7 +504,7 @@ describe Lotus::Configuration do end end - require 'lotus/utils/io' + require 'hanami/utils/io' describe '#default_format' do describe "deprecation" do @@ -518,7 +518,7 @@ describe Lotus::Configuration do describe "when not previously set" do it 'returns :html' do - Lotus::Utils::IO.silence_warnings do + Hanami::Utils::IO.silence_warnings do @configuration.default_format.must_equal :html end end @@ -526,20 +526,20 @@ describe Lotus::Configuration do describe "when set" do before do - Lotus::Utils::IO.silence_warnings do + Hanami::Utils::IO.silence_warnings do @configuration.default_format :json end end it 'returns the value' do - Lotus::Utils::IO.silence_warnings do + Hanami::Utils::IO.silence_warnings do @configuration.default_format.must_equal :json end end end it 'raises an error if the given format cannot be coerced into symbol' do - Lotus::Utils::IO.silence_warnings do + Hanami::Utils::IO.silence_warnings do -> { @configuration.default_format(23) }.must_raise TypeError end end @@ -607,13 +607,13 @@ describe Lotus::Configuration do describe '#host' do before do - ENV['LOTUS_HOST'] = nil - ENV['LOTUS_ENV'] = nil + ENV['HANAMI_HOST'] = nil + ENV['HANAMI_ENV'] = nil end describe "when not previously set" do before do - @configuration = Lotus::Configuration.new + @configuration = Hanami::Configuration.new end it 'defaults to a specific value' do @@ -623,18 +623,18 @@ describe Lotus::Configuration do describe "when the env var is set" do before do - ENV['LOTUS_HOST'] = 'lotustest.org' - @configuration = Lotus::Configuration.new + ENV['HANAMI_HOST'] = 'hanamitest.org' + @configuration = Hanami::Configuration.new end it 'returns that value' do - @configuration.host.must_equal 'lotustest.org' + @configuration.host.must_equal 'hanamitest.org' end end describe "when called with an argument" do it 'sets the value' do - @configuration.host(host = 'lotusrb.org') + @configuration.host(host = 'hanamirb.org') @configuration.host.must_equal host end end @@ -649,12 +649,12 @@ describe Lotus::Configuration do describe "when the env var is set" do before do - ENV['LOTUS_PORT'] = '2306' - @configuration = Lotus::Configuration.new + ENV['HANAMI_PORT'] = '2306' + @configuration = Hanami::Configuration.new end after do - ENV['LOTUS_PORT'] = nil + ENV['HANAMI_PORT'] = nil end it 'returns that value' do @@ -796,7 +796,7 @@ describe Lotus::Configuration do describe '#logger' do describe "when not previously set" do before do - @configuration = Lotus::Configuration.new + @configuration = Hanami::Configuration.new end it 'defaults to nil' do @@ -807,7 +807,7 @@ describe Lotus::Configuration do describe "when the logger is set" do before do @logger = Logger.new(STDOUT) - @configuration = Lotus::Configuration.new + @configuration = Hanami::Configuration.new @configuration.logger @logger end diff --git a/test/container_test.rb b/test/container_test.rb index ebc09c83..5f7e24f1 100644 --- a/test/container_test.rb +++ b/test/container_test.rb @@ -1,61 +1,61 @@ require 'test_helper' require 'rack/mock' -describe Lotus::Container do +describe Hanami::Container do describe '.configure' do before do @blk = -> { mount RackApp, at: '/rack' } - Lotus::Container.configure(&@blk) + Hanami::Container.configure(&@blk) end it 'allows to define mounted applications with a block' do - assert Lotus::Container.class_variable_get(:@@configuration) == @blk, "Expected Lotus::Container configuration to equal @blk" + assert Hanami::Container.class_variable_get(:@@configuration) == @blk, "Expected Hanami::Container configuration to equal @blk" end it 'allows to redefine the configuration' do blk = -> { mount RackApp, at: '/rack2' } - Lotus::Container.configure(&blk) + Hanami::Container.configure(&blk) - assert Lotus::Container.class_variable_get(:@@configuration) == blk, "Expected Lotus::Container configuration to equal blk" + assert Hanami::Container.class_variable_get(:@@configuration) == blk, "Expected Hanami::Container configuration to equal blk" end end describe '#initialize' do describe 'with defined applications' do before do - Lotus::Container.configure do + Hanami::Container.configure do mount RackApp, at: '/rack' end end it 'wraps them in a router' do - routes = Lotus::Container.new.routes - routes.must_be_kind_of(Lotus::Router) + routes = Hanami::Container.new.routes + routes.must_be_kind_of(Hanami::Router) end end describe 'without configuration' do before do - Lotus::Container.remove_class_variable(:@@configuration) rescue nil + Hanami::Container.remove_class_variable(:@@configuration) rescue nil end it 'raises error when initialized' do - exception = -> { Lotus::Container.new }.must_raise ArgumentError - exception.message.must_equal "Lotus::Container doesn't have any application mounted." + exception = -> { Hanami::Container.new }.must_raise ArgumentError + exception.message.must_equal "Hanami::Container doesn't have any application mounted." end end end describe '#call' do before do - Lotus::Container.configure do + Hanami::Container.configure do mount RackApp, at: '/rack' end end it 'forwards calls to inner router' do env = Rack::MockRequest.env_for('/rack', {}) - status, headers, body = Lotus::Container.new.call(env) + status, headers, body = Hanami::Container.new.call(env) status.must_equal 200 headers.must_equal({}) diff --git a/test/controller/csrf_protection_test.rb b/test/controller/csrf_protection_test.rb index c7db26d2..e908575f 100644 --- a/test/controller/csrf_protection_test.rb +++ b/test/controller/csrf_protection_test.rb @@ -1,7 +1,7 @@ require 'test_helper' require 'rack/mock' -describe Lotus::Action::CSRFProtection do +describe Hanami::Action::CSRFProtection do describe "when active" do before do @action = CSRFAction.new @@ -38,15 +38,15 @@ describe Lotus::Action::CSRFProtection do end end - describe "when LOTUS_ENV is 'test'" do + describe "when HANAMI_ENV is 'test'" do before do - @lotus_env = ENV['LOTUS_ENV'] - ENV['LOTUS_ENV'] = 'test' + @hanami_env = ENV['HANAMI_ENV'] + ENV['HANAMI_ENV'] = 'test' @action = Class.new do - include Lotus::Action - include Lotus::Action::Session - include Lotus::Action::CSRFProtection + include Hanami::Action + include Hanami::Action::Session + include Hanami::Action::CSRFProtection configuration.handle_exceptions false @@ -57,7 +57,7 @@ describe Lotus::Action::CSRFProtection do end after do - ENV['LOTUS_ENV'] = @lotus_env + ENV['HANAMI_ENV'] = @hanami_env end [ 'POST', 'PATCH', 'PUT', 'DELETE' ].each do |verb| @@ -70,17 +70,17 @@ describe Lotus::Action::CSRFProtection do end end - describe "when LOTUS_ENV isn't 'test'" do + describe "when HANAMI_ENV isn't 'test'" do before do - @lotus_env = ENV['LOTUS_ENV'] + @hanami_env = ENV['HANAMI_ENV'] @rack_env = ENV['RACK_ENV'] - ENV['LOTUS_ENV'] = 'development' + ENV['HANAMI_ENV'] = 'development' ENV['RACK_ENV'] = 'development' @action = Class.new do - include Lotus::Action - include Lotus::Action::Session - include Lotus::Action::CSRFProtection + include Hanami::Action + include Hanami::Action::Session + include Hanami::Action::CSRFProtection configuration.handle_exceptions false @@ -91,7 +91,7 @@ describe Lotus::Action::CSRFProtection do end after do - ENV['LOTUS_ENV'] = @lotus_env + ENV['HANAMI_ENV'] = @hanami_env ENV['RACK_ENV'] = @rack_env end @@ -99,7 +99,7 @@ describe Lotus::Action::CSRFProtection do it "raises error if token doesn't match (#{ verb })" do env = Rack::MockRequest.env_for('/', method: verb, params: { '_csrf_token' => 'nope' }) - -> { @action.call(env) }.must_raise Lotus::Action::InvalidCSRFTokenError + -> { @action.call(env) }.must_raise Hanami::Action::InvalidCSRFTokenError @action.__send__(:session).must_be :empty? # reset session end end diff --git a/test/env_test.rb b/test/env_test.rb index fabd33be..c5d0778a 100644 --- a/test/env_test.rb +++ b/test/env_test.rb @@ -1,13 +1,13 @@ require 'test_helper' -describe 'Lotus' do +describe 'Hanami' do before do - ENV['LOTUS_ENV'] = 'test' + ENV['HANAMI_ENV'] = 'test' end describe '.env' do it 'returns environment name' do - Lotus.env.must_equal 'test' + Hanami.env.must_equal 'test' end end @@ -16,12 +16,12 @@ describe 'Lotus' do describe 'when single name' do describe 'when environment var is symbol' do it 'returns true' do - Lotus.env?(:test).must_equal true + Hanami.env?(:test).must_equal true end end describe 'when environment var is string' do it 'returns true' do - Lotus.env?("test").must_equal true + Hanami.env?("test").must_equal true end end end @@ -29,18 +29,18 @@ describe 'Lotus' do describe 'when multiple names' do describe 'when environment vars are symbol' do it 'returns true' do - Lotus.env?(:development, :test, :production).must_equal true + Hanami.env?(:development, :test, :production).must_equal true end end describe 'when environment vars are string' do it 'returns true' do - Lotus.env?("development", "test", "production").must_equal true + Hanami.env?("development", "test", "production").must_equal true end end describe 'when environment vars include string and symbol' do it 'returns true' do - Lotus.env?(:development, "test", "production").must_equal true + Hanami.env?(:development, "test", "production").must_equal true end end end @@ -48,18 +48,18 @@ describe 'Lotus' do describe 'when environment is not matched' do before do - ENV['LOTUS_ENV'] = 'development' + ENV['HANAMI_ENV'] = 'development' end describe 'when single name' do describe 'when environment var is symbol' do it 'returns false' do - Lotus.env?(:test).must_equal false + Hanami.env?(:test).must_equal false end end describe 'when environment var is string' do it 'returns false' do - Lotus.env?("test").must_equal false + Hanami.env?("test").must_equal false end end end @@ -67,18 +67,18 @@ describe 'Lotus' do describe 'when multiple names' do describe 'when environment vars are symbol' do it 'returns false' do - Lotus.env?(:test, :production).must_equal false + Hanami.env?(:test, :production).must_equal false end end describe 'when environment vars are string' do it 'returns false' do - Lotus.env?("test", "production").must_equal false + Hanami.env?("test", "production").must_equal false end end describe 'when environment vars include string and symbol' do it 'returns false' do - Lotus.env?(:test, "production").must_equal false + Hanami.env?(:test, "production").must_equal false end end end diff --git a/test/environment_test.rb b/test/environment_test.rb index fa5be931..709ef0f2 100644 --- a/test/environment_test.rb +++ b/test/environment_test.rb @@ -1,11 +1,11 @@ require 'test_helper' -describe Lotus::Environment do +describe Hanami::Environment do before do - ENV['LOTUS_ENV'] = nil + ENV['HANAMI_ENV'] = nil ENV['RACK_ENV'] = nil - ENV['LOTUS_HOST'] = nil - ENV['LOTUS_PORT'] = nil + ENV['HANAMI_HOST'] = nil + ENV['HANAMI_PORT'] = nil ENV['FOO'] = nil ENV['BAZ'] = nil @@ -16,7 +16,7 @@ describe Lotus::Environment do describe 'env vars' do before do Dir.chdir($pwd + '/test/fixtures') - @env = Lotus::Environment.new + @env = Hanami::Environment.new end after do @@ -43,7 +43,7 @@ describe Lotus::Environment do ENV['FOO'] = nil ENV['BAZ'] = nil - @env = Lotus::Environment.new + @env = Hanami::Environment.new end it "doesn't set env vars" do @@ -54,11 +54,11 @@ describe Lotus::Environment do describe 'when the .env for the current environment is missing' do before do - ENV['LOTUS_ENV'] = 'test' + ENV['HANAMI_ENV'] = 'test' ENV['BAZ'] = nil ENV['WAT'] = nil - @env = Lotus::Environment.new + @env = Hanami::Environment.new end it "doesn't set env vars" do @@ -70,7 +70,7 @@ describe Lotus::Environment do describe 'when arguments are passed in' do before do @options = {'a' => 'b'} - @env = Lotus::Environment.new(@options) + @env = Hanami::Environment.new(@options) end it 'does not modify the origin arguments' do @@ -81,10 +81,10 @@ describe Lotus::Environment do end describe '#environment' do - describe "when LOTUS_ENV is set" do + describe "when HANAMI_ENV is set" do before do - ENV['LOTUS_ENV'] = 'test' - @env = Lotus::Environment.new + ENV['HANAMI_ENV'] = 'test' + @env = Hanami::Environment.new end it 'returns that value' do @@ -95,7 +95,7 @@ describe Lotus::Environment do describe "when RACK_ENV is set to 'production'" do before do ENV['RACK_ENV'] = 'production' - @env = Lotus::Environment.new + @env = Hanami::Environment.new end it 'returns that value' do @@ -106,7 +106,7 @@ describe Lotus::Environment do describe "when RACK_ENV is set to 'deployment'" do before do ENV['RACK_ENV'] = 'deployment' - @env = Lotus::Environment.new + @env = Hanami::Environment.new end it 'returns that value' do @@ -116,7 +116,7 @@ describe Lotus::Environment do describe "when none is set" do before do - @env = Lotus::Environment.new + @env = Hanami::Environment.new end it 'defaults to "development"' do @@ -126,25 +126,25 @@ describe Lotus::Environment do describe "when all are set" do before do - ENV['LOTUS_ENV'] = 'test' + ENV['HANAMI_ENV'] = 'test' ENV['RACK_ENV'] = 'production' - @env = Lotus::Environment.new + @env = Hanami::Environment.new end - it 'gives the precedence to LOTUS_ENV' do + it 'gives the precedence to HANAMI_ENV' do @env.environment.must_equal 'test' end end describe "when the env vars change after the initialization" do before do - @env = Lotus::Environment.new + @env = Hanami::Environment.new end it 'always returns the same value' do @env.environment.must_equal 'development' - ENV['LOTUS_ENV'] = 'test' + ENV['HANAMI_ENV'] = 'test' @env.environment.must_equal 'development' end end @@ -154,8 +154,8 @@ describe Lotus::Environment do describe '#environment?' do describe 'when environment is matched' do before do - ENV['LOTUS_ENV'] = 'test' - @env = Lotus::Environment.new + ENV['HANAMI_ENV'] = 'test' + @env = Hanami::Environment.new end describe 'when single name' do @@ -193,8 +193,8 @@ describe Lotus::Environment do describe 'when environment is not matched' do before do - ENV['LOTUS_ENV'] = 'development' - @env = Lotus::Environment.new + ENV['HANAMI_ENV'] = 'development' + @env = Hanami::Environment.new end describe 'when single name' do @@ -233,7 +233,7 @@ describe Lotus::Environment do describe '#bundler_groups' do before do - @env = Lotus::Environment.new + @env = Hanami::Environment.new end it 'returns a set of groups for Bundler' do @@ -245,7 +245,7 @@ describe Lotus::Environment do describe '#config' do describe 'when not specified' do before do - @env = Lotus::Environment.new + @env = Hanami::Environment.new end it 'equals to "config/"' do @@ -256,7 +256,7 @@ describe Lotus::Environment do describe 'when specified' do describe 'and it is relative path' do before do - @env = Lotus::Environment.new(config: 'test') + @env = Hanami::Environment.new(config: 'test') end it 'equals to it' do @@ -267,7 +267,7 @@ describe Lotus::Environment do describe 'and it is absolute path' do before do @path = File.expand_path(__dir__) + '/tmp/config' - @env = Lotus::Environment.new(config: @path) + @env = Hanami::Environment.new(config: @path) end it 'equals to it' do @@ -280,7 +280,7 @@ describe Lotus::Environment do describe '#env_config' do describe 'when not specified' do before do - @env = Lotus::Environment.new + @env = Hanami::Environment.new end it 'equals to "config/environment"' do @@ -291,7 +291,7 @@ describe Lotus::Environment do describe 'when specified' do describe 'and it is relative path' do before do - @env = Lotus::Environment.new(environment: 'env.rb') + @env = Hanami::Environment.new(environment: 'env.rb') end it 'assumes it is located under root' do @@ -302,7 +302,7 @@ describe Lotus::Environment do describe 'and it is absolute path' do before do @path = File.expand_path(__dir__) + '/c/env.rb' - @env = Lotus::Environment.new(environment: @path) + @env = Hanami::Environment.new(environment: @path) end it 'assumes it is located under root' do @@ -315,7 +315,7 @@ describe Lotus::Environment do describe '#rackup' do describe 'when not specified' do before do - @env = Lotus::Environment.new + @env = Hanami::Environment.new end it 'equals to "config.ru"' do @@ -326,7 +326,7 @@ describe Lotus::Environment do describe 'when specified' do describe 'and it is relative path' do before do - @env = Lotus::Environment.new(rackup: 'test.ru') + @env = Hanami::Environment.new(rackup: 'test.ru') end it 'assumes it is located under root' do @@ -337,7 +337,7 @@ describe Lotus::Environment do describe 'and it is absolute path' do before do @path = File.expand_path(__dir__) + '/absolute.ru' - @env = Lotus::Environment.new(rackup: @path) + @env = Hanami::Environment.new(rackup: @path) end it 'assumes it is located under root' do @@ -350,29 +350,29 @@ describe Lotus::Environment do describe '#host' do describe "when the correspoding option is set" do before do - @env = Lotus::Environment.new(host: 'lotusrb.test') + @env = Hanami::Environment.new(host: 'hanamirb.test') end it 'returns that value' do - @env.host.must_equal 'lotusrb.test' + @env.host.must_equal 'hanamirb.test' end end describe "when the corresponding option isn't set" do - describe "and LOTUS_HOST is set" do + describe "and HANAMI_HOST is set" do before do - ENV['LOTUS_HOST'] = 'lotus.host' - @env = Lotus::Environment.new + ENV['HANAMI_HOST'] = 'hanami.host' + @env = Hanami::Environment.new end it 'returns that value' do - @env.host.must_equal 'lotus.host' + @env.host.must_equal 'hanami.host' end end describe "and the current environment is the default one" do before do - @env = Lotus::Environment.new + @env = Hanami::Environment.new end it 'returns localhost' do @@ -382,8 +382,8 @@ describe Lotus::Environment do describe "and the current environment isn't the default" do before do - ENV['LOTUS_ENV'] = 'staging' - @env = Lotus::Environment.new + ENV['HANAMI_ENV'] = 'staging' + @env = Hanami::Environment.new end it 'returns 0.0.0.0' do @@ -393,38 +393,38 @@ describe Lotus::Environment do describe "and all the other env vars are set" do before do - ENV['LOTUS_HOST'] = 'lotushost.test' - ENV['LOTUS_ENV'] = 'test' - @env = Lotus::Environment.new + ENV['HANAMI_HOST'] = 'hanamihost.test' + ENV['HANAMI_ENV'] = 'test' + @env = Hanami::Environment.new end - it 'gives the precedence to LOTUS_HOST' do - @env.host.must_equal 'lotushost.test' + it 'gives the precedence to HANAMI_HOST' do + @env.host.must_equal 'hanamihost.test' end end end describe "when the corresponding option and all the other env vars are set" do before do - ENV['LOTUS_HOST'] = 'lotushost.test' - ENV['LOTUS_ENV'] = 'test' - @env = Lotus::Environment.new(host: 'lotusrb.org') + ENV['HANAMI_HOST'] = 'hanamihost.test' + ENV['HANAMI_ENV'] = 'test' + @env = Hanami::Environment.new(host: 'hanamirb.org') end it 'gives the precedence to the option' do - @env.host.must_equal 'lotusrb.org' + @env.host.must_equal 'hanamirb.org' end end describe "when the env vars change after the initialization" do before do - @env = Lotus::Environment.new + @env = Hanami::Environment.new end it 'always return the same value' do @env.host.must_equal 'localhost' - ENV['LOTUS_HOST'] = 'changedlotushost.org' + ENV['HANAMI_HOST'] = 'changedhanamihost.org' @env.host.must_equal 'localhost' end end @@ -433,7 +433,7 @@ describe Lotus::Environment do describe '#port' do describe "when the correspoding option is set" do before do - @env = Lotus::Environment.new(port: 1234) + @env = Hanami::Environment.new(port: 1234) end it 'returns that value' do @@ -442,10 +442,10 @@ describe Lotus::Environment do end describe "when the corresponding option isn't set" do - describe "and LOTUS_PORT is set" do + describe "and HANAMI_PORT is set" do before do - ENV['LOTUS_PORT'] = '3244' - @env = Lotus::Environment.new + ENV['HANAMI_PORT'] = '3244' + @env = Hanami::Environment.new end it 'returns that value' do @@ -455,7 +455,7 @@ describe Lotus::Environment do describe "and no env vars are set" do before do - @env = Lotus::Environment.new + @env = Hanami::Environment.new end it 'defaults to 2300' do @@ -466,8 +466,8 @@ describe Lotus::Environment do describe "when the corresponding option and all the other env vars are set" do before do - ENV['LOTUS_PORT'] = '8206' - @env = Lotus::Environment.new(port: 2323) + ENV['HANAMI_PORT'] = '8206' + @env = Hanami::Environment.new(port: 2323) end it 'gives the precedence to the option' do @@ -477,13 +477,13 @@ describe Lotus::Environment do describe "when the env vars change after the initialization" do before do - @env = Lotus::Environment.new + @env = Hanami::Environment.new end it 'always return the same value' do @env.port.must_equal 2300 - ENV['LOTUS_PORT'] = '1223' + ENV['HANAMI_PORT'] = '1223' @env.port.must_equal 2300 end end @@ -493,7 +493,7 @@ describe Lotus::Environment do describe 'when not specified' do describe 'in the default env' do before do - @env = Lotus::Environment.new + @env = Hanami::Environment.new end it 'returns true' do @@ -503,8 +503,8 @@ describe Lotus::Environment do describe 'with a specified env (development)' do before do - ENV['LOTUS_ENV'] = 'development' - @env = Lotus::Environment.new + ENV['HANAMI_ENV'] = 'development' + @env = Hanami::Environment.new end it 'returns true' do @@ -515,8 +515,8 @@ describe Lotus::Environment do describe 'with a specified env (test)' do before do - ENV['LOTUS_ENV'] = 'test' - @env = Lotus::Environment.new + ENV['HANAMI_ENV'] = 'test' + @env = Hanami::Environment.new end it 'returns true' do @@ -529,7 +529,7 @@ describe Lotus::Environment do describe 'when specified' do describe 'with false' do before do - @env = Lotus::Environment.new(code_reloading: false) + @env = Hanami::Environment.new(code_reloading: false) end it 'returns false' do @@ -539,7 +539,7 @@ describe Lotus::Environment do describe 'with true' do before do - @env = Lotus::Environment.new(code_reloading: true) + @env = Hanami::Environment.new(code_reloading: true) end it 'returns true' do @@ -549,13 +549,13 @@ describe Lotus::Environment do end end - describe 'lotusrc' do + describe 'hanamirc' do describe 'with existing file' do before do @old_pwd = Dir.pwd - # This .lotusrc has test=minitest - path = Pathname.new('test/fixtures/lotusrc/exists') + # This .hanamirc has test=minitest + path = Pathname.new('test/fixtures/hanamirc/exists') path.mkpath Dir.chdir(path) end @@ -565,13 +565,13 @@ describe Lotus::Environment do end it 'uses defaults if no inline args' do - env = Lotus::Environment.new + env = Hanami::Environment.new env.to_options.fetch(:test).must_equal 'minitest' end it 'gives priority to inline args' do - # Simulate lotus new bookshelf --test=rspec - env = Lotus::Environment.new(test: 'rspec') + # Simulate hanami new bookshelf --test=rspec + env = Hanami::Environment.new(test: 'rspec') env.to_options.fetch(:test).must_equal 'rspec' end end @@ -580,12 +580,12 @@ describe Lotus::Environment do before do @old_pwd = Dir.pwd - path = Pathname.new('test/fixtures/lotusrc/no_exists') + path = Pathname.new('test/fixtures/hanamirc/no_exists') path.mkpath Dir.chdir(path) - @env = Lotus::Environment.new + @env = Hanami::Environment.new end after do @@ -593,13 +593,13 @@ describe Lotus::Environment do end it 'uses defaults if no inline args' do - env = Lotus::Environment.new + env = Hanami::Environment.new env.to_options.fetch(:test).must_equal 'minitest' end it 'gives priority to inline args' do - # Simulate lotus new bookshelf --test=rspec - env = Lotus::Environment.new(test: 'rspec') + # Simulate hanami new bookshelf --test=rspec + env = Hanami::Environment.new(test: 'rspec') env.to_options.fetch(:test).must_equal 'rspec' end end @@ -608,17 +608,17 @@ describe Lotus::Environment do describe '#to_options' do before do @old_pwd = Dir.pwd - path = Pathname.new('test/fixtures/lotusrc/exists') + path = Pathname.new('test/fixtures/hanamirc/exists') path.mkpath Dir.chdir(path) - @env = Lotus::Environment.new + @env = Hanami::Environment.new end after do Dir.chdir @old_pwd end - it 'lotusrc merge options in environemnt options' do + it 'hanamirc merge options in environemnt options' do options = @env.to_options options[:architecture].must_equal 'container' options[:test].must_equal 'minitest' diff --git a/test/fixtures.rb b/test/fixtures.rb index 6f5beed8..58ea9f73 100644 --- a/test/fixtures.rb +++ b/test/fixtures.rb @@ -1,5 +1,5 @@ -require 'lotus/model' -require 'lotus/mailer' +require 'hanami/model' +require 'hanami/mailer' class FakeFrameworkConfiguration def prefix(value = nil) @@ -20,17 +20,17 @@ class FakeFrameworkConfiguration end class Order - include Lotus::Entity + include Hanami::Entity attributes :size, :coffee, :qty end class OrderRepository - include Lotus::Repository + include Hanami::Repository end module CoffeeShop - class Application < Lotus::Application + class Application < Hanami::Application configure do root Pathname.new(File.dirname(__FILE__)).join('../tmp/coffee_shop') layout nil @@ -41,7 +41,7 @@ module CoffeeShop default_response_format :html scheme 'https' - host 'lotus-coffeeshop.org' + host 'hanami-coffeeshop.org' routes do get '/', to: ->{}, as: :root @@ -63,7 +63,7 @@ module CoffeeShop end module Reviews - class Application < Lotus::Application + class Application < Hanami::Application configure do routes do get '/', to: ->{}, as: :root @@ -86,7 +86,7 @@ module Backend end end -class TinyApp < Lotus::Application +class TinyApp < Hanami::Application configure do routes do get '/', to: 'home#index' @@ -95,9 +95,9 @@ class TinyApp < Lotus::Application end class CSRFAction - include Lotus::Action - include Lotus::Action::Session - include Lotus::Action::CSRFProtection + include Hanami::Action + include Hanami::Action::Session + include Hanami::Action::CSRFProtection configuration.handle_exceptions false @@ -127,14 +127,14 @@ class CSRFAction end end -class FilteredParams < Lotus::Action::Params +class FilteredParams < Hanami::Action::Params param :name end class FilteredCSRFAction - include Lotus::Action - include Lotus::Action::Session - include Lotus::Action::CSRFProtection + include Hanami::Action + include Hanami::Action::Session + include Hanami::Action::CSRFProtection expose :csrf_token @@ -161,9 +161,9 @@ class FilteredCSRFAction end class DisabledCSRFAction - include Lotus::Action - include Lotus::Action::Session - include Lotus::Action::CSRFProtection + include Hanami::Action + include Hanami::Action::Session + include Hanami::Action::CSRFProtection def call(env) # ... @@ -177,7 +177,7 @@ class DisabledCSRFAction end module ForceSslApp - class Application < Lotus::Application + class Application < Hanami::Application configure do force_ssl true @@ -206,7 +206,7 @@ module ForceSslApp end module ContainerForceSsl - class Application < Lotus::Application + class Application < Hanami::Application configure do routes do get '/', to: 'home#show' @@ -234,7 +234,7 @@ module ContainerForceSsl end module ContainerNoForceSsl - class Application < Lotus::Application + class Application < Hanami::Application configure do routes do get '/', to: 'home#show' @@ -258,7 +258,7 @@ module ContainerNoForceSsl end module Back - class Application < Lotus::Application + class Application < Hanami::Application configure do routes do get '/home', to: 'home#show', as: :home @@ -271,7 +271,7 @@ module Back module Controllers module Home class Show - include Lotus::Action + include Hanami::Action def call(params) self.body = 'hello Back' @@ -280,7 +280,7 @@ module Back end module Users class Index - include Lotus::Action + include Hanami::Action def call(params) self.body = 'hello from Back users endpoint' @@ -289,7 +289,7 @@ module Back end module Articles class Index - include Lotus::Action + include Hanami::Action def call(params) self.body = request.url @@ -300,7 +300,7 @@ module Back end module Front - class Application < Lotus::Application + class Application < Hanami::Application configure do routes do get '/home', to: 'home#show', as: :home @@ -311,7 +311,7 @@ module Front module Controllers module Home class Show - include Lotus::Action + include Hanami::Action def call(params) self.body = 'hello Front' diff --git a/test/fixtures/.env b/test/fixtures/.env index 4fca57d7..5ab08dc1 100644 --- a/test/fixtures/.env +++ b/test/fixtures/.env @@ -1,3 +1,3 @@ FOO="bar" BAZ="no" -LOTUS_PORT=42 +HANAMI_PORT=42 diff --git a/test/fixtures/lotusrc/with_minitest b/test/fixtures/.hanamirc similarity index 100% rename from test/fixtures/lotusrc/with_minitest rename to test/fixtures/.hanamirc diff --git a/test/fixtures/body_parsers/.hanamirc b/test/fixtures/body_parsers/.hanamirc new file mode 100644 index 00000000..e6018c23 --- /dev/null +++ b/test/fixtures/body_parsers/.hanamirc @@ -0,0 +1,3 @@ +architecture=container +test=minitest +template=erb diff --git a/test/fixtures/body_parsers/application.rb b/test/fixtures/body_parsers/application.rb index 4a750bcb..17843762 100644 --- a/test/fixtures/body_parsers/application.rb +++ b/test/fixtures/body_parsers/application.rb @@ -1,7 +1,7 @@ require 'rexml/document' -require 'lotus/routing/parsing/parser' +require 'hanami/routing/parsing/parser' -class XmlParser < Lotus::Routing::Parsing::Parser +class XmlParser < Hanami::Routing::Parsing::Parser def mime_types ['application/xml', 'text/xml'] end @@ -17,7 +17,7 @@ class XmlParser < Lotus::Routing::Parsing::Parser end module BodyParsersApp - class Application < Lotus::Application + class Application < Hanami::Application configure do body_parsers :json, XmlParser.new diff --git a/test/fixtures/cdn/cdn/Gemfile b/test/fixtures/cdn/cdn/Gemfile index 4c043efd..845bc353 100644 --- a/test/fixtures/cdn/cdn/Gemfile +++ b/test/fixtures/cdn/cdn/Gemfile @@ -2,16 +2,16 @@ source 'https://rubygems.org' gem 'bundler' gem 'rake' -gem 'lotus-utils', require: false, github: 'lotus/utils' -gem 'lotus-router', require: false, github: 'lotus/router' -gem 'lotus-validations', require: false, github: 'lotus/validations' -gem 'lotus-helpers', require: false, github: 'lotus/helpers' -gem 'lotus-controller', require: false, github: 'lotus/controller' -gem 'lotus-view', require: false, github: 'lotus/view' -gem 'lotus-model', require: false, github: 'lotus/model' -gem 'lotus-mailer', require: false, github: 'lotus/mailer' -gem 'lotus-assets', require: false, github: 'lotus/assets' -gem 'lotusrb', path: '../../../..' +gem 'hanami-utils', require: false, github: 'hanami/utils' +gem 'hanami-router', require: false, github: 'hanami/router' +gem 'hanami-validations', require: false, github: 'hanami/validations' +gem 'hanami-helpers', require: false, github: 'hanami/helpers' +gem 'hanami-controller', require: false, github: 'hanami/controller' +gem 'hanami-view', require: false, github: 'hanami/view' +gem 'hanami-model', require: false, github: 'hanami/model' +gem 'hanami-mailer', require: false, github: 'hanami/mailer' +gem 'hanami-assets', require: false, github: 'hanami/assets' +gem 'hanami', path: '../../../..' group :test do gem 'minitest' diff --git a/test/fixtures/cdn/cdn/apps/web/application.rb b/test/fixtures/cdn/cdn/apps/web/application.rb index 70759786..88474f7e 100644 --- a/test/fixtures/cdn/cdn/apps/web/application.rb +++ b/test/fixtures/cdn/cdn/apps/web/application.rb @@ -1,8 +1,8 @@ -require 'lotus/helpers' -require 'lotus/assets' +require 'hanami/helpers' +require 'hanami/assets' module Web - class Application < Lotus::Application + class Application < Hanami::Application configure do ## # BASIC @@ -23,7 +23,7 @@ module Web # Handle exceptions with HTTP statuses (true) or don't catch them (false). # Defaults to true. - # See: http://www.rubydoc.info/gems/lotus-controller/#Exceptions_management + # See: http://www.rubydoc.info/gems/hanami-controller/#Exceptions_management # # handle_exceptions true @@ -32,7 +32,7 @@ module Web # # Routes definitions for this application - # See: http://www.rubydoc.info/gems/lotus-router#Usage + # See: http://www.rubydoc.info/gems/hanami-router#Usage # routes 'config/routes' @@ -186,7 +186,7 @@ module Web # Configure the code that will yield each time Web::Action is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-controller#Configuration + # See: http://www.rubydoc.info/gems/hanami-controller#Configuration controller.prepare do # include MyAuthentication # included in all the actions # before :authenticate! # run an authentication before callback @@ -195,9 +195,9 @@ module Web # Configure the code that will yield each time Web::View is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-view#Configuration + # See: http://www.rubydoc.info/gems/hanami-view#Configuration view.prepare do - include Lotus::Helpers + include Hanami::Helpers include Web::Assets::Helpers end end @@ -229,17 +229,17 @@ module Web assets do # Don't compile static assets in production mode (eg. Sass, ES6) # - # See: http://www.rubydoc.info/gems/lotus-assets#Configuration + # See: http://www.rubydoc.info/gems/hanami-assets#Configuration compile false # Use digest file name for asset paths # - # See: http://lotusrb.org/guides/assets/digest + # See: http://hanamirb.org/guides/assets/digest digest true # Content Delivery Network (CDN) # - # See: http://lotusrb.org/guides/assets/content-delivery-network + # See: http://hanamirb.org/guides/assets/content-delivery-network # scheme 'https' host 'cdn.example.org' diff --git a/test/fixtures/cdn/cdn/config.ru b/test/fixtures/cdn/cdn/config.ru index 8a3577bb..a9db2fb5 100644 --- a/test/fixtures/cdn/cdn/config.ru +++ b/test/fixtures/cdn/cdn/config.ru @@ -1,3 +1,3 @@ require './config/environment' -run Lotus::Container.new +run Hanami::Container.new diff --git a/test/fixtures/cdn/cdn/config/environment.rb b/test/fixtures/cdn/cdn/config/environment.rb index ec2af48f..e8d4c164 100644 --- a/test/fixtures/cdn/cdn/config/environment.rb +++ b/test/fixtures/cdn/cdn/config/environment.rb @@ -1,9 +1,9 @@ require 'rubygems' require 'bundler/setup' -require 'lotus/setup' +require 'hanami/setup' require_relative '../lib/cdn' require_relative '../apps/web/application' -Lotus::Container.configure do +Hanami::Container.configure do mount Web::Application, at: '/' end diff --git a/test/fixtures/cdn/cdn/spec/features_helper.rb b/test/fixtures/cdn/cdn/spec/features_helper.rb index 8ff1d023..0fed7124 100644 --- a/test/fixtures/cdn/cdn/spec/features_helper.rb +++ b/test/fixtures/cdn/cdn/spec/features_helper.rb @@ -4,7 +4,7 @@ require_relative './spec_helper' require 'capybara' require 'capybara/dsl' -Capybara.app = Lotus::Container.new +Capybara.app = Hanami::Container.new class MiniTest::Spec include Capybara::DSL diff --git a/test/fixtures/cdn/cdn/spec/spec_helper.rb b/test/fixtures/cdn/cdn/spec/spec_helper.rb index ee100aac..09bd2290 100644 --- a/test/fixtures/cdn/cdn/spec/spec_helper.rb +++ b/test/fixtures/cdn/cdn/spec/spec_helper.rb @@ -1,7 +1,7 @@ # Require this file for unit tests -ENV['LOTUS_ENV'] ||= 'test' +ENV['HANAMI_ENV'] ||= 'test' require_relative '../config/environment' require 'minitest/autorun' -Lotus::Application.preload! +Hanami::Application.preload! diff --git a/test/fixtures/cdn/cdn/spec/web/views/home/index_spec.rb b/test/fixtures/cdn/cdn/spec/web/views/home/index_spec.rb index b217559d..7a9be8d9 100644 --- a/test/fixtures/cdn/cdn/spec/web/views/home/index_spec.rb +++ b/test/fixtures/cdn/cdn/spec/web/views/home/index_spec.rb @@ -3,7 +3,7 @@ require_relative '../../../../apps/web/views/home/index' describe Web::Views::Home::Index do let(:exposures) { Hash[foo: 'bar'] } - let(:template) { Lotus::View::Template.new('apps/web/templates/home/index.html.erb') } + let(:template) { Hanami::View::Template.new('apps/web/templates/home/index.html.erb') } let(:view) { Web::Views::Home::Index.new(template, exposures) } let(:rendered) { view.render } diff --git a/test/fixtures/cdn/cdn_app/Gemfile b/test/fixtures/cdn/cdn_app/Gemfile index 4c043efd..845bc353 100644 --- a/test/fixtures/cdn/cdn_app/Gemfile +++ b/test/fixtures/cdn/cdn_app/Gemfile @@ -2,16 +2,16 @@ source 'https://rubygems.org' gem 'bundler' gem 'rake' -gem 'lotus-utils', require: false, github: 'lotus/utils' -gem 'lotus-router', require: false, github: 'lotus/router' -gem 'lotus-validations', require: false, github: 'lotus/validations' -gem 'lotus-helpers', require: false, github: 'lotus/helpers' -gem 'lotus-controller', require: false, github: 'lotus/controller' -gem 'lotus-view', require: false, github: 'lotus/view' -gem 'lotus-model', require: false, github: 'lotus/model' -gem 'lotus-mailer', require: false, github: 'lotus/mailer' -gem 'lotus-assets', require: false, github: 'lotus/assets' -gem 'lotusrb', path: '../../../..' +gem 'hanami-utils', require: false, github: 'hanami/utils' +gem 'hanami-router', require: false, github: 'hanami/router' +gem 'hanami-validations', require: false, github: 'hanami/validations' +gem 'hanami-helpers', require: false, github: 'hanami/helpers' +gem 'hanami-controller', require: false, github: 'hanami/controller' +gem 'hanami-view', require: false, github: 'hanami/view' +gem 'hanami-model', require: false, github: 'hanami/model' +gem 'hanami-mailer', require: false, github: 'hanami/mailer' +gem 'hanami-assets', require: false, github: 'hanami/assets' +gem 'hanami', path: '../../../..' group :test do gem 'minitest' diff --git a/test/fixtures/cdn/cdn_app/config/application.rb b/test/fixtures/cdn/cdn_app/config/application.rb index 5fe1f8eb..a023ccb6 100644 --- a/test/fixtures/cdn/cdn_app/config/application.rb +++ b/test/fixtures/cdn/cdn_app/config/application.rb @@ -1,8 +1,8 @@ -require 'lotus/helpers' -require 'lotus/assets' +require 'hanami/helpers' +require 'hanami/assets' module CdnApp - class Application < Lotus::Application + class Application < Hanami::Application configure do ## # BASIC @@ -23,7 +23,7 @@ module CdnApp # Handle exceptions with HTTP statuses (true) or don't catch them (false). # Defaults to true. - # See: http://www.rubydoc.info/gems/lotus-controller/ + # See: http://www.rubydoc.info/gems/hanami-controller/ # Exceptions_management # @@ -34,7 +34,7 @@ module CdnApp # # Routes definitions for this application - # See: http://www.rubydoc.info/gems/lotus-router#Usage + # See: http://www.rubydoc.info/gems/hanami-router#Usage # routes 'config/routes' @@ -183,7 +183,7 @@ module CdnApp # Configure the code that will yield each time CdnApp::Action is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-controller#Configuration + # See: http://www.rubydoc.info/gems/hanami-controller#Configuration controller.prepare do # include MyAuthentication # included in all the actions # before :authenticate! # run an authentication before callback @@ -192,9 +192,9 @@ module CdnApp # Configure the code that will yield each time CdnApp::View is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-view#Configuration + # See: http://www.rubydoc.info/gems/hanami-view#Configuration view.prepare do - include Lotus::Helpers + include Hanami::Helpers include CdnApp::Assets::Helpers end end @@ -226,17 +226,17 @@ module CdnApp assets do # Don't compile static assets in production mode (eg. Sass, ES6) # - # See: http://www.rubydoc.info/gems/lotus-assets#Configuration + # See: http://www.rubydoc.info/gems/hanami-assets#Configuration compile false # Use digest file name for asset paths # - # See: http://lotusrb.org/guides/assets/digest + # See: http://hanamirb.org/guides/assets/digest digest true # Content Delivery Network (CDN) # - # See: http://lotusrb.org/guides/assets/content-delivery-network + # See: http://hanamirb.org/guides/assets/content-delivery-network # scheme 'https' host 'cdn.example.org' diff --git a/test/fixtures/cdn/cdn_app/config/environment.rb b/test/fixtures/cdn/cdn_app/config/environment.rb index 85aa6f93..9a590f8f 100644 --- a/test/fixtures/cdn/cdn_app/config/environment.rb +++ b/test/fixtures/cdn/cdn_app/config/environment.rb @@ -1,5 +1,5 @@ require 'rubygems' require 'bundler/setup' -require 'lotus/setup' +require 'hanami/setup' require_relative '../lib/cdn_app' require_relative '../config/application' diff --git a/test/fixtures/cdn/cdn_app/config/routes.rb b/test/fixtures/cdn/cdn_app/config/routes.rb index 0a484459..e63d24d1 100644 --- a/test/fixtures/cdn/cdn_app/config/routes.rb +++ b/test/fixtures/cdn/cdn_app/config/routes.rb @@ -1,3 +1,3 @@ get '/', to: 'home#index' # Configure your routes here -# See: http://www.rubydoc.info/gems/lotus-router/#Usage +# See: http://www.rubydoc.info/gems/hanami-router/#Usage diff --git a/test/fixtures/cdn/cdn_app/spec/spec_helper.rb b/test/fixtures/cdn/cdn_app/spec/spec_helper.rb index ee100aac..09bd2290 100644 --- a/test/fixtures/cdn/cdn_app/spec/spec_helper.rb +++ b/test/fixtures/cdn/cdn_app/spec/spec_helper.rb @@ -1,7 +1,7 @@ # Require this file for unit tests -ENV['LOTUS_ENV'] ||= 'test' +ENV['HANAMI_ENV'] ||= 'test' require_relative '../config/environment' require 'minitest/autorun' -Lotus::Application.preload! +Hanami::Application.preload! diff --git a/test/fixtures/cdn/cdn_app/spec/views/home/index_spec.rb b/test/fixtures/cdn/cdn_app/spec/views/home/index_spec.rb index d16276bd..54165749 100644 --- a/test/fixtures/cdn/cdn_app/spec/views/home/index_spec.rb +++ b/test/fixtures/cdn/cdn_app/spec/views/home/index_spec.rb @@ -3,7 +3,7 @@ require_relative '../../../app/views/home/index' describe CdnApp::Views::Home::Index do let(:exposures) { Hash[foo: 'bar'] } - let(:template) { Lotus::View::Template.new('app/templates/home/index.html.erb') } + let(:template) { Hanami::View::Template.new('app/templates/home/index.html.erb') } let(:view) { CdnApp::Views::Home::Index.new(template, exposures) } let(:rendered) { view.render } diff --git a/test/fixtures/collaboration/apps/web/app/entities/book.rb b/test/fixtures/collaboration/apps/web/app/entities/book.rb index 6e7f4d82..ab82e0ef 100644 --- a/test/fixtures/collaboration/apps/web/app/entities/book.rb +++ b/test/fixtures/collaboration/apps/web/app/entities/book.rb @@ -1,5 +1,5 @@ class Book - include Lotus::Entity + include Hanami::Entity attributes :name end diff --git a/test/fixtures/collaboration/apps/web/app/repositories/book_repository.rb b/test/fixtures/collaboration/apps/web/app/repositories/book_repository.rb index 5fc153e5..9a22dde4 100644 --- a/test/fixtures/collaboration/apps/web/app/repositories/book_repository.rb +++ b/test/fixtures/collaboration/apps/web/app/repositories/book_repository.rb @@ -1,3 +1,3 @@ class BookRepository - include Lotus::Repository + include Hanami::Repository end diff --git a/test/fixtures/collaboration/apps/web/app/views/application_layout.rb b/test/fixtures/collaboration/apps/web/app/views/application_layout.rb index f603de6f..bcda4bbd 100644 --- a/test/fixtures/collaboration/apps/web/app/views/application_layout.rb +++ b/test/fixtures/collaboration/apps/web/app/views/application_layout.rb @@ -1,3 +1,3 @@ class Collaboration::Views::ApplicationLayout - include Lotus::Layout + include Hanami::Layout end diff --git a/test/fixtures/collaboration/apps/web/application.rb b/test/fixtures/collaboration/apps/web/application.rb index 5bc00da0..0d3a3984 100644 --- a/test/fixtures/collaboration/apps/web/application.rb +++ b/test/fixtures/collaboration/apps/web/application.rb @@ -1,9 +1,9 @@ -require 'lotus' -require 'lotus/model' -require 'lotus/helpers' +require 'hanami' +require 'hanami/model' +require 'hanami/helpers' require 'securerandom' -ADAPTER_TYPE = if Lotus::Utils.jruby? +ADAPTER_TYPE = if Hanami::Utils.jruby? require 'jdbc/sqlite3' Jdbc::SQLite3.load_driver @@ -14,7 +14,7 @@ ADAPTER_TYPE = if Lotus::Utils.jruby? 'sqlite' end -require 'lotus/model/adapters/sql_adapter' +require 'hanami/model/adapters/sql_adapter' db = Pathname.new(File.dirname(__FILE__)).join('../tmp/test.sqlite3') db.dirname.mkpath # create directory if not exist @@ -30,7 +30,7 @@ DB.create_table :books do end module Collaboration - class Application < Lotus::Application + class Application < Hanami::Application configure do layout :application load_paths << 'app' @@ -54,12 +54,12 @@ module Collaboration # security.content_security_policy "connect-src 'self'" view.prepare do - include Lotus::Helpers + include Hanami::Helpers include Collaboration::Assets::Helpers end controller.prepare do - # Always run CSRF Protection when running full stack integration specs, even when LOTUS_ENV is set to + # Always run CSRF Protection when running full stack integration specs, even when HANAMI_ENV is set to # test (it may happen depending on the order of specs and the way minitest works) before :set_csrf_token, :verify_csrf_token diff --git a/test/fixtures/collaboration/apps/web/assets/javascripts/application.js b/test/fixtures/collaboration/apps/web/assets/javascripts/application.js index 2ceb2a94..cad48d23 100644 --- a/test/fixtures/collaboration/apps/web/assets/javascripts/application.js +++ b/test/fixtures/collaboration/apps/web/assets/javascripts/application.js @@ -1 +1 @@ -alert("Lotus!"); +alert("Hanami!"); diff --git a/test/fixtures/collaboration/apps/web/vendor/another_assets_path/bar.js b/test/fixtures/collaboration/apps/web/vendor/another_assets_path/bar.js index 18d1624c..bb7a0659 100644 --- a/test/fixtures/collaboration/apps/web/vendor/another_assets_path/bar.js +++ b/test/fixtures/collaboration/apps/web/vendor/another_assets_path/bar.js @@ -1 +1 @@ -alert('Lotus!'); \ No newline at end of file +alert('Hanami!'); \ No newline at end of file diff --git a/test/fixtures/collaboration/vendor/assets/hanami.js b/test/fixtures/collaboration/vendor/assets/hanami.js new file mode 100644 index 00000000..67c0d152 --- /dev/null +++ b/test/fixtures/collaboration/vendor/assets/hanami.js @@ -0,0 +1 @@ +alert('hanami!'); \ No newline at end of file diff --git a/test/fixtures/collaboration/vendor/assets/lotus.js b/test/fixtures/collaboration/vendor/assets/lotus.js deleted file mode 100644 index d900ead3..00000000 --- a/test/fixtures/collaboration/vendor/assets/lotus.js +++ /dev/null @@ -1 +0,0 @@ -alert('lotus!'); \ No newline at end of file diff --git a/test/fixtures/commands/application/new_app/Gemfile.minitest b/test/fixtures/commands/application/new_app/Gemfile.minitest index 66b3c86c..d5de00cb 100644 --- a/test/fixtures/commands/application/new_app/Gemfile.minitest +++ b/test/fixtures/commands/application/new_app/Gemfile.minitest @@ -3,8 +3,8 @@ source 'https://rubygems.org' gem 'bundler' gem 'rake' -gem 'lotusrb', '0.6.1' -gem 'lotus-model', '~> 0.5' +gem 'hanami', '0.7.0' +gem 'hanami-model', '~> 0.5' group :test do diff --git a/test/fixtures/commands/application/new_app/Gemfile.rspec b/test/fixtures/commands/application/new_app/Gemfile.rspec index 7e945599..49924d5b 100644 --- a/test/fixtures/commands/application/new_app/Gemfile.rspec +++ b/test/fixtures/commands/application/new_app/Gemfile.rspec @@ -3,8 +3,8 @@ source 'https://rubygems.org' gem 'bundler' gem 'rake' -gem 'lotusrb', '0.6.1' -gem 'lotus-model', '~> 0.5' +gem 'hanami', '0.7.0' +gem 'hanami-model', '~> 0.5' group :test do diff --git a/test/fixtures/commands/application/new_app/Rakefile.minitest b/test/fixtures/commands/application/new_app/Rakefile.minitest index 0bc82960..554937b4 100644 --- a/test/fixtures/commands/application/new_app/Rakefile.minitest +++ b/test/fixtures/commands/application/new_app/Rakefile.minitest @@ -1,5 +1,5 @@ require 'rake' -require 'lotus/rake_tasks' +require 'hanami/rake_tasks' require 'rake/testtask' Rake::TestTask.new do |t| diff --git a/test/fixtures/commands/application/new_app/Rakefile.rspec b/test/fixtures/commands/application/new_app/Rakefile.rspec index 95423250..c8493fe2 100644 --- a/test/fixtures/commands/application/new_app/Rakefile.rspec +++ b/test/fixtures/commands/application/new_app/Rakefile.rspec @@ -1,5 +1,5 @@ require 'rake' -require 'lotus/rake_tasks' +require 'hanami/rake_tasks' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) diff --git a/test/fixtures/commands/application/new_app/config/application.rb b/test/fixtures/commands/application/new_app/config/application.rb index 88aa5a04..0fa1c5ad 100644 --- a/test/fixtures/commands/application/new_app/config/application.rb +++ b/test/fixtures/commands/application/new_app/config/application.rb @@ -1,8 +1,8 @@ -require 'lotus/helpers' -require 'lotus/assets' +require 'hanami/helpers' +require 'hanami/assets' module NewApp - class Application < Lotus::Application + class Application < Hanami::Application configure do ## # BASIC @@ -23,7 +23,7 @@ module NewApp # Handle exceptions with HTTP statuses (true) or don't catch them (false). # Defaults to true. - # See: http://www.rubydoc.info/gems/lotus-controller/ + # See: http://www.rubydoc.info/gems/hanami-controller/ # Exceptions_management # @@ -34,7 +34,7 @@ module NewApp # # Routes definitions for this application - # See: http://www.rubydoc.info/gems/lotus-router#Usage + # See: http://www.rubydoc.info/gems/hanami-router#Usage # routes 'config/routes' @@ -124,7 +124,7 @@ module NewApp # * :yui # * :closure # - # See: http://lotusrb.org/guides/assets/compressors + # See: http://hanamirb.org/guides/assets/compressors # # In order to skip JavaScript compression comment the following line javascript_compressor :builtin @@ -137,7 +137,7 @@ module NewApp # * :yui # * :sass # - # See: http://lotusrb.org/guides/assets/compressors + # See: http://hanamirb.org/guides/assets/compressors # # In order to skip stylesheet compression comment the following line stylesheet_compressor :builtin @@ -206,7 +206,7 @@ module NewApp # Configure the code that will yield each time NewApp::Action is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-controller#Configuration + # See: http://www.rubydoc.info/gems/hanami-controller#Configuration controller.prepare do # include MyAuthentication # included in all the actions # before :authenticate! # run an authentication before callback @@ -215,9 +215,9 @@ module NewApp # Configure the code that will yield each time NewApp::View is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-view#Configuration + # See: http://www.rubydoc.info/gems/hanami-view#Configuration view.prepare do - include Lotus::Helpers + include Hanami::Helpers include NewApp::Assets::Helpers end end @@ -249,17 +249,17 @@ module NewApp assets do # Don't compile static assets in production mode (eg. Sass, ES6) # - # See: http://www.rubydoc.info/gems/lotus-assets#Configuration + # See: http://www.rubydoc.info/gems/hanami-assets#Configuration compile false # Use digest file name for asset paths # - # See: http://lotusrb.org/guides/assets/digest + # See: http://hanamirb.org/guides/assets/digest digest true # Content Delivery Network (CDN) # - # See: http://lotusrb.org/guides/assets/content-delivery-network + # See: http://hanamirb.org/guides/assets/content-delivery-network # # scheme 'https' # host 'cdn.example.org' diff --git a/test/fixtures/commands/application/new_app/config/environment.rb b/test/fixtures/commands/application/new_app/config/environment.rb index 11223fc1..22665c29 100644 --- a/test/fixtures/commands/application/new_app/config/environment.rb +++ b/test/fixtures/commands/application/new_app/config/environment.rb @@ -1,5 +1,5 @@ require 'rubygems' require 'bundler/setup' -require 'lotus/setup' +require 'hanami/setup' require_relative '../lib/new_app' require_relative '../config/application' diff --git a/test/fixtures/commands/application/new_app/config/routes.rb b/test/fixtures/commands/application/new_app/config/routes.rb index 9050f88f..fa85d5d3 100644 --- a/test/fixtures/commands/application/new_app/config/routes.rb +++ b/test/fixtures/commands/application/new_app/config/routes.rb @@ -1,2 +1,2 @@ # Configure your routes here -# See: http://www.rubydoc.info/gems/lotus-router/#Usage +# See: http://www.rubydoc.info/gems/hanami-router/#Usage diff --git a/test/fixtures/commands/application/new_app/lib/new_app.rb b/test/fixtures/commands/application/new_app/lib/new_app.rb index d6e489c4..2fd8c05d 100644 --- a/test/fixtures/commands/application/new_app/lib/new_app.rb +++ b/test/fixtures/commands/application/new_app/lib/new_app.rb @@ -1,8 +1,8 @@ -require 'lotus/model' -require 'lotus/mailer' +require 'hanami/model' +require 'hanami/mailer' Dir["#{ __dir__ }/new_app/**/*.rb"].each { |file| require_relative file } -Lotus::Model.configure do +Hanami::Model.configure do # Database adapter # # Available options: @@ -39,10 +39,10 @@ Lotus::Model.configure do end end.load! -Lotus::Mailer.configure do +Hanami::Mailer.configure do root "#{ __dir__ }/new_app/mailers" - # See http://lotusrb.org/guides/mailers/delivery + # See http://hanamirb.org/guides/mailers/delivery delivery do development :test test :test diff --git a/test/fixtures/commands/application/new_app/spec/spec_helper.minitest.rb b/test/fixtures/commands/application/new_app/spec/spec_helper.minitest.rb index ee100aac..09bd2290 100644 --- a/test/fixtures/commands/application/new_app/spec/spec_helper.minitest.rb +++ b/test/fixtures/commands/application/new_app/spec/spec_helper.minitest.rb @@ -1,7 +1,7 @@ # Require this file for unit tests -ENV['LOTUS_ENV'] ||= 'test' +ENV['HANAMI_ENV'] ||= 'test' require_relative '../config/environment' require 'minitest/autorun' -Lotus::Application.preload! +Hanami::Application.preload! diff --git a/test/fixtures/commands/application/new_app/spec/spec_helper.rspec.rb b/test/fixtures/commands/application/new_app/spec/spec_helper.rspec.rb index 910a4ff5..b2bb380c 100644 --- a/test/fixtures/commands/application/new_app/spec/spec_helper.rspec.rb +++ b/test/fixtures/commands/application/new_app/spec/spec_helper.rspec.rb @@ -1,8 +1,8 @@ # Require this file for unit tests -ENV['LOTUS_ENV'] ||= 'test' +ENV['HANAMI_ENV'] ||= 'test' require_relative '../config/environment' -Lotus::Application.preload! +Hanami::Application.preload! Dir[__dir__ + '/support/**/*.rb'].each { |f| require f } diff --git a/test/fixtures/commands/application/new_container/Gemfile.filesystem b/test/fixtures/commands/application/new_container/Gemfile.filesystem index 135f3625..d5de00cb 100644 --- a/test/fixtures/commands/application/new_container/Gemfile.filesystem +++ b/test/fixtures/commands/application/new_container/Gemfile.filesystem @@ -3,8 +3,8 @@ source 'https://rubygems.org' gem 'bundler' gem 'rake' -gem 'lotusrb', '0.6.1' -gem 'lotus-model', '~> 0.5' +gem 'hanami', '0.7.0' +gem 'hanami-model', '~> 0.5' group :test do diff --git a/test/fixtures/commands/application/new_container/Gemfile.head b/test/fixtures/commands/application/new_container/Gemfile.head index 47a86512..8ac64c2e 100644 --- a/test/fixtures/commands/application/new_container/Gemfile.head +++ b/test/fixtures/commands/application/new_container/Gemfile.head @@ -3,16 +3,16 @@ source 'https://rubygems.org' gem 'bundler' gem 'rake' -gem 'lotus-utils', require: false, github: 'lotus/utils' -gem 'lotus-router', require: false, github: 'lotus/router' -gem 'lotus-validations', require: false, github: 'lotus/validations' -gem 'lotus-helpers', require: false, github: 'lotus/helpers' -gem 'lotus-controller', require: false, github: 'lotus/controller' -gem 'lotus-view', require: false, github: 'lotus/view' -gem 'lotus-model', require: false, github: 'lotus/model' -gem 'lotus-mailer', require: false, github: 'lotus/mailer' -gem 'lotus-assets', require: false, github: 'lotus/assets' -gem 'lotusrb', github: 'lotus/lotus' +gem 'hanami-utils', require: false, github: 'hanami/utils' +gem 'hanami-router', require: false, github: 'hanami/router' +gem 'hanami-validations', require: false, github: 'hanami/validations' +gem 'hanami-helpers', require: false, github: 'hanami/helpers' +gem 'hanami-controller', require: false, github: 'hanami/controller' +gem 'hanami-view', require: false, github: 'hanami/view' +gem 'hanami-model', require: false, github: 'hanami/model' +gem 'hanami-mailer', require: false, github: 'hanami/mailer' +gem 'hanami-assets', require: false, github: 'hanami/assets' +gem 'hanami', github: 'hanami/hanami' group :test do diff --git a/test/fixtures/commands/application/new_container/Gemfile.jdbc:mysql2 b/test/fixtures/commands/application/new_container/Gemfile.jdbc:mysql2 index ff1279f9..7a000918 100644 --- a/test/fixtures/commands/application/new_container/Gemfile.jdbc:mysql2 +++ b/test/fixtures/commands/application/new_container/Gemfile.jdbc:mysql2 @@ -3,8 +3,8 @@ source 'https://rubygems.org' gem 'bundler' gem 'rake' -gem 'lotusrb', '0.6.1' -gem 'lotus-model', '~> 0.5' +gem 'hanami', '0.7.0' +gem 'hanami-model', '~> 0.5' gem 'jdbc-mysql' diff --git a/test/fixtures/commands/application/new_container/Gemfile.jdbc:postgres b/test/fixtures/commands/application/new_container/Gemfile.jdbc:postgres index 3e7f1602..249363f2 100644 --- a/test/fixtures/commands/application/new_container/Gemfile.jdbc:postgres +++ b/test/fixtures/commands/application/new_container/Gemfile.jdbc:postgres @@ -3,8 +3,8 @@ source 'https://rubygems.org' gem 'bundler' gem 'rake' -gem 'lotusrb', '0.6.1' -gem 'lotus-model', '~> 0.5' +gem 'hanami', '0.7.0' +gem 'hanami-model', '~> 0.5' gem 'jdbc-postgres' diff --git a/test/fixtures/commands/application/new_container/Gemfile.jdbc:sqlite3 b/test/fixtures/commands/application/new_container/Gemfile.jdbc:sqlite3 index 5bd74eb2..c99eb46f 100644 --- a/test/fixtures/commands/application/new_container/Gemfile.jdbc:sqlite3 +++ b/test/fixtures/commands/application/new_container/Gemfile.jdbc:sqlite3 @@ -3,8 +3,8 @@ source 'https://rubygems.org' gem 'bundler' gem 'rake' -gem 'lotusrb', '0.6.1' -gem 'lotus-model', '~> 0.5' +gem 'hanami', '0.7.0' +gem 'hanami-model', '~> 0.5' gem 'jdbc-sqlite3' diff --git a/test/fixtures/commands/application/new_container/Gemfile.memory b/test/fixtures/commands/application/new_container/Gemfile.memory index 135f3625..d5de00cb 100644 --- a/test/fixtures/commands/application/new_container/Gemfile.memory +++ b/test/fixtures/commands/application/new_container/Gemfile.memory @@ -3,8 +3,8 @@ source 'https://rubygems.org' gem 'bundler' gem 'rake' -gem 'lotusrb', '0.6.1' -gem 'lotus-model', '~> 0.5' +gem 'hanami', '0.7.0' +gem 'hanami-model', '~> 0.5' group :test do diff --git a/test/fixtures/commands/application/new_container/Gemfile.minitest b/test/fixtures/commands/application/new_container/Gemfile.minitest index 135f3625..d5de00cb 100644 --- a/test/fixtures/commands/application/new_container/Gemfile.minitest +++ b/test/fixtures/commands/application/new_container/Gemfile.minitest @@ -3,8 +3,8 @@ source 'https://rubygems.org' gem 'bundler' gem 'rake' -gem 'lotusrb', '0.6.1' -gem 'lotus-model', '~> 0.5' +gem 'hanami', '0.7.0' +gem 'hanami-model', '~> 0.5' group :test do diff --git a/test/fixtures/commands/application/new_container/Gemfile.mysql2 b/test/fixtures/commands/application/new_container/Gemfile.mysql2 index 98923f51..3ee13b3f 100644 --- a/test/fixtures/commands/application/new_container/Gemfile.mysql2 +++ b/test/fixtures/commands/application/new_container/Gemfile.mysql2 @@ -3,8 +3,8 @@ source 'https://rubygems.org' gem 'bundler' gem 'rake' -gem 'lotusrb', '0.6.1' -gem 'lotus-model', '~> 0.5' +gem 'hanami', '0.7.0' +gem 'hanami-model', '~> 0.5' gem 'mysql2' diff --git a/test/fixtures/commands/application/new_container/Gemfile.postgres b/test/fixtures/commands/application/new_container/Gemfile.postgres index 4399c26a..418f842b 100644 --- a/test/fixtures/commands/application/new_container/Gemfile.postgres +++ b/test/fixtures/commands/application/new_container/Gemfile.postgres @@ -3,8 +3,8 @@ source 'https://rubygems.org' gem 'bundler' gem 'rake' -gem 'lotusrb', '0.6.1' -gem 'lotus-model', '~> 0.5' +gem 'hanami', '0.7.0' +gem 'hanami-model', '~> 0.5' gem 'pg' diff --git a/test/fixtures/commands/application/new_container/Gemfile.rspec b/test/fixtures/commands/application/new_container/Gemfile.rspec index 7983b174..49924d5b 100644 --- a/test/fixtures/commands/application/new_container/Gemfile.rspec +++ b/test/fixtures/commands/application/new_container/Gemfile.rspec @@ -3,8 +3,8 @@ source 'https://rubygems.org' gem 'bundler' gem 'rake' -gem 'lotusrb', '0.6.1' -gem 'lotus-model', '~> 0.5' +gem 'hanami', '0.7.0' +gem 'hanami-model', '~> 0.5' group :test do diff --git a/test/fixtures/commands/application/new_container/Gemfile.sqlite3 b/test/fixtures/commands/application/new_container/Gemfile.sqlite3 index d4def3fc..d0392148 100644 --- a/test/fixtures/commands/application/new_container/Gemfile.sqlite3 +++ b/test/fixtures/commands/application/new_container/Gemfile.sqlite3 @@ -3,8 +3,8 @@ source 'https://rubygems.org' gem 'bundler' gem 'rake' -gem 'lotusrb', '0.6.1' -gem 'lotus-model', '~> 0.5' +gem 'hanami', '0.7.0' +gem 'hanami-model', '~> 0.5' gem 'sqlite3' diff --git a/test/fixtures/commands/application/new_container/Rakefile.minitest b/test/fixtures/commands/application/new_container/Rakefile.minitest index 0bc82960..554937b4 100644 --- a/test/fixtures/commands/application/new_container/Rakefile.minitest +++ b/test/fixtures/commands/application/new_container/Rakefile.minitest @@ -1,5 +1,5 @@ require 'rake' -require 'lotus/rake_tasks' +require 'hanami/rake_tasks' require 'rake/testtask' Rake::TestTask.new do |t| diff --git a/test/fixtures/commands/application/new_container/Rakefile.rspec b/test/fixtures/commands/application/new_container/Rakefile.rspec index 95423250..c8493fe2 100644 --- a/test/fixtures/commands/application/new_container/Rakefile.rspec +++ b/test/fixtures/commands/application/new_container/Rakefile.rspec @@ -1,5 +1,5 @@ require 'rake' -require 'lotus/rake_tasks' +require 'hanami/rake_tasks' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) diff --git a/test/fixtures/commands/application/new_container/config.ru b/test/fixtures/commands/application/new_container/config.ru index 8a3577bb..a9db2fb5 100644 --- a/test/fixtures/commands/application/new_container/config.ru +++ b/test/fixtures/commands/application/new_container/config.ru @@ -1,3 +1,3 @@ require './config/environment' -run Lotus::Container.new +run Hanami::Container.new diff --git a/test/fixtures/commands/application/new_container/config/environment.rb b/test/fixtures/commands/application/new_container/config/environment.rb index c2b7e4ca..025f28ae 100644 --- a/test/fixtures/commands/application/new_container/config/environment.rb +++ b/test/fixtures/commands/application/new_container/config/environment.rb @@ -1,9 +1,9 @@ require 'rubygems' require 'bundler/setup' -require 'lotus/setup' +require 'hanami/setup' require_relative '../lib/new_container' require_relative '../apps/web/application' -Lotus::Container.configure do +Hanami::Container.configure do mount Web::Application, at: '/' end diff --git a/test/fixtures/commands/application/new_container/config/environment_mypath.rb b/test/fixtures/commands/application/new_container/config/environment_mypath.rb index 79d93d7d..e60cf2dc 100644 --- a/test/fixtures/commands/application/new_container/config/environment_mypath.rb +++ b/test/fixtures/commands/application/new_container/config/environment_mypath.rb @@ -1,9 +1,9 @@ require 'rubygems' require 'bundler/setup' -require 'lotus/setup' +require 'hanami/setup' require_relative '../lib/new_container' require_relative '../apps/web/application' -Lotus::Container.configure do +Hanami::Container.configure do mount Web::Application, at: '/mypath' end diff --git a/test/fixtures/commands/application/new_container/lib/new_container.filesystem.rb b/test/fixtures/commands/application/new_container/lib/new_container.filesystem.rb index c709f521..284d5f48 100644 --- a/test/fixtures/commands/application/new_container/lib/new_container.filesystem.rb +++ b/test/fixtures/commands/application/new_container/lib/new_container.filesystem.rb @@ -1,8 +1,8 @@ -require 'lotus/model' -require 'lotus/mailer' +require 'hanami/model' +require 'hanami/mailer' Dir["#{ __dir__ }/new_container/**/*.rb"].each { |file| require_relative file } -Lotus::Model.configure do +Hanami::Model.configure do ## # Database adapter # @@ -40,10 +40,10 @@ Lotus::Model.configure do end end.load! -Lotus::Mailer.configure do +Hanami::Mailer.configure do root "#{ __dir__ }/new_container/mailers" - # See http://lotusrb.org/guides/mailers/delivery + # See http://hanamirb.org/guides/mailers/delivery delivery do development :test test :test diff --git a/test/fixtures/commands/application/new_container/lib/new_container.memory.rb b/test/fixtures/commands/application/new_container/lib/new_container.memory.rb index 022924d0..0c12f499 100644 --- a/test/fixtures/commands/application/new_container/lib/new_container.memory.rb +++ b/test/fixtures/commands/application/new_container/lib/new_container.memory.rb @@ -1,8 +1,8 @@ -require 'lotus/model' -require 'lotus/mailer' +require 'hanami/model' +require 'hanami/mailer' Dir["#{ __dir__ }/new_container/**/*.rb"].each { |file| require_relative file } -Lotus::Model.configure do +Hanami::Model.configure do ## # Database adapter # @@ -40,10 +40,10 @@ Lotus::Model.configure do end end.load! -Lotus::Mailer.configure do +Hanami::Mailer.configure do root "#{ __dir__ }/new_container/mailers" - # See http://lotusrb.org/guides/mailers/delivery + # See http://hanamirb.org/guides/mailers/delivery delivery do development :test test :test diff --git a/test/fixtures/commands/application/new_container/lib/new_container.mysql2.rb b/test/fixtures/commands/application/new_container/lib/new_container.mysql2.rb index c3dcf902..50c98bbc 100644 --- a/test/fixtures/commands/application/new_container/lib/new_container.mysql2.rb +++ b/test/fixtures/commands/application/new_container/lib/new_container.mysql2.rb @@ -1,8 +1,8 @@ -require 'lotus/model' -require 'lotus/mailer' +require 'hanami/model' +require 'hanami/mailer' Dir["#{ __dir__ }/new_container/**/*.rb"].each { |file| require_relative file } -Lotus::Model.configure do +Hanami::Model.configure do ## # Database adapter # @@ -46,10 +46,10 @@ Lotus::Model.configure do end end.load! -Lotus::Mailer.configure do +Hanami::Mailer.configure do root "#{ __dir__ }/new_container/mailers" - # See http://lotusrb.org/guides/mailers/delivery + # See http://hanamirb.org/guides/mailers/delivery delivery do development :test test :test diff --git a/test/fixtures/commands/application/new_container/lib/new_container.postgres.rb b/test/fixtures/commands/application/new_container/lib/new_container.postgres.rb index c3dcf902..50c98bbc 100644 --- a/test/fixtures/commands/application/new_container/lib/new_container.postgres.rb +++ b/test/fixtures/commands/application/new_container/lib/new_container.postgres.rb @@ -1,8 +1,8 @@ -require 'lotus/model' -require 'lotus/mailer' +require 'hanami/model' +require 'hanami/mailer' Dir["#{ __dir__ }/new_container/**/*.rb"].each { |file| require_relative file } -Lotus::Model.configure do +Hanami::Model.configure do ## # Database adapter # @@ -46,10 +46,10 @@ Lotus::Model.configure do end end.load! -Lotus::Mailer.configure do +Hanami::Mailer.configure do root "#{ __dir__ }/new_container/mailers" - # See http://lotusrb.org/guides/mailers/delivery + # See http://hanamirb.org/guides/mailers/delivery delivery do development :test test :test diff --git a/test/fixtures/commands/application/new_container/lib/new_container.rb b/test/fixtures/commands/application/new_container/lib/new_container.rb index c709f521..284d5f48 100644 --- a/test/fixtures/commands/application/new_container/lib/new_container.rb +++ b/test/fixtures/commands/application/new_container/lib/new_container.rb @@ -1,8 +1,8 @@ -require 'lotus/model' -require 'lotus/mailer' +require 'hanami/model' +require 'hanami/mailer' Dir["#{ __dir__ }/new_container/**/*.rb"].each { |file| require_relative file } -Lotus::Model.configure do +Hanami::Model.configure do ## # Database adapter # @@ -40,10 +40,10 @@ Lotus::Model.configure do end end.load! -Lotus::Mailer.configure do +Hanami::Mailer.configure do root "#{ __dir__ }/new_container/mailers" - # See http://lotusrb.org/guides/mailers/delivery + # See http://hanamirb.org/guides/mailers/delivery delivery do development :test test :test diff --git a/test/fixtures/commands/application/new_container/lib/new_container.sqlite3.rb b/test/fixtures/commands/application/new_container/lib/new_container.sqlite3.rb index c3dcf902..50c98bbc 100644 --- a/test/fixtures/commands/application/new_container/lib/new_container.sqlite3.rb +++ b/test/fixtures/commands/application/new_container/lib/new_container.sqlite3.rb @@ -1,8 +1,8 @@ -require 'lotus/model' -require 'lotus/mailer' +require 'hanami/model' +require 'hanami/mailer' Dir["#{ __dir__ }/new_container/**/*.rb"].each { |file| require_relative file } -Lotus::Model.configure do +Hanami::Model.configure do ## # Database adapter # @@ -46,10 +46,10 @@ Lotus::Model.configure do end end.load! -Lotus::Mailer.configure do +Hanami::Mailer.configure do root "#{ __dir__ }/new_container/mailers" - # See http://lotusrb.org/guides/mailers/delivery + # See http://hanamirb.org/guides/mailers/delivery delivery do development :test test :test diff --git a/test/fixtures/commands/application/new_container/spec/features_helper.minitest.rb b/test/fixtures/commands/application/new_container/spec/features_helper.minitest.rb index 8ff1d023..0fed7124 100644 --- a/test/fixtures/commands/application/new_container/spec/features_helper.minitest.rb +++ b/test/fixtures/commands/application/new_container/spec/features_helper.minitest.rb @@ -4,7 +4,7 @@ require_relative './spec_helper' require 'capybara' require 'capybara/dsl' -Capybara.app = Lotus::Container.new +Capybara.app = Hanami::Container.new class MiniTest::Spec include Capybara::DSL diff --git a/test/fixtures/commands/application/new_container/spec/spec_helper.minitest.rb b/test/fixtures/commands/application/new_container/spec/spec_helper.minitest.rb index ee100aac..09bd2290 100644 --- a/test/fixtures/commands/application/new_container/spec/spec_helper.minitest.rb +++ b/test/fixtures/commands/application/new_container/spec/spec_helper.minitest.rb @@ -1,7 +1,7 @@ # Require this file for unit tests -ENV['LOTUS_ENV'] ||= 'test' +ENV['HANAMI_ENV'] ||= 'test' require_relative '../config/environment' require 'minitest/autorun' -Lotus::Application.preload! +Hanami::Application.preload! diff --git a/test/fixtures/commands/application/new_container/spec/spec_helper.rspec.rb b/test/fixtures/commands/application/new_container/spec/spec_helper.rspec.rb index 910a4ff5..b2bb380c 100644 --- a/test/fixtures/commands/application/new_container/spec/spec_helper.rspec.rb +++ b/test/fixtures/commands/application/new_container/spec/spec_helper.rspec.rb @@ -1,8 +1,8 @@ # Require this file for unit tests -ENV['LOTUS_ENV'] ||= 'test' +ENV['HANAMI_ENV'] ||= 'test' require_relative '../config/environment' -Lotus::Application.preload! +Hanami::Application.preload! Dir[__dir__ + '/support/**/*.rb'].each { |f| require f } diff --git a/test/fixtures/commands/generate/action/view_spec.app.minitest.rb b/test/fixtures/commands/generate/action/view_spec.app.minitest.rb index f984ac6f..93f3d22e 100644 --- a/test/fixtures/commands/generate/action/view_spec.app.minitest.rb +++ b/test/fixtures/commands/generate/action/view_spec.app.minitest.rb @@ -3,7 +3,7 @@ require_relative '../../../app/views/books/index' describe Testapp::Views::Books::Index do let(:exposures) { Hash[foo: 'bar'] } - let(:template) { Lotus::View::Template.new('app/templates/books/index.html.erb') } + let(:template) { Hanami::View::Template.new('app/templates/books/index.html.erb') } let(:view) { Testapp::Views::Books::Index.new(template, exposures) } let(:rendered) { view.render } diff --git a/test/fixtures/commands/generate/action/view_spec.app.rspec.rb b/test/fixtures/commands/generate/action/view_spec.app.rspec.rb index 6963fec2..5cb17327 100644 --- a/test/fixtures/commands/generate/action/view_spec.app.rspec.rb +++ b/test/fixtures/commands/generate/action/view_spec.app.rspec.rb @@ -2,7 +2,7 @@ require_relative '../../../app/views/books/index' RSpec.describe Testapp::Views::Books::Index do let(:exposures) { Hash[foo: 'bar'] } - let(:template) { Lotus::View::Template.new('app/templates/books/index.html.erb') } + let(:template) { Hanami::View::Template.new('app/templates/books/index.html.erb') } let(:view) { described_class.new(template, exposures) } let(:rendered) { view.render } diff --git a/test/fixtures/commands/generate/action/view_spec.container.minitest.rb b/test/fixtures/commands/generate/action/view_spec.container.minitest.rb index 388939f6..fc9c189c 100644 --- a/test/fixtures/commands/generate/action/view_spec.container.minitest.rb +++ b/test/fixtures/commands/generate/action/view_spec.container.minitest.rb @@ -3,7 +3,7 @@ require_relative '../../../../apps/web/views/books/index' describe Web::Views::Books::Index do let(:exposures) { Hash[foo: 'bar'] } - let(:template) { Lotus::View::Template.new('apps/web/templates/books/index.html.erb') } + let(:template) { Hanami::View::Template.new('apps/web/templates/books/index.html.erb') } let(:view) { Web::Views::Books::Index.new(template, exposures) } let(:rendered) { view.render } diff --git a/test/fixtures/commands/generate/action/view_spec.container.rspec.rb b/test/fixtures/commands/generate/action/view_spec.container.rspec.rb index 9e52bca7..0175ab19 100644 --- a/test/fixtures/commands/generate/action/view_spec.container.rspec.rb +++ b/test/fixtures/commands/generate/action/view_spec.container.rspec.rb @@ -2,7 +2,7 @@ require_relative '../../../../apps/web/views/books/index' RSpec.describe Web::Views::Books::Index do let(:exposures) { Hash[foo: 'bar'] } - let(:template) { Lotus::View::Template.new('apps/web/templates/books/index.html.erb') } + let(:template) { Hanami::View::Template.new('apps/web/templates/books/index.html.erb') } let(:view) { described_class.new(template, exposures) } let(:rendered) { view.render } diff --git a/test/fixtures/commands/generate/app/application.rb b/test/fixtures/commands/generate/app/application.rb index 1e9b059e..ecaa9164 100644 --- a/test/fixtures/commands/generate/app/application.rb +++ b/test/fixtures/commands/generate/app/application.rb @@ -1,8 +1,8 @@ -require 'lotus/helpers' -require 'lotus/assets' +require 'hanami/helpers' +require 'hanami/assets' module Admin - class Application < Lotus::Application + class Application < Hanami::Application configure do ## # BASIC @@ -23,7 +23,7 @@ module Admin # Handle exceptions with HTTP statuses (true) or don't catch them (false). # Defaults to true. - # See: http://www.rubydoc.info/gems/lotus-controller/#Exceptions_management + # See: http://www.rubydoc.info/gems/hanami-controller/#Exceptions_management # # handle_exceptions true @@ -32,7 +32,7 @@ module Admin # # Routes definitions for this application - # See: http://www.rubydoc.info/gems/lotus-router#Usage + # See: http://www.rubydoc.info/gems/hanami-router#Usage # routes 'config/routes' @@ -127,7 +127,7 @@ module Admin # * :yui # * :closure # - # See: http://lotusrb.org/guides/assets/compressors + # See: http://hanamirb.org/guides/assets/compressors # # In order to skip JavaScript compression comment the following line javascript_compressor :builtin @@ -140,7 +140,7 @@ module Admin # * :yui # * :sass # - # See: http://lotusrb.org/guides/assets/compressors + # See: http://hanamirb.org/guides/assets/compressors # # In order to skip stylesheet compression comment the following line stylesheet_compressor :builtin @@ -209,7 +209,7 @@ module Admin # Configure the code that will yield each time Admin::Action is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-controller#Configuration + # See: http://www.rubydoc.info/gems/hanami-controller#Configuration controller.prepare do # include MyAuthentication # included in all the actions # before :authenticate! # run an authentication before callback @@ -218,9 +218,9 @@ module Admin # Configure the code that will yield each time Admin::View is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-view#Configuration + # See: http://www.rubydoc.info/gems/hanami-view#Configuration view.prepare do - include Lotus::Helpers + include Hanami::Helpers include Admin::Assets::Helpers end end @@ -252,17 +252,17 @@ module Admin assets do # Don't compile static assets in production mode (eg. Sass, ES6) # - # See: http://www.rubydoc.info/gems/lotus-assets#Configuration + # See: http://www.rubydoc.info/gems/hanami-assets#Configuration compile false # Use digest file name for asset paths # - # See: http://lotusrb.org/guides/assets/digest + # See: http://hanamirb.org/guides/assets/digest digest true # Content Delivery Network (CDN) # - # See: http://lotusrb.org/guides/assets/content-delivery-network + # See: http://hanamirb.org/guides/assets/content-delivery-network # # scheme 'https' # host 'cdn.example.org' diff --git a/test/fixtures/commands/generate/app/environment.rb b/test/fixtures/commands/generate/app/environment.rb index bfa00b28..ae40ae80 100644 --- a/test/fixtures/commands/generate/app/environment.rb +++ b/test/fixtures/commands/generate/app/environment.rb @@ -1,9 +1,9 @@ require 'rubygems' require 'bundler/setup' -require 'lotus/setup' +require 'hanami/setup' require_relative '../lib/container-app' require_relative '../apps/web/application' -Lotus::Container.configure do +Hanami::Container.configure do mount Web::Application, at: '/' end diff --git a/test/fixtures/commands/generate/app/environment_with_app_added.rb b/test/fixtures/commands/generate/app/environment_with_app_added.rb index da770ebb..8b10ee93 100644 --- a/test/fixtures/commands/generate/app/environment_with_app_added.rb +++ b/test/fixtures/commands/generate/app/environment_with_app_added.rb @@ -1,11 +1,11 @@ require 'rubygems' require 'bundler/setup' -require 'lotus/setup' +require 'hanami/setup' require_relative '../lib/container-app' require_relative '../apps/admin/application' require_relative '../apps/web/application' -Lotus::Container.configure do +Hanami::Container.configure do mount Admin::Application, at: '/admin' mount Web::Application, at: '/' end diff --git a/test/fixtures/commands/generate/app/environment_with_app_added_url.rb b/test/fixtures/commands/generate/app/environment_with_app_added_url.rb index 3a8378aa..af7893ec 100644 --- a/test/fixtures/commands/generate/app/environment_with_app_added_url.rb +++ b/test/fixtures/commands/generate/app/environment_with_app_added_url.rb @@ -1,11 +1,11 @@ require 'rubygems' require 'bundler/setup' -require 'lotus/setup' +require 'hanami/setup' require_relative '../lib/container-app' require_relative '../apps/admin/application' require_relative '../apps/web/application' -Lotus::Container.configure do +Hanami::Container.configure do mount Admin::Application, at: '/backend' mount Web::Application, at: '/' end diff --git a/test/fixtures/commands/generate/app/routes.rb b/test/fixtures/commands/generate/app/routes.rb index 9050f88f..fa85d5d3 100644 --- a/test/fixtures/commands/generate/app/routes.rb +++ b/test/fixtures/commands/generate/app/routes.rb @@ -1,2 +1,2 @@ # Configure your routes here -# See: http://www.rubydoc.info/gems/lotus-router/#Usage +# See: http://www.rubydoc.info/gems/hanami-router/#Usage diff --git a/test/fixtures/commands/generate/mailer/forgot_password.rb b/test/fixtures/commands/generate/mailer/forgot_password.rb index 32c1b04d..9894dfa9 100644 --- a/test/fixtures/commands/generate/mailer/forgot_password.rb +++ b/test/fixtures/commands/generate/mailer/forgot_password.rb @@ -1,5 +1,5 @@ class Mailers::ForgotPassword - include Lotus::Mailer + include Hanami::Mailer from '' to '' diff --git a/test/fixtures/commands/generate/migration/migration.rb b/test/fixtures/commands/generate/migration/migration.rb index a05e291f..5619b543 100644 --- a/test/fixtures/commands/generate/migration/migration.rb +++ b/test/fixtures/commands/generate/migration/migration.rb @@ -1,4 +1,4 @@ -Lotus::Model.migration do +Hanami::Model.migration do change do end end diff --git a/test/fixtures/commands/generate/model/car.rb b/test/fixtures/commands/generate/model/car.rb index 54987b01..9beb1fb8 100644 --- a/test/fixtures/commands/generate/model/car.rb +++ b/test/fixtures/commands/generate/model/car.rb @@ -1,3 +1,3 @@ class Car - include Lotus::Entity + include Hanami::Entity end diff --git a/test/fixtures/commands/generate/model/car_repository.rb b/test/fixtures/commands/generate/model/car_repository.rb index f111d3d1..50d8df57 100644 --- a/test/fixtures/commands/generate/model/car_repository.rb +++ b/test/fixtures/commands/generate/model/car_repository.rb @@ -1,3 +1,3 @@ class CarRepository - include Lotus::Repository + include Hanami::Repository end diff --git a/test/fixtures/config.ru b/test/fixtures/config.ru index e2165c17..1dd7257e 100644 --- a/test/fixtures/config.ru +++ b/test/fixtures/config.ru @@ -1,12 +1,12 @@ -require 'lotus' +require 'hanami' module ServerTest - class Application < Lotus::Application + class Application < Hanami::Application configure do routes do route = -> (env) { headers = { - 'X-Lotus-Port' => ENV['LOTUS_PORT'].to_s + 'X-Hanami-Port' => ENV['HANAMI_PORT'].to_s } [200, headers, ['OK']] diff --git a/test/fixtures/configurable/.hanamirc b/test/fixtures/configurable/.hanamirc new file mode 100644 index 00000000..e6018c23 --- /dev/null +++ b/test/fixtures/configurable/.hanamirc @@ -0,0 +1,3 @@ +architecture=container +test=minitest +template=erb diff --git a/test/fixtures/configurable/application.rb b/test/fixtures/configurable/application.rb index ad87a72b..7196da8a 100644 --- a/test/fixtures/configurable/application.rb +++ b/test/fixtures/configurable/application.rb @@ -6,7 +6,7 @@ module Configurable end end - class Application < Lotus::Application + class Application < Hanami::Application configure do handle_exceptions false diff --git a/test/fixtures/cookies/.hanamirc b/test/fixtures/cookies/.hanamirc new file mode 100644 index 00000000..e6018c23 --- /dev/null +++ b/test/fixtures/cookies/.hanamirc @@ -0,0 +1,3 @@ +architecture=container +test=minitest +template=erb diff --git a/test/fixtures/cookies/application.rb b/test/fixtures/cookies/application.rb index 17172c0f..643c3dff 100644 --- a/test/fixtures/cookies/application.rb +++ b/test/fixtures/cookies/application.rb @@ -1,8 +1,8 @@ module CookiesApp - class Application < Lotus::Application + class Application < Hanami::Application configure do # Activate Cookies - cookies domain: 'lotusrb.org', path: '/another_controller', secure: true + cookies domain: 'hanamirb.org', path: '/another_controller', secure: true routes do get '/get_cookies', to: 'cookies#get' @@ -42,7 +42,7 @@ module CookiesApp cookies[:foo] = { value: 'nomnomnom!', - domain: 'lotusrocks.com', + domain: 'hanamirocks.com', path: '/controller', expires: expire_date, secure: true, diff --git a/test/fixtures/furnitures/.hanamirc b/test/fixtures/furnitures/.hanamirc new file mode 100644 index 00000000..e6018c23 --- /dev/null +++ b/test/fixtures/furnitures/.hanamirc @@ -0,0 +1,3 @@ +architecture=container +test=minitest +template=erb diff --git a/test/fixtures/furnitures/application.rb b/test/fixtures/furnitures/application.rb index 97ccf678..9d21259e 100644 --- a/test/fixtures/furnitures/application.rb +++ b/test/fixtures/furnitures/application.rb @@ -1,7 +1,7 @@ -require 'lotus' +require 'hanami' module Furnitures - class Application < Lotus::Application + class Application < Hanami::Application configure do layout :application routes 'config/routes' diff --git a/test/fixtures/furnitures/assets/javascripts/application.js b/test/fixtures/furnitures/assets/javascripts/application.js index 2ceb2a94..cad48d23 100644 --- a/test/fixtures/furnitures/assets/javascripts/application.js +++ b/test/fixtures/furnitures/assets/javascripts/application.js @@ -1 +1 @@ -alert("Lotus!"); +alert("Hanami!"); diff --git a/test/fixtures/lotusrc/exists/.lotusrc b/test/fixtures/hanamirc/exists/.hanamirc similarity index 100% rename from test/fixtures/lotusrc/exists/.lotusrc rename to test/fixtures/hanamirc/exists/.hanamirc diff --git a/test/fixtures/lotusrc/no_exists/.gitkeep b/test/fixtures/hanamirc/no_exists/.gitkeep similarity index 100% rename from test/fixtures/lotusrc/no_exists/.gitkeep rename to test/fixtures/hanamirc/no_exists/.gitkeep diff --git a/test/fixtures/hanamirc/with_minitest b/test/fixtures/hanamirc/with_minitest new file mode 100644 index 00000000..e6018c23 --- /dev/null +++ b/test/fixtures/hanamirc/with_minitest @@ -0,0 +1,3 @@ +architecture=container +test=minitest +template=erb diff --git a/test/fixtures/lotusrc/with_rspec b/test/fixtures/hanamirc/with_rspec similarity index 100% rename from test/fixtures/lotusrc/with_rspec rename to test/fixtures/hanamirc/with_rspec diff --git a/test/fixtures/information_tech/.hanamirc b/test/fixtures/information_tech/.hanamirc new file mode 100644 index 00000000..e6018c23 --- /dev/null +++ b/test/fixtures/information_tech/.hanamirc @@ -0,0 +1,3 @@ +architecture=container +test=minitest +template=erb diff --git a/test/fixtures/information_tech/app/controllers/hardware_controller.rb b/test/fixtures/information_tech/app/controllers/hardware_controller.rb index ffe4b96a..7208c87c 100644 --- a/test/fixtures/information_tech/app/controllers/hardware_controller.rb +++ b/test/fixtures/information_tech/app/controllers/hardware_controller.rb @@ -1,13 +1,13 @@ module HardwareController class Index - include Lotus::Action + include Hanami::Action def call(params) end end class Error - include Lotus::Action + include Hanami::Action def call(params) raise 'boom' @@ -15,7 +15,7 @@ module HardwareController end class Legacy - include Lotus::Action + include Hanami::Action def call(params) redirect_to 'http://localhost/hardware' @@ -23,7 +23,7 @@ module HardwareController end class Protected - include Lotus::Action + include Hanami::Action def call(params) halt 401 diff --git a/test/fixtures/information_tech/app/views/app_layout.rb b/test/fixtures/information_tech/app/views/app_layout.rb index 52cc097a..624a032f 100644 --- a/test/fixtures/information_tech/app/views/app_layout.rb +++ b/test/fixtures/information_tech/app/views/app_layout.rb @@ -1,3 +1,3 @@ class AppLayout - include Lotus::Layout + include Hanami::Layout end diff --git a/test/fixtures/information_tech/app/views/hardware/index.rb b/test/fixtures/information_tech/app/views/hardware/index.rb index 0b616261..f9f2fd39 100644 --- a/test/fixtures/information_tech/app/views/hardware/index.rb +++ b/test/fixtures/information_tech/app/views/hardware/index.rb @@ -1,5 +1,5 @@ module Hardware class Index - include Lotus::View + include Hanami::View end end diff --git a/test/fixtures/information_tech/application.rb b/test/fixtures/information_tech/application.rb index b57fa30f..59660322 100644 --- a/test/fixtures/information_tech/application.rb +++ b/test/fixtures/information_tech/application.rb @@ -1,7 +1,7 @@ -require 'lotus' +require 'hanami' module InformationTech - class Application < Lotus::Application + class Application < Hanami::Application configure do namespace Object diff --git a/test/fixtures/information_tech/assets/javascripts/application.js b/test/fixtures/information_tech/assets/javascripts/application.js index 2ceb2a94..cad48d23 100644 --- a/test/fixtures/information_tech/assets/javascripts/application.js +++ b/test/fixtures/information_tech/assets/javascripts/application.js @@ -1 +1 @@ -alert("Lotus!"); +alert("Hanami!"); diff --git a/test/fixtures/lint/.hanamirc b/test/fixtures/lint/.hanamirc new file mode 100644 index 00000000..e6018c23 --- /dev/null +++ b/test/fixtures/lint/.hanamirc @@ -0,0 +1,3 @@ +architecture=container +test=minitest +template=erb diff --git a/test/fixtures/lint/application.rb b/test/fixtures/lint/application.rb index 2fa75223..0d76e1ed 100644 --- a/test/fixtures/lint/application.rb +++ b/test/fixtures/lint/application.rb @@ -1,5 +1,5 @@ module Lint - class Application < Lotus::Application + class Application < Hanami::Application configure do routes do get '/', to: 'home#index' @@ -28,7 +28,7 @@ module Lint end # This is an integration test case for `Action#renderable?`. - # Please have a look at `Lotus::Action::Glue` and `#send_file`. + # Please have a look at `Hanami::Action::Glue` and `#send_file`. class Download include Lint::Action diff --git a/test/fixtures/microservices/apps/backend/application.rb b/test/fixtures/microservices/apps/backend/application.rb index 09846668..ffbbafc6 100644 --- a/test/fixtures/microservices/apps/backend/application.rb +++ b/test/fixtures/microservices/apps/backend/application.rb @@ -1,5 +1,5 @@ module Backend - class Application < Lotus::Application + class Application < Hanami::Application configure do root File.dirname(__FILE__) load_paths << [ diff --git a/test/fixtures/microservices/apps/backend/assets/javascripts/application.js b/test/fixtures/microservices/apps/backend/assets/javascripts/application.js index 2ceb2a94..cad48d23 100644 --- a/test/fixtures/microservices/apps/backend/assets/javascripts/application.js +++ b/test/fixtures/microservices/apps/backend/assets/javascripts/application.js @@ -1 +1 @@ -alert("Lotus!"); +alert("Hanami!"); diff --git a/test/fixtures/microservices/apps/frontend/application.rb b/test/fixtures/microservices/apps/frontend/application.rb index ceebf01b..57bebe13 100644 --- a/test/fixtures/microservices/apps/frontend/application.rb +++ b/test/fixtures/microservices/apps/frontend/application.rb @@ -1,5 +1,5 @@ module Frontend - class Application < Lotus::Application + class Application < Hanami::Application configure do root File.dirname(__FILE__) load_paths << [ diff --git a/test/fixtures/microservices/apps/frontend/assets/javascripts/application.js b/test/fixtures/microservices/apps/frontend/assets/javascripts/application.js index 2ceb2a94..cad48d23 100644 --- a/test/fixtures/microservices/apps/frontend/assets/javascripts/application.js +++ b/test/fixtures/microservices/apps/frontend/assets/javascripts/application.js @@ -1 +1 @@ -alert("Lotus!"); +alert("Hanami!"); diff --git a/test/fixtures/microservices/apps/frontend/vendor/assets/custom.js b/test/fixtures/microservices/apps/frontend/vendor/assets/custom.js index fa056919..d4c7873a 100644 --- a/test/fixtures/microservices/apps/frontend/vendor/assets/custom.js +++ b/test/fixtures/microservices/apps/frontend/vendor/assets/custom.js @@ -1 +1 @@ -alert("Lotus!"); \ No newline at end of file +alert("Hanami!"); \ No newline at end of file diff --git a/test/fixtures/microservices/config.ru b/test/fixtures/microservices/config.ru index 5f2f51c0..e3d617eb 100644 --- a/test/fixtures/microservices/config.ru +++ b/test/fixtures/microservices/config.ru @@ -1,7 +1,7 @@ require_relative 'apps/frontend/application' require_relative 'apps/backend/application' -run Lotus::Router.new { +run Hanami::Router.new { mount Backend::Application, at: '/backend' mount Frontend::Application, at: '/' } diff --git a/test/fixtures/middleware_stack/.hanamirc b/test/fixtures/middleware_stack/.hanamirc new file mode 100644 index 00000000..e6018c23 --- /dev/null +++ b/test/fixtures/middleware_stack/.hanamirc @@ -0,0 +1,3 @@ +architecture=container +test=minitest +template=erb diff --git a/test/fixtures/middleware_stack/application.rb b/test/fixtures/middleware_stack/application.rb index 84b6d5a0..8274325b 100644 --- a/test/fixtures/middleware_stack/application.rb +++ b/test/fixtures/middleware_stack/application.rb @@ -1,5 +1,5 @@ module MiddlewareStack - class Application < Lotus::Application + class Application < Hanami::Application configure do # Test lazy loading with relative class name middleware.use 'Middlewares::Runtime' diff --git a/test/fixtures/one_file/.hanamirc b/test/fixtures/one_file/.hanamirc new file mode 100644 index 00000000..e6018c23 --- /dev/null +++ b/test/fixtures/one_file/.hanamirc @@ -0,0 +1,3 @@ +architecture=container +test=minitest +template=erb diff --git a/test/fixtures/one_file/application.rb b/test/fixtures/one_file/application.rb index 31ad6940..d748bc42 100644 --- a/test/fixtures/one_file/application.rb +++ b/test/fixtures/one_file/application.rb @@ -1,5 +1,5 @@ module OneFile - class Application < Lotus::Application + class Application < Hanami::Application configure do routes do get '/', to: 'dashboard#index' diff --git a/test/fixtures/rake/rake_tasks/Gemfile b/test/fixtures/rake/rake_tasks/Gemfile index 9f8144fd..77de6409 100644 --- a/test/fixtures/rake/rake_tasks/Gemfile +++ b/test/fixtures/rake/rake_tasks/Gemfile @@ -4,16 +4,16 @@ gem 'bundler' gem 'rake' gem 'sqlite3' -gem 'lotus-utils', require: false, github: 'lotus/utils' -gem 'lotus-router', require: false, github: 'lotus/router' -gem 'lotus-validations', require: false, github: 'lotus/validations' -gem 'lotus-helpers', require: false, github: 'lotus/helpers' -gem 'lotus-controller', require: false, github: 'lotus/controller' -gem 'lotus-view', require: false, github: 'lotus/view' -gem 'lotus-model', require: false, github: 'lotus/model' -gem 'lotus-mailer', require: false, github: 'lotus/mailer' -gem 'lotus-assets', require: false, github: 'lotus/assets' -gem 'lotusrb', path: '../../../..' +gem 'hanami-utils', require: false, github: 'hanami/utils' +gem 'hanami-router', require: false, github: 'hanami/router' +gem 'hanami-validations', require: false, github: 'hanami/validations' +gem 'hanami-helpers', require: false, github: 'hanami/helpers' +gem 'hanami-controller', require: false, github: 'hanami/controller' +gem 'hanami-view', require: false, github: 'hanami/view' +gem 'hanami-model', require: false, github: 'hanami/model' +gem 'hanami-mailer', require: false, github: 'hanami/mailer' +gem 'hanami-assets', require: false, github: 'hanami/assets' +gem 'hanami', path: '../../../..' group :test do gem 'minitest' diff --git a/test/fixtures/rake/rake_tasks/Rakefile b/test/fixtures/rake/rake_tasks/Rakefile index 89c63030..23abc6f8 100644 --- a/test/fixtures/rake/rake_tasks/Rakefile +++ b/test/fixtures/rake/rake_tasks/Rakefile @@ -1,6 +1,6 @@ require 'rake' require 'rake/testtask' -require 'lotus/rake_tasks' +require 'hanami/rake_tasks' Rake::TestTask.new do |t| t.pattern = 'spec/**/*_spec.rb' diff --git a/test/fixtures/rake/rake_tasks/apps/web/application.rb b/test/fixtures/rake/rake_tasks/apps/web/application.rb index 8ad36335..438ea907 100644 --- a/test/fixtures/rake/rake_tasks/apps/web/application.rb +++ b/test/fixtures/rake/rake_tasks/apps/web/application.rb @@ -1,8 +1,8 @@ -require 'lotus/helpers' -require 'lotus/assets' +require 'hanami/helpers' +require 'hanami/assets' module Web - class Application < Lotus::Application + class Application < Hanami::Application configure do ## # BASIC @@ -23,7 +23,7 @@ module Web # Handle exceptions with HTTP statuses (true) or don't catch them (false). # Defaults to true. - # See: http://www.rubydoc.info/gems/lotus-controller/#Exceptions_management + # See: http://www.rubydoc.info/gems/hanami-controller/#Exceptions_management # # handle_exceptions true @@ -32,7 +32,7 @@ module Web # # Routes definitions for this application - # See: http://www.rubydoc.info/gems/lotus-router#Usage + # See: http://www.rubydoc.info/gems/hanami-router#Usage # routes 'config/routes' @@ -127,7 +127,7 @@ module Web # * :yui # * :closure # - # See: http://lotusrb.org/guides/assets/compressors + # See: http://hanamirb.org/guides/assets/compressors # # In order to skip JavaScript compression comment the following line javascript_compressor :builtin @@ -140,7 +140,7 @@ module Web # * :yui # * :sass # - # See: http://lotusrb.org/guides/assets/compressors + # See: http://hanamirb.org/guides/assets/compressors # # In order to skip stylesheet compression comment the following line stylesheet_compressor :builtin @@ -209,7 +209,7 @@ module Web # Configure the code that will yield each time Web::Action is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-controller#Configuration + # See: http://www.rubydoc.info/gems/hanami-controller#Configuration controller.prepare do # include MyAuthentication # included in all the actions # before :authenticate! # run an authentication before callback @@ -218,9 +218,9 @@ module Web # Configure the code that will yield each time Web::View is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-view#Configuration + # See: http://www.rubydoc.info/gems/hanami-view#Configuration view.prepare do - include Lotus::Helpers + include Hanami::Helpers include Web::Assets::Helpers end end @@ -252,17 +252,17 @@ module Web assets do # Don't compile static assets in production mode (eg. Sass, ES6) # - # See: http://www.rubydoc.info/gems/lotus-assets#Configuration + # See: http://www.rubydoc.info/gems/hanami-assets#Configuration compile false # Use digest file name for asset paths # - # See: http://lotusrb.org/guides/assets/digest + # See: http://hanamirb.org/guides/assets/digest digest true # Content Delivery Network (CDN) # - # See: http://lotusrb.org/guides/assets/content-delivery-network + # See: http://hanamirb.org/guides/assets/content-delivery-network # # scheme 'https' # host 'cdn.example.org' diff --git a/test/fixtures/rake/rake_tasks/apps/web/config/routes.rb b/test/fixtures/rake/rake_tasks/apps/web/config/routes.rb index bbe9b931..bfd258e7 100644 --- a/test/fixtures/rake/rake_tasks/apps/web/config/routes.rb +++ b/test/fixtures/rake/rake_tasks/apps/web/config/routes.rb @@ -1,3 +1,3 @@ get '/users/:id', to: 'users#show' # Configure your routes here -# See: http://www.rubydoc.info/gems/lotus-router/#Usage \ No newline at end of file +# See: http://www.rubydoc.info/gems/hanami-router/#Usage \ No newline at end of file diff --git a/test/fixtures/rake/rake_tasks/config.ru b/test/fixtures/rake/rake_tasks/config.ru index 8a3577bb..a9db2fb5 100644 --- a/test/fixtures/rake/rake_tasks/config.ru +++ b/test/fixtures/rake/rake_tasks/config.ru @@ -1,3 +1,3 @@ require './config/environment' -run Lotus::Container.new +run Hanami::Container.new diff --git a/test/fixtures/rake/rake_tasks/config/environment.rb b/test/fixtures/rake/rake_tasks/config/environment.rb index 4b8b40a0..ec9322a5 100644 --- a/test/fixtures/rake/rake_tasks/config/environment.rb +++ b/test/fixtures/rake/rake_tasks/config/environment.rb @@ -1,9 +1,9 @@ require 'rubygems' require 'bundler/setup' -require 'lotus/setup' +require 'hanami/setup' require_relative '../lib/rake_tasks' require_relative '../apps/web/application' -Lotus::Container.configure do +Hanami::Container.configure do mount Web::Application, at: '/' end diff --git a/test/fixtures/rake/rake_tasks/db/migrations/20151217091454_create_users.rb b/test/fixtures/rake/rake_tasks/db/migrations/20151217091454_create_users.rb index aa450256..61187f20 100644 --- a/test/fixtures/rake/rake_tasks/db/migrations/20151217091454_create_users.rb +++ b/test/fixtures/rake/rake_tasks/db/migrations/20151217091454_create_users.rb @@ -1,4 +1,4 @@ -Lotus::Model.migration do +Hanami::Model.migration do change do create_table :users do primary_key :id diff --git a/test/fixtures/rake/rake_tasks/lib/rake_tasks.rb b/test/fixtures/rake/rake_tasks/lib/rake_tasks.rb index 837ce405..af93d6f1 100644 --- a/test/fixtures/rake/rake_tasks/lib/rake_tasks.rb +++ b/test/fixtures/rake/rake_tasks/lib/rake_tasks.rb @@ -1,8 +1,8 @@ -require 'lotus/model' -require 'lotus/mailer' +require 'hanami/model' +require 'hanami/mailer' Dir["#{ __dir__ }/rake_tasks/**/*.rb"].each { |file| require_relative file } -Lotus::Model.configure do +Hanami::Model.configure do ## # Database adapter # @@ -46,10 +46,10 @@ Lotus::Model.configure do end end.load! -Lotus::Mailer.configure do +Hanami::Mailer.configure do root "#{ __dir__ }/rake_tasks/mailers" - # See http://lotusrb.org/guides/mailers/delivery + # See http://hanamirb.org/guides/mailers/delivery delivery do development :test test :test diff --git a/test/fixtures/rake/rake_tasks/lib/rake_tasks/entities/user.rb b/test/fixtures/rake/rake_tasks/lib/rake_tasks/entities/user.rb index b056e0be..7351fe3a 100644 --- a/test/fixtures/rake/rake_tasks/lib/rake_tasks/entities/user.rb +++ b/test/fixtures/rake/rake_tasks/lib/rake_tasks/entities/user.rb @@ -1,4 +1,4 @@ class User - include Lotus::Entity + include Hanami::Entity attributes :name end diff --git a/test/fixtures/rake/rake_tasks/lib/rake_tasks/repositories/user_repository.rb b/test/fixtures/rake/rake_tasks/lib/rake_tasks/repositories/user_repository.rb index 2a97230e..7bdebab6 100644 --- a/test/fixtures/rake/rake_tasks/lib/rake_tasks/repositories/user_repository.rb +++ b/test/fixtures/rake/rake_tasks/lib/rake_tasks/repositories/user_repository.rb @@ -1,3 +1,3 @@ class UserRepository - include Lotus::Repository + include Hanami::Repository end diff --git a/test/fixtures/rake/rake_tasks/spec/features_helper.rb b/test/fixtures/rake/rake_tasks/spec/features_helper.rb index 8ff1d023..0fed7124 100644 --- a/test/fixtures/rake/rake_tasks/spec/features_helper.rb +++ b/test/fixtures/rake/rake_tasks/spec/features_helper.rb @@ -4,7 +4,7 @@ require_relative './spec_helper' require 'capybara' require 'capybara/dsl' -Capybara.app = Lotus::Container.new +Capybara.app = Hanami::Container.new class MiniTest::Spec include Capybara::DSL diff --git a/test/fixtures/rake/rake_tasks/spec/spec_helper.rb b/test/fixtures/rake/rake_tasks/spec/spec_helper.rb index ee100aac..09bd2290 100644 --- a/test/fixtures/rake/rake_tasks/spec/spec_helper.rb +++ b/test/fixtures/rake/rake_tasks/spec/spec_helper.rb @@ -1,7 +1,7 @@ # Require this file for unit tests -ENV['LOTUS_ENV'] ||= 'test' +ENV['HANAMI_ENV'] ||= 'test' require_relative '../config/environment' require 'minitest/autorun' -Lotus::Application.preload! +Hanami::Application.preload! diff --git a/test/fixtures/rake/rake_tasks/spec/web/views/users/show_spec.rb b/test/fixtures/rake/rake_tasks/spec/web/views/users/show_spec.rb index 68d58e2f..40f126ee 100644 --- a/test/fixtures/rake/rake_tasks/spec/web/views/users/show_spec.rb +++ b/test/fixtures/rake/rake_tasks/spec/web/views/users/show_spec.rb @@ -3,7 +3,7 @@ require_relative '../../../../apps/web/views/users/show' describe Web::Views::Users::Show do let(:exposures) { Hash[foo: 'bar'] } - let(:template) { Lotus::View::Template.new('apps/web/templates/users/show.html.erb') } + let(:template) { Hanami::View::Template.new('apps/web/templates/users/show.html.erb') } let(:view) { Web::Views::Users::Show.new(template, exposures) } let(:rendered) { view.render } diff --git a/test/fixtures/rake/rake_tasks_app/Gemfile b/test/fixtures/rake/rake_tasks_app/Gemfile index 9f8144fd..77de6409 100644 --- a/test/fixtures/rake/rake_tasks_app/Gemfile +++ b/test/fixtures/rake/rake_tasks_app/Gemfile @@ -4,16 +4,16 @@ gem 'bundler' gem 'rake' gem 'sqlite3' -gem 'lotus-utils', require: false, github: 'lotus/utils' -gem 'lotus-router', require: false, github: 'lotus/router' -gem 'lotus-validations', require: false, github: 'lotus/validations' -gem 'lotus-helpers', require: false, github: 'lotus/helpers' -gem 'lotus-controller', require: false, github: 'lotus/controller' -gem 'lotus-view', require: false, github: 'lotus/view' -gem 'lotus-model', require: false, github: 'lotus/model' -gem 'lotus-mailer', require: false, github: 'lotus/mailer' -gem 'lotus-assets', require: false, github: 'lotus/assets' -gem 'lotusrb', path: '../../../..' +gem 'hanami-utils', require: false, github: 'hanami/utils' +gem 'hanami-router', require: false, github: 'hanami/router' +gem 'hanami-validations', require: false, github: 'hanami/validations' +gem 'hanami-helpers', require: false, github: 'hanami/helpers' +gem 'hanami-controller', require: false, github: 'hanami/controller' +gem 'hanami-view', require: false, github: 'hanami/view' +gem 'hanami-model', require: false, github: 'hanami/model' +gem 'hanami-mailer', require: false, github: 'hanami/mailer' +gem 'hanami-assets', require: false, github: 'hanami/assets' +gem 'hanami', path: '../../../..' group :test do gem 'minitest' diff --git a/test/fixtures/rake/rake_tasks_app/Rakefile b/test/fixtures/rake/rake_tasks_app/Rakefile index 04f4d8c1..a19c1979 100644 --- a/test/fixtures/rake/rake_tasks_app/Rakefile +++ b/test/fixtures/rake/rake_tasks_app/Rakefile @@ -1,6 +1,6 @@ require 'rake' require 'rake/testtask' -require 'lotus/rake_tasks' +require 'hanami/rake_tasks' Rake::TestTask.new do |t| t.pattern = 'spec/**/*_spec.rb' diff --git a/test/fixtures/rake/rake_tasks_app/config/application.rb b/test/fixtures/rake/rake_tasks_app/config/application.rb index f9ffbf53..4a1b6bd0 100644 --- a/test/fixtures/rake/rake_tasks_app/config/application.rb +++ b/test/fixtures/rake/rake_tasks_app/config/application.rb @@ -1,8 +1,8 @@ -require 'lotus/helpers' -require 'lotus/assets' +require 'hanami/helpers' +require 'hanami/assets' module RakeTasksApp - class Application < Lotus::Application + class Application < Hanami::Application configure do ## # BASIC @@ -23,7 +23,7 @@ module RakeTasksApp # Handle exceptions with HTTP statuses (true) or don't catch them (false). # Defaults to true. - # See: http://www.rubydoc.info/gems/lotus-controller/ + # See: http://www.rubydoc.info/gems/hanami-controller/ # Exceptions_management # @@ -34,7 +34,7 @@ module RakeTasksApp # # Routes definitions for this application - # See: http://www.rubydoc.info/gems/lotus-router#Usage + # See: http://www.rubydoc.info/gems/hanami-router#Usage # routes 'config/routes' @@ -124,7 +124,7 @@ module RakeTasksApp # * :yui # * :closure # - # See: http://lotusrb.org/guides/assets/compressors + # See: http://hanamirb.org/guides/assets/compressors # # In order to skip JavaScript compression comment the following line javascript_compressor :builtin @@ -137,7 +137,7 @@ module RakeTasksApp # * :yui # * :sass # - # See: http://lotusrb.org/guides/assets/compressors + # See: http://hanamirb.org/guides/assets/compressors # # In order to skip stylesheet compression comment the following line stylesheet_compressor :builtin @@ -206,7 +206,7 @@ module RakeTasksApp # Configure the code that will yield each time RakeTasksApp::Action is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-controller#Configuration + # See: http://www.rubydoc.info/gems/hanami-controller#Configuration controller.prepare do # include MyAuthentication # included in all the actions # before :authenticate! # run an authentication before callback @@ -215,9 +215,9 @@ module RakeTasksApp # Configure the code that will yield each time RakeTasksApp::View is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-view#Configuration + # See: http://www.rubydoc.info/gems/hanami-view#Configuration view.prepare do - include Lotus::Helpers + include Hanami::Helpers include RakeTasksApp::Assets::Helpers end end @@ -249,17 +249,17 @@ module RakeTasksApp assets do # Don't compile static assets in production mode (eg. Sass, ES6) # - # See: http://www.rubydoc.info/gems/lotus-assets#Configuration + # See: http://www.rubydoc.info/gems/hanami-assets#Configuration compile false # Use digest file name for asset paths # - # See: http://lotusrb.org/guides/assets/digest + # See: http://hanamirb.org/guides/assets/digest digest true # Content Delivery Network (CDN) # - # See: http://lotusrb.org/guides/assets/content-delivery-network + # See: http://hanamirb.org/guides/assets/content-delivery-network # # scheme 'https' # host 'cdn.example.org' diff --git a/test/fixtures/rake/rake_tasks_app/config/environment.rb b/test/fixtures/rake/rake_tasks_app/config/environment.rb index 527b4463..cd8ddf1b 100644 --- a/test/fixtures/rake/rake_tasks_app/config/environment.rb +++ b/test/fixtures/rake/rake_tasks_app/config/environment.rb @@ -1,5 +1,5 @@ require 'rubygems' require 'bundler/setup' -require 'lotus/setup' +require 'hanami/setup' require_relative '../lib/rake_tasks_app' require_relative '../config/application' diff --git a/test/fixtures/rake/rake_tasks_app/config/routes.rb b/test/fixtures/rake/rake_tasks_app/config/routes.rb index 252cea97..8872e847 100644 --- a/test/fixtures/rake/rake_tasks_app/config/routes.rb +++ b/test/fixtures/rake/rake_tasks_app/config/routes.rb @@ -1,3 +1,3 @@ get '/users/:id', to: 'users#show' # Configure your routes here -# See: http://www.rubydoc.info/gems/lotus-router/#Usage +# See: http://www.rubydoc.info/gems/hanami-router/#Usage diff --git a/test/fixtures/rake/rake_tasks_app/db/migrations/20151217104223_create_users.rb b/test/fixtures/rake/rake_tasks_app/db/migrations/20151217104223_create_users.rb index 32093eb8..17d804bb 100644 --- a/test/fixtures/rake/rake_tasks_app/db/migrations/20151217104223_create_users.rb +++ b/test/fixtures/rake/rake_tasks_app/db/migrations/20151217104223_create_users.rb @@ -1,4 +1,4 @@ -Lotus::Model.migration do +Hanami::Model.migration do change do User.new diff --git a/test/fixtures/rake/rake_tasks_app/lib/rake_tasks_app.rb b/test/fixtures/rake/rake_tasks_app/lib/rake_tasks_app.rb index 7d614c1f..198e62b1 100644 --- a/test/fixtures/rake/rake_tasks_app/lib/rake_tasks_app.rb +++ b/test/fixtures/rake/rake_tasks_app/lib/rake_tasks_app.rb @@ -1,8 +1,8 @@ -require 'lotus/model' -require 'lotus/mailer' +require 'hanami/model' +require 'hanami/mailer' Dir["#{ __dir__ }/rake_tasks_app/**/*.rb"].each { |file| require_relative file } -Lotus::Model.configure do +Hanami::Model.configure do # Database adapter # # Available options: @@ -45,10 +45,10 @@ Lotus::Model.configure do end end.load! -Lotus::Mailer.configure do +Hanami::Mailer.configure do root "#{ __dir__ }/rake_tasks_app/mailers" - # See http://lotusrb.org/guides/mailers/delivery + # See http://hanamirb.org/guides/mailers/delivery delivery do development :test test :test diff --git a/test/fixtures/rake/rake_tasks_app/lib/rake_tasks_app/entities/user.rb b/test/fixtures/rake/rake_tasks_app/lib/rake_tasks_app/entities/user.rb index b056e0be..7351fe3a 100644 --- a/test/fixtures/rake/rake_tasks_app/lib/rake_tasks_app/entities/user.rb +++ b/test/fixtures/rake/rake_tasks_app/lib/rake_tasks_app/entities/user.rb @@ -1,4 +1,4 @@ class User - include Lotus::Entity + include Hanami::Entity attributes :name end diff --git a/test/fixtures/rake/rake_tasks_app/lib/rake_tasks_app/repositories/user_repository.rb b/test/fixtures/rake/rake_tasks_app/lib/rake_tasks_app/repositories/user_repository.rb index 2a97230e..7bdebab6 100644 --- a/test/fixtures/rake/rake_tasks_app/lib/rake_tasks_app/repositories/user_repository.rb +++ b/test/fixtures/rake/rake_tasks_app/lib/rake_tasks_app/repositories/user_repository.rb @@ -1,3 +1,3 @@ class UserRepository - include Lotus::Repository + include Hanami::Repository end diff --git a/test/fixtures/rake/rake_tasks_app/spec/spec_helper.rb b/test/fixtures/rake/rake_tasks_app/spec/spec_helper.rb index ee100aac..09bd2290 100644 --- a/test/fixtures/rake/rake_tasks_app/spec/spec_helper.rb +++ b/test/fixtures/rake/rake_tasks_app/spec/spec_helper.rb @@ -1,7 +1,7 @@ # Require this file for unit tests -ENV['LOTUS_ENV'] ||= 'test' +ENV['HANAMI_ENV'] ||= 'test' require_relative '../config/environment' require 'minitest/autorun' -Lotus::Application.preload! +Hanami::Application.preload! diff --git a/test/fixtures/rake/rake_tasks_app/spec/views/users/show_spec.rb b/test/fixtures/rake/rake_tasks_app/spec/views/users/show_spec.rb index 924e00dd..f1f5f702 100644 --- a/test/fixtures/rake/rake_tasks_app/spec/views/users/show_spec.rb +++ b/test/fixtures/rake/rake_tasks_app/spec/views/users/show_spec.rb @@ -3,7 +3,7 @@ require_relative '../../../app/views/users/show' describe RakeTasksApp::Views::Users::Show do let(:exposures) { Hash[foo: 'bar'] } - let(:template) { Lotus::View::Template.new('app/templates/users/show.html.erb') } + let(:template) { Hanami::View::Template.new('app/templates/users/show.html.erb') } let(:view) { RakeTasksApp::Views::Users::Show.new(template, exposures) } let(:rendered) { view.render } diff --git a/test/fixtures/security_headers/apps/web/.hanamirc b/test/fixtures/security_headers/apps/web/.hanamirc new file mode 100644 index 00000000..e6018c23 --- /dev/null +++ b/test/fixtures/security_headers/apps/web/.hanamirc @@ -0,0 +1,3 @@ +architecture=container +test=minitest +template=erb diff --git a/test/fixtures/security_headers/apps/web/app/entities/book.rb b/test/fixtures/security_headers/apps/web/app/entities/book.rb index 6e7f4d82..ab82e0ef 100644 --- a/test/fixtures/security_headers/apps/web/app/entities/book.rb +++ b/test/fixtures/security_headers/apps/web/app/entities/book.rb @@ -1,5 +1,5 @@ class Book - include Lotus::Entity + include Hanami::Entity attributes :name end diff --git a/test/fixtures/security_headers/apps/web/app/repositories/book_repository.rb b/test/fixtures/security_headers/apps/web/app/repositories/book_repository.rb index 5fc153e5..9a22dde4 100644 --- a/test/fixtures/security_headers/apps/web/app/repositories/book_repository.rb +++ b/test/fixtures/security_headers/apps/web/app/repositories/book_repository.rb @@ -1,3 +1,3 @@ class BookRepository - include Lotus::Repository + include Hanami::Repository end diff --git a/test/fixtures/security_headers/apps/web/app/views/application_layout.rb b/test/fixtures/security_headers/apps/web/app/views/application_layout.rb index 1f6fce24..777540cc 100644 --- a/test/fixtures/security_headers/apps/web/app/views/application_layout.rb +++ b/test/fixtures/security_headers/apps/web/app/views/application_layout.rb @@ -1,3 +1,3 @@ class SecurityHeaders::Views::ApplicationLayout - include Lotus::Layout + include Hanami::Layout end diff --git a/test/fixtures/security_headers/apps/web/application.rb b/test/fixtures/security_headers/apps/web/application.rb index 09843949..e117f61d 100644 --- a/test/fixtures/security_headers/apps/web/application.rb +++ b/test/fixtures/security_headers/apps/web/application.rb @@ -1,5 +1,5 @@ -require 'lotus' -require 'lotus/model' +require 'hanami' +require 'hanami/model' SECURITY_HEADERS_ADAPTER_TYPE = if RUBY_ENGINE == 'jruby' require 'jdbc/sqlite3' @@ -10,7 +10,7 @@ SECURITY_HEADERS_ADAPTER_TYPE = if RUBY_ENGINE == 'jruby' 'sqlite' end -require 'lotus/model/adapters/sql_adapter' +require 'hanami/model/adapters/sql_adapter' db = Pathname.new(File.dirname(__FILE__)).join('../tmp/test.db') db.dirname.mkpath # create directory if not exist db.delete if db.exist? # delete file if exist @@ -24,7 +24,7 @@ SECURITY_HEADERS_DB.create_table :books do end module SecurityHeaders - class Application < Lotus::Application + class Application < Hanami::Application configure do layout :application load_paths << 'app' diff --git a/test/fixtures/sessions/.hanamirc b/test/fixtures/sessions/.hanamirc new file mode 100644 index 00000000..e6018c23 --- /dev/null +++ b/test/fixtures/sessions/.hanamirc @@ -0,0 +1,3 @@ +architecture=container +test=minitest +template=erb diff --git a/test/fixtures/sessions/application.rb b/test/fixtures/sessions/application.rb index cc1772a2..497fb1fb 100644 --- a/test/fixtures/sessions/application.rb +++ b/test/fixtures/sessions/application.rb @@ -1,5 +1,5 @@ module SessionsApp - class Application < Lotus::Application + class Application < Hanami::Application configure do sessions :cookie, secret: '1234567890' diff --git a/test/fixtures/static_assets/.sass-cache/c69727f5293119c4f0d98f5f55ec7e6ec09d283a/home.css.sassc b/test/fixtures/static_assets/.sass-cache/c69727f5293119c4f0d98f5f55ec7e6ec09d283a/home.css.sassc index f89b102b426e7734d743cd98b6128e38b98b398d..88de65bc4ac84749b60209af727f557af821efc6 100644 GIT binary patch delta 70 vcmbOsGEZc~Lq^_=#Jt4ZOnnG7`683dWDcfc3{l0&%bDa+MK@n$a%Tqsl2sXj delta 64 pcmbOyGDBp;Lq_hL{F2gQeK0xs9b-QlUuN<$CKYtC&7YaH*#Ss{8E*gp diff --git a/test/fixtures/static_assets/Gemfile b/test/fixtures/static_assets/Gemfile index 6b775aaa..4e9ca758 100644 --- a/test/fixtures/static_assets/Gemfile +++ b/test/fixtures/static_assets/Gemfile @@ -4,18 +4,17 @@ gem 'bundler' gem 'rake' gem 'sass' -gem 'lotus-utils', '~> 0.6', github: 'lotus/utils', branch: '0.6.x' -gem 'lotus-validations', '~> 0.3', github: 'lotus/validations', branch: '0.3.x' -gem 'lotus-router', '~> 0.4', github: 'lotus/router', branch: '0.5.x' -gem 'lotus-controller', '~> 0.4', github: 'lotus/controller', branch: '0.4.x' -gem 'lotus-view', '~> 0.4', github: 'lotus/view', branch: '0.4.x' -gem 'lotus-model', '~> 0.5', github: 'lotus/model', branch: '0.5.x' -gem 'lotus-helpers', '~> 0.2', github: 'lotus/helpers', branch: '0.2.x' -gem 'lotus-mailer', '~> 0.1', github: 'lotus/mailer', branch: '0.1.x' -gem 'lotus-assets', '~> 0.1', github: 'lotus/assets', branch: 'master' -gem 'lotusrb', path: '../../..' +gem 'hanami-utils', '~> 0.6', github: 'hanami/utils', branch: '0.6.x' +gem 'hanami-validations', '~> 0.3', github: 'hanami/validations', branch: '0.3.x' +gem 'hanami-router', '~> 0.4', github: 'hanami/router', branch: '0.5.x' +gem 'hanami-controller', '~> 0.4', github: 'hanami/controller', branch: '0.4.x' +gem 'hanami-view', '~> 0.4', github: 'hanami/view', branch: '0.4.x' +gem 'hanami-model', '~> 0.5', github: 'hanami/model', branch: '0.5.x' +gem 'hanami-helpers', '~> 0.2', github: 'hanami/helpers', branch: '0.2.x' +gem 'hanami-mailer', '~> 0.1', github: 'hanami/mailer', branch: '0.1.x' +gem 'hanami-assets', '~> 0.1', github: 'hanami/assets', branch: 'master' +gem 'hanami', path: '../../..' -gem 'byebug', require: false group :test do gem 'minitest' gem 'capybara' diff --git a/test/fixtures/static_assets/apps/admin/application.rb b/test/fixtures/static_assets/apps/admin/application.rb index 06d11084..921cc754 100644 --- a/test/fixtures/static_assets/apps/admin/application.rb +++ b/test/fixtures/static_assets/apps/admin/application.rb @@ -1,7 +1,7 @@ -require 'lotus/helpers' +require 'hanami/helpers' module Admin - class Application < Lotus::Application + class Application < Hanami::Application configure do ## # BASIC @@ -22,7 +22,7 @@ module Admin # Handle exceptions with HTTP statuses (true) or don't catch them (false). # Defaults to true. - # See: http://www.rubydoc.info/gems/lotus-controller/#Exceptions_management + # See: http://www.rubydoc.info/gems/hanami-controller/#Exceptions_management # # handle_exceptions true @@ -31,7 +31,7 @@ module Admin # # Routes definitions for this application - # See: http://www.rubydoc.info/gems/lotus-router#Usage + # See: http://www.rubydoc.info/gems/hanami-router#Usage # routes 'config/routes' @@ -185,7 +185,7 @@ module Admin # Configure the code that will yield each time Admin::Action is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-controller#Configuration + # See: http://www.rubydoc.info/gems/hanami-controller#Configuration controller.prepare do # include MyAuthentication # included in all the actions # before :authenticate! # run an authentication before callback @@ -194,9 +194,9 @@ module Admin # Configure the code that will yield each time Admin::View is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-view#Configuration + # See: http://www.rubydoc.info/gems/hanami-view#Configuration view.prepare do - include Lotus::Helpers + include Hanami::Helpers end end diff --git a/test/fixtures/static_assets/apps/admin/config/routes.rb b/test/fixtures/static_assets/apps/admin/config/routes.rb index 3af730e6..550325cb 100644 --- a/test/fixtures/static_assets/apps/admin/config/routes.rb +++ b/test/fixtures/static_assets/apps/admin/config/routes.rb @@ -1,2 +1,2 @@ # Configure your routes here -# See: http://www.rubydoc.info/gems/lotus-router/#Usage \ No newline at end of file +# See: http://www.rubydoc.info/gems/hanami-router/#Usage \ No newline at end of file diff --git a/test/fixtures/static_assets/apps/web/application.rb b/test/fixtures/static_assets/apps/web/application.rb index 083b17f6..3ac96925 100644 --- a/test/fixtures/static_assets/apps/web/application.rb +++ b/test/fixtures/static_assets/apps/web/application.rb @@ -1,8 +1,8 @@ -require 'lotus/helpers' -require 'lotus/assets' +require 'hanami/helpers' +require 'hanami/assets' module Web - class Application < Lotus::Application + class Application < Hanami::Application configure do ## # BASIC @@ -23,7 +23,7 @@ module Web # Handle exceptions with HTTP statuses (true) or don't catch them (false). # Defaults to true. - # See: http://www.rubydoc.info/gems/lotus-controller/#Exceptions_management + # See: http://www.rubydoc.info/gems/hanami-controller/#Exceptions_management # # handle_exceptions true @@ -32,7 +32,7 @@ module Web # # Routes definitions for this application - # See: http://www.rubydoc.info/gems/lotus-router#Usage + # See: http://www.rubydoc.info/gems/hanami-router#Usage # routes 'config/routes' @@ -186,7 +186,7 @@ module Web # Configure the code that will yield each time Web::Action is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-controller#Configuration + # See: http://www.rubydoc.info/gems/hanami-controller#Configuration controller.prepare do # include MyAuthentication # included in all the actions # before :authenticate! # run an authentication before callback @@ -195,9 +195,9 @@ module Web # Configure the code that will yield each time Web::View is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-view#Configuration + # See: http://www.rubydoc.info/gems/hanami-view#Configuration view.prepare do - include Lotus::Helpers + include Hanami::Helpers include Web::Assets::Helpers end end diff --git a/test/fixtures/static_assets/config.ru b/test/fixtures/static_assets/config.ru index 8a3577bb..a9db2fb5 100644 --- a/test/fixtures/static_assets/config.ru +++ b/test/fixtures/static_assets/config.ru @@ -1,3 +1,3 @@ require './config/environment' -run Lotus::Container.new +run Hanami::Container.new diff --git a/test/fixtures/static_assets/config/environment.rb b/test/fixtures/static_assets/config/environment.rb index c3f65e7c..ed832d50 100644 --- a/test/fixtures/static_assets/config/environment.rb +++ b/test/fixtures/static_assets/config/environment.rb @@ -1,12 +1,12 @@ require 'rubygems' require 'bundler/setup' -require 'lotus/setup' +require 'hanami/setup' require 'tilt/sass' require_relative '../lib/static_assets' require_relative '../apps/admin/application' require_relative '../apps/web/application' -Lotus::Container.configure do +Hanami::Container.configure do mount Admin::Application, at: '/admin' mount Web::Application, at: '/' end diff --git a/test/fixtures/static_assets/lib/static_assets.rb b/test/fixtures/static_assets/lib/static_assets.rb index b617db40..7d2c8cc5 100644 --- a/test/fixtures/static_assets/lib/static_assets.rb +++ b/test/fixtures/static_assets/lib/static_assets.rb @@ -1,14 +1,14 @@ -# require 'lotus/model' -# require 'lotus/mailer' +# require 'hanami/model' +# require 'hanami/mailer' # Dir["#{ __dir__ }/static_assets/**/*.rb"].each { |file| require_relative file } -# Lotus::Model.configure do +# Hanami::Model.configure do # adapter type: :file_system, uri: ENV['STATIC_ASSETS_DATABASE_URL'] # mapping do # end # end.load! -# Lotus::Mailer.configure do +# Hanami::Mailer.configure do # root "#{ __dir__ }/static_assets/mailers" # delivery do diff --git a/test/fixtures/static_assets/spec/features_helper.rb b/test/fixtures/static_assets/spec/features_helper.rb index 8ff1d023..0fed7124 100644 --- a/test/fixtures/static_assets/spec/features_helper.rb +++ b/test/fixtures/static_assets/spec/features_helper.rb @@ -4,7 +4,7 @@ require_relative './spec_helper' require 'capybara' require 'capybara/dsl' -Capybara.app = Lotus::Container.new +Capybara.app = Hanami::Container.new class MiniTest::Spec include Capybara::DSL diff --git a/test/fixtures/static_assets/spec/spec_helper.rb b/test/fixtures/static_assets/spec/spec_helper.rb index ee100aac..09bd2290 100644 --- a/test/fixtures/static_assets/spec/spec_helper.rb +++ b/test/fixtures/static_assets/spec/spec_helper.rb @@ -1,7 +1,7 @@ # Require this file for unit tests -ENV['LOTUS_ENV'] ||= 'test' +ENV['HANAMI_ENV'] ||= 'test' require_relative '../config/environment' require 'minitest/autorun' -Lotus::Application.preload! +Hanami::Application.preload! diff --git a/test/fixtures/static_assets/spec/web/views/home/index_spec.rb b/test/fixtures/static_assets/spec/web/views/home/index_spec.rb index b217559d..7a9be8d9 100644 --- a/test/fixtures/static_assets/spec/web/views/home/index_spec.rb +++ b/test/fixtures/static_assets/spec/web/views/home/index_spec.rb @@ -3,7 +3,7 @@ require_relative '../../../../apps/web/views/home/index' describe Web::Views::Home::Index do let(:exposures) { Hash[foo: 'bar'] } - let(:template) { Lotus::View::Template.new('apps/web/templates/home/index.html.erb') } + let(:template) { Hanami::View::Template.new('apps/web/templates/home/index.html.erb') } let(:view) { Web::Views::Home::Index.new(template, exposures) } let(:rendered) { view.render } diff --git a/test/fixtures/static_assets_app/.sass-cache/ab07a89ebee816b678ec7e773ca721c0e65b0446/home.css.sassc b/test/fixtures/static_assets_app/.sass-cache/ab07a89ebee816b678ec7e773ca721c0e65b0446/home.css.sassc index 363a440f8b545dae0ab2af4731d145cd6f1c75af..cc940db61bf9ba231ab05a5d8d87945d2cd98701 100644 GIT binary patch delta 70 rcmbO)vQ%WlLq^_=#Jt4ZOnnG7`3++qhKR!CrA#WAqMN@kX|n?W#xNSr delta 64 pcmZ1~GGAoFLq_hL{F2gQeK0xs9b+FFUt#h}CKYtC&A*tm*#S(i8IAw| diff --git a/test/fixtures/static_assets_app/Gemfile b/test/fixtures/static_assets_app/Gemfile index 6b775aaa..4e9ca758 100644 --- a/test/fixtures/static_assets_app/Gemfile +++ b/test/fixtures/static_assets_app/Gemfile @@ -4,18 +4,17 @@ gem 'bundler' gem 'rake' gem 'sass' -gem 'lotus-utils', '~> 0.6', github: 'lotus/utils', branch: '0.6.x' -gem 'lotus-validations', '~> 0.3', github: 'lotus/validations', branch: '0.3.x' -gem 'lotus-router', '~> 0.4', github: 'lotus/router', branch: '0.5.x' -gem 'lotus-controller', '~> 0.4', github: 'lotus/controller', branch: '0.4.x' -gem 'lotus-view', '~> 0.4', github: 'lotus/view', branch: '0.4.x' -gem 'lotus-model', '~> 0.5', github: 'lotus/model', branch: '0.5.x' -gem 'lotus-helpers', '~> 0.2', github: 'lotus/helpers', branch: '0.2.x' -gem 'lotus-mailer', '~> 0.1', github: 'lotus/mailer', branch: '0.1.x' -gem 'lotus-assets', '~> 0.1', github: 'lotus/assets', branch: 'master' -gem 'lotusrb', path: '../../..' +gem 'hanami-utils', '~> 0.6', github: 'hanami/utils', branch: '0.6.x' +gem 'hanami-validations', '~> 0.3', github: 'hanami/validations', branch: '0.3.x' +gem 'hanami-router', '~> 0.4', github: 'hanami/router', branch: '0.5.x' +gem 'hanami-controller', '~> 0.4', github: 'hanami/controller', branch: '0.4.x' +gem 'hanami-view', '~> 0.4', github: 'hanami/view', branch: '0.4.x' +gem 'hanami-model', '~> 0.5', github: 'hanami/model', branch: '0.5.x' +gem 'hanami-helpers', '~> 0.2', github: 'hanami/helpers', branch: '0.2.x' +gem 'hanami-mailer', '~> 0.1', github: 'hanami/mailer', branch: '0.1.x' +gem 'hanami-assets', '~> 0.1', github: 'hanami/assets', branch: 'master' +gem 'hanami', path: '../../..' -gem 'byebug', require: false group :test do gem 'minitest' gem 'capybara' diff --git a/test/fixtures/static_assets_app/config/application.rb b/test/fixtures/static_assets_app/config/application.rb index 4f2bab78..2a4e822b 100644 --- a/test/fixtures/static_assets_app/config/application.rb +++ b/test/fixtures/static_assets_app/config/application.rb @@ -1,7 +1,7 @@ -require 'lotus/helpers' +require 'hanami/helpers' module StaticAssetsApp - class Application < Lotus::Application + class Application < Hanami::Application configure do ## # BASIC @@ -22,7 +22,7 @@ module StaticAssetsApp # Handle exceptions with HTTP statuses (true) or don't catch them (false). # Defaults to true. - # See: http://www.rubydoc.info/gems/lotus-controller/ + # See: http://www.rubydoc.info/gems/hanami-controller/ # Exceptions_management # @@ -33,7 +33,7 @@ module StaticAssetsApp # # Routes definitions for this application - # See: http://www.rubydoc.info/gems/lotus-router#Usage + # See: http://www.rubydoc.info/gems/hanami-router#Usage # routes 'config/routes' @@ -182,7 +182,7 @@ module StaticAssetsApp # Configure the code that will yield each time StaticAssetsApp::Action is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-controller#Configuration + # See: http://www.rubydoc.info/gems/hanami-controller#Configuration controller.prepare do # include MyAuthentication # included in all the actions # before :authenticate! # run an authentication before callback @@ -191,9 +191,9 @@ module StaticAssetsApp # Configure the code that will yield each time StaticAssetsApp::View is included # This is useful for sharing common functionality # - # See: http://www.rubydoc.info/gems/lotus-view#Configuration + # See: http://www.rubydoc.info/gems/hanami-view#Configuration view.prepare do - include Lotus::Helpers + include Hanami::Helpers include StaticAssetsApp::Assets::Helpers end end diff --git a/test/fixtures/static_assets_app/config/environment.rb b/test/fixtures/static_assets_app/config/environment.rb index bea4abaa..ea27798c 100644 --- a/test/fixtures/static_assets_app/config/environment.rb +++ b/test/fixtures/static_assets_app/config/environment.rb @@ -1,6 +1,6 @@ require 'rubygems' require 'bundler/setup' -require 'lotus/setup' +require 'hanami/setup' require 'tilt/sass' require_relative '../lib/static_assets_app' require_relative '../config/application' diff --git a/test/fixtures/static_assets_app/config/routes.rb b/test/fixtures/static_assets_app/config/routes.rb index 0a484459..e63d24d1 100644 --- a/test/fixtures/static_assets_app/config/routes.rb +++ b/test/fixtures/static_assets_app/config/routes.rb @@ -1,3 +1,3 @@ get '/', to: 'home#index' # Configure your routes here -# See: http://www.rubydoc.info/gems/lotus-router/#Usage +# See: http://www.rubydoc.info/gems/hanami-router/#Usage diff --git a/test/fixtures/static_assets_app/lib/static_assets_app.rb b/test/fixtures/static_assets_app/lib/static_assets_app.rb index e5127861..7a1562e3 100644 --- a/test/fixtures/static_assets_app/lib/static_assets_app.rb +++ b/test/fixtures/static_assets_app/lib/static_assets_app.rb @@ -1,14 +1,14 @@ -# require 'lotus/model' -# require 'lotus/mailer' +# require 'hanami/model' +# require 'hanami/mailer' # Dir["#{ __dir__ }/static_assets_app/**/*.rb"].each { |file| require_relative file } -# Lotus::Model.configure do +# Hanami::Model.configure do # adapter type: :file_system, uri: ENV['STATIC_ASSETS_APP_DATABASE_URL'] # mapping do # end # end.load! -# Lotus::Mailer.configure do +# Hanami::Mailer.configure do # root "#{ __dir__ }/static_assets_app/mailers" # delivery do diff --git a/test/fixtures/static_assets_app/spec/spec_helper.rb b/test/fixtures/static_assets_app/spec/spec_helper.rb index ee100aac..09bd2290 100644 --- a/test/fixtures/static_assets_app/spec/spec_helper.rb +++ b/test/fixtures/static_assets_app/spec/spec_helper.rb @@ -1,7 +1,7 @@ # Require this file for unit tests -ENV['LOTUS_ENV'] ||= 'test' +ENV['HANAMI_ENV'] ||= 'test' require_relative '../config/environment' require 'minitest/autorun' -Lotus::Application.preload! +Hanami::Application.preload! diff --git a/test/fixtures/static_assets_app/spec/views/home/index_spec.rb b/test/fixtures/static_assets_app/spec/views/home/index_spec.rb index 5ed6b389..05de0a91 100644 --- a/test/fixtures/static_assets_app/spec/views/home/index_spec.rb +++ b/test/fixtures/static_assets_app/spec/views/home/index_spec.rb @@ -3,7 +3,7 @@ require_relative '../../../app/views/home/index' describe StaticAssetsApp::Views::Home::Index do let(:exposures) { Hash[foo: 'bar'] } - let(:template) { Lotus::View::Template.new('app/templates/home/index.html.erb') } + let(:template) { Hanami::View::Template.new('app/templates/home/index.html.erb') } let(:view) { StaticAssetsApp::Views::Home::Index.new(template, exposures) } let(:rendered) { view.render } diff --git a/test/fixtures/streaming/.hanamirc b/test/fixtures/streaming/.hanamirc new file mode 100644 index 00000000..e6018c23 --- /dev/null +++ b/test/fixtures/streaming/.hanamirc @@ -0,0 +1,3 @@ +architecture=container +test=minitest +template=erb diff --git a/test/fixtures/streaming/application.rb b/test/fixtures/streaming/application.rb index 6eea45be..0b7f0b64 100644 --- a/test/fixtures/streaming/application.rb +++ b/test/fixtures/streaming/application.rb @@ -1,7 +1,7 @@ require 'rack/chunked' module StreamingApp - class Application < Lotus::Application + class Application < Hanami::Application configure do # Activate Streaming middleware.use ::Rack::Chunked diff --git a/test/fixtures/streaming/config.ru b/test/fixtures/streaming/config.ru index de6c15f3..0ce352e3 100644 --- a/test/fixtures/streaming/config.ru +++ b/test/fixtures/streaming/config.ru @@ -1,4 +1,4 @@ -require 'lotus' +require 'hanami' require_relative 'application' run StreamingApp::Application.new diff --git a/test/fixtures/welcome_app/.hanamirc b/test/fixtures/welcome_app/.hanamirc new file mode 100644 index 00000000..e6018c23 --- /dev/null +++ b/test/fixtures/welcome_app/.hanamirc @@ -0,0 +1,3 @@ +architecture=container +test=minitest +template=erb diff --git a/test/fixtures/welcome_app/application.rb b/test/fixtures/welcome_app/application.rb index f444c426..c31e485a 100644 --- a/test/fixtures/welcome_app/application.rb +++ b/test/fixtures/welcome_app/application.rb @@ -1,5 +1,5 @@ module WelcomeApp - class Application < Lotus::Application + class Application < Hanami::Application configure do end end diff --git a/test/generators/database_config_test.rb b/test/generators/database_config_test.rb index 4ae33316..190c0298 100644 --- a/test/generators/database_config_test.rb +++ b/test/generators/database_config_test.rb @@ -1,8 +1,8 @@ require 'test_helper' -require 'lotus/generators/database_config' +require 'hanami/generators/database_config' -describe Lotus::Generators::DatabaseConfig do - let(:database_config) { Lotus::Generators::DatabaseConfig.new(engine, 'basecamp') } +describe Hanami::Generators::DatabaseConfig do + let(:database_config) { Hanami::Generators::DatabaseConfig.new(engine, 'basecamp') } describe '#type' do describe 'when engine is SQL Database' do @@ -57,14 +57,14 @@ describe Lotus::Generators::DatabaseConfig do end describe '#to_hash' do - let(:adapter_prefix) { :'jdbc:' if Lotus::Utils.jruby? } + let(:adapter_prefix) { :'jdbc:' if Hanami::Utils.jruby? } describe 'SQL databases' do let(:engine) { 'postgres' } it 'returns a hash containing gem, right connection URIs and type' do database_config.to_hash.must_equal( - gem: (Lotus::Utils.jruby? ? 'jdbc-postgres' : 'pg'), + gem: (Hanami::Utils.jruby? ? 'jdbc-postgres' : 'pg'), type: :sql, uri: { development: "#{ adapter_prefix }postgres://localhost/basecamp_development", diff --git a/test/generators/test_framework_test.rb b/test/generators/test_framework_test.rb index 213a149c..12d1d3d4 100644 --- a/test/generators/test_framework_test.rb +++ b/test/generators/test_framework_test.rb @@ -1,44 +1,44 @@ require 'test_helper' -require 'lotus/generators/test_framework' +require 'hanami/generators/test_framework' -describe Lotus::Generators::TestFramework do +describe Hanami::Generators::TestFramework do - describe 'respects lotusrc' do + describe 'respects hanamirc' do it 'detects rspec' do with_temp_dir do |original_wd| - FileUtils.cp original_wd.join('test', 'fixtures', 'lotusrc', 'with_rspec'), '.lotusrc' - lotusrc = Lotus::Lotusrc.new(Pathname.new(Dir.pwd)) - test_framework = Lotus::Generators::TestFramework.new(lotusrc, nil) + FileUtils.cp original_wd.join('test', 'fixtures', 'hanamirc', 'with_rspec'), '.hanamirc' + hanamirc = Hanami::Hanamirc.new(Pathname.new(Dir.pwd)) + test_framework = Hanami::Generators::TestFramework.new(hanamirc, nil) test_framework.rspec?.must_equal(true) test_framework.minitest?.must_equal(false) end end it 'detects minitest' do with_temp_dir do |original_wd| - FileUtils.cp original_wd.join('test', 'fixtures', 'lotusrc', 'with_minitest'), '.lotusrc' - lotusrc = Lotus::Lotusrc.new(Pathname.new(Dir.pwd)) - test_framework = Lotus::Generators::TestFramework.new(lotusrc, nil) + FileUtils.cp original_wd.join('test', 'fixtures', 'hanamirc', 'with_minitest'), '.hanamirc' + hanamirc = Hanami::Hanamirc.new(Pathname.new(Dir.pwd)) + test_framework = Hanami::Generators::TestFramework.new(hanamirc, nil) test_framework.rspec?.must_equal(false) test_framework.minitest?.must_equal(true) end end end - describe 'override lotusrc with argument' do + describe 'override hanamirc with argument' do it 'detects rspec' do with_temp_dir do |original_wd| - FileUtils.cp original_wd.join('test', 'fixtures', 'lotusrc', 'with_minitest'), '.lotusrc' - lotusrc = Lotus::Lotusrc.new(Pathname.new(Dir.pwd)) - test_framework = Lotus::Generators::TestFramework.new(lotusrc, 'rspec') + FileUtils.cp original_wd.join('test', 'fixtures', 'hanamirc', 'with_minitest'), '.hanamirc' + hanamirc = Hanami::Hanamirc.new(Pathname.new(Dir.pwd)) + test_framework = Hanami::Generators::TestFramework.new(hanamirc, 'rspec') test_framework.rspec?.must_equal(true) test_framework.minitest?.must_equal(false) end end it 'detects minitest' do with_temp_dir do |original_wd| - FileUtils.cp original_wd.join('test', 'fixtures', 'lotusrc', 'with_rspec'), '.lotusrc' - lotusrc = Lotus::Lotusrc.new(Pathname.new(Dir.pwd)) - test_framework = Lotus::Generators::TestFramework.new(lotusrc, 'minitest') + FileUtils.cp original_wd.join('test', 'fixtures', 'hanamirc', 'with_rspec'), '.hanamirc' + hanamirc = Hanami::Hanamirc.new(Pathname.new(Dir.pwd)) + test_framework = Hanami::Generators::TestFramework.new(hanamirc, 'minitest') test_framework.rspec?.must_equal(false) test_framework.minitest?.must_equal(true) end diff --git a/test/lotus_setup_test.rb b/test/hanami_setup_test.rb similarity index 69% rename from test/lotus_setup_test.rb rename to test/hanami_setup_test.rb index 8027ec8d..bbefc753 100644 --- a/test/lotus_setup_test.rb +++ b/test/hanami_setup_test.rb @@ -1,11 +1,11 @@ require 'test_helper' -describe 'lotus/setup' do +describe 'hanami/setup' do describe 'when required' do before do - ENV['LOTUS_ENV'] = ENV['RACK_ENV'] = nil + ENV['HANAMI_ENV'] = ENV['RACK_ENV'] = nil - Lotus::Utils::IO.silence_warnings do + Hanami::Utils::IO.silence_warnings do @bundler = Bundler Bundler = Module.new do @@ -22,17 +22,17 @@ describe 'lotus/setup' do end end - require 'lotus/setup' + require 'hanami/setup' end after do - Lotus::Utils::IO.silence_warnings do + Hanami::Utils::IO.silence_warnings do Bundler = @bundler end end it 'requires Bundler groups' do - env = Lotus::Environment.new + env = Hanami::Environment.new Bundler.required_groups.must_equal(env.bundler_groups) end diff --git a/test/lotusrc_test.rb b/test/hanamirc_test.rb similarity index 71% rename from test/lotusrc_test.rb rename to test/hanamirc_test.rb index 64a2db02..d7b7c6eb 100644 --- a/test/lotusrc_test.rb +++ b/test/hanamirc_test.rb @@ -1,13 +1,13 @@ require 'test_helper' -describe Lotus::Lotusrc do +describe Hanami::Hanamirc do describe '#options' do before do Dir.chdir($pwd) @old_pwd = Dir.pwd - Dir.chdir lotusrc_path + Dir.chdir hanamirc_path @root = Pathname.new(Dir.pwd) - @lotusrc = Lotus::Lotusrc.new(@root) + @hanamirc = Hanami::Hanamirc.new(@root) end after do @@ -15,22 +15,22 @@ describe Lotus::Lotusrc do end describe 'file exists' do - let(:lotusrc_path) { 'test/fixtures/lotusrc/exists' } + let(:hanamirc_path) { 'test/fixtures/hanamirc/exists' } describe "#exists?" do it 'retuns true' do - @lotusrc.exists?.must_equal true + @hanamirc.exists?.must_equal true end end it 'get values in the file' do - options = @lotusrc.options + options = @hanamirc.options options[:architecture].must_equal 'container' options[:test].must_equal 'minitest' options[:template].must_equal 'erb' end - # Bug: https://github.com/lotus/lotus/issues/243 + # Bug: https://github.com/hanami/hanami/issues/243 it "doesn't pollute ENV" do ENV.key?('architecture').must_equal false ENV.key?('test').must_equal false @@ -39,23 +39,23 @@ describe Lotus::Lotusrc do it 'returns only environment options' do allowed_keys = %i[architecture test template] - options = @lotusrc.options + options = @hanamirc.options options.keys.must_equal allowed_keys end end describe "file doesn't exist" do - let(:lotusrc_path) { 'test/fixtures/lotusrc/no_exists' } + let(:hanamirc_path) { 'test/fixtures/hanamirc/no_exists' } describe "#exists?" do it 'retuns false' do - @lotusrc.exists?.must_equal false + @hanamirc.exists?.must_equal false end end describe 'default values' do it 'reads the file' do - options = @lotusrc.options + options = @hanamirc.options options[:architecture].must_equal 'container' options[:test].must_equal 'minitest' options[:template].must_equal 'erb' diff --git a/test/integration/assets_digest_mode/test_application.rb b/test/integration/assets_digest_mode/test_application.rb index d81e4301..16876590 100644 --- a/test/integration/assets_digest_mode/test_application.rb +++ b/test/integration/assets_digest_mode/test_application.rb @@ -12,10 +12,10 @@ describe 'Render assets path with digest mode (Application)' do @current_dir = Dir.pwd Dir.chdir root - @lotus_env = ENV['LOTUS_ENV'] - ENV['LOTUS_ENV'] = 'production' + @hanami_env = ENV['HANAMI_ENV'] + ENV['HANAMI_ENV'] = 'production' - `bundle exec lotus assets precompile` + `bundle exec hanami assets precompile` public_directory.join('assets.json').must_be :exist? require root.join('config', 'environment') @@ -23,7 +23,7 @@ describe 'Render assets path with digest mode (Application)' do end after do - ENV['LOTUS_ENV'] = @lotus_env + ENV['HANAMI_ENV'] = @hanami_env Dir.chdir @current_dir @current_dir = nil diff --git a/test/integration/assets_digest_mode/test_container.rb b/test/integration/assets_digest_mode/test_container.rb index b6c0719b..0995275c 100644 --- a/test/integration/assets_digest_mode/test_container.rb +++ b/test/integration/assets_digest_mode/test_container.rb @@ -12,18 +12,18 @@ describe 'Render assets path with digest mode (Container)' do @current_dir = Dir.pwd Dir.chdir root - @lotus_env = ENV['LOTUS_ENV'] - ENV['LOTUS_ENV'] = 'production' + @hanami_env = ENV['HANAMI_ENV'] + ENV['HANAMI_ENV'] = 'production' - `bundle exec lotus assets precompile` + `bundle exec hanami assets precompile` public_directory.join('assets.json').must_be :exist? require root.join('config', 'environment') - @app = Lotus::Container.new + @app = Hanami::Container.new end after do - ENV['LOTUS_ENV'] = @lotus_env + ENV['HANAMI_ENV'] = @hanami_env Dir.chdir @current_dir @current_dir = nil diff --git a/test/integration/assets_precompile/test_application.rb b/test/integration/assets_precompile/test_application.rb index 7a808977..7f2c5d4f 100644 --- a/test/integration/assets_precompile/test_application.rb +++ b/test/integration/assets_precompile/test_application.rb @@ -10,12 +10,12 @@ describe 'Precompile static assets (Application)' do @current_dir = Dir.pwd Dir.chdir root - @lotus_env = ENV['LOTUS_ENV'] - ENV['LOTUS_ENV'] = 'production' + @hanami_env = ENV['HANAMI_ENV'] + ENV['HANAMI_ENV'] = 'production' end after do - ENV['LOTUS_ENV'] = @lotus_env + ENV['HANAMI_ENV'] = @hanami_env Dir.chdir @current_dir @current_dir = nil end @@ -25,7 +25,7 @@ describe 'Precompile static assets (Application)' do let(:assets_directory) { public_directory.join('assets') } it 'precompiles assets' do - `bundle exec lotus assets precompile` + `bundle exec hanami assets precompile` public_directory.join('assets.json').must_be :exist? diff --git a/test/integration/assets_precompile/test_container.rb b/test/integration/assets_precompile/test_container.rb index 2b854631..973a038c 100644 --- a/test/integration/assets_precompile/test_container.rb +++ b/test/integration/assets_precompile/test_container.rb @@ -10,12 +10,12 @@ describe 'Precompile static assets (Container)' do @current_dir = Dir.pwd Dir.chdir root - @lotus_env = ENV['LOTUS_ENV'] - ENV['LOTUS_ENV'] = 'production' + @hanami_env = ENV['HANAMI_ENV'] + ENV['HANAMI_ENV'] = 'production' end after do - ENV['LOTUS_ENV'] = @lotus_env + ENV['HANAMI_ENV'] = @hanami_env Dir.chdir @current_dir @current_dir = nil end @@ -25,7 +25,7 @@ describe 'Precompile static assets (Container)' do let(:assets_directory) { public_directory.join('assets') } it 'precompiles assets' do - `bundle exec lotus assets precompile` + `bundle exec hanami assets precompile` public_directory.join('assets.json').must_be :exist? diff --git a/test/integration/cdn/test_application.rb b/test/integration/cdn/test_application.rb index 29a66026..31439019 100644 --- a/test/integration/cdn/test_application.rb +++ b/test/integration/cdn/test_application.rb @@ -7,17 +7,17 @@ describe 'CDN (Application)' do @current_dir = Dir.pwd Dir.chdir root - @lotus_env = ENV['LOTUS_ENV'] - ENV['LOTUS_ENV'] = 'production' + @hanami_env = ENV['HANAMI_ENV'] + ENV['HANAMI_ENV'] = 'production' - assert system("LOTUS_ENV=production bundle exec lotus assets precompile") + assert system("HANAMI_ENV=production bundle exec hanami assets precompile") require root.join('config', 'environment') @app = CdnApp::Application.new end after do - ENV['LOTUS_ENV'] = @lotus_env + ENV['HANAMI_ENV'] = @hanami_env Dir.chdir @current_dir @current_dir = nil diff --git a/test/integration/cdn/test_container.rb b/test/integration/cdn/test_container.rb index f6e6493b..22d24b22 100644 --- a/test/integration/cdn/test_container.rb +++ b/test/integration/cdn/test_container.rb @@ -10,17 +10,17 @@ describe 'CDN (Container)' do @current_dir = Dir.pwd Dir.chdir root - @lotus_env = ENV['LOTUS_ENV'] - ENV['LOTUS_ENV'] = 'production' + @hanami_env = ENV['HANAMI_ENV'] + ENV['HANAMI_ENV'] = 'production' - assert system("LOTUS_ENV=production bundle exec lotus assets precompile") + assert system("HANAMI_ENV=production bundle exec hanami assets precompile") require root.join('config', 'environment') - @app = Lotus::Container.new + @app = Hanami::Container.new end after do - ENV['LOTUS_ENV'] = @lotus_env + ENV['HANAMI_ENV'] = @hanami_env Dir.chdir @current_dir @current_dir = nil diff --git a/test/integration/cli/database_test.rb b/test/integration/cli/database_test.rb index 8867dc57..d1dcaa50 100644 --- a/test/integration/cli/database_test.rb +++ b/test/integration/cli/database_test.rb @@ -2,15 +2,15 @@ require 'test_helper' require 'sequel' require 'fileutils' -describe 'lotus db' do - let(:adapter_prefix) { 'jdbc:' if Lotus::Utils.jruby? } +describe 'hanami db' do + let(:adapter_prefix) { 'jdbc:' if Hanami::Utils.jruby? } architectures = { container: nil, app: nil } - let(:lotus_env) { 'development' } + let(:hanami_env) { 'development' } let(:app_name) { 'delivery' } let(:tmp) { Pathname.new(Dir.pwd).join("tmp/integration/cli/database/#{ architecture }") } let(:root) { tmp.join(app_name) } @@ -23,7 +23,7 @@ describe 'lotus db' do end def generate_application - `lotus new #{ app_name } --architecture="#{ architecture }" --database=sqlite3` + `hanami new #{ app_name } --architecture="#{ architecture }" --database=sqlite3` Dir.chdir(root) File.open(root.join('.env.development'), 'w') do |f| @@ -50,7 +50,7 @@ describe 'lotus db' do def write_migrations File.open(root.join('db/migrations/20150613152241_create_users.rb'), 'w') do |f| f.write <<-MIGRATION -Lotus::Model.migration do +Hanami::Model.migration do change do create_table :users do primary_key :id @@ -63,7 +63,7 @@ MIGRATION File.open(root.join('db/migrations/20150613152815_add_name_to_users.rb'), 'w') do |f| f.write <<-MIGRATION -Lotus::Model.migration do +Hanami::Model.migration do change do alter_table :users do add_column :name, String @@ -75,27 +75,27 @@ MIGRATION end def db_create - `LOTUS_ENV="#{ lotus_env }" lotus db create` + `HANAMI_ENV="#{ hanami_env }" hanami db create` end def db_drop - `LOTUS_ENV="#{ lotus_env }" lotus db drop` + `HANAMI_ENV="#{ hanami_env }" hanami db drop` end def db_migrate(version = nil) - `LOTUS_ENV="#{ lotus_env }" lotus db migrate #{ version }` + `HANAMI_ENV="#{ hanami_env }" hanami db migrate #{ version }` end def db_apply - `LOTUS_ENV="#{ lotus_env }" lotus db apply` + `HANAMI_ENV="#{ hanami_env }" hanami db apply` end def db_prepare - `LOTUS_ENV="#{ lotus_env }" lotus db prepare` + `HANAMI_ENV="#{ hanami_env }" hanami db prepare` end def db_version - `LOTUS_ENV="#{ lotus_env }" lotus db version` + `HANAMI_ENV="#{ hanami_env }" hanami db version` end before do @@ -131,7 +131,7 @@ MIGRATION end describe 'test environment' do - let(:lotus_env) { 'test' } + let(:hanami_env) { 'test' } it 'creates database' do root.join("db/#{ app_name }_test.sqlite3").must_be :exist? @@ -139,7 +139,7 @@ MIGRATION end describe 'production environment' do - let(:lotus_env) { 'production' } + let(:hanami_env) { 'production' } it "doesn't create database" do root.join("db/#{ app_name }.sqlite3").wont_be :exist? @@ -164,7 +164,7 @@ MIGRATION end describe 'test environment' do - let(:lotus_env) { 'test' } + let(:hanami_env) { 'test' } it 'drops database' do db_create @@ -175,7 +175,7 @@ MIGRATION end describe 'production environment' do - let(:lotus_env) { 'production' } + let(:hanami_env) { 'production' } it "doesn't drop database" do production_database = root.join("db/#{ app_name }.sqlite3") @@ -212,7 +212,7 @@ MIGRATION end describe 'test environment' do - let(:lotus_env) { 'test' } + let(:hanami_env) { 'test' } it 'migrates database' do database = root.join("db/#{ app_name }_test.sqlite3") @@ -224,7 +224,7 @@ MIGRATION end describe 'production environment' do - let(:lotus_env) { 'production' } + let(:hanami_env) { 'production' } it 'migrates database' # it 'migrates database' do @@ -262,7 +262,7 @@ MIGRATION end describe 'test environment' do - let(:lotus_env) { 'test' } + let(:hanami_env) { 'test' } it 'migrates database' do database = root.join("db/#{ app_name }_test.sqlite3") @@ -274,7 +274,7 @@ MIGRATION end describe 'production environment' do - let(:lotus_env) { 'production' } + let(:hanami_env) { 'production' } it 'migrates database' # it 'migrates database' do @@ -318,7 +318,7 @@ MIGRATION end describe 'test environment' do - let(:lotus_env) { 'test' } + let(:hanami_env) { 'test' } it "doesn't migrate database without generating schema neither deleting migrations" do database = root.join("db/#{ app_name }_test.sqlite3") @@ -332,7 +332,7 @@ MIGRATION end describe 'production environment' do - let(:lotus_env) { 'production' } + let(:hanami_env) { 'production' } it "doesn't migrate database without generating schema neither deleting migrations" do database = root.join("db/#{ app_name }.sqlite3") @@ -358,7 +358,7 @@ MIGRATION File.open(migration_file, 'w') do |f| f.write <<-MIGRATION -Lotus::Model.migration do +Hanami::Model.migration do change do create_table :deliveries do primary_key :id @@ -387,7 +387,7 @@ MIGRATION end describe 'test environment' do - let(:lotus_env) { 'test' } + let(:hanami_env) { 'test' } it 'creates and migrates database' do database = root.join("db/#{ app_name }_test.sqlite3") @@ -399,7 +399,7 @@ MIGRATION end describe 'production environment' do - let(:lotus_env) { 'production' } + let(:hanami_env) { 'production' } it "doesn't create database" do database = root.join("db/#{ app_name }.sqlite3") @@ -431,7 +431,7 @@ MIGRATION end describe 'test environment' do - let(:lotus_env) { 'test' } + let(:hanami_env) { 'test' } it 'prints current database version' do out = db_version @@ -441,7 +441,7 @@ MIGRATION end describe 'production environment' do - let(:lotus_env) { 'production' } + let(:hanami_env) { 'production' } it 'prints current database version' # it 'prints current database version' do diff --git a/test/integration/configuration_test.rb b/test/integration/configuration_test.rb index 07e98e49..7be24f8a 100644 --- a/test/integration/configuration_test.rb +++ b/test/integration/configuration_test.rb @@ -46,7 +46,7 @@ describe 'Configurable application' do describe "model configuration" do it 'forwards settings' do adapter = Configurable::Model.configuration.instance_variable_get(:@adapter) - adapter.must_be_kind_of(Lotus::Model::Adapters::MemoryAdapter) + adapter.must_be_kind_of(Hanami::Model::Adapters::MemoryAdapter) end end diff --git a/test/integration/container_force_ssl_test.rb b/test/integration/container_force_ssl_test.rb index 984906d1..f2229b79 100644 --- a/test/integration/container_force_ssl_test.rb +++ b/test/integration/container_force_ssl_test.rb @@ -1,7 +1,7 @@ require 'test_helper' require 'rack/test' -describe Lotus::Container do +describe Hanami::Container do include Rack::Test::Methods def app @@ -14,12 +14,12 @@ describe Lotus::Container do describe 'force_ssl activated' do before do - Lotus::Container.configure do + Hanami::Container.configure do mount Backend::App, at: '/backend' mount ContainerForceSsl::Application, at: '/' end - @container = Lotus::Container.new + @container = Hanami::Container.new end it "doesn't force SSL if app doesn't has force_ssl turned on" do @@ -42,11 +42,11 @@ describe Lotus::Container do describe 'force_ssl desactivated' do before do - Lotus::Container.configure do + Hanami::Container.configure do mount ContainerNoForceSsl::Application, at: '/' end - @container = Lotus::Container.new + @container = Hanami::Container.new end it "https request doesn't return Strict-Transport-Security header" do diff --git a/test/integration/container_test.rb b/test/integration/container_test.rb index cd6c75be..ab26100c 100644 --- a/test/integration/container_test.rb +++ b/test/integration/container_test.rb @@ -1,16 +1,16 @@ require 'test_helper' require 'rack/test' -describe Lotus::Container do +describe Hanami::Container do include Rack::Test::Methods before do - Lotus::Container.configure do + Hanami::Container.configure do mount Front::Application, at: '/front' mount Back::Application, at: '/back' end - @container = Lotus::Container.new + @container = Hanami::Container.new Front::Application.load! Back::Application.load! end diff --git a/test/integration/cookies_test.rb b/test/integration/cookies_test.rb index f3d07f43..0aab19a0 100644 --- a/test/integration/cookies_test.rb +++ b/test/integration/cookies_test.rb @@ -34,14 +34,14 @@ describe 'Cookies' do request.cookies.must_equal({ 'foo' => 'bar' }) response.body.must_equal('bar') - response.headers['Set-Cookie'].must_equal('foo=bar; domain=lotusrb.org; path=/another_controller; secure; HttpOnly') + response.headers['Set-Cookie'].must_equal('foo=bar; domain=hanamirb.org; path=/another_controller; secure; HttpOnly') end it 'succesfully sets cookies' do get '/set_cookies' response.body.must_equal('yummy!') - response.headers['Set-Cookie'].must_equal('foo=nomnomnom%21; domain=lotusrb.org; path=/another_controller; secure; HttpOnly') + response.headers['Set-Cookie'].must_equal('foo=nomnomnom%21; domain=hanamirb.org; path=/another_controller; secure; HttpOnly') end it 'sucessfully sets cookies with options' do @@ -49,7 +49,7 @@ describe 'Cookies' do get '/set_cookies_with_options', { expires: next_week } response.body.must_equal('with options!') - response.headers['Set-Cookie'].must_equal("foo=nomnomnom%21; domain=lotusrocks.com; path=/controller; expires=#{next_week.gmtime.rfc2822}; secure; HttpOnly") + response.headers['Set-Cookie'].must_equal("foo=nomnomnom%21; domain=hanamirocks.com; path=/controller; expires=#{next_week.gmtime.rfc2822}; secure; HttpOnly") end it 'sucessfully deletes cookies' do @@ -58,6 +58,6 @@ describe 'Cookies' do request.cookies.must_equal({ 'foo' => 'bar', 'delete' => 'cookie' }) response.body.must_equal('deleted!') - response.headers['Set-Cookie'].must_equal("foo=bar; domain=lotusrb.org; path=/another_controller; secure; HttpOnly\ndelete=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 -0000") + response.headers['Set-Cookie'].must_equal("foo=bar; domain=hanamirb.org; path=/another_controller; secure; HttpOnly\ndelete=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 -0000") end end diff --git a/test/integration/full_stack_test.rb b/test/integration/full_stack_test.rb index 99990e6e..493b0ddc 100644 --- a/test/integration/full_stack_test.rb +++ b/test/integration/full_stack_test.rb @@ -2,7 +2,7 @@ require 'test_helper' require 'rack/test' require 'fixtures/collaboration/apps/web/application' -describe 'A full stack Lotus application' do +describe 'A full stack Hanami application' do include Rack::Test::Methods attr_reader :app diff --git a/test/integration/headers_test.rb b/test/integration/headers_test.rb index 5ac1234f..01a070e9 100644 --- a/test/integration/headers_test.rb +++ b/test/integration/headers_test.rb @@ -3,7 +3,7 @@ require 'rack/test' require 'fixtures/collaboration/apps/web/application' require 'fixtures/security_headers/apps/web/application' -describe 'A full stack Lotus application' do +describe 'A full stack Hanami application' do describe 'with default headers' do include Rack::Test::Methods diff --git a/test/integration/microservices_test.rb b/test/integration/microservices_test.rb index a3a95138..905d58a4 100644 --- a/test/integration/microservices_test.rb +++ b/test/integration/microservices_test.rb @@ -3,14 +3,14 @@ require 'rack/test' require 'fixtures/microservices/apps/frontend/application' require 'fixtures/microservices/apps/backend/application' -describe 'Lotus microservices applications' do +describe 'Hanami microservices applications' do include Rack::Test::Methods before do @current_dir = Dir.pwd Dir.chdir FIXTURES_ROOT.join('microservices') - @app = Lotus::Router.new do + @app = Hanami::Router.new do mount Backend::Application.new, at: '/backend' mount Frontend::Application.new, at: '/' end diff --git a/test/integration/modulized_application_test.rb b/test/integration/modulized_application_test.rb index 56c47b21..05d6de4a 100644 --- a/test/integration/modulized_application_test.rb +++ b/test/integration/modulized_application_test.rb @@ -2,7 +2,7 @@ require 'test_helper' require 'rack/test' require 'fixtures/furnitures/application' -describe 'A modulized Lotus application' do +describe 'A modulized Hanami application' do include Rack::Test::Methods before do diff --git a/test/integration/one_file_test.rb b/test/integration/one_file_test.rb index 07b29ac0..4691f4bf 100644 --- a/test/integration/one_file_test.rb +++ b/test/integration/one_file_test.rb @@ -2,7 +2,7 @@ require 'test_helper' require 'rack/test' require 'fixtures/one_file/application' -describe 'A one file Lotus application' do +describe 'A one file Hanami application' do include Rack::Test::Methods before do diff --git a/test/integration/rake/test_application.rb b/test/integration/rake/test_application.rb index e7c67bde..afd858db 100644 --- a/test/integration/rake/test_application.rb +++ b/test/integration/rake/test_application.rb @@ -34,9 +34,9 @@ describe 'Rake tasks (Application)' do out.must_include %("SERVE_STATIC_ASSETS"=>"true") out.must_include %("RAKE_TASKS_APP_SESSIONS_SECRET") out.must_include %("RACK_ENV") - out.must_include %("LOTUS_ENV") - out.must_include %("LOTUS_HOST") - out.must_include %("LOTUS_PORT"=>"2300") + out.must_include %("HANAMI_ENV") + out.must_include %("HANAMI_HOST") + out.must_include %("HANAMI_PORT"=>"2300") end it "doesn't load application code from lib/" do @@ -63,9 +63,9 @@ describe 'Rake tasks (Application)' do out.must_include %("SERVE_STATIC_ASSETS"=>"true") out.must_include %("RAKE_TASKS_APP_SESSIONS_SECRET") out.must_include %("RACK_ENV") - out.must_include %("LOTUS_ENV") - out.must_include %("LOTUS_HOST") - out.must_include %("LOTUS_PORT"=>"2300") + out.must_include %("HANAMI_ENV") + out.must_include %("HANAMI_HOST") + out.must_include %("HANAMI_PORT"=>"2300") end it "loads application code from lib/" do diff --git a/test/integration/rake/test_container.rb b/test/integration/rake/test_container.rb index cf76cb75..637ae49f 100644 --- a/test/integration/rake/test_container.rb +++ b/test/integration/rake/test_container.rb @@ -34,9 +34,9 @@ describe 'Rake tasks (Container)' do out.must_include %("SERVE_STATIC_ASSETS"=>"true") out.must_include %("WEB_SESSIONS_SECRET") out.must_include %("RACK_ENV") - out.must_include %("LOTUS_ENV") - out.must_include %("LOTUS_HOST") - out.must_include %("LOTUS_PORT"=>"2300") + out.must_include %("HANAMI_ENV") + out.must_include %("HANAMI_HOST") + out.must_include %("HANAMI_PORT"=>"2300") end it "doesn't load application code from lib/" do @@ -63,9 +63,9 @@ describe 'Rake tasks (Container)' do out.must_include %("SERVE_STATIC_ASSETS"=>"true") out.must_include %("WEB_SESSIONS_SECRET") out.must_include %("RACK_ENV") - out.must_include %("LOTUS_ENV") - out.must_include %("LOTUS_HOST") - out.must_include %("LOTUS_PORT"=>"2300") + out.must_include %("HANAMI_ENV") + out.must_include %("HANAMI_HOST") + out.must_include %("HANAMI_PORT"=>"2300") end it "loads application code from lib/" do diff --git a/test/integration/sessions_test.rb b/test/integration/sessions_test.rb index 39e87924..4196ce39 100644 --- a/test/integration/sessions_test.rb +++ b/test/integration/sessions_test.rb @@ -35,23 +35,23 @@ describe 'Sessions' do end it 'allows to set session' do - post '/set_session', { name: 'Lotus', _csrf_token: 'app123' } + post '/set_session', { name: 'Hanami', _csrf_token: 'app123' } - response.body.must_equal 'Session created for: Lotus' + response.body.must_equal 'Session created for: Hanami' end it 'preserves session between requests' do - post '/set_session', { name: 'Lotus', _csrf_token: 'app123' } + post '/set_session', { name: 'Hanami', _csrf_token: 'app123' } get '/get_session', nil, { 'HTTP_COOKIE' => response.headers['Set-Cookie'] } - response.body.must_equal 'Lotus' + response.body.must_equal 'Hanami' end it 'allows to clear session' do - post '/set_session', { name: 'Lotus', _csrf_token: 'app123' } + post '/set_session', { name: 'Hanami', _csrf_token: 'app123' } delete '/clear_session', { _csrf_token: 'app123'}, { 'HTTP_COOKIE' => response.headers['Set-Cookie'] } - response.body.must_equal 'Session cleared for: Lotus' + response.body.must_equal 'Session cleared for: Hanami' get '/get_session', nil, { 'HTTP_COOKIE' => response.headers['Set-Cookie'] } response.body.must_equal '[empty]' diff --git a/test/integration/static_assets/test_application.rb b/test/integration/static_assets/test_application.rb index 02ca9447..7f5b290b 100644 --- a/test/integration/static_assets/test_application.rb +++ b/test/integration/static_assets/test_application.rb @@ -103,12 +103,12 @@ JS describe 'production mode' do before do - @lotus_env = ENV['LOTUS_ENV'] - ENV['LOTUS_ENV'] = 'production' + @hanami_env = ENV['HANAMI_ENV'] + ENV['HANAMI_ENV'] = 'production' end after do - ENV['LOTUS_ENV'] = @lotus_env + ENV['HANAMI_ENV'] = @hanami_env end it "serves static files" do diff --git a/test/integration/static_assets/test_container.rb b/test/integration/static_assets/test_container.rb index 4bf0edc8..adf890e3 100644 --- a/test/integration/static_assets/test_container.rb +++ b/test/integration/static_assets/test_container.rb @@ -12,7 +12,7 @@ describe 'Serve static assets (Container)' do ENV['SERVE_STATIC_ASSETS'] = 'true' require root.join('config', 'environment') - @app = Lotus::Container.new + @app = Hanami::Container.new end after do @@ -114,12 +114,12 @@ JS describe 'production mode' do before do - @lotus_env = ENV['LOTUS_ENV'] - ENV['LOTUS_ENV'] = 'production' + @hanami_env = ENV['HANAMI_ENV'] + ENV['HANAMI_ENV'] = 'production' end after do - ENV['LOTUS_ENV'] = @lotus_env + ENV['HANAMI_ENV'] = @hanami_env end it "serves static files" do diff --git a/test/integration/top_level_application_test.rb b/test/integration/top_level_application_test.rb index cf625137..71771e35 100644 --- a/test/integration/top_level_application_test.rb +++ b/test/integration/top_level_application_test.rb @@ -2,7 +2,7 @@ require 'test_helper' require 'rack/test' require 'fixtures/information_tech/application' -describe 'A top level Lotus application' do +describe 'A top level Hanami application' do include Rack::Test::Methods before do diff --git a/test/integration/welcome_page_test.rb b/test/integration/welcome_page_test.rb index e1933c00..6d5e8714 100644 --- a/test/integration/welcome_page_test.rb +++ b/test/integration/welcome_page_test.rb @@ -6,14 +6,14 @@ describe 'Welcome page' do include Rack::Test::Methods before do - ENV['LOTUS_ENV'] = 'development' + ENV['HANAMI_ENV'] = 'development' @current_dir = Dir.pwd Dir.chdir FIXTURES_ROOT.join('welcome_app') @app = WelcomeApp::Application.new end after do - ENV['LOTUS_ENV'] = 'test' + ENV['HANAMI_ENV'] = 'test' Dir.chdir @current_dir @current_dir = nil end @@ -30,6 +30,6 @@ describe 'Welcome page' do get '/' response.status.must_equal 200 - response.body.must_include %(Lotus) + response.body.must_include %(Hanami) end end diff --git a/test/loader_test.rb b/test/loader_test.rb index cbf6cf3c..798e4d44 100644 --- a/test/loader_test.rb +++ b/test/loader_test.rb @@ -1,6 +1,6 @@ require 'test_helper' -describe Lotus::Loader do +describe Hanami::Loader do before do @application = CoffeeShop::Application.new end @@ -10,7 +10,7 @@ describe Lotus::Loader do Reviews::Application.load! end - # Bug: https://github.com/lotus/lotus/issues/187 + # Bug: https://github.com/hanami/hanami/issues/187 it 'generates per application routes' do assert defined?(Reviews::Routes), 'expected Reviews::Routes' end @@ -58,14 +58,14 @@ describe Lotus::Loader do end it 'assigns layout to CoffeeShop::View' do - CoffeeShop::View.configuration.layout.must_equal Lotus::View::Rendering::NullLayout + CoffeeShop::View.configuration.layout.must_equal Hanami::View::Rendering::NullLayout end end describe 'application' do describe 'routing' do it 'assigns routes' do - expected = Lotus::Router.new(&@application.configuration.routes) + expected = Hanami::Router.new(&@application.configuration.routes) @application.routes.path(:root).must_equal expected.path(:root) end @@ -76,18 +76,18 @@ describe Lotus::Loader do it 'assigns custom default app' do default_app = @application.routes.instance_variable_get(:@router).instance_variable_get(:@default_app) - default_app.must_be_kind_of(Lotus::Routing::Default) + default_app.must_be_kind_of(Hanami::Routing::Default) end it 'assigns scheme, host and port configuration' do routes = @application.routes - routes.url(:root).must_equal 'https://lotus-coffeeshop.org:2300/' + routes.url(:root).must_equal 'https://hanami-coffeeshop.org:2300/' end end describe 'middleware' do it 'preloads the middleware' do - @application.middleware.must_be_kind_of(Lotus::Middleware) + @application.middleware.must_be_kind_of(Hanami::Middleware) end end @@ -97,7 +97,7 @@ describe Lotus::Loader do before do @output = stub_stdout_constant do module BeerShop - class Application < Lotus::Application; load!; end + class Application < Hanami::Application; load!; end end end end @@ -106,7 +106,7 @@ describe Lotus::Loader do end it 'load a default logger' do - BeerShop::Logger.must_be_instance_of Lotus::Logger + BeerShop::Logger.must_be_instance_of Hanami::Logger end it 'has app module name along with log output' do BeerShop::Logger.info 'foo' @@ -118,7 +118,7 @@ describe Lotus::Loader do before do class MyLogger < Logger; end module DrinkShop - class Application < Lotus::Application + class Application < Hanami::Application configure { logger MyLogger.new(STDOUT) } load! end diff --git a/test/middleware_test.rb b/test/middleware_test.rb index a638f234..beb4bc7b 100644 --- a/test/middleware_test.rb +++ b/test/middleware_test.rb @@ -1,7 +1,7 @@ require 'test_helper' -require 'lotus/middleware' +require 'hanami/middleware' -describe Lotus::Middleware do +describe Hanami::Middleware do before do Dir.chdir($pwd) config = config_blk @@ -10,7 +10,7 @@ describe Lotus::Middleware do MockMiddleware = Object.new MockApp = Module.new - MockApp::Application = Class.new(Lotus::Application) do + MockApp::Application = Class.new(Hanami::Application) do configure(&config) end end diff --git a/test/rake_helper_test.rb b/test/rake_helper_test.rb index 182ba977..62f3a59f 100644 --- a/test/rake_helper_test.rb +++ b/test/rake_helper_test.rb @@ -1,10 +1,10 @@ require 'test_helper' -require 'lotus/rake_helper' +require 'hanami/rake_helper' -describe Lotus::RakeHelper do +describe Hanami::RakeHelper do describe '.install_tasks' do before do - Lotus::RakeHelper.install_tasks + Hanami::RakeHelper.install_tasks end let(:app) { Rake.application } diff --git a/test/root_test.rb b/test/root_test.rb index cf49d5c7..0df6495f 100644 --- a/test/root_test.rb +++ b/test/root_test.rb @@ -1,9 +1,9 @@ require 'test_helper' -require 'lotus/root' +require 'hanami/root' -describe 'Lotus' do +describe 'Hanami' do describe '.root' do - let(:pathname) { Lotus.root } + let(:pathname) { Hanami.root } it 'returns root path' do pwd = Pathname.getwd pathname.must_equal pwd diff --git a/test/routes_test.rb b/test/routes_test.rb index d4c3e008..b12ed826 100644 --- a/test/routes_test.rb +++ b/test/routes_test.rb @@ -1,15 +1,15 @@ require 'test_helper' -describe Lotus::Routes do +describe Hanami::Routes do before do @scheme = 'https' - @host = 'lotusrb.org' + @host = 'hanamirb.org' @port = 443 - @original = Lotus::Router.new(scheme: @scheme, host: @host, port: @port) do + @original = Hanami::Router.new(scheme: @scheme, host: @host, port: @port) do get '/', as: :root end - @routes = Lotus::Routes.new(@original) + @routes = Hanami::Routes.new(@original) end describe '#path' do @@ -18,11 +18,11 @@ describe Lotus::Routes do end it 'raises an error when the path cannot be found' do - -> { @routes.path(:unknown) }.must_raise Lotus::Routing::InvalidRouteException + -> { @routes.path(:unknown) }.must_raise Hanami::Routing::InvalidRouteException end it 'returns safe string' do - @routes.path(:root).must_be_kind_of Lotus::Utils::Escape::SafeString + @routes.path(:root).must_be_kind_of Hanami::Utils::Escape::SafeString end end @@ -32,11 +32,11 @@ describe Lotus::Routes do end it 'raises an error when the url cannot be found' do - -> { @routes.url(:unknown) }.must_raise Lotus::Routing::InvalidRouteException + -> { @routes.url(:unknown) }.must_raise Hanami::Routing::InvalidRouteException end it 'returns safe string' do - @routes.url(:root).must_be_kind_of Lotus::Utils::Escape::SafeString + @routes.url(:root).must_be_kind_of Hanami::Utils::Escape::SafeString end end @@ -47,7 +47,7 @@ describe Lotus::Routes do end it "raises an error if an unknown path is invoked" do - -> { @routes.unknown_path }.must_raise Lotus::Routing::InvalidRouteException + -> { @routes.unknown_path }.must_raise Hanami::Routing::InvalidRouteException end end @@ -57,7 +57,7 @@ describe Lotus::Routes do end it "raises an error if an unknown url is invoked" do - -> { @routes.unknown_url }.must_raise Lotus::Routing::InvalidRouteException + -> { @routes.unknown_url }.must_raise Hanami::Routing::InvalidRouteException end end diff --git a/test/support/helper.rb b/test/support/helper.rb index 81a32c58..52e2e4ad 100644 --- a/test/support/helper.rb +++ b/test/support/helper.rb @@ -11,6 +11,6 @@ require 'minitest/autorun' require 'support/assertions' $:.unshift 'lib' -require 'lotus' +require 'hanami' $pwd = Dir.pwd diff --git a/test/support/isolated.rb b/test/support/isolated.rb index ba646a2d..758f83f2 100644 --- a/test/support/isolated.rb +++ b/test/support/isolated.rb @@ -16,7 +16,7 @@ module Minitest @port = FreeTCPPort.new # options = {} options = {out: '/dev/null', err: '/dev/null'} - Process.spawn("cd #{ root } && bundle exec lotus server --port=#{ @port } --pid=tmp/server.pid", options) + Process.spawn("cd #{ root } && bundle exec hanami server --port=#{ @port } --pid=tmp/server.pid", options) @pid = server_pid Process.detach(@pid) end diff --git a/test/test_helper.rb b/test/test_helper.rb index 09f795d5..68bc19e4 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -49,11 +49,11 @@ Minitest::Test.class_eval do end Minitest.after_run do - lotusrc = Pathname.new(__dir__ + '/../.lotusrc') - lotusrc.delete if lotusrc.exist? + hanamirc = Pathname.new(__dir__ + '/../.hanamirc') + hanamirc.delete if hanamirc.exist? end -Lotus::Application.class_eval do +Hanami::Application.class_eval do def self.clear_registered_applications! synchronize do applications.clear @@ -61,7 +61,7 @@ Lotus::Application.class_eval do end end -Lotus::Config::LoadPaths.class_eval do +Hanami::Config::LoadPaths.class_eval do def clear @paths.clear end @@ -75,7 +75,7 @@ Lotus::Config::LoadPaths.class_eval do end end -Lotus::Middleware.class_eval { attr_reader :stack } +Hanami::Middleware.class_eval { attr_reader :stack } Pathname.new(File.dirname(__FILE__)).join('../tmp/coffee_shop/app/templates').mkpath Pathname.new(File.dirname(__FILE__)).join('../tmp/coffee_shop/app/templates/mailers').mkpath @@ -98,15 +98,15 @@ class FakeRackBuilder end class DependenciesReporter - LOTUS_GEMS = [ - 'lotus-utils', - 'lotus-validations', - 'lotus-router', - 'lotus-model', - 'lotus-view', - 'lotus-controller', - 'lotus-mailer', - 'lotus-assets' + HANAMI_GEMS = [ + 'hanami-utils', + 'hanami-validations', + 'hanami-router', + 'hanami-model', + 'hanami-view', + 'hanami-controller', + 'hanami-mailer', + 'hanami-assets' ].freeze def initialize @@ -125,7 +125,7 @@ class DependenciesReporter private def dependencies Bundler.environment.dependencies.find_all do |dep| - LOTUS_GEMS.include?(dep.name) + HANAMI_GEMS.include?(dep.name) end end end diff --git a/test/version_test.rb b/test/version_test.rb index 2f6fec14..8244cb0c 100644 --- a/test/version_test.rb +++ b/test/version_test.rb @@ -1,7 +1,7 @@ require 'test_helper' -describe Lotus::VERSION do +describe Hanami::VERSION do it 'returns current version' do - Lotus::VERSION.must_equal '0.6.1' + Hanami::VERSION.must_equal '0.7.0' end end