spinebox 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +1 -0
- data/bin/spinebox +8 -6
- data/lib/spinebox/command.rb +11 -3
- data/lib/spinebox/version.rb +1 -1
- data/lib/spinebox.rb +1 -0
- metadata +1 -1
data/Gemfile
CHANGED
data/bin/spinebox
CHANGED
@@ -5,33 +5,35 @@ require 'spinebox'
|
|
5
5
|
Spinebox::Command.dispatch do
|
6
6
|
|
7
7
|
# Version
|
8
|
-
on "--version, -v", "Show the version", :if => proc { ['--version', '-v'].include?(ARGV.first) } do
|
8
|
+
on "--version, -v", "Show the version", :if => proc { ['--version', '-v'].include?(ARGV.first) }, :type => :option do
|
9
9
|
puts "Spinebox #{Spinebox::VERSION}"
|
10
10
|
exit(0)
|
11
11
|
end
|
12
12
|
|
13
13
|
# Help
|
14
|
-
on "--help, -h", "Show this help", :if => proc { ['--help', '-h'].include?(ARGV.first) or ARGV.empty? } do
|
15
|
-
|
14
|
+
on "--help, -h", "Show this help", :if => proc { ['--help', '-h'].include?(ARGV.first) or ARGV.empty? }, :type => :option do
|
15
|
+
Spinebox::Command.help
|
16
16
|
exit(0)
|
17
17
|
end
|
18
18
|
|
19
19
|
# New application
|
20
|
-
on "new APP", "Create a new APP", :if => proc { ['new', 'n'].include?(ARGV.first) } do
|
20
|
+
on "new APP", "Create a new APP", :if => proc { ['new', 'n'].include?(ARGV.first) }, :type => :action do
|
21
21
|
ARGV.shift
|
22
22
|
Spinebox::Generator.new(ARGV.first)
|
23
|
+
puts "Successfully created '#{ARGV.first}'".green
|
23
24
|
exit(0)
|
24
25
|
end
|
25
26
|
|
26
27
|
# Compile
|
27
|
-
on "compile, precompile", "Compile files to the public dir", :if => proc { ['compile', 'precompile'].include?(ARGV.first) } do
|
28
|
+
on "compile, precompile", "Compile files to the public dir", :if => proc { ['compile', 'precompile'].include?(ARGV.first) }, :type => :action do
|
28
29
|
Spinebox.boot!
|
29
30
|
Spinebox::Compiler.compile
|
31
|
+
puts "Successfully compiled to 'public'".green
|
30
32
|
exit(0)
|
31
33
|
end
|
32
34
|
|
33
35
|
# Run server
|
34
|
-
on "
|
36
|
+
on "server, s", "Run the development server", :if => proc { ['server', 's'].include?(ARGV.first) }, :type => :action do
|
35
37
|
Rack::Handler::Thin.run(Spinebox.app, :Port => 3000)
|
36
38
|
end
|
37
39
|
|
data/lib/spinebox/command.rb
CHANGED
@@ -27,9 +27,16 @@ module Spinebox
|
|
27
27
|
|
28
28
|
# Combines the information of all registered commands and concatenates them to a string
|
29
29
|
def self.help
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
puts "Usage:"
|
31
|
+
printf "%-3s %s\n\n", "", "spinebox new APP_PATH"
|
32
|
+
|
33
|
+
puts "Options:"
|
34
|
+
@@commands.each { |command| printf "%-3s %-20s %s\n", "", command.command, command.desc if command.options[:type] == :option }
|
35
|
+
|
36
|
+
puts ""
|
37
|
+
|
38
|
+
puts "Actions:"
|
39
|
+
@@commands.each { |command| printf "%-3s %-20s %s\n", "", command.command, command.desc if command.options[:type] == :action }
|
33
40
|
end
|
34
41
|
|
35
42
|
# Encapsules a registered command
|
@@ -37,6 +44,7 @@ module Spinebox
|
|
37
44
|
|
38
45
|
attr_reader :command
|
39
46
|
attr_reader :desc
|
47
|
+
attr_reader :options
|
40
48
|
|
41
49
|
def initialize command, desc, options, &block
|
42
50
|
@command, @desc, @options, @block = command, desc, options, block
|
data/lib/spinebox/version.rb
CHANGED
data/lib/spinebox.rb
CHANGED