Module: SparkEngine::Help

Extended by:
Help
Included in:
Help
Defined in:
lib/spark_engine/command/help.rb

Instance Method Summary collapse

Instance Method Details



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/spark_engine/command/help.rb', line 5

def banner(command=nil)
  if command.nil?
    <<-HERE
General Commands (run from anywhere):
  #{spark_commands.map{|c| commands(c) }.join("\n  ")}

Engine Commands (run these from your project's directory)
  #{engine_commands.map{|c| commands(c) }.join("\n  ")}

For help with a specific command, run `spark help command`

Options:
    HERE
  elsif commands(command)
    "\nUsage:\n  spark #{commands(command)}\n\nOptions:\n"
  end
end

#buildObject



69
70
71
# File 'lib/spark_engine/command/help.rb', line 69

def build
  "build [options]          # Build assets"
end

#cleanObject



85
86
87
# File 'lib/spark_engine/command/help.rb', line 85

def clean
  "clean                    # Remove cache files"
end

#commands(command) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/spark_engine/command/help.rb', line 38

def commands(command)
  case command
  when 'new', 'n'; new
  when 'help', 'h'; help
  when 'build', 'b'; build
  when 'watch', 'w'; watch
  when 'server', 's'; server
  when 'generate', 'g'; generate
  when 'clean', 'c'; clean
  when 'help', 'h'; help
  when 'gem:build'; gem_build
  when 'gem:install'; gem_install
  when 'gem:release'; gem_release
  when 'gem:bump:patch'; gem_bump_patch
  when 'gem:bump:minor'; gem_bump_minor
  when 'gem:bump:major'; gem_bump_major
  end
end

#engine_commandsObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/spark_engine/command/help.rb', line 23

def engine_commands
  list = %w(help build watch server generate clean gem:build gem:install gem:release)
  begin
    gem 'bump'
    list.concat %w(gem:bump:patch gem:bump:minor gem:bump:major)
  rescue Gem::LoadError
  end

  list
end

#gem_buildObject



81
82
83
# File 'lib/spark_engine/command/help.rb', line 81

def gem_build
  "gem:build                # Build assets for production and build gem"
end

#gem_bump_majorObject



105
106
107
# File 'lib/spark_engine/command/help.rb', line 105

def gem_bump_major
  "gem:bump:major           # Bump version v0.0.0 -> v1.0.0"
end

#gem_bump_minorObject



101
102
103
# File 'lib/spark_engine/command/help.rb', line 101

def gem_bump_minor
  "gem:bump:minor           # Bump version v0.0.0 -> v0.1.0"
end

#gem_bump_patchObject



97
98
99
# File 'lib/spark_engine/command/help.rb', line 97

def gem_bump_patch
  "gem:bump:patch           # Bump version v0.0.0 -> v0.0.1"
end

#gem_installObject



89
90
91
# File 'lib/spark_engine/command/help.rb', line 89

def gem_install
  "gem:install              # Build assets for production, build, and install gem"
end

#gem_releaseObject



93
94
95
# File 'lib/spark_engine/command/help.rb', line 93

def gem_release
  "gem:release              # Build assets for production, build, and release gem to rubygems.org"
end

#generateObject



65
66
67
# File 'lib/spark_engine/command/help.rb', line 65

def generate
  "generate name [options]  # Generate a Component"
end

#helpObject



61
62
63
# File 'lib/spark_engine/command/help.rb', line 61

def help
  "help [command]           # Show help for a specific command"
end

#newObject



57
58
59
# File 'lib/spark_engine/command/help.rb', line 57

def new
  "new name [options]       # Create a new Spark framework engine"
end

#serverObject



77
78
79
# File 'lib/spark_engine/command/help.rb', line 77

def server
  "server [options]         # Serve documentation site"
end

#spark_commandsObject



34
35
36
# File 'lib/spark_engine/command/help.rb', line 34

def spark_commands
  %w(new help)
end

#watchObject



73
74
75
# File 'lib/spark_engine/command/help.rb', line 73

def watch
  "watch [options]          # Build assets when files change"
end