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



95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/archangel/commands/theme_command.rb', line 95

def banner
  say %(

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

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

You look lovely today by the way.

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

  )
end

#copy_common_directoriesObject

Copy common directories that are shared with extension generator



51
52
53
54
55
56
57
58
59
# 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_templatesObject

Copy common templates that are shared with extension generator



73
74
75
76
77
78
79
# 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_directoriesObject

Copy theme directories and chmod bin scripts



64
65
66
67
68
# 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_templatesObject

Copy theme templates



84
85
86
87
88
# File 'lib/archangel/commands/theme_command.rb', line 84

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

#create_plugin_directoryObject

Create theme directory



37
38
39
# File 'lib/archangel/commands/theme_command.rb', line 37

def create_plugin_directory
  empty_directory(extension_name)
end

#create_plugin_gemspecObject

Create theme .gemspec file



44
45
46
# File 'lib/archangel/commands/theme_command.rb', line 44

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

#generateObject

Generate theme

Usage

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


30
31
32
# File 'lib/archangel/commands/theme_command.rb', line 30

def generate
  name_plugin
end