Module: Hanami::CLI::Commands::Project Private
- Defined in:
- lib/hanami/cli/commands/project.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- MIGRATION_TIMESTAMP_FORMAT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"%Y%m%d%H%M%S".freeze
- MIGRATION_FILENAME_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"%{timestamp}_%{name}".freeze
Class Method Summary collapse
- .action(context) ⇒ Object private
- .action_spec(context) ⇒ Object private
- .app(context) ⇒ Object private
- .app?(context) ⇒ Boolean private
- .app_application(context) ⇒ Object private
- .app_favicon(context) ⇒ Object private
- .app_layout(context) ⇒ Object private
- .app_layout_spec(context) ⇒ Object private
- .app_routes(context) ⇒ Object private
- .app_sessions_secret ⇒ Object private
- .app_spec(context) ⇒ Object private
- .app_template(context) ⇒ Object private
- .apps ⇒ Object private
- .assets_manifest ⇒ Object private
- .boot ⇒ Object private
- .capybara ⇒ Object private
- .config_ru ⇒ Object private
- .controllers(context) ⇒ Object private
- .controllers_spec(context) ⇒ Object private
- .db ⇒ Object private
- .db_schema ⇒ Object private
- .dotrspec ⇒ Object private
- .entities(context) ⇒ Object private
- .entities_spec(context) ⇒ Object private
- .entity(context) ⇒ Object private
- .entity_spec(context) ⇒ Object private
- .env(environment) ⇒ Object private
- .environment ⇒ Object private
- .features_helper ⇒ Object private
- .features_spec(context) ⇒ Object private
- .find_migration(context) ⇒ Object private
- .gemfile ⇒ Object private
- .gitignore ⇒ Object private
- .hanamirc ⇒ Object private
- .images(context) ⇒ Object private
- .initializers ⇒ Object private
- .javascripts(context) ⇒ Object private
- .keep(path) ⇒ Object private
- .list(pattern) ⇒ Object private
- .mailer(context) ⇒ Object private
- .mailer_spec(context) ⇒ Object private
- .mailer_template(context, format) ⇒ Object private
- .mailer_templates(context) ⇒ Object private
- .mailers(context) ⇒ Object private
- .mailers_spec(context) ⇒ Object private
- .mailers_templates(context) ⇒ Object private
- .migration(context) ⇒ Object private
- .migration_timestamp ⇒ Object private
- .migrations ⇒ Object private
- .project(context) ⇒ Object private
- .public_app_assets(context) ⇒ Object private
- .public_directory ⇒ Object private
- .rakefile ⇒ Object private
- .readme ⇒ Object private
- .repositories(context) ⇒ Object private
- .repositories_spec(context) ⇒ Object private
- .repository(context) ⇒ Object private
- .repository_spec(context) ⇒ Object private
- .root ⇒ Object private
- .spec_helper ⇒ Object private
- .stylesheets(context) ⇒ Object private
- .support_spec ⇒ Object private
- .template(context) ⇒ Object private
- .templates(context) ⇒ Object private
- .view(context) ⇒ Object private
- .view_spec(context) ⇒ Object private
Class Method Details
.action(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
253 254 255 |
# File 'lib/hanami/cli/commands/project.rb', line 253 def self.action(context) root.join("apps", context.app, "controllers", context.controller, "#{context.action}.rb") end |
.action_spec(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
329 330 331 |
# File 'lib/hanami/cli/commands/project.rb', line 329 def self.action_spec(context) root.join("spec", context.app, "controllers", context.controller, "#{context.action}_spec.rb") end |
.app(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
377 378 379 |
# File 'lib/hanami/cli/commands/project.rb', line 377 def self.app(context) root.join("apps", context.app) end |
.app?(context) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
383 384 385 |
# File 'lib/hanami/cli/commands/project.rb', line 383 def self.app?(context) apps.include?(context.app) end |
.app_application(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
193 194 195 |
# File 'lib/hanami/cli/commands/project.rb', line 193 def self.app_application(context) root.join("apps", context.app, "application.rb") end |
.app_favicon(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
223 224 225 |
# File 'lib/hanami/cli/commands/project.rb', line 223 def self.app_favicon(context) root.join("apps", context.app, "assets", "favicon.ico") end |
.app_layout(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
211 212 213 |
# File 'lib/hanami/cli/commands/project.rb', line 211 def self.app_layout(context) root.join("apps", context.app, "views", "application_layout.rb") end |
.app_layout_spec(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
317 318 319 |
# File 'lib/hanami/cli/commands/project.rb', line 317 def self.app_layout_spec(context) root.join("spec", context.app, "views", "application_layout_spec.rb") end |
.app_routes(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
205 206 207 |
# File 'lib/hanami/cli/commands/project.rb', line 205 def self.app_routes(context) root.join("apps", context.app, "config", "routes.rb") end |
.app_sessions_secret ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
199 200 201 |
# File 'lib/hanami/cli/commands/project.rb', line 199 def self.app_sessions_secret SecureRandom.hex(32) end |
.app_spec(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
313 314 315 |
# File 'lib/hanami/cli/commands/project.rb', line 313 def self.app_spec(context) root.join("spec", context.app) end |
.app_template(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
217 218 219 |
# File 'lib/hanami/cli/commands/project.rb', line 217 def self.app_template(context) root.join("apps", context.app, "templates", "application.html.#{context.template}") end |
.apps ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
389 390 391 |
# File 'lib/hanami/cli/commands/project.rb', line 389 def self.apps Dir.glob(root.join("apps", "*")).map { |app| File.basename(app) } end |
.assets_manifest ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
173 174 175 |
# File 'lib/hanami/cli/commands/project.rb', line 173 def self.assets_manifest(*) root.join("public", "assets.json") end |
.boot ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
57 58 59 |
# File 'lib/hanami/cli/commands/project.rb', line 57 def self.boot(*) root.join("config", "boot.rb") end |
.capybara ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
371 372 373 |
# File 'lib/hanami/cli/commands/project.rb', line 371 def self.(*) root.join("spec", "support", "capybara.rb") end |
.config_ru ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
45 46 47 |
# File 'lib/hanami/cli/commands/project.rb', line 45 def self.config_ru(*) root.join("config.ru") end |
.controllers(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
229 230 231 |
# File 'lib/hanami/cli/commands/project.rb', line 229 def self.controllers(context) root.join("apps", context.app, "controllers") end |
.controllers_spec(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
323 324 325 |
# File 'lib/hanami/cli/commands/project.rb', line 323 def self.controllers_spec(context) root.join("spec", context.app, "controllers") end |
.db ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
75 76 77 |
# File 'lib/hanami/cli/commands/project.rb', line 75 def self.db(*) root.join("db") end |
.db_schema ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
81 82 83 |
# File 'lib/hanami/cli/commands/project.rb', line 81 def self.db_schema(*) root.join("db", "schema.sql") end |
.dotrspec ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
347 348 349 |
# File 'lib/hanami/cli/commands/project.rb', line 347 def self.dotrspec(*) root.join(".rspec") end |
.entities(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
143 144 145 |
# File 'lib/hanami/cli/commands/project.rb', line 143 def self.entities(context) root.join("lib", context..fetch(:project), "entities") end |
.entities_spec(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
277 278 279 |
# File 'lib/hanami/cli/commands/project.rb', line 277 def self.entities_spec(context) root.join("spec", context..fetch(:project), "entities") end |
.entity(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
149 150 151 |
# File 'lib/hanami/cli/commands/project.rb', line 149 def self.entity(context) root.join("lib", context..fetch(:project), "entities", "#{context.model}.rb") end |
.entity_spec(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
283 284 285 |
# File 'lib/hanami/cli/commands/project.rb', line 283 def self.entity_spec(context) root.join("spec", context..fetch(:project), "entities", "#{context.model}_spec.rb") end |
.env(environment) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
69 70 71 |
# File 'lib/hanami/cli/commands/project.rb', line 69 def self.env(*, environment) root.join(".env.#{environment}") end |
.environment ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
51 52 53 |
# File 'lib/hanami/cli/commands/project.rb', line 51 def self.environment(*) root.join("config", "environment.rb") end |
.features_helper ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
359 360 361 |
# File 'lib/hanami/cli/commands/project.rb', line 359 def self.features_helper(*) root.join("spec", "features_helper.rb") end |
.features_spec(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
341 342 343 |
# File 'lib/hanami/cli/commands/project.rb', line 341 def self.features_spec(context) root.join("spec", context.app, "features") end |
.find_migration(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
107 108 109 |
# File 'lib/hanami/cli/commands/project.rb', line 107 def self.find_migration(context) list(root.join("db", "migrations", "*_#{context.migration}.rb")).first end |
.gemfile ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 |
# File 'lib/hanami/cli/commands/project.rb', line 21 def self.gemfile(*) root.join("Gemfile") end |
.gitignore ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/hanami/cli/commands/project.rb', line 39 def self.gitignore(*) root.join(".gitignore") end |
.hanamirc ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
33 34 35 |
# File 'lib/hanami/cli/commands/project.rb', line 33 def self.hanamirc(*) root.join(".hanamirc") end |
.images(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
235 236 237 |
# File 'lib/hanami/cli/commands/project.rb', line 235 def self.images(context) root.join("apps", context.app, "assets", "images") end |
.initializers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
63 64 65 |
# File 'lib/hanami/cli/commands/project.rb', line 63 def self.initializers(*) root.join("config", "initializers") end |
.javascripts(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
241 242 243 |
# File 'lib/hanami/cli/commands/project.rb', line 241 def self.javascripts(context) root.join("apps", context.app, "assets", "javascripts") end |
.keep(path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
395 396 397 |
# File 'lib/hanami/cli/commands/project.rb', line 395 def self.keep(path) root.join(path, ".gitkeep") end |
.list(pattern) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
401 402 403 |
# File 'lib/hanami/cli/commands/project.rb', line 401 def self.list(pattern) Hanami::Utils::FileList[pattern] end |
.mailer(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
131 132 133 |
# File 'lib/hanami/cli/commands/project.rb', line 131 def self.mailer(context) root.join("lib", context..fetch(:project), "mailers", "#{context.mailer}.rb") end |
.mailer_spec(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
307 308 309 |
# File 'lib/hanami/cli/commands/project.rb', line 307 def self.mailer_spec(context) root.join("spec", context..fetch(:project), "mailers", "#{context.mailer}_spec.rb") end |
.mailer_template(context, format) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
187 188 189 |
# File 'lib/hanami/cli/commands/project.rb', line 187 def self.mailer_template(context, format) root.join("lib", context..fetch(:project), "mailers", "templates", "#{context.mailer}.#{format}.#{context..fetch(:template)}") end |
.mailer_templates(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
137 138 139 |
# File 'lib/hanami/cli/commands/project.rb', line 137 def self.mailer_templates(context) list root.join("lib", context..fetch(:project), "mailers", "templates", "#{context.mailer}.*.*") end |
.mailers(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
119 120 121 |
# File 'lib/hanami/cli/commands/project.rb', line 119 def self.mailers(context) root.join("lib", context..fetch(:project), "mailers") end |
.mailers_spec(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
301 302 303 |
# File 'lib/hanami/cli/commands/project.rb', line 301 def self.mailers_spec(context) root.join("spec", context..fetch(:project), "mailers") end |
.mailers_templates(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
125 126 127 |
# File 'lib/hanami/cli/commands/project.rb', line 125 def self.mailers_templates(context) root.join("lib", context..fetch(:project), "mailers", "templates") end |
.migration(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
93 94 95 96 97 |
# File 'lib/hanami/cli/commands/project.rb', line 93 def self.migration(context) filename = MIGRATION_FILENAME_PATTERN % { timestamp: , name: context.migration } root.join("db", "migrations", "#{filename}.rb") end |
.migration_timestamp ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
101 102 103 |
# File 'lib/hanami/cli/commands/project.rb', line 101 def self. Time.now.utc.strftime(MIGRATION_TIMESTAMP_FORMAT) end |
.migrations ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
87 88 89 |
# File 'lib/hanami/cli/commands/project.rb', line 87 def self.migrations(*) root.join("db", "migrations") end |
.project(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
113 114 115 |
# File 'lib/hanami/cli/commands/project.rb', line 113 def self.project(context) root.join("lib", "#{context..fetch(:project)}.rb") end |
.public_app_assets(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
179 180 181 182 183 |
# File 'lib/hanami/cli/commands/project.rb', line 179 def self.public_app_assets(context) # FIXME: extract this URL to path conversion into Hanami::Utils assets_directory = context.base_url.sub(/\A\//, "").split("/") root.join("public", "assets", *assets_directory) end |
.public_directory ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
167 168 169 |
# File 'lib/hanami/cli/commands/project.rb', line 167 def self.public_directory(*) root.join("public") end |
.rakefile ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/hanami/cli/commands/project.rb', line 27 def self.rakefile(*) root.join("Rakefile") end |
.readme ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 |
# File 'lib/hanami/cli/commands/project.rb', line 15 def self.readme(*) root.join("README.md") end |
.repositories(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
155 156 157 |
# File 'lib/hanami/cli/commands/project.rb', line 155 def self.repositories(context) root.join("lib", context..fetch(:project), "repositories") end |
.repositories_spec(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
289 290 291 |
# File 'lib/hanami/cli/commands/project.rb', line 289 def self.repositories_spec(context) root.join("spec", context..fetch(:project), "repositories") end |
.repository(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
161 162 163 |
# File 'lib/hanami/cli/commands/project.rb', line 161 def self.repository(context) root.join("lib", context..fetch(:project), "repositories", "#{context.model}_repository.rb") end |
.repository_spec(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
295 296 297 |
# File 'lib/hanami/cli/commands/project.rb', line 295 def self.repository_spec(context) root.join("spec", context..fetch(:project), "repositories", "#{context.model}_repository_spec.rb") end |
.root ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
407 408 409 |
# File 'lib/hanami/cli/commands/project.rb', line 407 def self.root File end |
.spec_helper ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
353 354 355 |
# File 'lib/hanami/cli/commands/project.rb', line 353 def self.spec_helper(*) root.join("spec", "spec_helper.rb") end |
.stylesheets(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
247 248 249 |
# File 'lib/hanami/cli/commands/project.rb', line 247 def self.stylesheets(context) root.join("apps", context.app, "assets", "stylesheets") end |
.support_spec ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
365 366 367 |
# File 'lib/hanami/cli/commands/project.rb', line 365 def self.support_spec(*) root.join("spec", "support") end |
.template(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
265 266 267 |
# File 'lib/hanami/cli/commands/project.rb', line 265 def self.template(context) root.join("apps", context.app, "templates", context.controller, "#{context.action}.html.#{context..fetch(:template)}") end |
.templates(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
271 272 273 |
# File 'lib/hanami/cli/commands/project.rb', line 271 def self.templates(context) list root.join("apps", context.app, "templates", context.controller, "#{context.action}.*.*") end |
.view(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
259 260 261 |
# File 'lib/hanami/cli/commands/project.rb', line 259 def self.view(context) root.join("apps", context.app, "views", context.controller, "#{context.action}.rb") end |
.view_spec(context) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
335 336 337 |
# File 'lib/hanami/cli/commands/project.rb', line 335 def self.view_spec(context) root.join("spec", context.app, "views", context.controller, "#{context.action}_spec.rb") end |