homesteading 0.3.4 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 68d7781170e5197f841632afdab2875e70bc5e20
4
- data.tar.gz: 912ba28ae746e6c51b2befb8c55bb3c738f9f331
3
+ metadata.gz: dec72081ab17f61ff268fb5a2fbd1b7780c3a94e
4
+ data.tar.gz: 9c7d532c77094aaac91b949215d1c0cb3c87765d
5
5
  SHA512:
6
- metadata.gz: 3d4e7d94ae3991df437f1bfa18a136ab19923378802491ff17df242d4060e728db3639ec88a6665d89e0b1681ed9b95bb99d801355c5f4decb529232159e0d68
7
- data.tar.gz: 0c6a893032e3339ae2409c1582864cdcc58df564cb447e6f791e714f56bb9fca2d2868663f37f37b381eba0bc6a8171f6bbff582d068d1a9d90d3f8766dbdf8e
6
+ metadata.gz: 23c94bc176bc3d85d3d186c5c3c45c866c4e5909f56e39a2beb73ab33d7d3c465622d5d268ef41d1b7c7110f31a5ee078e11f3402efeb6cd1915412cd1d008b7
7
+ data.tar.gz: 2e806470c3c489d7e3d47721b854541f750236c6bd6bf03559a02950a8f39ecef3d6d5cd5e2fecd6381af693a86cf8163edb4a2a0a121a037e870b4252374880
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- homesteading (0.3.4)
4
+ homesteading (0.4.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -12,7 +12,7 @@ See the [/help](https://github.com/homesteading/homesteading/tree/master/help) d
12
12
 
13
13
  ## Current Version
14
14
 
15
- 0.3.4
15
+ 0.4.0
16
16
 
17
17
 
18
18
  ## Code Status
data/bin/homesteading CHANGED
@@ -4,6 +4,8 @@ require "fileutils"
4
4
  require "json"
5
5
  require "yaml"
6
6
  require "homesteading/command"
7
+ require "platform-api"
8
+
7
9
 
8
10
  dir = File.expand_path("../../lib/homesteading/commands", __FILE__)
9
11
  # require all commands
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
- * / : myprefix-feed.herokuapp.com
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
- end
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
- def set
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
@@ -61,7 +61,7 @@ module Homesteading
61
61
  routes << "#{app_path}@@@localhost:#{app_port}"
62
62
  end
63
63
 
64
- if app_name =~ /homesteading-router-rack/
64
+ if app_name =~ /homesteading-router-rack/
65
65
  # TODO TEMP FIXME serve assets from hub
66
66
  # skipping assets and router
67
67
  else
@@ -1,4 +1,4 @@
1
1
  module Homesteading
2
- VERSION = "0.3.4"
2
+ VERSION = "0.4.0"
3
3
  CODENAME = "The Rooftop Series"
4
4
  end
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.3.4
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