lib/generators/actions.rb in padrino-gen-0.1.2 vs lib/generators/actions.rb in padrino-gen-0.1.3

- old
+ new

@@ -77,11 +77,18 @@ root ? File.exist?(File.join(root, 'config/boot.rb')) : File.exist?('config/boot.rb') end # Returns the app_name for the application at root def fetch_app_name(root=nil) - app_path = root ? File.join(root, 'app.rb') : 'app.rb' + app_path = root ? File.join(root, 'app/app.rb') : 'app/app.rb' @app_name ||= File.read(app_path).scan(/class\s(.*?)\s</).flatten[0] + end + + # Constructs a path from the specified app root + # build_target_path("app/mailers", "#{@mailer_basename}.rb") + def app_root_path(*paths) + settings = paths.extract_options! + File.join(settings[:root] || options[:root] || '.', *paths) end module ClassMethods # Defines a class option to allow a component to be chosen and add to component type list # Also builds the available_choices hash of which component choices are supported