lib/lotus/generators/slice.rb in lotusrb-0.2.0 vs lib/lotus/generators/slice.rb in lotusrb-0.2.1
- old
+ new
@@ -1,17 +1,19 @@
require 'securerandom'
require 'lotus/generators/abstract'
require 'lotus/utils/string'
+require 'lotus/application_name'
module Lotus
module Generators
class Slice < Abstract
def initialize(command)
super
- @slice_name = options.fetch(:application)
- @upcase_slice_name = @slice_name.upcase
+ application_name = ApplicationName.new(options.fetch(:application))
+ @slice_name = application_name.to_s
+ @upcase_slice_name = application_name.to_env_s
@classified_slice_name = Utils::String.new(@slice_name).classify
@source = Pathname.new(::File.dirname(__FILE__) + '/../generators/slice')
@target = target.join('apps', @slice_name)
@@ -42,18 +44,15 @@
empty_directories = [
"public/javascripts",
"public/stylesheets"
]
- case options[:test]
- when 'rspec'
- else # minitest (default)
- empty_directories << [
- "../../spec/#{ opts[:slice_name] }/features",
- "../../spec/#{ opts[:slice_name] }/controllers",
- "../../spec/#{ opts[:slice_name] }/views"
- ]
- end
+ # Add testing directories (spec/ is the default for both MiniTest and RSpec)
+ empty_directories << [
+ "../../spec/#{ opts[:slice_name] }/features",
+ "../../spec/#{ opts[:slice_name] }/controllers",
+ "../../spec/#{ opts[:slice_name] }/views"
+ ]
##
# config/environment.rb
#