sesh 0.0.3 → 0.0.4

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
  SHA1:
3
- metadata.gz: 17fc8871ceac325d5a9344163c1dbac6bfad4d0a
4
- data.tar.gz: 7ae48a72c52d78d6b511e50a4c76878951c7786e
3
+ metadata.gz: 4d86cf244f2cbd17bbc9adf55648f0392cbb7760
4
+ data.tar.gz: 306097f046d6f12d3aef38570621b243bd57086f
5
5
  SHA512:
6
- metadata.gz: 0514a6354033fe60c716a24e094a0e6bf464ba74628d03c089ce7915dce42c7b5bf0f1eab5838312b6b16a7b3105abefc719a25833ce4bc65645fd14a1d43081
7
- data.tar.gz: 1c72f43d3b349a374d48a0fe640e9a4a6a45499ccb2ae9b86c481aec4cb041ce4e37c90687f2f3ee4b10ae4bad913214856f40fc6e3c96768ac1eae985e23524
6
+ metadata.gz: f1843f234222d995922f3d487271493e1c514d93d86e84c94b4af03898a2d7c526da0c73ad1011371f278f1de0922be45fa4b441c431be428f325c28fe66a04c
7
+ data.tar.gz: 2cf3101287b3080bce44f00ce9fdf705e0353b62a1dc8874562ee4c3f9e86d550334b534f853602a2aefc8983b45b7b5a647eedd4a12684c0162dac810dc6625
data/bin/sesh CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ require 'tmuxinator'
2
3
 
3
4
  if ARGV.empty? or ARGV.include? '-h' or ARGV.include? '--help' then puts <<-HELP
4
5
  Sesh: remote background sessions powered by tmux and tmuxinator.
@@ -34,11 +35,12 @@ def is_tmuxinator_project?(name)
34
35
  end
35
36
 
36
37
  def get_project_name
38
+ new_project = @command == 'new'
37
39
  if @options.any? && !@options[0].include?('@')
38
- return @options.shift if is_tmuxinator_project? @options[0]
40
+ return @options.shift if new_project || is_tmuxinator_project?(@options[0])
39
41
  end
40
42
  output = `printf '%q\n' "${PWD##*/}"`.strip
41
- return output if is_tmuxinator_project?(output)
43
+ return output if new_project || is_tmuxinator_project?(output)
42
44
  puts "Sesh project '#{output}' could not be found."
43
45
  fatal "Hint: run sesh new or specify an existing project after your commmand."
44
46
  end
@@ -161,8 +163,20 @@ if @command
161
163
  sleep(0.5)
162
164
  puts `sesh start #{@project_name} #{@options if @options.any?}`.strip
163
165
  when 'new'
164
- command = "env EDITOR='vim' tmuxinator new #{@project_name}"
165
- output = exec command
166
+ name = @project_name
167
+ config = Tmuxinator::Config.project(name)
168
+
169
+ unless Tmuxinator::Config.exists?(name)
170
+ template = File.join(File.dirname(File.expand_path(__FILE__)), "../lib/sesh/assets/sample.yml")
171
+ erb = Erubis::Eruby.new(File.read(template)).result(binding)
172
+ File.open(config, "w") { |f| f.write(erb) }
173
+ end
174
+
175
+ editor = `echo $EDITOR`.strip
176
+ editor = 'vim' unless editor.length > 0
177
+ Kernel.system("#{editor} #{config}") || Tmuxinator::Cli.new.doctor
178
+ # command = "env EDITOR='vim' tmuxinator new #{@project_name}"
179
+ # output = exec command
166
180
  puts
167
181
  when 'list'
168
182
  output = format_and_run_command <<-BASH
@@ -0,0 +1,30 @@
1
+ # ~/.tmuxinator/<%= name %>.yml
2
+
3
+ name: <%= name %>
4
+ root: ~/Sites/<%= name %>
5
+
6
+ # Optional tmux socket
7
+ # socket_name: foo
8
+
9
+ # Runs before everything. Use it to start daemons etc.
10
+ # pre: sudo /etc/rc.d/mysqld start
11
+
12
+ # Runs in each window and pane before window/pane specific commands. Useful for setting up interpreter versions.
13
+ # pre_window: rbenv shell 2.0.0-p247
14
+
15
+ # Pass command line options to tmux. Useful for specifying a different tmux.conf.
16
+ # tmux_options: -f ~/.tmux.mac.conf
17
+
18
+ # Change the command to call tmux. This can be used by derivatives/wrappers like byobu.
19
+ tmux_command: reattach-to-user-namespace tmux
20
+
21
+ # Specifies (by name or index) which window will be selected on project startup. If not set, the first window is used.
22
+ # startup_window: logs
23
+
24
+ windows:
25
+ - background:
26
+ layout: main-vertical
27
+ panes:
28
+ - #empty
29
+ - spring rails s
30
+ - spring rails c
@@ -0,0 +1,3 @@
1
+ module Sesh
2
+ VERSION = '0.0.4'
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sesh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - MacKinley Smith
@@ -9,7 +9,21 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2015-03-17 00:00:00.000000000 Z
12
- dependencies: []
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: tmuxinator
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.6.9
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.6.9
13
27
  description: Remote background sessions powered by tmux and tmuxinator.
14
28
  email: smithmackinley@gmail.com
15
29
  executables:
@@ -18,6 +32,8 @@ extensions: []
18
32
  extra_rdoc_files: []
19
33
  files:
20
34
  - bin/sesh
35
+ - lib/sesh/assets/sample.yml
36
+ - lib/sesh/version.rb
21
37
  homepage: http://rubygems.org/gems/sesh
22
38
  licenses:
23
39
  - GNU GPLv3