screeninator 1.0.3 → 1.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.
data/CHANGELOG.md CHANGED
@@ -1,17 +1,24 @@
1
+ 1.0.4 / 2012-04-23
2
+ ------------------
3
+
4
+ * 1 bugfix
5
+
6
+ * delete command now deletes both yml template and screen config files and removes the start_ alias.
7
+
1
8
  1.0.3 / 2011-07-07
2
9
  ------------------
3
10
 
4
11
  * 1 bugfix
5
-
12
+
6
13
  * fix existing aliases being deleted when creating a new project
7
14
 
8
15
  1.0.2 / 2011-04-04
9
16
  ------------------
10
17
 
11
18
  * 1 bugfix
12
-
19
+
13
20
  * fix whitespace issue in status line
14
-
21
+
15
22
  * 5 enhancements
16
23
 
17
24
  * added help command. shows available commands and explanation
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ UPGRADE WARNING - If you have a custom default config, move it to ~/.screeninato
20
20
  Remember to add the following line to your .bashrc file
21
21
 
22
22
  [[ -s "$HOME/.screeninator/scripts/screeninator" ]] && source "$HOME/.screeninator/scripts/screeninator"
23
-
23
+
24
24
  Message
25
25
 
26
26
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.3
1
+ 1.0.4
@@ -12,4 +12,4 @@ tabs:
12
12
  - console: rails c
13
13
  - capistrano:
14
14
  - server: ssh me@myhost
15
-
15
+
@@ -1,9 +1,9 @@
1
1
  require 'fileutils'
2
2
 
3
3
  # Author:: Jon Druse (mailto:jon@jondruse.com)
4
- #
4
+ #
5
5
  # = Description
6
- #
6
+ #
7
7
  # This class is where each screeninator command is implemented.
8
8
  #
9
9
  # == Change History
@@ -11,14 +11,18 @@ require 'fileutils'
11
11
  # * 03/15/11:: renmaed usage to help. adding option parser
12
12
  module Screeninator
13
13
  class Cli
14
-
14
+
15
15
  class << self
16
16
  include Screeninator::Helper
17
-
17
+
18
18
  def start(*args)
19
-
19
+
20
20
  begin
21
- self.send(args.shift, *args)
21
+ if args.empty?
22
+ self.help
23
+ else
24
+ self.send(args.shift, *args)
25
+ end
22
26
  rescue NoMethodError => e
23
27
  puts e
24
28
  self.help
@@ -30,7 +34,7 @@ module Screeninator
30
34
  def help
31
35
  puts HELP_TEXT
32
36
  end
33
-
37
+
34
38
  # Open a config file, it's created if it doesn't exist already.
35
39
  def open(*args)
36
40
  @name = args.shift
@@ -45,43 +49,42 @@ module Screeninator
45
49
  system("$EDITOR #{config_path}")
46
50
  update(@name)
47
51
  end
48
-
52
+
49
53
  def copy(*args)
50
54
  @copy = args.shift
51
55
  @name = args.shift
52
56
  @config_to_copy = "#{root_dir}#{@copy}.yml"
53
-
57
+
54
58
  exit!("Project #{@copy} doesn't exist!") unless File.exists?(@config_to_copy)
55
59
  exit!("You must specify a name for the new project") unless @name
56
-
60
+
57
61
  file_path = "#{root_dir}#{@name}.yml"
58
-
62
+
59
63
  if File.exists?(file_path)
60
64
  confirm!("#{@name} already exists, would you like to overwrite it? (type yes or no):") do
61
65
  FileUtils.rm(file_path)
62
66
  puts "Overwriting #{@name}"
63
67
  end
64
-
68
+
65
69
  end
66
70
  open(@name)
67
71
  end
68
-
72
+
69
73
  def delete(*args)
70
74
  puts "warning: passing multiple arguments to delete will be ignored" if args.size > 1
71
75
  filename = args.shift
72
- file_path = "#{root_dir}#{filename}.yml"
73
-
74
- if File.exists?(file_path)
76
+ files = Dir["#{root_dir}#{filename}*"]
77
+
78
+ unless files.empty?
75
79
  confirm!("Are you sure you want to delete #{filename}? (type yes or no):") do
