lotusrb 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +57 -14
  3. data/FEATURES.md +21 -0
  4. data/LICENSE.md +1 -1
  5. data/README.md +8 -7
  6. data/bin/lotus +1 -0
  7. data/lib/lotus.rb +6 -0
  8. data/lib/lotus/action/csrf_protection.rb +1 -1
  9. data/lib/lotus/application.rb +4 -4
  10. data/lib/lotus/application_name.rb +8 -6
  11. data/lib/lotus/cli.rb +75 -66
  12. data/lib/lotus/cli_sub_commands/assets.rb +29 -0
  13. data/lib/lotus/{commands → cli_sub_commands}/db.rb +24 -29
  14. data/lib/lotus/cli_sub_commands/destroy.rb +102 -0
  15. data/lib/lotus/cli_sub_commands/generate.rb +127 -0
  16. data/lib/lotus/commands/assets/precompile.rb +35 -0
  17. data/lib/lotus/commands/console.rb +28 -8
  18. data/lib/lotus/commands/db/abstract.rb +6 -2
  19. data/lib/lotus/commands/db/console.rb +5 -5
  20. data/lib/lotus/commands/generate/abstract.rb +63 -0
  21. data/lib/lotus/commands/generate/action.rb +262 -0
  22. data/lib/lotus/commands/generate/app.rb +116 -0
  23. data/lib/lotus/commands/generate/mailer.rb +118 -0
  24. data/lib/lotus/commands/generate/migration.rb +63 -0
  25. data/lib/lotus/commands/generate/model.rb +96 -0
  26. data/lib/lotus/commands/new/abstract.rb +128 -0
  27. data/lib/lotus/commands/new/app.rb +116 -0
  28. data/lib/lotus/commands/new/container.rb +102 -0
  29. data/lib/lotus/commands/routes.rb +19 -2
  30. data/lib/lotus/commands/server.rb +16 -2
  31. data/lib/lotus/config/framework_configuration.rb +13 -1
  32. data/lib/lotus/configuration.rb +24 -76
  33. data/lib/lotus/container.rb +15 -2
  34. data/lib/lotus/environment.rb +43 -4
  35. data/lib/lotus/frameworks.rb +1 -0
  36. data/lib/lotus/generators/action/action_spec.minitest.tt +1 -1
  37. data/lib/lotus/generators/action/action_spec.rspec.tt +1 -1
  38. data/lib/lotus/generators/action/view_spec.minitest.tt +1 -1
  39. data/lib/lotus/generators/action/view_spec.rspec.tt +1 -1
  40. data/lib/lotus/generators/{slice → app}/.gitkeep.tt +0 -0
  41. data/lib/lotus/generators/{slice → app}/application.rb.tt +61 -23
  42. data/lib/lotus/generators/app/config/initializers/.gitkeep +0 -0
  43. data/lib/lotus/generators/{slice → app}/config/routes.rb.tt +0 -0
  44. data/lib/lotus/generators/app/favicon.ico +0 -0
  45. data/lib/lotus/generators/{slice → app}/templates/application.html.erb.tt +2 -1
  46. data/lib/lotus/generators/app/views/application_layout.rb.tt +7 -0
  47. data/lib/lotus/generators/application/app/.env.development.tt +1 -0
  48. data/lib/lotus/generators/application/app/.env.test.tt +1 -0
  49. data/lib/lotus/generators/application/app/Gemfile.tt +1 -0
  50. data/lib/lotus/generators/application/app/Rakefile.minitest.tt +1 -0
  51. data/lib/lotus/generators/application/app/Rakefile.rspec.tt +1 -0
  52. data/lib/lotus/generators/application/app/config/application.rb.tt +56 -18
  53. data/lib/lotus/generators/application/app/config/initializers/.gitkeep +0 -0
  54. data/lib/lotus/generators/application/app/favicon.ico +0 -0
  55. data/lib/lotus/generators/application/app/gitignore.tt +2 -0
  56. data/lib/lotus/generators/application/app/lotusrc.tt +3 -3
  57. data/lib/lotus/generators/application/app/spec_helper.rb.rspec.tt +5 -1
  58. data/lib/lotus/generators/application/app/templates/application.html.erb.tt +1 -0
  59. data/lib/lotus/generators/application/container/.env.development.tt +1 -0
  60. data/lib/lotus/generators/application/container/.env.test.tt +1 -0
  61. data/lib/lotus/generators/application/container/Gemfile.tt +1 -1
  62. data/lib/lotus/generators/application/container/Rakefile.minitest.tt +1 -0
  63. data/lib/lotus/generators/application/container/Rakefile.rspec.tt +1 -0
  64. data/lib/lotus/generators/application/container/config/initializers/.gitkeep +0 -0
  65. data/lib/lotus/generators/application/container/gitignore.tt +2 -0
  66. data/lib/lotus/generators/application/container/lib/chirp/mailers/.gitkeep +0 -0
  67. data/lib/lotus/generators/application/container/lib/chirp/mailers/templates/.gitkeep +0 -0
  68. data/lib/lotus/generators/application/container/lotusrc.tt +3 -3
  69. data/lib/lotus/generators/application/container/spec_helper.rb.rspec.tt +5 -1
  70. data/lib/lotus/generators/database_config.rb +17 -4
  71. data/lib/lotus/generators/generatable.rb +51 -0
  72. data/lib/lotus/generators/generator.rb +35 -0
  73. data/lib/lotus/generators/test_framework.rb +42 -0
  74. data/lib/lotus/loader.rb +43 -0
  75. data/lib/lotus/lotusrc.rb +50 -49
  76. data/lib/lotus/middleware.rb +28 -10
  77. data/lib/lotus/rake_helper.rb +68 -0
  78. data/lib/lotus/rake_tasks.rb +2 -0
  79. data/lib/lotus/rendering_policy.rb +2 -2
  80. data/lib/lotus/repositories/car_repository.rb +3 -0
  81. data/lib/lotus/repositories/name_repository.rb +3 -0
  82. data/lib/lotus/setup.rb +1 -3
  83. data/lib/lotus/static.rb +77 -0
  84. data/lib/lotus/templates/welcome.html.erb +7 -4
  85. data/lib/lotus/version.rb +1 -1
  86. data/lib/lotus/views/default.rb +2 -1
  87. data/lib/lotus/views/default_template_finder.rb +4 -3
  88. data/lotusrb.gemspec +11 -9
  89. metadata +79 -60
  90. data/lib/lotus/commands/generate.rb +0 -97
  91. data/lib/lotus/commands/new.rb +0 -43
  92. data/lib/lotus/config/assets.rb +0 -81
  93. data/lib/lotus/generators/abstract.rb +0 -31
  94. data/lib/lotus/generators/action.rb +0 -235
  95. data/lib/lotus/generators/app.rb +0 -39
  96. data/lib/lotus/generators/app/.gitkeep +0 -1
  97. data/lib/lotus/generators/application/app.rb +0 -129
  98. data/lib/lotus/generators/application/container.rb +0 -111
  99. data/lib/lotus/generators/mailer.rb +0 -112
  100. data/lib/lotus/generators/migration.rb +0 -58
  101. data/lib/lotus/generators/model.rb +0 -90
  102. data/lib/lotus/generators/slice.rb +0 -94
  103. data/lib/lotus/generators/slice/views/application_layout.rb.tt +0 -7
