threeman 0.8.0 → 0.9.0

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
  SHA256:
3
- metadata.gz: d45d2cd254f2c7ac356e640e3b4abce6a3295423a67c3db6722a9eabe8e92fa0
4
- data.tar.gz: a31bbf2712949c338a831bcf598468812c63d0aeba81b54baa8ceeee3ca495c1
3
+ metadata.gz: e049b805d8a91707480d78ed24ae471b9e8d4da692ba5f9a0095677a43a268e6
4
+ data.tar.gz: 7f8498eca7ceb29bf5e40fd2cd0f19c5483c51c32d2bff56f27d51b9ab313ef5
5
5
  SHA512:
6
- metadata.gz: 9404cf7e0e41790b19a0ee22adf902a1963932d9cc465c984b61824d6877af66f07c4f9e93c059ef7eb0d7b3e10a024ccb409d968788f35cea7b6be351061284
7
- data.tar.gz: 782b73e714aac292a4ef3af01699fd07e892d540d6d53b071be9ea7d0a54c98f3e4c7485dbac202af1a25c8c39572b0d63832105f082b6dd31bd256b46515c61
6
+ metadata.gz: bec2a0d1d0376a21a838e2f44f779ac7f8d40a0fd55a3362c20b25305c77020b4f472eb3c763be39b4a65d7668faebb92a8a97578f70cfa77d56b05b31e4ea0d
7
+ data.tar.gz: ee1301e72572dc63fa62adfc3641acbc63e7fa3440def31094621235b7e96710dbc6737c57d398cdaa3b38098e89b46755f74035e8b4f231e539ebd2d9ca2254
data/.threeman CHANGED
@@ -1,3 +1,4 @@
1
1
  panes:
2
- - one
2
+ - one
3
3
  - three
4
+ formation: one=1,two=2,three=3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.9.0 - March 1, 2019
2
+
3
+ * Support Foreman's `--formation` (or `-m`) option
4
+
1
5
  # 0.8.0 - November 29, 2018
2
6
 
3
7
  * Add a `--command-prefix` option, which will make this easier to use in Docker Compose setups
data/lib/threeman/cli.rb CHANGED
@@ -26,6 +26,7 @@ module Threeman
26
26
  option :layout_name, desc: "If using tmux, the layout name to use for paned commands", type: :string
27
27
  option :procfile, desc: "Procfile file name", default: "Procfile", aliases: "-f"
28
28
  option :root, desc: "Directory of Procfile", aliases: "-d"
29
+ option :formation, aliases: '-m'
29
30
  option(
30
31
  :open_in_new_tab,
31
32
  desc: "If using iterm3, configure how threeman opens",
@@ -51,7 +52,8 @@ module Threeman
51
52
  procfile_name = options[:procfile]
52
53
  pwd = options[:root] || Dir.pwd
53
54
  procfile = Threeman::Procfile.new(File.expand_path(procfile_name, pwd))
54
- commands = procfile.commands(pwd, options[:port] || 5000, options[:command_prefix])
55
+ formation = parse_formation(options[:formation])
56
+ commands = procfile.commands(pwd, options[:port] || 5000, options[:command_prefix], formation)
55
57
 
56
58
  frontend_name = options[:frontend] || auto_frontend
57
59
  unless frontend_name
@@ -115,5 +117,15 @@ module Threeman
115
117
  def dotfile
116
118
  @dotfile ||= ['.threeman', '.foreman'].find { |filename| File.file?(filename) }
117
119
  end
120
+
121
+ def parse_formation(formation)
122
+ pairs = formation.to_s.gsub(/\s/, "").split(",")
123
+
124
+ pairs.inject(Hash.new(0)) do |ax, pair|
125
+ process, amount = pair.split("=")
126
+ process == "all" ? ax.default = amount.to_i : ax[process] = amount.to_i
127
+ ax
128
+ end
129
+ end
118
130
  end
119
131
  end
@@ -3,12 +3,15 @@ require 'threeman/command'
3
3
 
4
4
  module Threeman
5
5
  class Procfile < Foreman::Procfile
6
- def commands(workdir, port, command_prefix)
6
+ def commands(workdir, port, command_prefix, formation)
7
7
  commands = []
8
8
 
9
9
  entries do |name, command|
10
+ count = formation[name]
10
11
  command_with_prefix = [command_prefix, command].compact.join(' ')
11
- commands << Threeman::Command.new(name, command_with_prefix, workdir, port)
12
+ (0...count).each do |index|
13
+ commands << Threeman::Command.new(name, command_with_prefix, workdir, port + index)
14
+ end
12
15
  end
13
16
 
14
17
  commands
@@ -1,3 +1,3 @@
1
1
  module Threeman
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: threeman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nat Budin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-29 00:00:00.000000000 Z
11
+ date: 2019-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foreman