Skip to content

Commit

Permalink
Better description for option (#2346)
Browse files Browse the repository at this point in the history
  • Loading branch information
pablobm authored Apr 6, 2023
1 parent 0191ee8 commit 7dd3ee1
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
7 changes: 6 additions & 1 deletion lib/administrate/view_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
module Administrate
class ViewGenerator < Rails::Generators::Base
include Administrate::GeneratorHelpers
class_option :namespace, type: :string, default: :admin
class_option(
:namespace,
type: :string,
desc: "Namespace where the admin dashboards live",
default: "admin",
)

def self.template_source_path
File.expand_path(
Expand Down
7 changes: 6 additions & 1 deletion lib/generators/administrate/dashboard/dashboard_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ class DashboardGenerator < Rails::Generators::NamedBase
COLLECTION_ATTRIBUTE_LIMIT = 4
READ_ONLY_ATTRIBUTES = %w[id created_at updated_at]

class_option :namespace, type: :string, default: :admin
class_option(
:namespace,
type: :string,
desc: "Namespace where the admin dashboards live",
default: "admin",
)

source_root File.expand_path("../templates", __FILE__)

Expand Down
7 changes: 6 additions & 1 deletion lib/generators/administrate/install/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ class InstallGenerator < Rails::Generators::Base
include Administrate::GeneratorHelpers
source_root File.expand_path("../templates", __FILE__)

class_option :namespace, type: :string, default: "admin"
class_option(
:namespace,
type: :string,
desc: "Namespace where the admin dashboards will live",
default: "admin",
)

def run_routes_generator
if dashboard_resources.none?
Expand Down
7 changes: 6 additions & 1 deletion lib/generators/administrate/routes/routes_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ module Generators
class RoutesGenerator < Rails::Generators::Base
include Administrate::GeneratorHelpers
source_root File.expand_path("../templates", __FILE__)
class_option :namespace, type: :string, default: "admin"
class_option(
:namespace,
type: :string,
desc: "Namespace where the admin dashboards live",
default: "admin",
)

def insert_dashboard_routes
if valid_dashboard_models.any?
Expand Down
6 changes: 3 additions & 3 deletions spec/generators/views_generator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
expect(Rails::Generators).
to invoke_generator(
"administrate:views:#{generator}",
[resource, "--namespace", :admin],
[resource, "--namespace", "admin"],
)
end
end
Expand All @@ -27,7 +27,7 @@

expect(Rails::Generators).to invoke_generator(
"administrate:views:index",
[resource, "--namespace", :admin],
[resource, "--namespace", "admin"],
behavior: :revoke,
)
end
Expand All @@ -44,7 +44,7 @@
%w[index show new edit].each do |generator|
expect(Rails::Generators). to invoke_generator(
"administrate:views:#{generator}",
[application_resource_path, "--namespace", :admin],
[application_resource_path, "--namespace", "admin"],
)
end
end
Expand Down

0 comments on commit 7dd3ee1

Please sign in to comment.