class GemGenerator::Command::ProcessFiles::RenderVariables

Class for a single object which should be a scope in render

Constants

EXAMPLE_VALUES

Attributes

summary[R]

Public Class Methods

new(name, namespace_option, indentation, summary) click to toggle source
Calls superclass method
# File lib/gem_generator/command/process_files/render_variables.rb, line 16
def initialize(name, namespace_option, indentation, summary)
        super name, indentation

        @namespace_option = namespace_option
        @summary = summary

        ## Call to be sure that this is checked before author fields
        github_namespace
end

Public Instance Methods

author_name_string() click to toggle source
# File lib/gem_generator/command/process_files/render_variables.rb, line 75
        def author_name_string
        quote = author_name.include?("'") ? '"' : "'"
        "#{quote}#{author_name}#{quote}"
end
description() click to toggle source
# File lib/gem_generator/command/process_files/render_variables.rb, line 31
        def description
        summary.match?(/[.?!]$/) ? summary : "#{summary}."
end
github_namespace_uri() click to toggle source
# File lib/gem_generator/command/process_files/render_variables.rb, line 43
        def github_namespace_uri
        "https://github.com/#{github_namespace}"
end
github_path() click to toggle source
# File lib/gem_generator/command/process_files/render_variables.rb, line 39
        def github_path
        "#{github_namespace}/#{name}"
end
github_uri() click to toggle source
# File lib/gem_generator/command/process_files/render_variables.rb, line 47
        def github_uri
        "https://github.com/#{github_path}"
end
summary_string() click to toggle source
# File lib/gem_generator/command/process_files/render_variables.rb, line 26
        def summary_string
        quote = summary.include?("'") ? '"' : "'"
        "#{quote}#{summary}#{quote}"
end
version_constant() click to toggle source
# File lib/gem_generator/command/process_files/render_variables.rb, line 35
        def version_constant
        "#{module_name}::VERSION"
end

Private Instance Methods

config() click to toggle source
# File lib/gem_generator/command/process_files/render_variables.rb, line 94
        def config
        config_file = find_config_file
        return {} unless config_file

        YAML.load_file config_file
end
find_config_file() click to toggle source
# File lib/gem_generator/command/process_files/render_variables.rb, line 101
def find_config_file
        config_lookup_directory = Dir.getwd

        until (
                config_file = Dir.glob(
                        File.join(config_lookup_directory, '.gem_generator.y{a,}ml'), File::FNM_DOTMATCH
                ).first
        ) || config_lookup_directory == '/'
                config_lookup_directory = File.dirname config_lookup_directory
        end

        config_file
end
github_namespace() click to toggle source
# File lib/gem_generator/command/process_files/render_variables.rb, line 82
                                        def github_namespace
                                        result = @namespace_option || config[:namespace]

                                        return result unless result.blank?

                                        abort <<~TEXT
                                                You have to specify project's namespace on GitHub.
                                                You can use `--namespace` option, or create a configuration file.
                                                Check the README.
                                        TEXT
                                end