@@ -52,7 +52,7 @@ module Lotus
52
52
  @builder.call(env)
53
53
  end
54
54
 
55
- # Add a middleware to the stack.
55
+ # Append a middleware to the stack.
56
56
  #
57
57
  # @param middleware [Object] a Rack middleware
58
58
  # @param args [Array] optional arguments to pass to the Rack middleware
@@ -61,7 +61,24 @@ module Lotus
61
61
  # @return [Array] the middleware that was added
62
62
  #
63
63
  # @since 0.2.0
64
+ #
65
+ # @see Lotus::Middleware#prepend
64
66
  def use(middleware, *args, &blk)
67
+ @stack.push [middleware, args, blk]
68
+ end
69
+
70
+ # Prepend a middleware to the stack.
71
+ #
72
+ # @param middleware [Object] a Rack middleware
73
+ # @param args [Array] optional arguments to pass to the Rack middleware
74
+ # @param blk [Proc] an optional block to pass to the Rack middleware
75
+ #
76
+ # @return [Array] the middleware that was added
77
+ #
78
+ # @since 0.6.0
79
+ #
80
+ # @see Lotus::Middleware#use
81
+ def prepend(middleware, *args, &blk)
65
82
  @stack.unshift [middleware, args, blk]
66
83
  end
67
84
 
@@ -80,8 +97,8 @@ module Lotus
80
97
  # @since 0.2.0
81
98
  def load_default_stack(application)
82
99
  @default_stack_loaded ||= begin
100
+ _load_assets_middleware
83
101
  _load_session_middleware
84
- _load_asset_middlewares
85
102
  _load_default_welcome_page_for(application)
86
103
  use Rack::MethodOverride
87
104
 
@@ -106,19 +123,20 @@ module Lotus
106
123
  # @since 0.2.0
107
124
  def _load_session_middleware
108
125
  if @configuration.sessions.enabled?
109
- use(*@configuration.sessions.middleware)
126
+ prepend(*@configuration.sessions.middleware)
110
127
  end
111
128
  end
112
129
 
