homesteading 0.3.0 → 0.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a82750c6c682b84fb5bfb2166b6a0dbbc01c3da0
4
- data.tar.gz: 78a9abdf91ea7819a1ede910f07eda5f4be57811
3
+ metadata.gz: a268e39a24a8529310b3c12d0ceb99542b803e16
4
+ data.tar.gz: b6ee7431bc266a2ba5d430b6ba10da1b400f78a7
5
5
  SHA512:
6
- metadata.gz: cf06b41d47bff573e9ec52f7dee74219ef405fcd4548686e6dc3cc45601932dfad1944c235bb4a609751ff3fe7449251cffe8ee30a18a92d58adc11e3e016294
7
- data.tar.gz: 858c29ad2fddeec866a53e17783cd264747b9fc5c8d9b17ab0a42401fd8ca2974d2da1b7cb26bcca158a4be62fe428d36e27df185e4fdbd9171cfc224265a36c
6
+ metadata.gz: abe953e171117d736bd632250263f8b258101c344aac98a3d967b3ca9b800d95356a64ffb1eb4eb0b91fb4b7991c7bb133a3befcecb62811261e7d8ca69e4616
7
+ data.tar.gz: 87ff2f5e634d91eee8475cf8991c31cac4ba5bb86577fcebedc30a449c0bc1ee936b8556a02ca04e8ff0b8bc836f2d42f9ae22e1ba48510e9f420e4c3357b75a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- homesteading (0.3.0)
4
+ homesteading (0.3.1)
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.0
15
+ 0.3.1
16
16
 
17
17
 
18
18
  ## Code Status
@@ -48,12 +48,13 @@ cd path/to/install/location
48
48
  homesteading server
49
49
  ```
50
50
 
51
- You can alias `homesteading` to `hs` for shorter commands.
51
+ You can alias `homesteading` to `hs` for shorter commands:
52
52
 
53
53
  ```bash
54
54
  alias hs="homesteading"
55
55
  ```
56
56
 
57
+
57
58
  ## Tests
58
59
 
59
60
  Run specs with:
@@ -68,6 +69,7 @@ Or run guard to autorun specs:
68
69
  bundle exec guard
69
70
  ```
70
71
 
72
+
71
73
  ## Authors
72
74
 
73
75
  * Shane Becker / [@veganstraightedge](https:github.com/veganstraightedge)
@@ -14,15 +14,7 @@ module Homesteading
14
14
  puts
15
15
  options = parse_options
16
16
 
17
- constellation_path = Dir.pwd
18
-
19
- if options[:app].nil?
20
- apps = Dir.glob("#{Dir.pwd}/homesteading-*/")
21
- else
22
- apps = Dir.glob("#{Dir.pwd}/homesteading-#{options[:app]}/")
23
- end
24
-
25
- apps.each do |directory|
17
+ Dir.glob("#{Dir.pwd}/homesteading-#{options[:app]}*/").each do |directory|
26
18
  app = directory.split("/").last.sub(/homesteading-/, "").downcase
27
19
  app_file_path = directory + "app.json"
28
20
 
@@ -41,9 +33,15 @@ module Homesteading
41
33
  puts "* ...done"
42
34
  else
43
35
  puts "* Tried deploying #{app}..."
44
- puts "* No git remote named 'heroku'"
45
- puts "* TODO: heroku app create setup"
36
+ puts "* No git remote named 'heroku'"
37
+ puts "* Creating heroku app for #{app}..."
38
+ system "heroku apps:create"
39
+ puts "* Deploying #{app}..."
40
+ g.push(g.remote("heroku"))
46
41
  puts "* ...done"
42
+
43
+ # run initial app remote setup
44
+ Homesteading::Command.create("init").default(nil, server: :heroku, app: :note)
47
45
  end
48
46
  end
49
47
  end
@@ -4,41 +4,58 @@ module Homesteading
4
4
  class Init < Command
5
5
  register "init"
6
6
 
7
- def default(constellation_dir)
8
- puts
9
- puts "* Setting up all apps"
7
+ def default(constellation_dir, server: :local, app: nil)
10
8
  puts
9
+ puts "* Running initial setup"
10
+
11
+ unless constellation_dir.nil?
12
+ constellation_dir = "/#{constellation_dir}"
13
+ end
11
14
 
12
- Dir.glob("#{Dir.pwd}/#{constellation_dir}/homesteading-*/").each do |app_dir|
15
+ Dir.glob("#{Dir.pwd}#{constellation_dir}/homesteading-#{app}*/").each do |app_dir|
13
16
  app = app_dir.split("/").last.sub(/homesteading-/, "").downcase
14
17
  app_file_path = app_dir + "app.json"
15
18
 
16
19
  puts "* Setting up: #{app}"
17
20
 
18
21
  if File.exist?(app_file_path)
19
- app_file = JSON.parse(File.read(app_file_path))
20
- app_postdeploy = app_file["scripts"]["postdeploy"]
22
+ app_postdeploy_script = app_postdeploy(app_file_path)
21
23
 
22
24
  FileUtils.cd app_dir do
23
25
  if File.exist?("#{app_dir}/config/database.example.yml")
24
- puts "* Copying database config file"
25
- system "rake hs:db:config"
26
- end
27
-
28
- unless app_postdeploy.nil? && app_postdeploy.empty?
29
- puts "* Running postdeploy command on #{app}:"
26
+ run_app_postdeploy_script(app, app_postdeploy_script, server)
30
27
  puts
31
- system app_postdeploy if app_postdeploy
32
28
  end
33
-
34
- puts
35
29
  end
36
30
  end
37
31
 
38
- puts "* Setup up complete for: #{app}"
39
- puts
40
- puts
32
+ puts "* #{server.to_s.capitalize} setup up complete for: #{app}"
33
+ end
34
+
35
+ puts
36
+ end
37
+
38
+ def app_postdeploy(app_file_path)
39
+ JSON.parse(File.read(app_file_path))["scripts"]["postdeploy"]
40
+ end
41
+
42
+ def run_app_postdeploy_script(app, app_postdeploy_script, server)
43
+ unless app_postdeploy_script.nil? || app_postdeploy_script.empty?
44
+ puts "* Running postdeploy script on #{app}:"
45
+
46
+ if server == :local
47
+ puts "* Copying database config file"
48
+ system "bundle exec rake hs:db:config"
49
+ system app_postdeploy_script
50
+ else
51
+ app_postdeploy_script.split("&&").each do |command|
52
+ remote_command = "#{server.to_s} run #{command}"
53
+ puts "* Running: #{remote_command}"
54
+ system remote_command
55
+ end
56
+ end
41
57
  end
42
58
  end
59
+
43
60
  end
44
61
  end
@@ -95,7 +95,7 @@ module Homesteading
95
95
  end
96
96
 
97
97
  puts
98
- Homesteading::Init.default(constellation_dir)
98
+ Homesteading::Command.create("init").default(constellation_dir)
99
99
 
100
100
  unless options[:quiet]
101
101
  puts "* Next up, do this:"
@@ -1,4 +1,4 @@
1
1
  module Homesteading
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  CODENAME = "The Rooftop Series"
4
4
  end
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.3.0
4
+ version: 0.3.1
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-10 00:00:00.000000000 Z
11
+ date: 2014-12-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: The Homesteading CLI is used to create, update and deploy a constellation
14
14
  of homesteading apps that together make up a website powered by Homesteading.