padrino/padrino-framework · error

Constant `#{@project_name}` already exists. Please, use anot

Error message

Constant `#{@project_name}` already exists. Please, use another name

What it means

Error "Constant `#{@project_name}` already exists. Please, use another name" thrown in padrino/padrino-framework.

Source

Thrown at padrino-gen/lib/padrino-gen/generators/project.rb:52

      class_option :adapter,          desc: 'SQL adapter for ORM (sqlite, mysql, mysql2, mysql-gem, postgres)', aliases: '-a', default: 'sqlite',    type: :string
      class_option :server,           desc: 'HTTP server to use (webrick, thin, puma)',                         aliases: '-s', default: 'webrick',   type: :string

      # Definitions for the available customizable components.
      defines_component_options

      # Show help if no ARGV given.
      require_arguments!

      ##
      # Copies over the Padrino base application app.
      #
      def setup_project
        valid_constant? name
        app = options[:app] || 'App'

        @project_name = name.gsub(/\W/, '_').underscore.camelize

        raise "Constant `#{@project_name}` already exists. Please, use another name" if already_exists?(@project_name)

        @app_name = app.gsub(/\W/, '_').camelize
        self.destination_root = File.join(options[:root], name)
        if options[:template]
          execute_runner(:template, options[:template])
        else
          directory('project/', destination_root)
          empty_directory destination_root('public/images')
          empty_directory destination_root('public/javascripts')
          empty_directory destination_root('public/stylesheets')
          store_component_config('.components')
          unless options[:lean]
            app_skeleton('app', options[:tiny])
            append_file destination_root('config/apps.rb'), "Padrino.mount('#{@project_name}::#{@app_name}', app_file: Padrino.root('app/app.rb')).to('/')\n"
          end
          template 'templates/Gemfile.tt', destination_root('Gemfile')
          template 'templates/Rakefile.tt', destination_root('Rakefile')
          template 'templates/project_bin.tt', destination_root("exe/#{name}")

View on GitHub (pinned to 167044f3d5)

When it happens

Trigger: Thrown at padrino-gen/lib/padrino-gen/generators/project.rb:52 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of padrino/padrino-framework@167044f3d5 (2026-08-23). Data as JSON: /api/errors/0e05cc5635fc5009. Report an issue: GitHub.