113
- # Add asset middlewares
130
+ # Use static assets middleware
114
131
  #
115
132
  # @api private
116
- # #since 0.2.0
117
- def _load_asset_middlewares
118
- if @configuration.serve_assets
119
- @configuration.assets.for_each_source do |source|
120
- use Rack::Static, urls: source.urls, root: source.root
121
- end
133
+ # @since 0.6.0
134
+ def _load_assets_middleware
135
+ env = Lotus.environment
136
+
137
+ if !env.container? && env.serve_static_assets?
138
+ require 'lotus/static'
139
+ use Lotus::Static
122
140
  end
123
141
  end
124
142
  end
@@ -0,0 +1,68 @@
1
+ require 'rake'
2
+
3
+ module Lotus
4
+ # Install Rake tasks in projects
5
+ #
6
+ # @since 0.6.0
7
+ # @api private
8
+ class RakeHelper
9
+ include Rake::DSL
10
+
11
+ # @since 0.6.0
12
+ # @api private
13
+ def self.install_tasks
14
+ new.install
15
+ end
16
+
17
+ # @since 0.6.0
18
+ # @api private
19
+ def install
20
+ desc "Preload project configuration"
21
+ task :preload do
22
+ require 'lotus/environment'
23
+ Lotus::Environment.new
24
+ end
25
+
26
+ desc "Load the full project"
27
+ task environment: :preload do
28
+ require Lotus::Environment.new.env_config
29
+ Lotus::Application.preload_applications!
30
+ end
31
+
32
+ # Ruby ecosystem compatibility
33
+ #
34
+ # Most of the SaaS automatic tasks are designed after Ruby on Rails.
35
+ # They expect the following Rake tasks to be present:
36
+ #
37
+ # * db:migrate
38
+ # * assets:precompile
39
+ #
40
+ # See https://github.com/heroku/heroku-buildpack-ruby/issues/442
41
+ #
42
+ # ===
43
+ #
44
+ # These Rake tasks aren't listed when someone runs `rake -T`, because we
45
+ # want to encourage developers to use `lotus` commands.
46
+ #
47
+ # In order to migrate the database or precompile assets a developer should
48
+ # use:
49
+ #
50
+ # * lotus db migrate
51
+ # * lotus assets precompile
52
+ #
53
+ # This is the preferred way to run Lotus command line tasks.
54
+ # Please use them when you're in control of your deployment environment.
55
+ namespace :db do
56
+ task :migrate do
57
+ system "bundle exec lotus db migrate"
58
+ end
59
+ end
60
+
61
+ namespace :assets do
62
+ task :precompile do
63
+ system "bundle exec lotus assets precompile"
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,2 @@
1
+ require 'lotus/rake_helper'
2
+ Lotus::RakeHelper.install_tasks
@@ -27,7 +27,7 @@ module Lotus
27
27
  def render(env, response)
28
28
  body = _render(env, response)
29
29
 
30
- response[BODY] = Array(body) unless body.nil?
30
+ response[BODY] = Array(body) unless body.nil? || body.respond_to?(:each)
31
31
  response
32
32
  end
33
33
 
@@ -66,7 +66,7 @@ module Lotus
66
66
  end
67
67
 
68
68
  def view_for(action, response)
69
- if response[BODY].empty?
69
+ if response[BODY].respond_to?(:empty?) && response[BODY].empty?
70
70
  captures = @controller_pattern.match(action.class.name)
71
71
  Utils::Class.load!(@view_pattern % { controller: captures[:controller], action: captures[:action] }, @namespace)
72
72
  else
@@ -0,0 +1,3 @@
1
+ class CarRepository
2
+ include Lotus::Repository
3
+ end
@@ -0,0 +1,3 @@
1
+ class NameRepository
2
+ include Lotus::Repository
3
+ end
data/lib/lotus/setup.rb CHANGED
@@ -1,5 +1,3 @@
1
1
  require 'lotusrb'
2
2
 
