class Archangel::Commands::ThemeCommand

Generate Archangel theme

Public Instance Methods

banner() click to toggle source

Banner

Say something nice

copy_common_directories() click to toggle source

Copy common directories that are shared with extension generator

# File lib/archangel/commands/theme_command.rb, line 51
def copy_common_directories
  %w[
    bin lib spec
  ].each do |dir|
    directory("../common/#{dir}", "#{extension_name}/#{dir}")
  end

  chmod("#{extension_name}/bin/rails", 0o755)
end
copy_common_templates() click to toggle source

Copy common templates that are shared with extension generator

# File lib/archangel/commands/theme_command.rb, line 73
def copy_common_templates
  %w[
    .gitignore .rspec Gemfile MIT-LICENSE Rakefile
  ].each do |tpl|
    template("../common/#{tpl}", "#{extension_name}/#{tpl}")
  end
end
copy_plugin_directories() click to toggle source

Copy theme directories and chmod bin scripts

# File lib/archangel/commands/theme_command.rb, line 64
def copy_plugin_directories
  %w[
    app
  ].each { |dir| directory(dir, "#{extension_name}/#{dir}") }
end
copy_plugin_templates() click to toggle source

Copy theme templates

# File lib/archangel/commands/theme_command.rb, line 84
def copy_plugin_templates
  %w[
    README.md
  ].each { |tpl| template(tpl, "#{extension_name}/#{tpl}") }
end
corrected_plugin_name() click to toggle source
# File lib/archangel/commands/theme_command.rb, line 119
def corrected_plugin_name
  ext_name = extension_name.downcase

  unless /^archangel_/.match?(ext_name)
    ext_name = "archangel_#{ext_name}"
  end
  ext_name = "#{ext_name}_theme" unless /_theme$/.match?(ext_name)

  Thor::Util.snake_case(ext_name)
end
create_plugin_directory() click to toggle source

Create theme directory

# File lib/archangel/commands/theme_command.rb, line 37
def create_plugin_directory
  empty_directory(extension_name)
end
create_plugin_gemspec() click to toggle source

Create theme .gemspec file

# File lib/archangel/commands/theme_command.rb, line 44
def create_plugin_gemspec
  template("theme.gemspec", "#{extension_name}/#{extension_name}.gemspec")
end
generate() click to toggle source

Generate theme

Usage

archangel theme [EXTENSION_NAME]
bundle exec bin/archangel theme [EXTENSION_NAME]
# File lib/archangel/commands/theme_command.rb, line 30
def generate
  name_plugin
end
name_plugin() click to toggle source
# File lib/archangel/commands/theme_command.rb, line 111
def name_plugin
  @extension_name = corrected_plugin_name
end
theme_base_name() click to toggle source
# File lib/archangel/commands/theme_command.rb, line 115
def theme_base_name
  extension_name.sub(/^archangel_/, "").sub(/_theme$/, "")
end