screeninator 0.1.2 → 1.0.1

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/README.md CHANGED
@@ -103,6 +103,8 @@ Questions? Comments? Feature Request?
103
103
 
104
104
  I would love to hear your feedback on this project! Send me a message!
105
105
 
106
+ For realtime feedback check out the #screeninator channel on irc.freenode.com
107
+
106
108
 
107
109
  Note on Patches/Pull Requests
108
110
  -----------------------------
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 1.0.1
data/bin/screeninator CHANGED
@@ -1,4 +1,4 @@
1
- #! /usr/bin/env ruby
1
+ #!/usr/bin/env ruby
2
2
  $:.unshift(File.dirname(__FILE__) + '/../lib') unless $:.include?(File.dirname(__FILE__) + '/../lib')
3
3
 
4
4
  require 'screeninator'
@@ -14,6 +14,8 @@ module Screeninator
14
14
  class Cli
15
15
 
16
16
  class << self
17
+ include Screeninator::Helper
18
+
17
19
  def start(*args)
18
20
 
19
21
  if args.empty?
@@ -48,22 +50,16 @@ module Screeninator
48
50
  @copy = args.shift
49
51
  @name = args.shift
50
52
  @config_to_copy = "#{root_dir}#{@copy}.yml"
51
- unless File.exists?(@config_to_copy)
52
- puts "Project #{@copy} doesn't exist!"
53
- Kernel.exit(1)
54
- end
53
+
54
+ exit!("Project #{@copy} doesn't exist!") unless File.exists?(@config_to_copy)
55
+ exit!("You must specify a name for the new project") unless @name
55
56
 
56
57
  file_path = "#{root_dir}#{@name}.yml"
57
58
 
58
59
  if File.exists?(file_path)
59
- puts "#{@name} already exists, would you like to overwrite it? (type yes or no):"
60
-
61
- if %w(yes Yes YES).include?(STDIN.gets.chop)
60
+ confirm!("#{@name} already exists, would you like to overwrite it? (type yes or no):") do
62
61
  FileUtils.rm(file_path)
63
62
  puts "Overwriting #{@name}"
64
- else
65
- puts "Aborting."
66
- Kernel.exit(0)
67
63
  end
68
64
 
69
65
  end
@@ -76,30 +72,22 @@ module Screeninator
76
72
  file_path = "#{root_dir}#{filename}.yml"
77
73
 
78
74
  if File.exists?(file_path)
79
- puts "Are you sure you want to delete #{filename}? (type yes or no):"
80
- if %w(yes Yes YES).include?(STDIN.gets.chop)
75
+ confirm!("Are you sure you want to delete #{filename}? (type yes or no):") do
81
76
  FileUtils.rm(file_path)
82
- puts "Deleted #{file_path}"
83
- else
84
- puts "Aborting."
77
+ puts "Deleted #{filename}"
85
78
  end
86
79
  else
87
- puts "That file doesn't exist."
80
+ exit! "That file doesn't exist."
88
81
  end
89
82
 
90
83
  end
91
84
 
92
85
  def implode(*args)
93
- puts "delete_all doesn't accapt any arguments!" unless args.empty?
94
- puts "Are you sure you want to delete all screeninator configs? (type yes or no):"
95
-
96
- if %w(yes Yes YES).include?(STDIN.gets.chop)
86
+ exit!("delete_all doesn't accapt any arguments!") unless args.empty?
87
+ confirm!("Are you sure you want to delete all screeninator configs? (type yes or no):") do
97
88
  FileUtils.remove_dir(root_dir)
98
89
  puts "Deleted #{root_dir}"
99
- else
100
- puts "Aborting."
101
90
  end
102
-
103
91
  end
104
92
 
105
93
  def list(*args)
@@ -113,12 +101,12 @@ module Screeninator
113
101
  end
114
102
 
115
103
  def update_scripts
104
+ Dir["#{root_dir}*.screen"].each {|p| FileUtils.rm(p) }
116
105
  aliases = []
117
106
  Dir["#{root_dir}*.yml"].each do |path|
118
107
  path = File.basename(path, '.yml')
119
108
  aliases << Screeninator::ConfigWriter.new(path).write!
120
109
  end
121
-
122
110
  Screeninator::ConfigWriter.write_aliases(aliases)
123
111
  end
124
112
 
@@ -2,6 +2,8 @@ module Screeninator
2
2
 
3
3
  class ConfigWriter
4
4
 
5
+ include Screeninator::Helper
6
+
5
7
  def self.write_aliases(aliases)
6
8
  File.open("#{ENV["HOME"]}/.screeninator/scripts/screeninator", 'w') {|f| f.write(aliases.join("\n")) }
7
9
  end
@@ -30,12 +32,9 @@ module Screeninator
30
32
  def process_config!
31
33
  yaml = YAML.load(File.read(@file_path))
32
34
 
33
- raise "Your configuration file should include some tabs." if yaml["tabs"].nil?
34
- puts "Your configuration file didn't specify a 'project_root', using ~/" if yaml["project_root"].nil?
35
- if yaml["project_name"].nil?
36
- puts "Your configuration file didn't specify a 'project_name', using 'Fluffy Bunnies'"
37
- yaml["project_name"] = 'Fluffy Bunnies'
38
- end
35
+ exit!("Your configuration file should include some tabs.") if yaml["tabs"].nil?
36
+ exit!("Your configuration file didn't specify a 'project_root'") if yaml["project_root"].nil?
37
+ exit!("Your configuration file didn't specify a 'project_name'") if yaml["project_name"].nil?
39
38
 
40
39
  @escape = yaml["escape"]
41
40
  @project_name = yaml["project_name"]
@@ -0,0 +1,21 @@
1
+ module Screeninator
2
+ module Helper
3
+
4
+ def exit!(msg)
5
+ puts msg
6
+ Kernel.exit(1)
7
+ end
8
+
9
+ def confirm!(msg)
10
+ puts msg
11
+ if %w(yes Yes YES y).include?(STDIN.gets.chop)
12
+ yield
13
+ else
14
+ exit! "Aborting."
15
+ end
16
+
17
+
18
+ end
19
+
20
+ end
21
+ end
data/lib/screeninator.rb CHANGED
@@ -1,8 +1,9 @@
1
1
  require 'yaml'
2
2
  require 'ostruct'
3
3
  require 'erb'
4
+ require 'screeninator/helper'
4
5
  require 'screeninator/cli'
5
6
  require 'screeninator/config_writer'
6
7
 
7
- module Screeninator
8
- end
8
+ module Screeninator
9
+ end
data/screeninator.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{screeninator}
8
- s.version = "0.1.2"
8
+ s.version = "1.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jon Druse"]
12
- s.date = %q{2010-10-12}
12
+ s.date = %q{2010-10-29}
13
13
  s.default_executable = %q{screeninator}
14
14
  s.description = %q{Create and manage complex screen sessions easily.}
15
15
  s.email = %q{jon@jondruse.com}
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
32
32
  "lib/screeninator/assets/screen_config.screen",
33
33
  "lib/screeninator/cli.rb",
34
34
  "lib/screeninator/config_writer.rb",
35
+ "lib/screeninator/helper.rb",
35
36
  "screeninator.gemspec",
36
37
  "test/helper.rb",
37
38
  "test/test_screeninator.rb"
metadata CHANGED
@@ -3,10 +3,10 @@ name: screeninator
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
+ - 1
6
7
  - 0
7
8
  - 1
8
- - 2
9
- version: 0.1.2
9
+ version: 1.0.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jon Druse
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-12 00:00:00 -07:00
17
+ date: 2010-10-29 00:00:00 -07:00
18
18
  default_executable: screeninator
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -52,6 +52,7 @@ files:
52
52
  - lib/screeninator/assets/screen_config.screen
53
53
  - lib/screeninator/cli.rb
54
54
  - lib/screeninator/config_writer.rb
55
+ - lib/screeninator/helper.rb
55
56
  - screeninator.gemspec
56
57
  - test/helper.rb
57
58
  - test/test_screeninator.rb