3
- Bundler.require(
4
- *Lotus::Environment.new.bundler_groups
5
- )
3
+ Bundler.require(*Lotus::Environment.new.bundler_groups)
@@ -0,0 +1,77 @@
1
+ require 'rack/static'
2
+ require 'lotus/assets/compiler'
3
+
4
+ module Lotus
5
+ class Static < ::Rack::Static
6
+ PATH_INFO = 'PATH_INFO'.freeze
7
+ PUBLIC_DIRECTORY = Lotus.public_directory.join('**', '*').to_s.freeze
8
+
9
+ def initialize(app)
10
+ super(app, root: Lotus.public_directory, header_rules: _header_rules)
11
+ @sources = _sources_from_applications
12
+ end
13
+
14
+ def call(env)
15
+ path = env[PATH_INFO]
16
+
17
+ prefix, config = @sources.find {|p, _| path.start_with?(p) }
18
+ original = if prefix && config
19
+ config.sources.find(path.sub(prefix, ''))
20
+ end
21
+
22
+ if can_serve(path, original)
23
+ super
24
+ else
25
+ precompile(original, config) ?
26
+ call(env) :
27
+ @app.call(env)
28
+ end
29
+ end
30
+
31
+ private
32
+
33
+ def can_serve(path, original = nil)
34
+ destination = Dir[PUBLIC_DIRECTORY].find do |file|
35
+ file.index(path).to_i > 0
36
+ end
37
+
38
+ (super(path) || !!destination) && _fresh?(original, destination)
39
+ end
40
+
41
+ def _fresh?(original, destination)
42
+ # At this point we're sure that destination exist.
43
+ #
44
+ # If original is missing, it could be a file that a developer manually
45
+ # created into public directory without having the corresponding original.
46
+ # In this case we return true, so the destination file can be served.
47
+ return true if original.nil? || !::File.exist?(original.to_s)
48
+
49
+ ::File.mtime(destination) >
50
+ ::File.mtime(original)
51
+ end
52
+
53
+ def precompile(original, config)
54
+ return unless original && config
55
+
56
+ Lotus::Assets::Compiler.compile(config, original)
57
+ true
58
+ end
59
+
60
+ def _sources_from_applications
61
+ Lotus::Application.applications.each_with_object({}) do |application, result|
62
+ config = _assets_configuration(application)
63
+ result["#{ config.prefix }/"] = config
64
+ end
65
+ end
66
+
67
+ def _assets_configuration(application)
68
+ application.configuration.namespace::Assets.configuration
69
+ end
70
+
71
+ def _header_rules
72
+ unless Lotus.env?(:development, :test)
73
+ [[:all, {'Cache-Control' => 'public, max-age=31536000'}]]
74
+ end
75
+ end
76
+ end
77
+ end
@@ -2,11 +2,12 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>Lotus &mdash; A complete web framework for Ruby</title>
5
+ <link rel="shortcut icon" type="image/x-icon" href="/assets/favicon.ico">
5
6
  <style>
6
7
  * { margin: 0; padding: 0; }
7
8
  body { font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; color: #333; background-color: #ecf0f1; font-size: 16px; line-height: 24px; }
8
- h1, h2, h3 { margin: -20px; line-height: 100px; text-align: center; }
9
- h1 { font-size: 60px; color: #551e54; }
9
+ h2, h3 { margin: -20px; line-height: 100px; text-align: center; }
10
+ .logo { text-align: center; margin-top: 0.5em; }
10
11
  h2 { font-size: 30px; }
11
12
  h3 { font-size: 20px; line-height: 22px; color: #666; }
12
13
  hr { margin: 2em; color: #ecf0f1; }
@@ -23,7 +24,9 @@
23
24
  </head>
24
25
  <body>
25
26
  <div id="container">
26
- <h1>Lotus</h1>
27
+ <div class="logo">
28
+ <img alt="Lotus Logo" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAW4AAABYCAMAAADiKO25AAAAilBMVEUAAABQK01QK01QK01QK01QK01QK01QK01QK01QK01QK01QK01QK01QK01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TLjeQ+JzkASJIbR68X+/Eb/Ypb6Rf95MuNFAZlOTlIlRs2Qbdt76ED88S7qUa/xioiN5JkHu/AZiBZbjAnHBE+ddx2ma/3Nv4lbTG5EfOXy1vY1QDS5QanCtoamVpAkexbjXFqyk9B8N/kRswsfrSMywZAptxIVBmPlp0x6KVOjw9yvtejJtg4z2mW5Ier0vCuD41PWZiAMOH8Sg3CmJVtBNeGG+VhA4IU88su9v8oHe/SbaR6+hjHMgvTSuB7SCz2b89ydHKkn4pO/SWITmynIFpuEj2YKI1OuSuETiitJDpduhi6GICS6FIXYuhCLmqiyxQJoYtwqYkuMSeGLqCoJtFJlwcVRBe/VRFd2lkaunD5t/IbPw+WlZDv0SkAAAAASUVORK5CYII="/>
29
+ </div>
27
30
  <hr />
28
31
  <h2>A complete web framework for Ruby</h2>
29
32
 
@@ -44,7 +47,7 @@
44
47
  </div>
45
48
  </div>
46
49
  <div id="footer">
47
- &copy; 2014 - present Luca Guidi &mdash; Lotus is released under the MIT License.
50
+ &copy; 2014 &dash; <%= Time.now.year %> Luca Guidi &mdash; Lotus is released under the MIT License.
48
51
  </div>
49
52
  </body>
50
53
  </html>
data/lib/lotus/version.rb CHANGED
@@ -2,5 +2,5 @@ module Lotus
2
2
  # Defines the version
3
3
  #
4
4
  # @since 0.1.0
5
- VERSION = '0.5.0'.freeze
5
+ VERSION = '0.6.0'.freeze
6
6
  end
@@ -8,6 +8,7 @@ module Lotus
8
8
  # @api private
9
9
  class Default
10
10
  include Lotus::View
11
+
11
12
  configuration.reset!
12
13
 
13
14
  layout nil
@@ -20,7 +21,7 @@ module Lotus
20
21
 
21
22
  def self.render(root, template_name, context)
22
23
  format = context[:format]
23
- template = DefaultTemplateFinder.new(root, template_name, format).find
24
+ template = DefaultTemplateFinder.new(self, root, template_name, format).find
24
25
 
25
26
  if template
26
27
  new(template, context).render
@@ -5,9 +5,10 @@ module Lotus
5
5
  #
6
6
  # @since 0.2.0
7
7
  # @api private
8
- def initialize(root, template_name, format)
9
- @root = root
10
- @options = { template: template_name, format: format }
8
+ def initialize(view, root, template_name, format)
9
+ @view = view
10
+ @root = root
11
+ @options = { template: template_name, format: format }
11
12
  end
12
13
 
13
14
  private
data/lotusrb.gemspec CHANGED
@@ -19,18 +19,20 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
  spec.required_ruby_version = '>= 2.0.0'
21
21
 
22
- spec.add_dependency 'lotus-utils', '~> 0.5', '>= 0.5.2'
23
- spec.add_dependency 'lotus-router', '~> 0.4', '>= 0.4.3'
24
- spec.add_dependency 'lotus-controller', '~> 0.4', '>= 0.4.5'
25
- spec.add_dependency 'lotus-view', '~> 0.4', '>= 0.4.4'
26
- spec.add_dependency 'lotus-helpers', '~> 0.2', '>= 0.2.5'
22
+ spec.add_dependency 'lotus-utils', '~> 0.6'
23
+ spec.add_dependency 'lotus-router', '~> 0.5'
24
+ spec.add_dependency 'lotus-controller', '~> 0.5'
25
+ spec.add_dependency 'lotus-view', '~> 0.5'
26
+ spec.add_dependency 'lotus-helpers', '~> 0.2', '>= 0.2.6'
27
27
  spec.add_dependency 'lotus-mailer', '~> 0.1'
28
+ spec.add_dependency 'lotus-assets', '~> 0.1'
28
29
  spec.add_dependency 'shotgun', '~> 0.9'
29
30
  spec.add_dependency 'dotenv', '~> 2.0'
30
31
  spec.add_dependency 'thor', '~> 0.19'
32
+ spec.add_dependency 'bundler', '~> 1.6'
31
33
 
32
- spec.add_development_dependency 'bundler', '~> 1.6'
33
- spec.add_development_dependency 'rake', '~> 10'
34
- spec.add_development_dependency 'minitest', '~> 5'
35
- spec.add_development_dependency 'rack-test', '~> 0.6'
34
+ spec.add_development_dependency 'minispec-metadata', '~> 3.2.1'
35
+ spec.add_development_dependency 'minitest', '~> 5'
36
+ spec.add_development_dependency 'rack-test', '~> 0.6'
37
+ spec.add_development_dependency 'rake', '~> 10'
36
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lotusrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-09-30 00:00:00.000000000 Z
13
+ date: 2016-01-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: lotus-utils
@@ -18,80 +18,56 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '0.5'
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: 0.5.2
21
+ version: '0.6'
25
22
  type: :runtime
26
23
  prerelease: false
27
24
  version_requirements: !ruby/object:Gem::Requirement
28
25
  requirements:
29
26
  - - "~>"
30
27
  - !ruby/object:Gem::Version
31
- version: '0.5'
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: 0.5.2
28
+ version: '0.6'
35
29
  - !ruby/object:Gem::Dependency
36
30
  name: lotus-router
37
31
  requirement: !ruby/object:Gem::Requirement
38
32
  requirements:
39
33
  - - "~>"
40
34
  - !ruby/object:Gem::Version
41
- version: '0.4'
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- version: 0.4.3
35
+ version: '0.5'
45
36
  type: :runtime
46
37
  prerelease: false
47
38
  version_requirements: !ruby/object:Gem::Requirement
48
39
  requirements:
49
40
  - - "~>"
50
41
  - !ruby/object:Gem::Version
51
- version: '0.4'
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: 0.4.3
42
+ version: '0.5'
55
43
  - !ruby/object:Gem::Dependency
56
44
  name: lotus-controller
57
45
  requirement: !ruby/object:Gem::Requirement
58
46
  requirements:
59
47
  - - "~>"
60
48
  - !ruby/object:Gem::Version
61
- version: '0.4'
62
- - - ">="
63
- - !ruby/object:Gem::Version
64
- version: 0.4.5
49
+ version: '0.5'
65
50
  type: :runtime
66
51
  prerelease: false
67
52
  version_requirements: !ruby/object:Gem::Requirement
68
53
  requirements:
69
54
  - - "~>"
70
55
  - !ruby/object:Gem::Version
71
- version: '0.4'
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: 0.4.5
56
+ version: '0.5'
75
57
  - !ruby/object:Gem::Dependency
76
58
  name: lotus-view
77
59
  requirement: !ruby/object:Gem::Requirement
78
60
  requirements:
79
61
  - - "~>"
80
62
  - !ruby/object:Gem::Version
81
- version: '0.4'
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- version: 0.4.4
63
+ version: '0.5'
85
64
  type: :runtime
86
65
  prerelease: false
87
66
  version_requirements: !ruby/object:Gem::Requirement
88
67
  requirements:
89
68
  - - "~>"
90
69
  - !ruby/object:Gem::Version
91
- version: '0.4'
92
- - - ">="
93
- - !ruby/object:Gem::Version
94
- version: 0.4.4
70
+ version: '0.5'
95
71
  - !ruby/object:Gem::Dependency
96
72
  name: lotus-helpers
97
73
  requirement: !ruby/object:Gem::Requirement
@@ -101,7 +77,7 @@ dependencies:
101
77
  version: '0.2'
102
78
  - - ">="
103
79
  - !ruby/object:Gem::Version
104
- version: 0.2.5
80
+ version: 0.2.6
105
81
  type: :runtime
106
82
  prerelease: false
107
83
  version_requirements: !ruby/object:Gem::Requirement
@@ -111,7 +87,7 @@ dependencies:
111
87
  version: '0.2'
112
88
  - - ">="
113
89
  - !ruby/object:Gem::Version
114
- version: 0.2.5
90
+ version: 0.2.6
115
91
  - !ruby/object:Gem::Dependency
116
92
  name: lotus-mailer
117
93
  requirement: !ruby/object:Gem::Requirement
@@ -126,6 +102,20 @@ dependencies:
126
102
  - - "~>"
127
103
  - !ruby/object:Gem::Version
128
104
  version: '0.1'
105
+ - !ruby/object:Gem::Dependency
106
+ name: lotus-assets
107
+ requirement: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '0.1'
112
+ type: :runtime
113
+ prerelease: false
114
+ version_requirements: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: '0.1'
129
119
  - !ruby/object:Gem::Dependency
130
120
  name: shotgun
131
121
  requirement: !ruby/object:Gem::Requirement
@@ -175,7 +165,7 @@ dependencies:
175
165
  - - "~>"
176
166
  - !ruby/object:Gem::Version
177
167
  version: '1.6'
178
- type: :development
168
+ type: :runtime
179
169
  prerelease: false
180
170
  version_requirements: !ruby/object:Gem::Requirement
181
171
  requirements:
@@ -183,19 +173,19 @@ dependencies:
183
173
  - !ruby/object:Gem::Version
184
174
  version: '1.6'
185
175
  - !ruby/object:Gem::Dependency
186
- name: rake
176
+ name: minispec-metadata
187
177
  requirement: !ruby/object:Gem::Requirement
188
178
  requirements:
189
179
  - - "~>"
190
180
  - !ruby/object:Gem::Version
191
- version: '10'
181
+ version: 3.2.1
192
182
  type: :development
193
183
  prerelease: false
194
184
  version_requirements: !ruby/object:Gem::Requirement
195
185
  requirements:
196
186
  - - "~>"
197
187
  - !ruby/object:Gem::Version
198
- version: '10'
188
+ version: 3.2.1
199
189
  - !ruby/object:Gem::Dependency
200
190
  name: minitest
201
191
  requirement: !ruby/object:Gem::Requirement
@@ -224,6 +214,20 @@ dependencies:
224
214
  - - "~>"
225
215
  - !ruby/object:Gem::Version
226
216
  version: '0.6'
217
+ - !ruby/object:Gem::Dependency
218
+ name: rake
219
+ requirement: !ruby/object:Gem::Requirement
220
+ requirements:
221
+ - - "~>"
222
+ - !ruby/object:Gem::Version
223
+ version: '10'
224
+ type: :development
225
+ prerelease: false
226
+ version_requirements: !ruby/object:Gem::Requirement
227
+ requirements:
228
+ - - "~>"
229
+ - !ruby/object:Gem::Version
230
+ version: '10'
227
231
  description: A complete web framework for Ruby
228
232
  email:
229
233
  - me@lucaguidi.com
@@ -245,8 +249,12 @@ files:
245
249
  - lib/lotus/application.rb
246
250
  - lib/lotus/application_name.rb
247
251
  - lib/lotus/cli.rb
252
+ - lib/lotus/cli_sub_commands/assets.rb
253
+ - lib/lotus/cli_sub_commands/db.rb
254
+ - lib/lotus/cli_sub_commands/destroy.rb
255
+ - lib/lotus/cli_sub_commands/generate.rb
256
+ - lib/lotus/commands/assets/precompile.rb
248
257
  - lib/lotus/commands/console.rb
249
- - lib/lotus/commands/db.rb
250
258
  - lib/lotus/commands/db/abstract.rb
251
259
  - lib/lotus/commands/db/apply.rb
252
260
  - lib/lotus/commands/db/console.rb
@@ -255,11 +263,17 @@ files:
255
263
  - lib/lotus/commands/db/migrate.rb
256
264
  - lib/lotus/commands/db/prepare.rb
257
265
  - lib/lotus/commands/db/version.rb
258
- - lib/lotus/commands/generate.rb
259
- - lib/lotus/commands/new.rb
266
+ - lib/lotus/commands/generate/abstract.rb
267
+ - lib/lotus/commands/generate/action.rb
268
+ - lib/lotus/commands/generate/app.rb
269
+ - lib/lotus/commands/generate/mailer.rb
270
+ - lib/lotus/commands/generate/migration.rb
271
+ - lib/lotus/commands/generate/model.rb
272
+ - lib/lotus/commands/new/abstract.rb
273
+ - lib/lotus/commands/new/app.rb
274
+ - lib/lotus/commands/new/container.rb
260
275
  - lib/lotus/commands/routes.rb
261
276
  - lib/lotus/commands/server.rb
262
- - lib/lotus/config/assets.rb
263
277
  - lib/lotus/config/configure.rb
264
278
  - lib/lotus/config/cookies.rb
265
279
  - lib/lotus/config/framework_configuration.rb
@@ -273,8 +287,6 @@ files:
273
287
  - lib/lotus/container.rb
274
288
  - lib/lotus/environment.rb
275
289
  - lib/lotus/frameworks.rb
276
- - lib/lotus/generators/abstract.rb
277
- - lib/lotus/generators/action.rb
278
290
  - lib/lotus/generators/action/action.rb.tt
279
291
  - lib/lotus/generators/action/action_spec.minitest.tt
280
292
  - lib/lotus/generators/action/action_spec.rspec.tt
@@ -283,9 +295,13 @@ files:
283
295
  - lib/lotus/generators/action/view.rb.tt
284
296
  - lib/lotus/generators/action/view_spec.minitest.tt
285
297
  - lib/lotus/generators/action/view_spec.rspec.tt
286
- - lib/lotus/generators/app.rb
287
- - lib/lotus/generators/app/.gitkeep
288
- - lib/lotus/generators/application/app.rb
298
+ - lib/lotus/generators/app/.gitkeep.tt
299
+ - lib/lotus/generators/app/application.rb.tt
300
+ - lib/lotus/generators/app/config/initializers/.gitkeep
301
+ - lib/lotus/generators/app/config/routes.rb.tt
302
+ - lib/lotus/generators/app/favicon.ico
303
+ - lib/lotus/generators/app/templates/application.html.erb.tt
304
+ - lib/lotus/generators/app/views/application_layout.rb.tt
289
305
  - lib/lotus/generators/application/app/.env.development.tt
290
306
  - lib/lotus/generators/application/app/.env.test.tt
291
307
  - lib/lotus/generators/application/app/.env.tt
@@ -299,8 +315,10 @@ files:
299
315
  - lib/lotus/generators/application/app/config.ru.tt
300
316
  - lib/lotus/generators/application/app/config/application.rb.tt
301
317
  - lib/lotus/generators/application/app/config/environment.rb.tt
318
+ - lib/lotus/generators/application/app/config/initializers/.gitkeep
302
319
  - lib/lotus/generators/application/app/config/routes.rb.tt
303
320
  - lib/lotus/generators/application/app/db/.gitkeep
321
+ - lib/lotus/generators/application/app/favicon.ico
304
322
  - lib/lotus/generators/application/app/features_helper.rb.minitest.tt
305
323
  - lib/lotus/generators/application/app/features_helper.rb.rspec.tt
306
324
  - lib/lotus/generators/application/app/gitignore.tt
@@ -315,7 +333,6 @@ files:
315
333
  - lib/lotus/generators/application/app/spec_helper.rb.rspec.tt
316
334
  - lib/lotus/generators/application/app/templates/application.html.erb.tt
317
335
  - lib/lotus/generators/application/app/views/application_layout.rb.tt
318
- - lib/lotus/generators/application/container.rb
319
336
  - lib/lotus/generators/application/container/.env.development.tt
320
337
  - lib/lotus/generators/application/container/.env.test.tt
321
338
  - lib/lotus/generators/application/container/.env.tt
@@ -327,12 +344,15 @@ files:
327
344
  - lib/lotus/generators/application/container/capybara.rb.rspec.tt
328
345
  - lib/lotus/generators/application/container/config.ru.tt
329
346
  - lib/lotus/generators/application/container/config/environment.rb.tt
347
+ - lib/lotus/generators/application/container/config/initializers/.gitkeep
330
348
  - lib/lotus/generators/application/container/db/.gitkeep
331
349
  - lib/lotus/generators/application/container/features_helper.rb.minitest.tt
332
350
  - lib/lotus/generators/application/container/features_helper.rb.rspec.tt
333
351
  - lib/lotus/generators/application/container/gitignore.tt
334
352
  - lib/lotus/generators/application/container/lib/app_name.rb.tt
335
353
  - lib/lotus/generators/application/container/lib/chirp/entities/.gitkeep
354
+ - lib/lotus/generators/application/container/lib/chirp/mailers/.gitkeep
355
+ - lib/lotus/generators/application/container/lib/chirp/mailers/templates/.gitkeep
336
356
  - lib/lotus/generators/application/container/lib/chirp/repositories/.gitkeep
337
357
  - lib/lotus/generators/application/container/lib/config/mapping.rb.tt
338
358
  - lib/lotus/generators/application/container/lotusrc.tt
@@ -341,35 +361,34 @@ files:
341
361
  - lib/lotus/generators/application/container/spec_helper.rb.minitest.tt
342
362
  - lib/lotus/generators/application/container/spec_helper.rb.rspec.tt
343
363
  - lib/lotus/generators/database_config.rb
344
- - lib/lotus/generators/mailer.rb
364
+ - lib/lotus/generators/generatable.rb
365
+ - lib/lotus/generators/generator.rb
345
366
  - lib/lotus/generators/mailer/mailer.rb.tt
346
367
  - lib/lotus/generators/mailer/mailer_spec.rb.tt
347
368
  - lib/lotus/generators/mailer/template.html.tt
348
369
  - lib/lotus/generators/mailer/template.txt.tt
349
- - lib/lotus/generators/migration.rb
350
370
  - lib/lotus/generators/migration/migration.rb.tt
351
- - lib/lotus/generators/model.rb
352
371
  - lib/lotus/generators/model/entity.rb.tt
353
372
  - lib/lotus/generators/model/entity_spec.minitest.tt
354
373
  - lib/lotus/generators/model/entity_spec.rspec.tt
355
374
  - lib/lotus/generators/model/repository.rb.tt
356
375
  - lib/lotus/generators/model/repository_spec.minitest.tt
357
376
  - lib/lotus/generators/model/repository_spec.rspec.tt
358
- - lib/lotus/generators/slice.rb
359
- - lib/lotus/generators/slice/.gitkeep.tt
360
- - lib/lotus/generators/slice/application.rb.tt
361
- - lib/lotus/generators/slice/config/routes.rb.tt
362
- - lib/lotus/generators/slice/templates/application.html.erb.tt
363
- - lib/lotus/generators/slice/views/application_layout.rb.tt
377
+ - lib/lotus/generators/test_framework.rb
364
378
  - lib/lotus/loader.rb
365
379
  - lib/lotus/lotusrc.rb
366
380
  - lib/lotus/mailer/glue.rb
367
381
  - lib/lotus/middleware.rb
382
+ - lib/lotus/rake_helper.rb
383
+ - lib/lotus/rake_tasks.rb
368
384
  - lib/lotus/rendering_policy.rb
385
+ - lib/lotus/repositories/car_repository.rb
386
+ - lib/lotus/repositories/name_repository.rb
369
387
  - lib/lotus/root.rb
370
388
  - lib/lotus/routes.rb
371
389
  - lib/lotus/routing/default.rb
372
390
  - lib/lotus/setup.rb
391
+ - lib/lotus/static.rb
373
392
  - lib/lotus/templates/default.html.erb
374
393
  - lib/lotus/templates/welcome.html.erb
375
394
  - lib/lotus/version.rb
@@ -399,7 +418,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
399
418
  version: '0'
400
419
  requirements: []
401
420
  rubyforge_project:
402
- rubygems_version: 2.4.5.1
421
+ rubygems_version: 2.5.1
403
422
  signing_key:
404
423
  specification_version: 4
405
424
  summary: A complete web framework for Ruby