homesteading 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/bin/homesteading +4 -5
- data/help/apps-create.md +16 -4
- data/help/apps-destroy.md +23 -2
- data/help/apps-info.md +33 -2
- data/help/apps-rename.md +8 -2
- data/help/apps-reroute.md +11 -0
- data/help/apps.md +16 -14
- data/help/new.md +14 -20
- data/help/server-stop.md +2 -0
- data/help/server.md +4 -2
- data/help/update.md +27 -26
- data/lib/homesteading/commands/apps.rb +273 -5
- data/lib/homesteading/commands/help.rb +8 -9
- data/lib/homesteading/commands/new.rb +110 -27
- data/lib/homesteading/commands/run.rb +1 -1
- data/lib/homesteading/commands/server.rb +4 -4
- data/lib/homesteading/commands/update.rb +52 -14
- data/lib/homesteading/commands/version.rb +2 -2
- data/lib/homesteading/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80cc70869c0c40d888be826da79f68efb60dcc82
|
4
|
+
data.tar.gz: 7446c3c1e779f5276c52d33931e942bfe9993eae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 125f9e637252325d7172ac199a2ac15ccd7524f4484eb357f8978fb6081ee233a1bd4d065e3d6c25e6f7c976abef3560134125aacf7a1fb8654f764d4520501b
|
7
|
+
data.tar.gz: 975451048996a019f038cff05f74593356113902e35fb8eeeef84ed735c6a081a73c80ceccaa8efe29789e54ca61f66706af22c2212416e11d2fc5426501076c
|
data/README.md
CHANGED
data/bin/homesteading
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require "homesteading/commands/help"
|
3
3
|
require "optparse"
|
4
|
+
require "fileutils"
|
5
|
+
require "json"
|
6
|
+
require "yaml"
|
4
7
|
|
5
8
|
if ARGV.empty?
|
6
9
|
name_space = "Help"
|
@@ -24,8 +27,4 @@ else
|
|
24
27
|
end
|
25
28
|
|
26
29
|
require "homesteading/commands/#{name_space.downcase}"
|
27
|
-
|
28
|
-
Homesteading.const_get(name_space).send(task.to_sym)
|
29
|
-
else
|
30
|
-
Homesteading.const_get(name_space).send(task.to_sym, ARGV)
|
31
|
-
end
|
30
|
+
Homesteading.const_get(name_space).send(task.to_sym)
|
data/help/apps-create.md
CHANGED
@@ -1,6 +1,18 @@
|
|
1
|
-
# TODO:
|
2
|
-
|
3
1
|
Usage: homesteading apps:create
|
4
2
|
|
5
|
-
|
6
|
-
|
3
|
+
create a new app from @homesteading on GitHub or a URL
|
4
|
+
|
5
|
+
* -f, --force : Overwrite apps that already exist
|
6
|
+
* -p, --pretend : Run but do not make any changes
|
7
|
+
* -q, --quiet : Suppress status output
|
8
|
+
* -s, --skip : Skip apps that already exist
|
9
|
+
|
10
|
+
Example:
|
11
|
+
|
12
|
+
$ homesteading apps:create --app note
|
13
|
+
* Cloning homesteading app from GitHub: note
|
14
|
+
|
15
|
+
Example:
|
16
|
+
|
17
|
+
$ homesteading apps:create --url git@github.com:homesteading/homesteading-note.git
|
18
|
+
* Cloning from: git@github.com:homesteading/homesteading-note.git
|
data/help/apps-destroy.md
CHANGED
@@ -1,3 +1,24 @@
|
|
1
|
-
# TODO:
|
2
|
-
|
3
1
|
Usage: homesteading apps:destroy
|
2
|
+
|
3
|
+
destroy a homesteading app
|
4
|
+
|
5
|
+
* -c, --confirm : Overwrite apps that already exist
|
6
|
+
|
7
|
+
Example:
|
8
|
+
|
9
|
+
$ homesteading apps:destory --app note
|
10
|
+
! WARNING: Potentially Destructive Action
|
11
|
+
! This command will destroy note
|
12
|
+
! To proceed, type 'note' or re-run this command with '--confirm note'
|
13
|
+
|
14
|
+
note
|
15
|
+
|
16
|
+
* Destroying note permananently...
|
17
|
+
* ...done
|
18
|
+
|
19
|
+
Example:
|
20
|
+
|
21
|
+
$ homesteading apps:destory --app note --confirm note
|
22
|
+
|
23
|
+
* Destroying note permananently...
|
24
|
+
* ...done
|
data/help/apps-info.md
CHANGED
@@ -1,3 +1,34 @@
|
|
1
|
-
# TODO:
|
2
|
-
|
3
1
|
Usage: homesteading apps:info
|
2
|
+
|
3
|
+
show info about a homesteading app
|
4
|
+
|
5
|
+
Example:
|
6
|
+
|
7
|
+
$ homesteading apps:info --app note
|
8
|
+
|
9
|
+
---
|
10
|
+
name: Homesteading Note
|
11
|
+
description: An app used for publishing notes to your own website.
|
12
|
+
keywords:
|
13
|
+
- indieweb
|
14
|
+
- homesteading
|
15
|
+
- publishing
|
16
|
+
- hs:publisher
|
17
|
+
- hs:note
|
18
|
+
website: http://homesteading.io
|
19
|
+
repository: https://github.com/homesteading/homesteading-note
|
20
|
+
logo: http://homesteading.io/logo.png
|
21
|
+
success_url: "/settings"
|
22
|
+
scripts:
|
23
|
+
postdeploy: bundle exec rake db:migrate && bundle exec rake db:seed
|
24
|
+
env:
|
25
|
+
RAILS_ENV: production
|
26
|
+
COOKIE_SECRET:
|
27
|
+
description: This gets generated
|
28
|
+
generator: secret
|
29
|
+
addons:
|
30
|
+
- heroku-postgresql:hobby-dev
|
31
|
+
- papertrail
|
32
|
+
- pgbackups
|
33
|
+
routes:
|
34
|
+
path: notes
|
data/help/apps-rename.md
CHANGED
data/help/apps.md
CHANGED
@@ -5,21 +5,23 @@ Usage: homesteading apps
|
|
5
5
|
Example:
|
6
6
|
|
7
7
|
$ homesteading apps
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
|
9
|
+
* Publisher Apps
|
10
|
+
article
|
11
|
+
note
|
12
|
+
photo
|
13
|
+
video
|
14
|
+
|
15
|
+
* Non-Publisher Apps
|
16
|
+
hub
|
17
|
+
router
|
18
|
+
syndicator
|
17
19
|
|
18
20
|
Additional commands, type "homesteading help COMMAND" for more details:
|
19
21
|
|
20
|
-
* apps:create --app HS_APP
|
21
|
-
* apps:create --url URL
|
22
|
-
* apps:destroy --app APP
|
23
|
-
* apps:info --app APP
|
24
|
-
* apps:rename NEWNAME --app APP
|
22
|
+
* apps:create --app HS_APP : create a new app from @homesteading on GitHub
|
23
|
+
* apps:create --url URL : create a new app from a URL
|
24
|
+
* apps:destroy --app APP : permanently destroy an app
|
25
|
+
* apps:info --app APP : show detailed app information (from app.json)
|
26
|
+
* apps:rename NEWNAME --app APP : change the app name
|
25
27
|
* apps:reroute NEWROUTE --app APP : change the app route
|
data/help/new.md
CHANGED
@@ -2,14 +2,19 @@ Usage: homesteading new /path/to/constellation [options]
|
|
2
2
|
|
3
3
|
create a constellation of homesteading apps
|
4
4
|
|
5
|
-
* -
|
6
|
-
* -
|
5
|
+
* -e, --except APPS_TO_SKIP : Comma separated list of apps to not install
|
6
|
+
* -o, --only APPS_TO_CREATE : Comma separated list of apps to only install
|
7
7
|
|
8
|
-
|
8
|
+
* -f, --force : Overwrite apps that already exist
|
9
|
+
* -p, --pretend : Run but do not make any changes
|
10
|
+
* -q, --quiet : Suppress status output
|
11
|
+
* -s, --skip : Skip apps that already exist
|
9
12
|
|
10
|
-
|
13
|
+
Example:
|
11
14
|
|
12
|
-
|
15
|
+
$ homesteading new my-site
|
16
|
+
|
17
|
+
* Creating homesteading directory: my-site
|
13
18
|
* Cloning homesteading app from GitHub: hub
|
14
19
|
* Cloning homesteading app from GitHub: router-rack
|
15
20
|
* Cloning homesteading app from GitHub: article
|
@@ -21,18 +26,7 @@ Example:
|
|
21
26
|
* Cloning homesteading app from GitHub: video
|
22
27
|
* Cloning homesteading app from GitHub: walk
|
23
28
|
* Cloning homesteading app from GitHub: weight
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
---
|
29
|
-
|
30
|
-
# TODO
|
31
|
-
|
32
|
-
refer to this for help
|
33
|
-
https://github.com/rdoc/rdoc/blob/master/lib/rdoc/options.rb#L724-L728
|
34
|
-
* -e, --except APPS_TO_SKIP : Comma separated list of apps to not install
|
35
|
-
* -o, --only APPS_TO_CREATE
|
36
|
-
|
37
|
-
* -f, --force : Overwrite apps that already exist
|
38
|
-
* -s, --skip : Skip apps that already exist
|
29
|
+
|
30
|
+
* Next up, do this:
|
31
|
+
cd my-site
|
32
|
+
homesteading server
|
data/help/server-stop.md
CHANGED
data/help/server.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# TODO
|
2
|
+
|
1
3
|
Usage: homesteading server
|
2
4
|
|
3
5
|
start a server for constellation of homesteading apps
|
@@ -8,13 +10,13 @@ Example:
|
|
8
10
|
|
9
11
|
$ homesteading server
|
10
12
|
Homesteading starting...
|
11
|
-
|
13
|
+
|
12
14
|
* Homesteading: 1.0.1, codename: Rooftop
|
13
15
|
* Puma: 2.10.2 (ruby 2.1.5-p273), codename: Robots on Comets
|
14
16
|
* Ruby: 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin14.0]
|
15
17
|
* Environment: development
|
16
18
|
* Running on: http://0.0.0.0:3000
|
17
|
-
|
19
|
+
|
18
20
|
Use Ctrl-C to stop
|
19
21
|
|
20
22
|
|
data/help/update.md
CHANGED
@@ -5,32 +5,33 @@ Usage: homesteading update
|
|
5
5
|
Example:
|
6
6
|
|
7
7
|
$ homesteading update
|
8
|
-
|
9
|
-
...
|
10
|
-
|
11
|
-
...
|
12
|
-
|
13
|
-
...
|
14
|
-
|
15
|
-
...
|
16
|
-
|
17
|
-
...
|
18
|
-
|
19
|
-
...
|
20
|
-
|
21
|
-
...
|
22
|
-
|
23
|
-
...
|
24
|
-
|
25
|
-
...
|
26
|
-
|
27
|
-
...
|
28
|
-
|
29
|
-
...
|
30
|
-
|
31
|
-
...
|
32
|
-
|
33
|
-
...
|
8
|
+
|
9
|
+
* Updating article...
|
10
|
+
* ...done
|
11
|
+
* Updating bookmark...
|
12
|
+
* ...done
|
13
|
+
* Updating event...
|
14
|
+
* ...done
|
15
|
+
* Updating feed...
|
16
|
+
* ...done
|
17
|
+
* Updating hub...
|
18
|
+
* ...done
|
19
|
+
* Updating note...
|
20
|
+
* ...done
|
21
|
+
* Updating photo...
|
22
|
+
* ...done
|
23
|
+
* Updating router...
|
24
|
+
* ...done
|
25
|
+
* Updating sound...
|
26
|
+
* ...done
|
27
|
+
* Updating syndicator...
|
28
|
+
* ...done
|
29
|
+
* Updating video...
|
30
|
+
* ...done
|
31
|
+
* Updating walk...
|
32
|
+
* ...done
|
33
|
+
* Updating weight...
|
34
|
+
* ...done
|
34
35
|
|
35
36
|
|
36
37
|
Additional commands, type "homesteading help COMMAND" for more details:
|
@@ -2,19 +2,287 @@ class Homesteading
|
|
2
2
|
class Apps
|
3
3
|
class << self
|
4
4
|
|
5
|
-
def default
|
5
|
+
def default
|
6
|
+
puts
|
7
|
+
|
8
|
+
constellation_path = Dir.pwd
|
9
|
+
publisher_apps = []
|
10
|
+
nonpublisher_apps = []
|
11
|
+
|
12
|
+
Dir.glob("#{Dir.pwd}/homesteading-*/").each do |directory|
|
13
|
+
app = directory.split("/").last.sub(/homesteading-/, "").downcase
|
14
|
+
app_file_path = directory + "app.json"
|
15
|
+
|
16
|
+
app_keywords = []
|
17
|
+
if File.exist?(app_file_path)
|
18
|
+
app_file = JSON.parse(File.read(app_file_path))
|
19
|
+
app_keywords = app_file["keywords"]
|
20
|
+
end
|
21
|
+
|
22
|
+
if app_keywords.include?("hs:publisher")
|
23
|
+
publisher_apps << app
|
24
|
+
else
|
25
|
+
nonpublisher_apps << app
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
unless publisher_apps.empty?
|
30
|
+
puts "* Publisher Apps"
|
31
|
+
publisher_apps.each do |app|
|
32
|
+
puts " #{app}"
|
33
|
+
end
|
34
|
+
puts
|
35
|
+
end
|
36
|
+
|
37
|
+
unless nonpublisher_apps.empty?
|
38
|
+
puts "* Non-Publisher Apps"
|
39
|
+
nonpublisher_apps.each do |app|
|
40
|
+
puts " #{app}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
puts
|
6
45
|
end
|
7
46
|
|
8
|
-
def create
|
47
|
+
def create
|
48
|
+
puts
|
49
|
+
options = parse_options
|
50
|
+
|
51
|
+
if options[:app].nil? && options[:app].nil?
|
52
|
+
puts "* This requires an '--app' or '--url'"
|
53
|
+
puts "* Example:"
|
54
|
+
puts " homesteading apps:create --app note"
|
55
|
+
puts " homesteading apps:create --url git@github.com:homesteading/homesteading-note.git"
|
56
|
+
puts
|
57
|
+
exit
|
58
|
+
end
|
59
|
+
|
60
|
+
git_url = if options[:app]
|
61
|
+
"git@github.com:homesteading/homesteading-#{options[:app]}.git"
|
62
|
+
else
|
63
|
+
options[:url]
|
64
|
+
end
|
65
|
+
|
66
|
+
app_dir = git_url.split("/").last.split(".git").first
|
67
|
+
|
68
|
+
if File.exist?(app_dir)
|
69
|
+
if options[:skip]
|
70
|
+
unless options[:quiet]
|
71
|
+
puts "* #{app_dir} already exists"
|
72
|
+
puts "* Skipping homesteading-#{options[:app]}"
|
73
|
+
end
|
74
|
+
elsif options[:force]
|
75
|
+
unless options[:quiet]
|
76
|
+
puts "* #{app_dir} already exists"
|
77
|
+
puts "* Removing homesteading-#{options[:app]}"
|
78
|
+
end
|
79
|
+
|
80
|
+
unless options[:pretend]
|
81
|
+
FileUtils.rm_rf app_dir
|
82
|
+
end
|
83
|
+
|
84
|
+
unless options[:quiet]
|
85
|
+
if options[:app]
|
86
|
+
puts "* Cloning homesteading app from GitHub: #{options[:app]}"
|
87
|
+
else
|
88
|
+
puts "* Cloning from: #{options[:url]}"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
unless options[:pretend]
|
93
|
+
system "git clone #{git_url}"
|
94
|
+
end
|
95
|
+
else
|
96
|
+
unless options[:quiet]
|
97
|
+
puts "* #{app_dir} already exists"
|
98
|
+
puts "* TODO gets user input on what to do about the conflict"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
else
|
103
|
+
|
104
|
+
unless options[:quiet]
|
105
|
+
if options[:app]
|
106
|
+
puts "* Cloning homesteading app from GitHub: #{options[:app]}"
|
107
|
+
else
|
108
|
+
puts "* Cloning from: #{options[:url]}"
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
unless options[:pretend]
|
113
|
+
system "git clone #{git_url}"
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
puts
|
9
118
|
end
|
10
119
|
|
11
|
-
def destroy
|
120
|
+
def destroy
|
121
|
+
puts
|
122
|
+
options = parse_options
|
123
|
+
|
124
|
+
if options[:app].nil?
|
125
|
+
puts "* '--app APP' is required for this command"
|
126
|
+
puts
|
127
|
+
exit
|
128
|
+
end
|
129
|
+
|
130
|
+
app = options[:app].downcase
|
131
|
+
constellation_path = Dir.pwd
|
132
|
+
app_dir = "#{constellation_path}/homesteading-#{app}"
|
133
|
+
|
134
|
+
unless File.exist?(app_dir)
|
135
|
+
puts "* #{app} does not exist"
|
136
|
+
puts "* Did you mean one of these?"
|
137
|
+
Dir.glob("#{Dir.pwd}/homesteading-*/").each do |ff|
|
138
|
+
puts " - #{ff.split("/").last.sub(/homesteading-/, "")}"
|
139
|
+
end
|
140
|
+
puts
|
141
|
+
exit
|
142
|
+
end
|
143
|
+
|
144
|
+
if options[:confirm] == app || options[:confirm] == "homesteading-#{app}"
|
145
|
+
puts "* Destroying #{app} permananently..."
|
146
|
+
FileUtils.rm_rf app_dir
|
147
|
+
puts "* ...done"
|
148
|
+
else
|
149
|
+
puts "! WARNING: Potentially Destructive Action"
|
150
|
+
puts "! This command will destroy #{app}"
|
151
|
+
puts "! To proceed, type '#{app}' or re-run this command with '--confirm #{app}'"
|
152
|
+
puts
|
153
|
+
confirmation_input = gets.chomp
|
154
|
+
puts
|
155
|
+
|
156
|
+
if confirmation_input == app
|
157
|
+
puts "* Destroying #{app} permananently..."
|
158
|
+
FileUtils.rm_rf app_dir
|
159
|
+
puts "* ...done"
|
160
|
+
else
|
161
|
+
puts "! Confirmation did not match #{app}. Aborted."
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
puts
|
166
|
+
end
|
167
|
+
|
168
|
+
def info
|
169
|
+
puts
|
170
|
+
options = parse_options
|
171
|
+
|
172
|
+
if options[:app].nil?
|
173
|
+
puts "* '--app APP' is required for this command"
|
174
|
+
puts
|
175
|
+
exit
|
176
|
+
end
|
177
|
+
|
178
|
+
app = options[:app].downcase
|
179
|
+
constellation_path = Dir.pwd
|
180
|
+
app_dir = "#{constellation_path}/homesteading-#{app}/"
|
181
|
+
app_file_path = app_dir + "app.json"
|
182
|
+
|
183
|
+
if File.exist?(app_dir)
|
184
|
+
if File.exist?(app_file_path)
|
185
|
+
app_file = JSON.parse(File.read(app_file_path))
|
186
|
+
puts app_file.to_yaml
|
187
|
+
else
|
188
|
+
puts "* No app.json found for #{app}"
|
189
|
+
puts
|
190
|
+
exit
|
191
|
+
end
|
192
|
+
else
|
193
|
+
puts "* #{app} does not exist"
|
194
|
+
puts "* Did you mean one of these?"
|
195
|
+
Dir.glob("#{Dir.pwd}/homesteading-*/").each do |ff|
|
196
|
+
puts " - #{ff.split("/").last.sub(/homesteading-/, "")}"
|
197
|
+
end
|
198
|
+
puts
|
199
|
+
exit
|
200
|
+
end
|
201
|
+
|
202
|
+
puts
|
203
|
+
end
|
204
|
+
|
205
|
+
def rename
|
206
|
+
puts
|
207
|
+
options = parse_options
|
208
|
+
|
209
|
+
if options[:app].nil?
|
210
|
+
puts "* '--app APP' is required for this command"
|
211
|
+
puts
|
212
|
+
exit
|
213
|
+
end
|
214
|
+
|
215
|
+
new_name = ARGV.shift
|
216
|
+
if new_name.nil?
|
217
|
+
puts "* New app name is required for this command"
|
218
|
+
puts "* Example:"
|
219
|
+
puts " homesteading apps:rename status --app note"
|
220
|
+
puts
|
221
|
+
exit
|
222
|
+
end
|
223
|
+
|
224
|
+
app = options[:app].downcase
|
225
|
+
constellation_path = Dir.pwd
|
226
|
+
app_dir = "#{constellation_path}/homesteading-#{app}"
|
227
|
+
new_app_dir = "#{constellation_path}/homesteading-#{new_name}"
|
228
|
+
|
229
|
+
if File.exist?(app_dir)
|
230
|
+
puts "* Renaming #{app} to #{new_name}..."
|
231
|
+
FileUtils.mv app_dir, new_app_dir
|
232
|
+
puts "* ...done"
|
233
|
+
else
|
234
|
+
puts "* #{app} does not exist"
|
235
|
+
puts "* Did you mean one of these?"
|
236
|
+
Dir.glob("#{Dir.pwd}/homesteading-*/").each do |ff|
|
237
|
+
puts " - #{ff.split("/").last.sub(/homesteading-/, "")}"
|
238
|
+
end
|
239
|
+
puts
|
240
|
+
exit
|
241
|
+
end
|
242
|
+
|
243
|
+
puts
|
12
244
|
end
|
13
245
|
|
14
|
-
def
|
246
|
+
def reroute
|
15
247
|
end
|
16
248
|
|
17
|
-
|
249
|
+
private
|
250
|
+
def parse_options
|
251
|
+
# Parse command line options
|
252
|
+
options = {}
|
253
|
+
|
254
|
+
optparse = OptionParser.new do |opts|
|
255
|
+
opts.on("-a", "--app APP", "Name of Homesteading app on GitHub") do |app|
|
256
|
+
options[:app] = app
|
257
|
+
end
|
258
|
+
|
259
|
+
opts.on("-c", "--confirm CONFIRM", "Confirm the app name to delete") do |confirm|
|
260
|
+
options[:confirm] = confirm
|
261
|
+
end
|
262
|
+
|
263
|
+
opts.on("-f", "--force", "Overwrite apps that already exist") do |force|
|
264
|
+
options[:force] = force
|
265
|
+
end
|
266
|
+
|
267
|
+
opts.on("-p", "--pretend", "Run but do not make any changes") do |pretend|
|
268
|
+
options[:pretend] = pretend
|
269
|
+
end
|
270
|
+
|
271
|
+
opts.on("-q", "--quiet", "Suppress status output") do |quiet|
|
272
|
+
options[:quiet] = quiet
|
273
|
+
end
|
274
|
+
|
275
|
+
opts.on("-s", "--skip", "Skip apps that already exist") do |skip|
|
276
|
+
options[:skip] = skip
|
277
|
+
end
|
278
|
+
|
279
|
+
opts.on("-u", "--url URL", "URL of Homesteading app") do |url|
|
280
|
+
options[:url] = url
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
optparse.parse!
|
285
|
+
options
|
18
286
|
end
|
19
287
|
|
20
288
|
end
|
@@ -3,15 +3,14 @@ class Homesteading
|
|
3
3
|
class << self
|
4
4
|
DEFAULT_HELP_DOC = "README"
|
5
5
|
|
6
|
-
def default
|
7
|
-
if
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
6
|
+
def default
|
7
|
+
help_doc_path = if ARGV.empty?
|
8
|
+
DEFAULT_HELP_DOC
|
9
|
+
elsif ARGV.first.match(/:/)
|
10
|
+
ARGV.first.sub(":", "-")
|
11
|
+
else
|
12
|
+
ARGV.first
|
13
|
+
end
|
15
14
|
|
16
15
|
print(help_doc_path)
|
17
16
|
end
|
@@ -4,52 +4,135 @@ class Homesteading
|
|
4
4
|
PUBLISHER_APPS = ["article", "bookmark", "event", "note", "photo", "sound", "video", "walk", "weight"]
|
5
5
|
NONPUBLISHER_APPS = ["hub", "router-rack"] # TODO "syndicator"
|
6
6
|
|
7
|
-
def default
|
7
|
+
def default
|
8
8
|
puts
|
9
9
|
|
10
|
-
|
11
|
-
options = {}
|
12
|
-
optparse = OptionParser.new do |opts|
|
13
|
-
opts.on("-p", "--pretend", "Run but do not make any changes") do |pretend|
|
14
|
-
options[:pretend] = pretend
|
15
|
-
end
|
10
|
+
options = parse_options
|
16
11
|
|
17
|
-
|
18
|
-
|
12
|
+
# Install location
|
13
|
+
constellation_dir = ARGV.shift
|
14
|
+
constellation_path = "#{Dir.pwd}/#{constellation_dir}"
|
15
|
+
|
16
|
+
if File.exist?(constellation_path)
|
17
|
+
unless options[:quiet]
|
18
|
+
puts "* #{constellation_path} already exists"
|
19
|
+
puts "* Using #{constellation_path}"
|
20
|
+
end
|
21
|
+
else
|
22
|
+
unless options[:quiet]
|
23
|
+
puts "* Creating homesteading directory: #{constellation_dir}"
|
24
|
+
end
|
25
|
+
unless options[:pretend]
|
26
|
+
FileUtils.mkpath constellation_dir
|
19
27
|
end
|
20
28
|
end
|
21
|
-
optparse.parse!
|
22
29
|
|
30
|
+
# Apps to install
|
31
|
+
apps = [NONPUBLISHER_APPS, PUBLISHER_APPS].flatten
|
32
|
+
if options[:only]
|
33
|
+
apps = options[:only].split(",").map { |a| a.downcase }
|
34
|
+
end
|
35
|
+
if options[:except]
|
36
|
+
only_list = options[:except].split(",").map { |a| a.downcase }
|
37
|
+
apps = apps.delete_if { |a| only_list.include?(a) }
|
38
|
+
end
|
23
39
|
|
24
|
-
|
25
|
-
|
40
|
+
apps.each do |app|
|
41
|
+
unless options[:pretend]
|
42
|
+
puts
|
43
|
+
end
|
26
44
|
|
27
|
-
|
28
|
-
|
45
|
+
app_dir = "#{constellation_path}/homesteading-#{app}"
|
46
|
+
|
47
|
+
if File.exist?(app_dir)
|
48
|
+
if options[:skip]
|
49
|
+
unless options[:quiet]
|
50
|
+
puts "* #{app_dir} already exists"
|
51
|
+
puts "* Skipping homesteading-#{app}"
|
52
|
+
end
|
53
|
+
elsif options[:force]
|
54
|
+
unless options[:quiet]
|
55
|
+
puts "* #{app_dir} already exists"
|
56
|
+
puts "* Removing homesteading-#{app}"
|
57
|
+
end
|
58
|
+
|
59
|
+
unless options[:pretend]
|
60
|
+
FileUtils.rm_rf app_dir
|
61
|
+
end
|
62
|
+
|
63
|
+
unless options[:quiet]
|
64
|
+
puts "* Cloning homesteading app from GitHub: #{app}"
|
65
|
+
end
|
66
|
+
|
67
|
+
unless options[:pretend]
|
68
|
+
FileUtils.cd constellation_dir do
|
69
|
+
system "git clone git@github.com:homesteading/homesteading-#{app}.git"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
else
|
73
|
+
unless options[:quiet]
|
74
|
+
puts "* #{app_dir} already exists"
|
75
|
+
puts "* TODO gets user input on what to do about the conflict"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
else
|
80
|
+
|
81
|
+
unless options[:quiet]
|
82
|
+
puts "* Cloning homesteading app from GitHub: #{app}"
|
83
|
+
end
|
84
|
+
|
85
|
+
unless options[:pretend]
|
86
|
+
FileUtils.cd constellation_dir do
|
87
|
+
system "git clone git@github.com:homesteading/homesteading-#{app}.git"
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
29
91
|
end
|
30
92
|
|
31
|
-
unless options[:
|
93
|
+
unless options[:quiet]
|
32
94
|
puts
|
33
|
-
|
95
|
+
puts "* Next up, do this:"
|
96
|
+
puts " cd #{constellation_dir}"
|
97
|
+
puts " homesteading server"
|
34
98
|
end
|
35
99
|
|
36
|
-
|
37
|
-
|
38
|
-
|
100
|
+
puts
|
101
|
+
end
|
102
|
+
|
103
|
+
private
|
104
|
+
def parse_options
|
105
|
+
# Parse command line options
|
106
|
+
options = {}
|
107
|
+
|
108
|
+
optparse = OptionParser.new do |opts|
|
109
|
+
opts.on("-e", "--except EXCEPT", "Comma separated list of apps to not install") do |except|
|
110
|
+
options[:except] = except
|
39
111
|
end
|
40
112
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
113
|
+
opts.on("-f", "--force", "Overwrite apps that already exist") do |force|
|
114
|
+
options[:force] = force
|
115
|
+
end
|
116
|
+
|
117
|
+
opts.on("-o", "--only ONLY", "Comma separated list of apps to install") do |only|
|
118
|
+
options[:only] = only
|
119
|
+
end
|
120
|
+
|
121
|
+
opts.on("-p", "--pretend", "Run but do not make any changes") do |pretend|
|
122
|
+
options[:pretend] = pretend
|
45
123
|
end
|
46
|
-
end
|
47
124
|
|
48
|
-
|
49
|
-
|
125
|
+
opts.on("-q", "--quiet", "Suppress status output") do |quiet|
|
126
|
+
options[:quiet] = quiet
|
127
|
+
end
|
128
|
+
|
129
|
+
opts.on("-s", "--skip", "Skip apps that already exist") do |skip|
|
130
|
+
options[:skip] = skip
|
131
|
+
end
|
50
132
|
end
|
51
133
|
|
52
|
-
|
134
|
+
optparse.parse!
|
135
|
+
options
|
53
136
|
end
|
54
137
|
|
55
138
|
end
|
@@ -2,19 +2,19 @@ class Homesteading
|
|
2
2
|
class Server
|
3
3
|
class << self
|
4
4
|
|
5
|
-
def default
|
5
|
+
def default
|
6
6
|
end
|
7
7
|
|
8
|
-
def list
|
8
|
+
def list
|
9
9
|
end
|
10
10
|
|
11
|
-
def stop
|
11
|
+
def stop
|
12
12
|
# TEMP HACK TODO FIXME
|
13
13
|
# This is overly aggressive, but the above kill isn't working
|
14
14
|
system "killall ruby"
|
15
15
|
end
|
16
16
|
|
17
|
-
def urls
|
17
|
+
def urls
|
18
18
|
end
|
19
19
|
|
20
20
|
end
|
@@ -2,28 +2,44 @@ class Homesteading
|
|
2
2
|
class Update
|
3
3
|
class << self
|
4
4
|
|
5
|
-
def default
|
6
|
-
# update hs apps from github
|
7
|
-
end
|
8
|
-
|
9
|
-
def client(options=nil)
|
5
|
+
def default
|
10
6
|
puts
|
11
7
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
options = parse_options
|
9
|
+
hs_path = options[:hs_path] || Dir.pwd
|
10
|
+
|
11
|
+
Dir.glob("#{hs_path}/*").each do |dir|
|
12
|
+
unless Dir.glob("#{dir}/.git/config").empty?
|
13
|
+
puts "* Updating #{dir.split("/").last}..."
|
14
|
+
|
15
|
+
FileUtils.cd dir do
|
16
|
+
system "git pull origin master"
|
17
|
+
end
|
18
|
+
|
19
|
+
puts "* ...done"
|
20
|
+
puts
|
17
21
|
end
|
18
22
|
end
|
19
|
-
|
23
|
+
|
24
|
+
puts "* All Homesteading apps are now update to the latest version"
|
25
|
+
puts
|
26
|
+
end
|
27
|
+
|
28
|
+
def client
|
29
|
+
puts
|
30
|
+
|
31
|
+
options = parse_options
|
20
32
|
|
21
33
|
if options[:beta]
|
22
34
|
puts "* Cloning Homesteading from GitHub into /tmp"
|
23
|
-
|
35
|
+
FileUtils.cd "/tmp" do
|
36
|
+
system "git clone git@github.com:homesteading/homesteading.git"
|
37
|
+
end
|
24
38
|
|
25
39
|
puts "* Building homesteading gem from .gemspec"
|
26
|
-
|
40
|
+
FileUtils.cd "/tmp/homesteading" do
|
41
|
+
system "gem build homesteading.gemspec"
|
42
|
+
end
|
27
43
|
|
28
44
|
dot_gem = Dir.glob("/tmp/homesteading/*.gem").last
|
29
45
|
version = dot_gem.split("/").last.sub("homesteading-", "").sub(".gem", "")
|
@@ -32,7 +48,7 @@ class Homesteading
|
|
32
48
|
system "gem install #{dot_gem}"
|
33
49
|
|
34
50
|
puts "* Cleaning up"
|
35
|
-
|
51
|
+
FileUtils.rm_rf "/tmp/homesteading"
|
36
52
|
|
37
53
|
puts "* Homesteading CLI version #{version} successfully installed from GitHub"
|
38
54
|
else
|
@@ -41,6 +57,28 @@ class Homesteading
|
|
41
57
|
|
42
58
|
puts
|
43
59
|
end
|
60
|
+
|
61
|
+
private
|
62
|
+
def parse_options
|
63
|
+
# Parse command line options
|
64
|
+
options = {}
|
65
|
+
|
66
|
+
optparse = OptionParser.new do |opts|
|
67
|
+
opts.banner = "Learning Option parsing in Ruby"
|
68
|
+
|
69
|
+
opts.on("-p", "--path PATH", "Path of the constelation of Homesteading apps") do |opt_path|
|
70
|
+
options[:hs_path] = opt_path
|
71
|
+
end
|
72
|
+
|
73
|
+
opts.on("-b", "--beta", "Update to the latest beta Homesteading CLI") do |beta|
|
74
|
+
options[:beta] = beta
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
optparse.parse!
|
79
|
+
options
|
80
|
+
end
|
81
|
+
|
44
82
|
end
|
45
83
|
end
|
46
84
|
end
|
@@ -2,10 +2,10 @@ class Homesteading
|
|
2
2
|
class Version
|
3
3
|
class << self
|
4
4
|
|
5
|
-
def default
|
5
|
+
def default
|
6
6
|
# TODO load in *actual* VERSION and CODENAME from homesteading/version
|
7
7
|
# puts "Homesteading #{Homesteading::VERSION}, codename: #{Homesteading::CODENAME}"
|
8
|
-
puts "Homesteading 0.0.
|
8
|
+
puts "Homesteading 0.0.8, codename: Rooftop"
|
9
9
|
end
|
10
10
|
|
11
11
|
end
|
data/lib/homesteading/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: homesteading
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane Becker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- help/apps-destroy.md
|
60
60
|
- help/apps-info.md
|
61
61
|
- help/apps-rename.md
|
62
|
+
- help/apps-reroute.md
|
62
63
|
- help/apps.md
|
63
64
|
- help/blank.md
|
64
65
|
- help/deploy-heroku.md
|