Class: Archangel::Commands::ThemeCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/archangel/commands/theme_command.rb

Overview

Generate Archangel theme

Instance Method Summary collapse

Instance Method Details

Banner

Say something nice


91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/archangel/commands/theme_command.rb', line 91

def banner
  puts %(

  ******************************************************************

    Your theme has been generated with a gemspec dependency on
    Archangel v#{archangel_version}

#{random_compliment}

  ******************************************************************

  )
end

#copy_common_directoriesObject

Copy common directories that are shared with extension generator


49
50
51
52
53
# File 'lib/archangel/commands/theme_command.rb', line 49

def copy_common_directories
  %w[spec].each do |dir|
    directory("../common/#{dir}", "#{theme_name}/#{dir}")
  end
end

#copy_common_templatesObject

Copy common templates that are shared with extension generator


69
70
71
72
73
74
75
# File 'lib/archangel/commands/theme_command.rb', line 69

def copy_common_templates
  %w[
    .gitignore .rspec .rubocop.yml MIT-LICENSE
  ].each do |tpl|
    template("../common/#{tpl}", "#{theme_name}/#{tpl}")
  end
end

#copy_plugin_directoriesObject

Copy theme directories and chmod bin scripts


58
59
60
61
62
63
64
# File 'lib/archangel/commands/theme_command.rb', line 58

def copy_plugin_directories
  %w[
    app bin lib
  ].each { |dir| directory(dir, "#{theme_name}/#{dir}") }

  chmod("#{theme_name}/bin/rails", 0o755)
end

#copy_plugin_templatesObject

Copy theme templates


80
81
82
83
84
# File 'lib/archangel/commands/theme_command.rb', line 80

def copy_plugin_templates
  %w[
    Gemfile Rakefile README.md
  ].each { |tpl| template(tpl, "#{theme_name}/#{tpl}") }
end

#create_plugin_directoryObject

Create theme directory


35
36
37
# File 'lib/archangel/commands/theme_command.rb', line 35

def create_plugin_directory
  empty_directory(theme_name)
end

#create_plugin_gemspecObject

Create theme .gemspec file


42
43
44
# File 'lib/archangel/commands/theme_command.rb', line 42

def create_plugin_gemspec
  template("theme.gemspec", "#{theme_name}/#{theme_name}.gemspec")
end

#generateObject

Generate theme

Usage

archangel theme [THEME_NAME]
bundle exec bin/archangel theme [THEME_NAME]

28
29
30
# File 'lib/archangel/commands/theme_command.rb', line 28

def generate
  name_plugin
end