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

#build ⇒ Object



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

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

#clean ⇒ Object



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

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
# 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 '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_commands ⇒ Object



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 help 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_build ⇒ Object



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

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

#gem_bump_major ⇒ Object



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

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

#gem_bump_minor ⇒ Object



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

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

#gem_bump_patch ⇒ Object



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

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

#gem_install ⇒ Object



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

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

#gem_release ⇒ Object



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

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

#help ⇒ Object



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

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

#new ⇒ Object



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

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

#server ⇒ Object



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

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

#spark_commands ⇒ Object



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

def spark_commands
  %w(new help)
end

#watch ⇒ Object



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

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