homesteading 0.1.0 → 0.2.0
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.
- checksums.yaml +4 -4
- data/README.md +0 -3
- data/bin/homesteading +37 -20
- data/lib/homesteading/command.rb +19 -0
- data/lib/homesteading/commands/apps.rb +242 -242
- data/lib/homesteading/commands/help.rb +26 -25
- data/lib/homesteading/commands/init.rb +29 -29
- data/lib/homesteading/commands/new.rb +100 -99
- data/lib/homesteading/commands/run.rb +36 -35
- data/lib/homesteading/commands/server.rb +98 -97
- data/lib/homesteading/commands/update.rb +55 -56
- data/lib/homesteading/commands/version.rb +7 -8
- data/lib/homesteading/version.rb +2 -2
- metadata +3 -4
- data/lib/homesteading/commands/h.rb +0 -13
- data/lib/homesteading/commands/s.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d41012c5cf25936b063cac45455c91f8df72c39a
|
4
|
+
data.tar.gz: 881ca530b7404d9d34c6f3aa809a5e381a880676
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f1d35f5ea21cdf887afa8e1659f53b017c4644c9846f12de069bcfd480b8138ee9c265b3917ae76baa82e8ec7be8b6394d86fe8600b019ed04bbf606f6179d1
|
7
|
+
data.tar.gz: 0e08056a1cf6d24c09893d1e71dc3e79f8693ed3e6cdbd9569fb94e4ba163983f05ceace2eeb9881aa822e0a63a6b7232030f245cda0dd4dd909b4506c8f572b
|
data/README.md
CHANGED
data/bin/homesteading
CHANGED
@@ -3,28 +3,45 @@ require "optparse"
|
|
3
3
|
require "fileutils"
|
4
4
|
require "json"
|
5
5
|
require "yaml"
|
6
|
-
require "homesteading/
|
6
|
+
require "homesteading/command"
|
7
7
|
|
8
|
+
dir = File.expand_path("../../lib/homesteading/commands", __FILE__)
|
9
|
+
# require all commands
|
10
|
+
Dir["#{dir}/*.rb"].each do |f|
|
11
|
+
require f
|
12
|
+
end
|
13
|
+
|
14
|
+
# require some command input
|
8
15
|
if ARGV.empty?
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
Homesteading::Help.new.print("blank")
|
17
|
+
exit 1
|
18
|
+
end
|
19
|
+
|
20
|
+
# special case for `hs -v` alias for `hs version`
|
21
|
+
if ARGV.first.match(/-[vV]/)
|
22
|
+
Homesteading::Version.new.default
|
23
|
+
exit 0
|
24
|
+
end
|
25
|
+
|
26
|
+
# normal flow
|
27
|
+
command_subcommand = ARGV.shift.match(/^(\w+)(:*)(\w*)$/)
|
28
|
+
command = command_subcommand[1]
|
29
|
+
klass = Homesteading::Command.create(command)
|
20
30
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
31
|
+
unless klass
|
32
|
+
puts
|
33
|
+
puts "* Unknown command: #{command_subcommand}"
|
34
|
+
puts
|
35
|
+
exit 1
|
27
36
|
end
|
28
37
|
|
29
|
-
|
30
|
-
|
38
|
+
subcommand = command_subcommand[2] == ":" ? command_subcommand[3] : "default"
|
39
|
+
|
40
|
+
if klass.class.public_method_defined?(subcommand.to_sym)
|
41
|
+
klass.send(subcommand.to_sym)
|
42
|
+
else
|
43
|
+
puts
|
44
|
+
puts "* Undefined subcommand: #{command_subcommand}"
|
45
|
+
puts
|
46
|
+
exit 1
|
47
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Homesteading
|
2
|
+
class Command
|
3
|
+
COMMANDS = {}
|
4
|
+
|
5
|
+
def self.register(name, *aliases)
|
6
|
+
COMMANDS[name] = self
|
7
|
+
|
8
|
+
aliases.each do |a|
|
9
|
+
COMMANDS[a] = self
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.create(name)
|
14
|
+
if klass = COMMANDS[name]
|
15
|
+
klass.new
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|