threeman 0.5.0 → 0.6.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
- SHA1:
3
- metadata.gz: 69d8685bd916a582798ff25ff645c0cc0d1b2349
4
- data.tar.gz: 09caa15bd71c1c46aae565d13ae450ee1c064019
2
+ SHA256:
3
+ metadata.gz: 5a38286d26038200e32dd5ac06d159c9097bddd265554955765194506492eb2a
4
+ data.tar.gz: '03117213615048aecb66b64f17b17036068090086c76ddf8eb4b132bc879d4fb'
5
5
  SHA512:
6
- metadata.gz: bdd20f5247ee87ec37f52cf27169c6f6b409940410e9238f92c88e9ee758476dfb0c34ac6c66fdd7dba6f47021a46776fcd1341e71cb213bbdcabfb28ff60527
7
- data.tar.gz: ad118a7c53bb3b6aacf54e6285708dc2af36216e34e1fe895dbdf940e761ff5918a79c2700ee37e2e54c7afca54fba4629d2fefb3483061cbb4ae2049bf586e1
6
+ metadata.gz: f93fe78bf87ab7c39f55d678c05bbf337b3e7afe913b4a04349420ba3568c68fb911d06b4ff0aa1cb30d2fcdc8cfdcaa4ac14901e6a837dd0a801465236accd2
7
+ data.tar.gz: 39aa4cdfafee6125a8bab217d6527ed9250063b3150ae9141cbc681db117096aad0a0758c79f50ac634d45f991d6da2c5355671d6175286c99339c38cbd05f30
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Threeman
2
2
 
3
- Threeman is an alternative to [Foreman](https://github.com/ddollar/foreman). Rather than running all the commands together in one terminal, it opens a new terminal window with each command in a tab. The benefits of this are:
3
+ Threeman is an alternative to [Foreman](https://github.com/ddollar/foreman). Rather than running all the commands together in one terminal, it opens a tab for each command. The benefits of this are:
4
4
 
5
5
  * Your terminal app will notify you using an icon when there's new output from each command
6
6
  * Because your command's input and output aren't being intercepted by Foreman, you can use [Pry](http://pryrepl.org)
@@ -9,6 +9,7 @@ Threeman also has an extensible architecture to allow it to support multiple ter
9
9
 
10
10
  * iTerm 2.9 and above
11
11
  * Mac OS X's built-in Terminal app
12
+ * tmux
12
13
 
13
14
  ## Installation
14
15
 
@@ -36,7 +37,7 @@ will cause Threeman to run the app with the `PORT` environment variable set to 3
36
37
 
37
38
  ## Development
38
39
 
39
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
40
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
40
41
 
41
42
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
42
43
 
data/lib/threeman/cli.rb CHANGED
@@ -23,9 +23,22 @@ module Threeman
23
23
 
24
24
  desc "start", "Start the application"
25
25
  option :frontend, desc: "Which frontend to use. One of: #{FRONTENDS.keys.sort.join(', ')}"
26
- option :panes, desc: "Runs each command in a pane, if supported by the frontend. (Currently supported in iterm3 and tmux.)", type: :array
27
- option :port, desc: "The port to run the application on. This will set the PORT environment variable.", type: :numeric
28
26
  option :layout_name, desc: "If using tmux, the layout name to use for paned commands", type: :string
27
+ option(
28
+ :open_in_new_tab,
29
+ desc: "If using iterm3, configure how threeman opens",
30
+ type: :boolean
31
+ )
32
+ option(
33
+ :panes,
34
+ desc: "Runs each command in a pane, if supported by the frontend. (Currently supported in iterm3 and tmux.)",
35
+ type: :array
36
+ )
37
+ option(
38
+ :port,
39
+ desc: "The port to run the application on. This will set the PORT environment variable.",
40
+ type: :numeric
41
+ )
29
42
 
30
43
  def start
31
44
  pwd = Dir.pwd
@@ -39,10 +52,19 @@ module Threeman
39
52
  exit! 1
40
53
  end
41
54
 
55
+ valid_frontend_open_option?(frontend_name) if options[:open_in_new_tab]
56
+
42
57
  frontend(frontend_name, options).run_commands(commands)
43
58
  end
44
59
 
45
60
  private
61
+ def valid_frontend_open_option?(frontend_name)
62
+ unless frontend_name == :iterm3
63
+ puts "Opening in a new tab is only supported for iterm3"
64
+ exit! 1
65
+ end
66
+ end
67
+
46
68
  def frontend(name, options = {})
47
69
  frontend_lambda = FRONTENDS[name.to_sym]
48
70
  unless frontend_lambda
@@ -12,7 +12,7 @@ module Threeman
12
12
  def run_commands(commands)
13
13
  iterm = Appscript.app("iTerm")
14
14
  iterm.activate
15
- window = iterm.create_window_with_default_profile
15
+ window = open_option(iterm)
16
16
 
17
17
  sort_commands(commands).each_with_index do |command, index|
18
18
  current_tab = if index == 0
@@ -35,6 +35,16 @@ module Threeman
35
35
  bash_cmd = "bash -c #{Shellwords.escape bash_script(command)}"
36
36
  session.write(text: [cd_cmd, bash_cmd].join("\n"))
37
37
  end
38
+
39
+ def open_option(iterm)
40
+ if options[:open_in_new_tab]
41
+ current_window = iterm.current_window
42
+ current_window.create_tab_with_default_profile
43
+ current_window
44
+ else
45
+ iterm.create_window_with_default_profile
46
+ end
47
+ end
38
48
  end
39
49
  end
40
50
  end
@@ -1,3 +1,3 @@
1
1
  module Threeman
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
data/threeman.gemspec CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Nat Budin"]
10
10
  spec.email = ["nbudin@patientslikeme.com"]
11
11
 
12
- spec.summary = %q{Runs Procfile commands in iTerm 2 tabs}
13
- spec.description = %q{An alternative to Foreman for Mac users, which runs each command in a separate iTerm 2 tab}
12
+ spec.summary = %q{Runs Procfile commands in tabs}
13
+ spec.description = %q{An alternative to Foreman, which runs each command in a separate tab}
14
14
  spec.homepage = "https://github.com/patientslikeme/threeman"
15
15
  spec.license = "MIT"
16
16
 
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.5.0
4
+ version: 0.6.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: 2017-05-31 00:00:00.000000000 Z
11
+ date: 2018-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foreman
@@ -94,8 +94,7 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- description: An alternative to Foreman for Mac users, which runs each command in a
98
- separate iTerm 2 tab
97
+ description: An alternative to Foreman, which runs each command in a separate tab
99
98
  email:
100
99
  - nbudin@patientslikeme.com
101
100
  executables:
@@ -146,8 +145,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
145
  version: '0'
147
146
  requirements: []
148
147
  rubyforge_project:
149
- rubygems_version: 2.6.4
148
+ rubygems_version: 2.7.3
150
149
  signing_key:
151
150
  specification_version: 4
152
- summary: Runs Procfile commands in iTerm 2 tabs
151
+ summary: Runs Procfile commands in tabs
153
152
  test_files: []