Skip to content

Commit

Permalink
Integrate with Lotus::Helper
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkadwill committed Mar 6, 2015
1 parent 0318125 commit 8314e18
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 16 deletions.
24 changes: 13 additions & 11 deletions lib/lotus/generators/application/container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,26 @@ class Container < Abstract
def initialize(command)
super

@slice_generator = Slice.new(command)
@lotus_head = options.fetch(:lotus_head)
@test = options[:test]
@database = options[:database]
@lotus_model_version = '~> 0.2'
@slice_generator = Slice.new(command)
@lotus_head = options.fetch(:lotus_head)
@test = options[:test]
@database = options[:database]
@lotus_model_version = '~> 0.2'
@lotus_helpers_version = '~> 0.0'

cli.class.source_root(source)
end

def start

opts = {
app_name: app_name,
lotus_head: @lotus_head,
test: @test,
database: @database,
database_config: database_config,
lotus_model_version: @lotus_model_version
app_name: app_name,
lotus_head: @lotus_head,
test: @test,
database: @database,
database_config: database_config,
lotus_model_version: @lotus_model_version,
lotus_helpers_version: @lotus_helpers_version
}

templates = {
Expand Down
5 changes: 3 additions & 2 deletions lib/lotus/generators/application/container/Gemfile.tt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ gem 'lotus-view', require: false, github: 'lotus/view'
gem 'lotus-model', require: false, github: 'lotus/model'
gem 'lotusrb', github: 'lotus/lotus'
<%- else -%>
gem 'lotusrb', '<%= Lotus::VERSION %>'
gem 'lotus-model', '<%= config[:lotus_model_version] %>'
gem 'lotusrb', '<%= Lotus::VERSION %>'
gem 'lotus-model', '<%= config[:lotus_model_version] %>'
gem 'lotus-helpers', '<%= config[:lotus_helpers_version] %>'
<%- end -%>

<%- if config[:database_config][:gem] %>
Expand Down
4 changes: 3 additions & 1 deletion lib/lotus/generators/slice/application.rb.tt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'lotus/helpers'

module <%= config[:classified_slice_name] %>
class Application < Lotus::Application
configure do
Expand Down Expand Up @@ -194,7 +196,7 @@ module <%= config[:classified_slice_name] %>
#
# See: http://www.rubydoc.info/gems/lotus-view#Configuration
view.prepare do
# include MyRoutingHelpers # included in all the views
include Lotus::Helpers
end
end

Expand Down
1 change: 1 addition & 0 deletions lotusrb.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
spec.add_dependency 'lotus-router', '~> 0.2', '>= 0.2.1'
spec.add_dependency 'lotus-controller', '~> 0.3', '>= 0.3.2'
spec.add_dependency 'lotus-view', '~> 0.3'
spec.add_dependency 'lotus-helpers', '~> 0.0'
spec.add_dependency 'shotgun', '~> 0.9'
spec.add_dependency 'dotenv', '~> 1.0'
spec.add_dependency 'thor', '~> 0.19'
Expand Down
7 changes: 5 additions & 2 deletions test/commands/new_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ def container_options
content = @root.join('Gemfile').read
content.must_match %(gem 'bundler')
content.must_match %(gem 'rake')
content.must_match %(gem 'lotusrb', '#{ Lotus::VERSION }')
content.must_match %(gem 'lotus-model', '~> 0.2')
content.must_match %(gem 'lotusrb', '#{ Lotus::VERSION }')
content.must_match %(gem 'lotus-model', '~> 0.2')
content.must_match %(gem 'lotus-helpers', '~> 0.0')
content.must_match %(gem 'capybara')
end

Expand Down Expand Up @@ -579,6 +580,7 @@ def container_options
describe 'apps/web/application.rb' do
it 'generates it' do
content = @root.join('apps/web/application.rb').read
content.must_match %(require 'lotus/helpers')
content.must_match %(module Web)
content.must_match %(class Application < Lotus::Application)

Expand Down Expand Up @@ -617,6 +619,7 @@ def container_options

content.must_match %(controller.prepare)
content.must_match %(view.prepare)
content.must_match %(include Lotus::Helpers)

# per environment configuration
content.must_match %(configure :development do)
Expand Down

0 comments on commit 8314e18

Please sign in to comment.