homesteading 0.3.4 → 0.4.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/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/bin/homesteading +2 -0
- data/help/README.md +1 -0
- data/help/routes.md +2 -1
- data/lib/homesteading/commands/routes.rb +61 -2
- data/lib/homesteading/commands/server.rb +1 -1
- data/lib/homesteading/version.rb +1 -1
- metadata +1 -2
- data/help/routes-set.md +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dec72081ab17f61ff268fb5a2fbd1b7780c3a94e
|
4
|
+
data.tar.gz: 9c7d532c77094aaac91b949215d1c0cb3c87765d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23c94bc176bc3d85d3d186c5c3c45c866c4e5909f56e39a2beb73ab33d7d3c465622d5d268ef41d1b7c7110f31a5ee078e11f3402efeb6cd1915412cd1d008b7
|
7
|
+
data.tar.gz: 2e806470c3c489d7e3d47721b854541f750236c6bd6bf03559a02950a8f39ecef3d6d5cd5e2fecd6381af693a86cf8163edb4a2a0a121a037e870b4252374880
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/bin/homesteading
CHANGED
data/help/README.md
CHANGED
@@ -6,6 +6,7 @@ Primary help topics, type "homesteading help TOPIC" for more details:
|
|
6
6
|
* apps : manage constellation of apps (create, destroy, list, update)
|
7
7
|
* deploy : deploy apps to remote host (heroku, vektra, etc)
|
8
8
|
* run : run one-off commands (console, rake)
|
9
|
+
* routes : manage remote routes (set, push)
|
9
10
|
* server : run constellation of apps (start, stop)
|
10
11
|
|
11
12
|
Additional help topics:
|
data/help/routes.md
CHANGED
@@ -5,10 +5,11 @@ Usage: homesteading routes
|
|
5
5
|
Example:
|
6
6
|
|
7
7
|
$ homesteading routes
|
8
|
-
|
8
|
+
|
9
9
|
* article : myprefix-article.herokuapp.com
|
10
10
|
* bookmark : myprefix-bookmark.herokuapp.com
|
11
11
|
* event : myprefix-event.herokuapp.com
|
12
|
+
* feed : myprefix-feed.herokuapp.com
|
12
13
|
* hub : myprefix-hub.herokuapp.com
|
13
14
|
* note : myprefix-note.herokuapp.com
|
14
15
|
* photo : myprefix-photo.herokuapp.com
|
@@ -5,12 +5,71 @@ module Homesteading
|
|
5
5
|
register "routes"
|
6
6
|
|
7
7
|
def default
|
8
|
-
|
8
|
+
puts
|
9
|
+
|
10
|
+
routes = get_routes
|
11
|
+
longest_app = routes.map{ |app, host| app }.sort_by { |a| a.length }.last.length
|
9
12
|
|
10
|
-
|
13
|
+
routes.sort.each do |app, remote_host|
|
14
|
+
app = "/" if app.empty?
|
15
|
+
puts "* #{app.ljust(longest_app)} : #{remote_host}"
|
16
|
+
end
|
17
|
+
|
18
|
+
puts
|
11
19
|
end
|
12
20
|
|
13
21
|
def push
|
22
|
+
puts
|
23
|
+
|
24
|
+
env_var = get_routes.map do |app, remote_host|
|
25
|
+
[app.empty? ? "feed" : app, remote_host].join("@@@")
|
26
|
+
end.join(",")
|
27
|
+
|
28
|
+
env_var = get_routes.map{ |app, host| [app.empty? ? "feed" : app, host].join("@@@") }.join(",")
|
29
|
+
|
30
|
+
app_dir = "#{Dir.pwd}/homesteading-router-rack/"
|
31
|
+
git_url = Git.open(app_dir).remote("heroku").url
|
32
|
+
|
33
|
+
if git_url.nil?
|
34
|
+
puts "* No known router app deployed to Heroku"
|
35
|
+
exit 1
|
36
|
+
else
|
37
|
+
heroku_app = git_url.split(":").last.split(".").first
|
38
|
+
|
39
|
+
puts "* Setting remote routes env variable..."
|
40
|
+
puts
|
41
|
+
system "heroku config:set HOMESTEADING_ROUTES=#{env_var} --app #{heroku_app}"
|
42
|
+
puts
|
43
|
+
puts "* ...done"
|
44
|
+
end
|
45
|
+
|
46
|
+
puts
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
def get_routes
|
51
|
+
routes = {}
|
52
|
+
|
53
|
+
Dir.glob("#{Dir.pwd}/homesteading-*/").each do |app_dir|
|
54
|
+
app = app_dir.split("/").last.sub(/homesteading-/, "").downcase
|
55
|
+
app_file_path = app_dir + "app.json"
|
56
|
+
|
57
|
+
if File.exist?(app_file_path)
|
58
|
+
app_file = JSON.parse(File.read(app_file_path))
|
59
|
+
route = app_file["routes"]["path"]
|
60
|
+
end
|
61
|
+
|
62
|
+
if File.exist?(app_dir + ".git")
|
63
|
+
git_url = Git.open(app_dir).remote("heroku").url
|
64
|
+
unless git_url.nil?
|
65
|
+
heroku_app = git_url.split(":").last.split(".").first
|
66
|
+
routes[route] = "#{heroku_app}.herokuapp.com"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
routes
|
14
72
|
end
|
73
|
+
|
15
74
|
end
|
16
75
|
end
|
data/lib/homesteading/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: homesteading
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane Becker
|
@@ -42,7 +42,6 @@ files:
|
|
42
42
|
- help/init.md
|
43
43
|
- help/new.md
|
44
44
|
- help/routes-push.md
|
45
|
-
- help/routes-set.md
|
46
45
|
- help/routes.md
|
47
46
|
- help/run.md
|
48
47
|
- help/server-stop.md
|
data/help/routes-set.md
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
Usage: homesteading routes:set
|
2
|
-
|
3
|
-
creates local routes file for homesteading apps
|
4
|
-
|
5
|
-
Example:
|
6
|
-
|
7
|
-
$ homesteading routes:set
|
8
|
-
* Reading app.json files from homesteading apps
|
9
|
-
* ...done
|
10
|
-
|
11
|
-
* Merging default routes with custom routes
|
12
|
-
* ...done
|
13
|
-
|
14
|
-
* Saving homesteading.json...
|
15
|
-
* ...done
|