Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0fe6bc9
Rename usage of Dir/File.exists to exist
ecnelises Dec 26, 2022
4693875
Fix misleading comment at the top of procfile.rb that indicates that …
benwilber Apr 22, 2023
0ebcb08
spec_helper: don't try to remove /tmp
terceiro Feb 25, 2021
14aba8d
[Foreman::Procfile#load] Fail when empty
NickLaMuro Jul 13, 2020
fb80608
[engine/cli.rb] Handle nil name_padding
NickLaMuro Jul 13, 2020
df6258d
Update man page to reflect recent changes in systemd export
lukaskonarovsky Apr 13, 2020
1f4d44f
handle empty procfile exception in cli
ddollar Apr 12, 2024
915e81f
update for ci
ddollar Apr 12, 2024
91daffc
remove Gemfile.lock from repo because it's too strict
ddollar Apr 12, 2024
266fd47
use actions/checkout@v4
ddollar Apr 12, 2024
d3a34ed
0.88.0
ddollar Apr 12, 2024
d5fac29
update master to main
ddollar Apr 12, 2024
e70bd92
0.88.1
ddollar Apr 12, 2024
0590629
update docs
ddollar Apr 12, 2024
3a26271
dont fail tests when Procfile is present in foreman dir (closes #771)
ddollar Apr 12, 2024
8940a0e
Run processes in new pgroup (#1)
dentarg Oct 28, 2022
f1a808d
Be able to run CI from GitHub Actions UI
dentarg Oct 28, 2022
41aa0a6
Allow ruby-head to fail in CI
dentarg Oct 28, 2022
5a059ee
`foreman` -> `overman` where it makes sense
dentarg Oct 28, 2022
89d3201
Some more `foreman` -> `overman`
dentarg Oct 28, 2022
3577d70
Fix homepage URL in gemspec
dentarg Dec 25, 2022
de2e9f1
Test with Ruby 3.2
dentarg Dec 25, 2022
741c556
Suppress `required_ruby_version` warning from bundler
dentarg Dec 25, 2022
cca56b9
CI: Test with Ruby 3.3, 3.4
dentarg Feb 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: ci
on:
- push
- pull_request
- workflow_dispatch
permissions:
contents: read
jobs:
Expand All @@ -18,17 +19,25 @@ jobs:
- "2.7"
- "3.0"
- "3.1"
- "head"
- "3.2"
- "3.3"
- "3.4"
include:
- { ruby: "head", allow-failure: true }
env:
BUNDLE_WITHOUT: development
BUNDLER_NO_OLD_RUBYGEMS_WARNING: true
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
rubygems: latest # runs 'gem update --system'
- name: Run test
continue-on-error: ${{ matrix.allow-failure || false }}
id: tests
run: bundle exec rake spec
- name: "Test outcome: ${{ steps.tests.outcome }}"
run: ""
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
/pkg/
/vendor
Gemfile.lock
/*.gem
31 changes: 31 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
## 0.88.1 (2024-04-12)

* update master to main [David Dollar]

## 0.88.0 (2024-04-12)

* use actions/checkout@v4 [David Dollar]
* remove Gemfile.lock from repo because it's too strict [David Dollar]
* update for ci [David Dollar]
* handle empty procfile exception in cli [David Dollar]
* Update man page to reflect recent changes in systemd export [Lukáš Konarovský]
* [engine/cli.rb] Handle nil name_padding [Nick LaMuro]
* [Foreman::Procfile#load] Fail when empty [Nick LaMuro]
* spec_helper: don't try to remove /tmp [Antonio Terceiro]
* Fix misleading comment at the top of procfile.rb that indicates that hyphens "-" are not allowed in process names. [Ben Wilber]
* Rename usage of Dir/File.exists to exist [Qiu Chaofan]
* remove codeclimate [David Dollar]
* clean up and autoformat [David Dollar]
* Add GitHub token permissions for workflow [mishina]
* Migrate from Travis CI to GitHub Actions [mishina]
* Pass a block rather than an argument to `expect` [mishina]
* Replace `File.exists?` with `File.exist?` [mishina]
* Use the latest fakefs [mishina]
* Remove and ignore Gemfile.lock [mishina]
* Add GitHub Actions workflow [mishina]
* GitHub is HTTPS by default [Akira Matsuda]

## 0.87.2 (2020-08-07)

* update json for CVE-2020-10663 [David Dollar]

## 0.87.1 (2020-04-02)

* update rake for CVE-2020-8130 [David Dollar]
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ end

group :development do
gem 'aws-s3'
gem 'ronn'
gem 'ronn-ng'
gem 'yard', '~> 0.9.11'
gem 'automatiek'
end
38 changes: 20 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,50 @@
# Foreman
# Overman (`ddollar/foreman` fork)

[![CI](https://github.com/ddollar/foreman/actions/workflows/ci.yml/badge.svg)](https://github.com/ddollar/foreman/actions/workflows/ci.yml)
[![CI](https://github.com/spinels/overman/actions/workflows/ci.yml/badge.svg)](https://github.com/spinels/overman/actions/workflows/ci.yml)

Manage Procfile-based applications

## Installation

$ gem install foreman
$ gem install overman

Ruby users should take care *not* to install foreman in their project's `Gemfile`. See this [wiki article](https://github.com/ddollar/foreman/wiki/Don't-Bundle-Foreman) for more details.
Ruby users should take care _not_ to install foreman in their project's `Gemfile`. See this [wiki article](https://github.com/ddollar/foreman/wiki/Don't-Bundle-Foreman) for more details.

## Getting Started

* http://blog.daviddollar.org/2011/05/06/introducing-foreman.html
- http://blog.daviddollar.org/2011/05/06/introducing-foreman.html

## Supported Ruby versions

See [ci.yml](.github/workflows/ci.yml) for a list of Ruby versions against which Foreman is tested.

## Documentation

* [man page](http://ddollar.github.io/foreman/)
* [wiki](https://github.com/ddollar/foreman/wiki)
* [changelog](https://github.com/ddollar/foreman/blob/master/Changelog.md)
- [man page](http://ddollar.github.io/foreman/)
- [wiki](https://github.com/ddollar/foreman/wiki)
- [changelog](https://github.com/ddollar/foreman/blob/main/Changelog.md)

## Ports

* [forego](https://github.com/ddollar/forego) - Go
* [node-foreman](https://github.com/strongloop/node-foreman) - Node.js
* [gaffer](https://github.com/jingweno/gaffer) - Java/JVM
* [goreman](https://github.com/mattn/goreman) - Go
* [honcho](https://github.com/nickstenning/honcho) - python
* [proclet](https://github.com/kazeburo/Proclet) - Perl
* [shoreman](https://github.com/chrismytton/shoreman) - shell
* [crank](https://github.com/arktisklada/crank) - Crystal
* [houseman](https://github.com/fujimura/houseman) - Haskell
* [spm](https://github.com/bytegust/spm) - Go
- [forego](https://github.com/ddollar/forego) - Go
- [node-foreman](https://github.com/strongloop/node-foreman) - Node.js
- [gaffer](https://github.com/jingweno/gaffer) - Java/JVM
- [goreman](https://github.com/mattn/goreman) - Go
- [honcho](https://github.com/nickstenning/honcho) - python
- [proclet](https://github.com/kazeburo/Proclet) - Perl
- [shoreman](https://github.com/chrismytton/shoreman) - shell
- [crank](https://github.com/arktisklada/crank) - Crystal
- [houseman](https://github.com/fujimura/houseman) - Haskell
- [spm](https://github.com/bytegust/spm) - Go

## Authors

#### Created and maintained by

David Dollar

#### Patches contributed by

[Contributor List](https://github.com/ddollar/foreman/contributors)

## License
Expand Down
File renamed without changes.
9 changes: 7 additions & 2 deletions lib/foreman/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def start(process=nil)
engine.load_procfile(procfile)
engine.options[:formation] = "#{process}=1" if process
engine.start
rescue Foreman::Procfile::EmptyFileError
error "no processes defined"
end

desc "export FORMAT LOCATION", "Export the application to another process management format"
Expand All @@ -60,7 +62,7 @@ def export(format, location=nil)
engine.load_procfile(procfile)
formatter = Foreman::Export.formatter(format)
formatter.new(location, engine, options).export
rescue Foreman::Export::Exception => ex
rescue Foreman::Export::Exception, Foreman::Procfile::EmptyFileError => ex
error ex.message
end

Expand All @@ -69,8 +71,9 @@ def export(format, location=nil)
def check
check_procfile!
engine.load_procfile(procfile)
error "no processes defined" unless engine.processes.length > 0
puts "valid procfile detected (#{engine.process_names.join(', ')})"
rescue Foreman::Procfile::EmptyFileError
error "no processes defined"
end

desc "run COMMAND [ARGS...]", "Run a command using your application's environment"
Expand Down Expand Up @@ -105,6 +108,8 @@ def run(*args)
Process.wait(pid)
exit $?.exitstatus || 0
rescue Interrupt
rescue Foreman::Procfile::EmptyFileError
error "no processes defined"
end

desc "version", "Display Foreman gem version"
Expand Down
4 changes: 2 additions & 2 deletions lib/foreman/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,14 @@ def kill_children(signal="SIGTERM")
@running.each do |pid, (process, index)|
system "sending #{signal} to #{name_for(pid)} at pid #{pid}"
begin
Process.kill(signal, pid)
Process.kill("-#{signal}", pid)
rescue Errno::ESRCH, Errno::EPERM
end
end
else
begin
pids = @running.keys.compact
Process.kill signal, *pids unless pids.empty?
Process.kill("-#{signal}", *pids) unless pids.empty?
rescue Errno::ESRCH, Errno::EPERM
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/foreman/engine/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def color(name)

def startup
@colors = map_colors
proctitle "foreman: master" unless Foreman.windows?
proctitle "foreman: main" unless Foreman.windows?
Color.enable($stdout, options[:color])
end

Expand Down Expand Up @@ -77,7 +77,7 @@ def name_padding
@name_padding ||= begin
index_padding = @names.values.map { |n| formation[n] }.max.to_s.length + 1
name_padding = @names.values.map { |n| n.length + index_padding }.sort.last
[ 6, name_padding ].max
[ 6, name_padding.to_i ].max
end
end

Expand Down
12 changes: 6 additions & 6 deletions lib/foreman/export/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,16 @@ def self.warn_deprecation!
puts "WARNING: Using deprecated exporter interface. Please update your exporter"
puts "the interface shown in the upstart exporter:"
puts
puts "https://github.com/ddollar/foreman/blob/master/lib/foreman/export/upstart.rb"
puts "https://github.com/ddollar/foreman/blob/master/data/export/upstart/process.conf.erb"
puts "https://github.com/ddollar/foreman/blob/main/lib/foreman/export/upstart.rb"
puts "https://github.com/ddollar/foreman/blob/main/data/export/upstart/process.conf.erb"
puts
@@deprecation_warned = true
end

def chown user, dir
FileUtils.chown user, nil, dir
rescue
error("Could not chown #{dir} to #{user}") unless File.writable?(dir) || ! File.exists?(dir)
error("Could not chown #{dir} to #{user}") unless File.writable?(dir) || ! File.exist?(dir)
end

def error(message)
Expand All @@ -95,13 +95,13 @@ def say(message)
end

def clean(filename)
return unless File.exists?(filename)
return unless File.exist?(filename)
say "cleaning up: #{filename}"
FileUtils.rm(filename)
end

def clean_dir(dirname)
return unless File.exists?(dirname)
return unless File.exist?(dirname)
say "cleaning up directory: #{dirname}"
FileUtils.rm_r(dirname)
end
Expand Down Expand Up @@ -130,7 +130,7 @@ def export_template(name, file=nil, template_root=nil)
matchers << File.join(options[:template], name_without_first) if options[:template]
matchers << File.expand_path("~/.foreman/templates/#{name}")
matchers << File.expand_path("../../../../data/export/#{name}", __FILE__)
File.read(matchers.detect { |m| File.exists?(m) })
File.read(matchers.detect { |m| File.exist?(m) })
end
end

Expand Down
5 changes: 3 additions & 2 deletions lib/foreman/process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ def run(options={})
env = @options[:env].merge(options[:env] || {})
output = options[:output] || $stdout
runner = "#{Foreman.runner}".shellescape

pgroup = Foreman.windows? ? :new_pgroup : :pgroup

Dir.chdir(cwd) do
Process.spawn env, expanded_command(env), :out => output, :err => output
Process.spawn env, expanded_command(env), :out => output, :err => output, pgroup => true
end
end

Expand Down
10 changes: 8 additions & 2 deletions lib/foreman/procfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
#
# A valid Procfile entry is captured by this regex:
#
# /^([A-Za-z0-9_]+):\s*(.+)$/
# /^([A-Za-z0-9_-]+):\s*(.+)$/
#
# All other lines are ignored.
#
class Foreman::Procfile

EmptyFileError = Class.new(StandardError)

# Initialize a Procfile
#
# @param [String] filename (nil) An optional filename to read from
Expand Down Expand Up @@ -60,7 +62,11 @@ def delete(name)
# @param [String] filename The filename of the +Procfile+ to load
#
def load(filename)
@entries.replace parse(filename)
parse_data = parse(filename)

raise EmptyFileError if parse_data.empty?

@entries.replace parse_data
end

# Save a Procfile to a file
Expand Down
2 changes: 1 addition & 1 deletion lib/foreman/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Foreman

VERSION = "0.87.2"
VERSION = "0.88.1"

end
Loading
Loading