76
- FileUtils.rm(file_path)
80
+ FileUtils.rm(files)
77
81
  puts "Deleted #{filename}"
78
82
  end
79
- else
80
- exit! "That file doesn't exist."
81
83
  end
82
-
84
+
85
+ update
83
86
  end
84
-
87
+
85
88
  def implode(*args)
86
89
  exit!("delete_all doesn't accapt any arguments!") unless args.empty?
87
90
  confirm!("Are you sure you want to delete all screeninator configs? (type yes or no):") do
@@ -94,21 +97,21 @@ module Screeninator
94
97
  puts "screeninator configs:"
95
98
  list
96
99
  end
97
-
100
+
98
101
  def info(*args)
99
102
  puts "screeninator configs:"
100
103
  list(true)
101
104
  end
102
-
105
+
103
106
  def update(*args)
104
107
  aliases = []
105
108
  Dir["#{root_dir}*.yml"].each do |path|
106
109
  begin
107
110
  path = File.basename(path, '.yml')
108
111
  config_name = path.split("/").last
109
-
112
+
110
113
  begin; FileUtils.rm("#{path}.screen"); rescue; end
111
-
114
+
112
115
  aliases << Screeninator::ConfigWriter.new(path).write!
113
116
  rescue ArgumentError => e
114
117
  puts e
@@ -116,8 +119,8 @@ module Screeninator
116
119
  end
117
120
  Screeninator::ConfigWriter.write_aliases(aliases)
118
121
  end
119
-
120
- def customize(*args)
122
+
123
+ def customize(*args)
121
124
  @type = args.shift
122
125
  @action = args.shift
123
126
  if !['config','template'].include?(@type)
@@ -128,16 +131,16 @@ module Screeninator
128
131
  end
129
132
 
130
133
  FileUtils.mkdir_p(root_dir+"defaults")
131
-
132
- path = case @type
134
+
135
+ path = case @type
133
136
  when "config"; USER_CONFIG
134
137
  when "template"; USER_SCREEN_CONFIG
135
138
  end
136
-
139
+
137
140
  if @action.nil?
138
141
  system("$EDITOR #{path}")
139
142
  end
140
-
143
+
141
144
  if @action == "delete"
142
145
  confirm!("Are you sure you want to delete #{path}? (type yes or no):") do
143
146
  FileUtils.rm(path)
@@ -145,25 +148,25 @@ module Screeninator
145
148
  end
146
149
  end
147
150
  end
148
-
151
+
149
152
  private
150
-
153
+
151
154
  def root_dir
152
155
  dir = "#{ENV["HOME"]}/.screeninator/"
153
156
  end
154
-
157
+
155
158
  def sample_config
156
159
  "#{File.dirname(__FILE__)}/assets/sample.yml"
157
160
  end
158
-
161
+
159
162
  def user_config
160
163
  @config_to_copy || USER_CONFIG
161
164
  end
162
-
165
+
163
166
  def user_screen_config
164
167
  USER_SCREEN_CONFIG
165
168
  end
166
-
169
+
167
170
  def list(verbose=false)
168
171
  Dir["#{root_dir}**"].each do |path|
169
172
  next unless verbose || File.extname(path) == ".yml"
@@ -171,9 +174,9 @@ module Screeninator
171
174
  puts " #{path}"
172
175
  end
173
176
  end
174
-
177
+
175
178
  end
176
-
179
+
177
180
  end
178
181
  end
179
182
 
@@ -1,19 +1,19 @@
1
1
  module Screeninator
2
-
2
+
3
3
  class ConfigWriter
4
-
4
+
5
5
  include Screeninator::Helper
6
-
6
+
7
7
  def self.write_aliases(aliases)
8
8
  File.open("#{ENV["HOME"]}/.screeninator/scripts/screeninator", 'w') {|f| f.write(aliases.join("\n")) }
9
9
  end
10
-
10
+
11
11
  def initialize(filename)
12
12
  @filename = filename
13
13
  @file_path = "#{root_dir}#{@filename}.yml"
14
14
  process_config!
15
15
  end
16
-
16
+
17
17
  def write!
18
18
  if File.exists?(USER_SCREEN_CONFIG)
19
19
  template = USER_SCREEN_CONFIG
@@ -31,24 +31,24 @@ module Screeninator
31
31
  start = "screen -c #{config_path} -S #{@project_name}"
32
32
  %Q{alias start_#{@filename}='if [[ -n `#{check}` ]] ; then `#{attch}` ; else `#{start}`; fi'}
33
33
  end
34
-
34
+
35
35
  private
36
-
36
+
37
37
  def root_dir
38
38
  "#{ENV["HOME"]}/.screeninator/"
39
39
  end
40
-
40
+
41
41
  def process_config!
42
42
  raise ArgumentError.new("#{@file_path} is not valid YAML!") unless yaml = YAML.load(File.read(@file_path))
43
43
  raise ArgumentError.new("Your configuration file should include some tabs.") if yaml["tabs"].nil?
44
44
  raise ArgumentError.new("Your configuration file didn't specify a 'project_root'") if yaml["project_root"].nil?
45
45
  raise ArgumentError.new("Your configuration file didn't specify a 'project_name'") if yaml["project_name"].nil?
46
-
46
+
47
47
  @escape = yaml["escape"]
48
48
  @project_name = yaml["project_name"]
49
49
  @project_root = yaml["project_root"]
50
50
  @tabs = []
51
-
51
+
52
52
  yaml["tabs"].each do |tab|
53
53
  t = OpenStruct.new
54
54
  t.name = tab.keys.first
@@ -60,12 +60,12 @@ module Screeninator
60
60
  end
61
61
  @tabs << t
62
62
  end
63
-
63
+
64
64
  end
65
-
65
+
66
66
  def write_alias(stuff)
67
67
  File.open("#{root_dir}scripts/#{@filename}", 'w') {|f| f.write(stuff) }
68
68
  end
69
69
  end
70
-
70
+
71
71
  end
@@ -1,8 +1,8 @@
1
1
  module Screeninator
2
2
  module Helper
3
-
3
+
4
4
  help = ["Usage: screeninator ACTION [Args]\n\n"]
5
- help << "Available Commans:\n\n"
5
+ help << "Available Commands:\n\n"
6
6
  help << "open CONFIG_NAME".ljust(40) + "Open's the config file in $EDITOR. If it doesn't exist, it will be created."
7
7
  help << "copy CONFIG_NAME NEW_CONFIG".ljust(40) + "Copy an existing config into a new one."
8
8
  help << "list".ljust(40) + "List all your current config files."
@@ -10,14 +10,14 @@ module Screeninator
10
10
  help << "customize [config|template] [delete]".ljust(40) + "Write your own default YML config or screen template."
11
11
  help << "update [CONFIG_NAME, CONFIG_NAME]".ljust(40) + "Recompile all config files. Helpful if you edit them without using 'screeninator open'."
12
12
  help << "implode".ljust(40) + "Destroy all configs, compiled configs, and bash scripts."
13
-
13
+
14
14
  HELP_TEXT = help.join("\n")
15
-
15
+
16
16
  def exit!(msg)
17
17
  puts msg
18
18
  Kernel.exit(1)
19
19
  end
20
-
20
+
21
21
  def confirm!(msg)
22
22
  puts msg
23
23
  if %w(yes Yes YES y).include?(STDIN.gets.chop)
@@ -25,9 +25,9 @@ module Screeninator
25
25
  else
26
26
  exit! "Aborting."
27
27
  end
28
-
29
-
28
+
29
+
30
30
  end
31
-
31
+
32
32
  end
33
33
  end
data/lib/screeninator.rb CHANGED
@@ -7,5 +7,5 @@ require 'screeninator/config_writer'
7
7
 
8
8
  module Screeninator
9
9
  USER_CONFIG = "#{ENV["HOME"]}/.screeninator/defaults/default.yml"
10
- USER_SCREEN_CONFIG = "#{ENV["HOME"]}/.screeninator/defaults/screen_config.screen"
10
+ USER_SCREEN_CONFIG = "#{ENV["HOME"]}/.screeninator/defaults/screen_config.screen"
11
11
  end
data/screeninator.gemspec CHANGED
@@ -46,7 +46,7 @@ UPGRADE WARNING - If you have a custom default config, move it to ~/.screeninato
46
46
  Remember to add the following line to your .bashrc file
47
47
 
48
48
  [[ -s "$HOME/.screeninator/scripts/screeninator" ]] && source "$HOME/.screeninator/scripts/screeninator"
49
-
49
+
50
50
  }
51
51
  s.rdoc_options = ["--charset=UTF-8"]
52
52
  s.require_paths = ["lib"]
metadata CHANGED
@@ -1,60 +1,66 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: screeninator
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 31
4
5
  prerelease:
5
- version: 1.0.3
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 4
10
+ version: 1.0.4
6
11
  platform: ruby
7
12
  authors:
8
- - Jon Druse
13
+ - Jon Druse
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-07-07 00:00:00 -07:00
14
- default_executable: screeninator
18
+ date: 2012-04-23 00:00:00 Z
15
19
  dependencies:
16
- - !ruby/object:Gem::Dependency
17
- name: shoulda
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
20
- none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: "0"
25
- type: :development
26
- version_requirements: *id001
20
+ - !ruby/object:Gem::Dependency
21
+ name: shoulda
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :development
33
+ version_requirements: *id001
27
34
  description: Create and manage complex screen sessions easily.
28
35
  email: jon@jondruse.com
29
36
  executables:
30
- - screeninator
37
+ - screeninator
31
38
  extensions: []
32
39
 
33
40
  extra_rdoc_files:
34
- - LICENSE
35
- - README.md
41
+ - LICENSE
42
+ - README.md
36
43
  files:
37
- - .document
38
- - CHANGELOG.md
39
- - LICENSE
40
- - README.md
41
- - Rakefile
42
- - VERSION
43
- - bin/screeninator
44
- - lib/screeninator.rb
45
- - lib/screeninator/assets/sample.yml
46
- - lib/screeninator/assets/screen_config.screen
47
- - lib/screeninator/cli.rb
48
- - lib/screeninator/config_writer.rb
49
- - lib/screeninator/helper.rb
50
- - screeninator.gemspec
51
- - test/helper.rb
52
- - test/test_screeninator.rb
53
- has_rdoc: true
44
+ - .document
45
+ - CHANGELOG.md
46
+ - LICENSE
47
+ - README.md
48
+ - Rakefile
49
+ - VERSION
50
+ - bin/screeninator
51
+ - lib/screeninator.rb
52
+ - lib/screeninator/assets/sample.yml
53
+ - lib/screeninator/assets/screen_config.screen
54
+ - lib/screeninator/cli.rb
55
+ - lib/screeninator/config_writer.rb
56
+ - lib/screeninator/helper.rb
57
+ - screeninator.gemspec
58
+ - test/helper.rb
59
+ - test/test_screeninator.rb
54
60
  homepage: http://github.com/jondruse/screeninator
55
61
  licenses: []
56
62
 
57
- post_install_message: |
63
+ post_install_message: |+
58
64
 
59
65
  Thanks for installing Screeninator!
60
66
 
@@ -63,31 +69,35 @@ post_install_message: |
63
69
  Remember to add the following line to your .bashrc file
64
70
 
65
71
  [[ -s "$HOME/.screeninator/scripts/screeninator" ]] && source "$HOME/.screeninator/scripts/screeninator"
66
-
67
-
72
+
68
73
  rdoc_options: []
69
74
 
70
75
  require_paths:
71
- - lib
76
+ - lib
72
77
  required_ruby_version: !ruby/object:Gem::Requirement
73
78
  none: false
74
79
  requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- version: "0"
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ hash: 3
83
+ segments:
84
+ - 0
85
+ version: "0"
78
86
  required_rubygems_version: !ruby/object:Gem::Requirement
79
87
  none: false
80
88
  requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: "0"
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ hash: 3
92
+ segments:
93
+ - 0
94
+ version: "0"
84
95
  requirements: []
85
96
 
86
97
  rubyforge_project:
87
- rubygems_version: 1.5.1
98
+ rubygems_version: 1.8.15
88
99
  signing_key:
89
100
  specification_version: 3
90
101
  summary: Create and manage complex screen sessions easily.
91
- test_files:
92
- - test/helper.rb
93
- - test/test_screeninator.rb
102
+ test_files: []
103
+