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 +4 -4
 - data/Gemfile.lock +1 -1
 - data/README.md +4 -2
 - data/lib/homesteading/commands/deploy.rb +9 -11
 - data/lib/homesteading/commands/init.rb +35 -18
 - data/lib/homesteading/commands/new.rb +1 -1
 - data/lib/homesteading/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: a268e39a24a8529310b3c12d0ceb99542b803e16
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: b6ee7431bc266a2ba5d430b6ba10da1b400f78a7
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: abe953e171117d736bd632250263f8b258101c344aac98a3d967b3ca9b800d95356a64ffb1eb4eb0b91fb4b7991c7bb133a3befcecb62811261e7d8ca69e4616
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 87ff2f5e634d91eee8475cf8991c31cac4ba5bb86577fcebedc30a449c0bc1ee936b8556a02ca04e8ff0b8bc836f2d42f9ae22e1ba48510e9f420e4c3357b75a
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        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. 
     | 
| 
      
 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 
     | 
    
         
            -
                   
     | 
| 
       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 "* 
     | 
| 
       45 
     | 
    
         
            -
                        puts "* 
     | 
| 
      
 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} 
     | 
| 
      
 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 
     | 
    
         
            -
                       
     | 
| 
       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 
     | 
    
         
            -
                           
     | 
| 
       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 "*  
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
      
 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
         
     | 
    
        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.3. 
     | 
| 
      
 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- 
     | 
| 
      
 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.
         
     |