Skip to content

Instantly share code, notes, and snippets.

@Chew
Last active July 3, 2022 16:42
Show Gist options
  • Select an option

  • Save Chew/b2c9b7a51179eeb14744a7c0210de05f to your computer and use it in GitHub Desktop.

Select an option

Save Chew/b2c9b7a51179eeb14744a7c0210de05f to your computer and use it in GitHub Desktop.

Revisions

  1. Chew revised this gist Jul 3, 2022. 1 changed file with 13 additions and 1 deletion.
    14 changes: 13 additions & 1 deletion deployboy.rb
    Original file line number Diff line number Diff line change
    @@ -1,21 +1,33 @@
    # Pull from GitHub
    puts "Pulling..."
    pull = `git pull`

    if pull.include? "Already up to date."
    puts "Already up to date, nothing to deploy."
    exit
    end

    # Gem changes occur, we must bundle install
    if pull.include? "Gemfile"
    print "Updating Gems..."
    `bundle install`
    puts " Done!"
    end

    # Did package.json or yarn.lock change?
    # Install and recompile assets
    if pull.include?("yarn.lock") || pull.include?("package.json")
    print "Updating dependencies..."
    `yarn install --check-files`
    `rake assets:precompile`
    puts " Done!"
    end

    # Did assets change? precompile
    if pull.include?("assets")
    if pull.include?("assets") || pull.include?("javascript")
    print "Compiling assets..."
    `rake assets:precompile`
    puts " Done!"
    end

    `rails restart`
  2. Chew revised this gist Jul 3, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion deployboy.rb
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@

    # Did package.json or yarn.lock change?
    # Install and recompile assets
    if pull.include?("yarn.lock") || pull.include("package.json")
    if pull.include?("yarn.lock") || pull.include?("package.json")
    `yarn install --check-files`
    `rake assets:precompile`
    end
  3. Chew revised this gist Jul 3, 2022. 1 changed file with 1 addition and 10 deletions.
    11 changes: 1 addition & 10 deletions deployboy.rb
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,9 @@
    # Pull from GitHub
    pull = `git pull`

    # if a restart is needed
    restart = false

    # Gem changes occur, we must bundle install
    if pull.include? "Gemfile"
    `bundle install`
    restart = true
    end

    # Did package.json or yarn.lock change?
    @@ -22,11 +18,6 @@
    `rake assets:precompile`
    end

    # Did config change?
    if pull.include?("config")
    restart = true
    end

    `rails restart` if restart
    `rails restart`

    # Done!
  4. Chew created this gist Oct 14, 2021.
    32 changes: 32 additions & 0 deletions deployboy.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    # Pull from GitHub
    pull = `git pull`

    # if a restart is needed
    restart = false

    # Gem changes occur, we must bundle install
    if pull.include? "Gemfile"
    `bundle install`
    restart = true
    end

    # Did package.json or yarn.lock change?
    # Install and recompile assets
    if pull.include?("yarn.lock") || pull.include("package.json")
    `yarn install --check-files`
    `rake assets:precompile`
    end

    # Did assets change? precompile
    if pull.include?("assets")
    `rake assets:precompile`
    end

    # Did config change?
    if pull.include?("config")
    restart = true
    end

    `rails restart` if restart

    # Done!