threeman 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db3a146d14c8f26cb496fe157f82a5d6d235db23
4
- data.tar.gz: 9b8545342433e346b41d71974c0639730f2584eb
3
+ metadata.gz: c27245f62909c634dffc2b58459d0274a43b7bd5
4
+ data.tar.gz: 171dfafb1e03b7511e7b77bafdf244cc46eb2117
5
5
  SHA512:
6
- metadata.gz: ac9d33db4a9ff2d71c12d9fd63f52b6acf94587a05719a59b1335a00fb8206b49b79746e1ff5a018fdca6a21a343cf653c3331d8586209b80dcf1fd2af8ba542
7
- data.tar.gz: 3b88e1219bb2aee260f4f37b4bb6cc08434bc90cebd161ce71f6b435ab4b0c7ac2818c0b0759c1862d12fb039627ee70dd9f72281ef9fe5b35be7795f3e2db3f
6
+ metadata.gz: 508af4ea8207a1bd4411944b89d75799552d4841209a69f188b129eb6eacfe940fdd87f8737d2344180a32d9badc7345f61ff71eddcfb9207d76b160d29a3cdc
7
+ data.tar.gz: 7ff53715ab635ebf6ada6f68ac9f2d43e2e00b7903cf32b62a6347ebdbffed6f5ac5bab2f48c8b0198cff89f7b86e8e67dd8541ab62af785c0433abce888eed9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.4.0 - March 18, 2017
2
+
3
+ * Support reading .threeman or .foreman files to get the default options
4
+
1
5
  # 0.3.1 - November 13, 2016
2
6
 
3
7
  * Fix a bug in setting the PORT environment variable (it has to be separately set before using it)
data/README.md CHANGED
@@ -26,6 +26,14 @@ From your app's directory (with a Procfile in it), run:
26
26
 
27
27
  Threeman will open a new terminal window with each of your Procfile commands running in a separate tab.
28
28
 
29
+ Threeman also supports reading a `.threeman` or `.foreman` file containing default options in YAML format, just like Foreman does with the `.foreman` file. For example, a `.foreman` file containing:
30
+
31
+ ```
32
+ port: 3000
33
+ ```
34
+
35
+ will cause Threeman to run the app with the `PORT` environment variable set to 3000.
36
+
29
37
  ## Development
30
38
 
31
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.
@@ -38,5 +46,5 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/patien
38
46
 
39
47
  ## License
40
48
 
41
- Threeman is © 2016 PatientsLikeMe, Inc. and is released under the MIT License. See the LICENSE file for more information.
49
+ Threeman is © 2016-2017 PatientsLikeMe, Inc. and is released under the MIT License. See the LICENSE file for more information.
42
50
 
data/lib/threeman/cli.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'threeman/procfile'
2
2
  require 'thor'
3
+ require 'yaml'
3
4
 
4
5
  module Threeman
5
6
  FRONTENDS = {
@@ -22,11 +23,11 @@ module Threeman
22
23
 
23
24
  desc "start", "Start the application"
24
25
  option :frontend, desc: "Which frontend to use. One of: #{FRONTENDS.keys.sort.join(', ')}"
25
- option :port, desc: "The port to run the application on. This will set the PORT environment variable.", type: :numeric, default: 5000
26
+ option :port, desc: "The port to run the application on. This will set the PORT environment variable.", type: :numeric
26
27
  def start
27
28
  pwd = Dir.pwd
28
29
  procfile = Threeman::Procfile.new(File.expand_path("Procfile", pwd))
29
- commands = procfile.commands(pwd, options[:port])
30
+ commands = procfile.commands(pwd, options[:port] || 5000)
30
31
 
31
32
  frontend_name = options[:frontend] || auto_frontend
32
33
  unless frontend_name
@@ -69,5 +70,17 @@ module Threeman
69
70
  def print_valid_frontend_names
70
71
  puts "Valid frontend names are: #{FRONTENDS.keys.sort.join(', ')}."
71
72
  end
73
+
74
+ # Cribbed mostly from Foreman
75
+ def options
76
+ original_options = super
77
+ return original_options unless dotfile
78
+ defaults = ::YAML::load_file(dotfile) || {}
79
+ Thor::CoreExt::HashWithIndifferentAccess.new(defaults.merge(original_options))
80
+ end
81
+
82
+ def dotfile
83
+ @dotfile ||= ['.threeman', '.foreman'].find { |filename| File.file?(filename) }
84
+ end
72
85
  end
73
86
  end
@@ -1,3 +1,3 @@
1
1
  module Threeman
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.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.3.1
4
+ version: 0.4.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: 2016-11-13 00:00:00.000000000 Z
11
+ date: 2017-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foreman