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 CHANGED
@@ -9,3 +9,4 @@ gem 'thin'
9
9
  gem 'coffee_script'
10
10
  gem 'eco'
11
11
  gem 'sass'
12
+ gem 'colorize'
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
- puts Spinebox::Command.help
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 "s, server", "Run the development server", :if => proc { ['server', 's'].include?(ARGV.first) } do
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
 
@@ -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
- output = "Usage: spinebox [options]\n\n"
31
- @@commands.each { |command| output += "\t#{command.command}\t\t#{command.desc}\n" }
32
- output
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
@@ -1,3 +1,3 @@
1
1
  module Spinebox
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/spinebox.rb CHANGED
@@ -3,6 +3,7 @@ require "rack"
3
3
  require 'coffee_script'
4
4
  require 'eco'
5
5
  require 'sass'
6
+ require "colorize"
6
7
  require "ostruct"
7
8
 
8
9
  require "spinebox/version"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spinebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: