divide 0.0.3 → 0.1.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: 2376fb8797109014e9071c60ee29a5d4d158b442
4
- data.tar.gz: c9b0f77470c3c3584abf21a34ee2ce711126407c
3
+ metadata.gz: 00aef84128dedd3cb5862284bf90b1c0052ff219
4
+ data.tar.gz: d95bba2bd54de736fc5e6a1aa70cee009ac6ea25
5
5
  SHA512:
6
- metadata.gz: ba7271baff2e9fb627aa093f4bd7bdefb43f3e7b45b9581e77d0a00eaf4a44b4d06ff57264bb008b745a0d43660adaf5cbfb1a36c2a0c9055f0466bd261e08bf
7
- data.tar.gz: ecb6fbaaa0b6db0805d24c8a34c7a7cffa74c8f0f80803b869809aefe830dc09a04858597cc652174f054557006a3395246ece2b2c2b3ba16dc299865d998dc7
6
+ metadata.gz: b47030e3f349ca510556d9efdf6288df460a18e569bba45970859cef85bb00e5421bc57ef1e48576b3552e37f93e54d7f90c7974b06ae688be7e4f7cb997f3c1
7
+ data.tar.gz: 6efa5f312ca238dffd5088f29173fd1998ee87ad6c5fe7715db258a1566cc5a7dc7cfe8a01aa5952d4317f45f1588abbe95bf3a538683d7718bb48835efa49e1
data/README.md CHANGED
@@ -55,6 +55,10 @@ $ divide
55
55
  ```
56
56
 
57
57
  ## Changelog
58
+ ### 0.1.0
59
+ - iTerm opens new processes into split panes (see #85bc235)
60
+ - Make sure all the options are being replaced
61
+
58
62
  ### 0.0.3
59
63
  - Fix bug when there are double quotes in Procfile
60
64
 
@@ -1,9 +1,12 @@
1
1
  module Divide
2
2
  class CLI
3
- attr_reader :options
3
+ attr_reader :options, :flags
4
+ OPTIONS = %w(--tabs)
4
5
 
5
6
  def initialize(argv=[])
6
- @options = argv.each_slice(2).to_a
7
+ @options = {}
8
+ OPTIONS.each { |option| @options[option.sub('--', '').to_sym] = argv.include?(option) }
9
+ @flags = (argv - OPTIONS).each_slice(2).to_a
7
10
 
8
11
  show_version if argv.grep(/^-v|--version$/).any?
9
12
  show_help if argv.grep(/^-h|--help$/).any?
@@ -59,14 +62,14 @@ module Divide
59
62
 
60
63
  def terminal
61
64
  @terminal ||= case current_app_name.downcase
62
- when 'terminal' then TerminalBridge::Terminal.new
63
- when 'iterm' then TerminalBridge::ITerm.new
65
+ when 'terminal' then TerminalBridge::Terminal.new(@options)
66
+ when 'iterm' then TerminalBridge::ITerm.new(@options)
64
67
  else nil
65
68
  end
66
69
  end
67
70
 
68
71
  def extractor
69
- @extractor ||= Extractor.new(@options)
72
+ @extractor ||= Extractor.new(@flags)
70
73
  end
71
74
  end
72
75
  end
@@ -21,17 +21,14 @@ module Divide
21
21
  end
22
22
 
23
23
  def overwrite_options
24
- splitted_content = procfile_content.split(/\s/)
25
-
26
24
  @options.each do |option|
27
25
  next if option.length < 2
28
26
 
29
27
  key = option[0]
30
28
  value = option[1]
31
29
 
32
- if key_index = splitted_content.index(key)
33
- value_to_overwrite = splitted_content[key_index + 1]
34
- procfile_content.sub!(value_to_overwrite, value)
30
+ procfile_content.scan(/\s?#{key}\s(\S+)/).each do |value_to_overwrite|
31
+ procfile_content.gsub!(value_to_overwrite[0], value)
35
32
  end
36
33
  end
37
34
  end
@@ -17,7 +17,8 @@ module Divide
17
17
  end
18
18
 
19
19
  # Instance methods
20
- def initialize
20
+ def initialize(options={})
21
+ @options = options
21
22
  @app_name = bridge.current_app_name
22
23
  end
23
24
 
@@ -40,15 +41,19 @@ module Divide
40
41
  def keystroke(key)
41
42
  splits = key.split('+')
42
43
 
43
- if splits.length > 1
44
- modifier_key = splits[0]
45
- key = splits[1]
44
+ if splits.length > 2
45
+ key = splits.last
46
+ modifier_keys = splits - [key]
47
+ modifier_key = "{#{modifier_keys.map { |m| "#{m} down" }.join(', ')}}"
48
+ elsif splits.length == 2
49
+ key = splits.last
50
+ modifier_key = "#{splits.first} down"
46
51
  else
47
- modifier_key = nil
48
52
  key = splits[0]
53
+ modifier_key = nil
49
54
  end
50
55
 
51
- modifier = modifier_key ? " using #{modifier_key} down" : ''
56
+ modifier = modifier_key ? " using #{modifier_key}" : ''
52
57
  %(tell app "System Events" to tell process "#{@app_name}" to keystroke "#{key}"#{modifier})
53
58
  end
54
59
 
@@ -7,7 +7,11 @@ module Divide
7
7
  end
8
8
 
9
9
  def open_new_tab
10
- tell_current_app %(tell the first terminal to launch session "Default Session")
10
+ if @options[:tabs]
11
+ keystroke 'command+t'
12
+ else
13
+ keystroke 'command+d'
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -1,3 +1,3 @@
1
1
  module Divide
2
- VERSION = '0.0.3'
2
+ VERSION = '0.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: divide
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Etienne Lemay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-27 00:00:00.000000000 Z
11
+ date: 2013-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake