session 3.1.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +15 -0
  2. data/Rakefile +168 -25
  3. data/lib/session.rb +5 -1
  4. data/session.gemspec +27 -7
  5. metadata +29 -48
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YTU5NGVjNTY2YzY2MDYxOTk2ZjUwZjE4OWIxNTAyYzJkNjgzNDlkYg==
5
+ data.tar.gz: !binary |-
6
+ ZjdiMDUxYmRhZTc1OGEyMjE3ZTk2YjdlY2RkOTYzMjQ0M2QzYjA3MQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ OTI1YzZjNjMyZmU5NjEyZDc3OWE0MzFhNzI1YzYyZDgwNmE4NzRkNjJjOGY4
10
+ NGNiYzVlY2EzNTA3ZTEyM2VlYjVmMThlNzFiNTdlYjVkOTM2OTE5OTAzYzdk
11
+ ZjcxZTA0ODdmNTRkOGFmZGEzMzU2NTFkYTgwZTI0NzljYzNkOGM=
12
+ data.tar.gz: !binary |-
13
+ MmEyM2RmZDk2YTcxOTVhMzEwZDE4MjdjYTQ1MzNhNzViNmI0YzM2MTlmMzNk
14
+ NmQxM2U1YTczN2NkNzk1ODk3ODNlMzU1ODRmNTgwMWEwYzNhYzM5OWJmM2M5
15
+ YmY2MzA2NTQ2MTdkNDZjYjE0M2MzOTAxMDAzMjI4ZjUxZmViZDg=
data/Rakefile CHANGED
@@ -1,19 +1,69 @@
1
-
2
1
  This.rubyforge_project = 'codeforpeople'
3
2
  This.author = "Ara T. Howard"
4
3
  This.email = "ara.t.howard@gmail.com"
5
- This.homepage = "http://github.com/ahoward/#{ This.lib }/tree/master"
4
+ This.homepage = "https://github.com/ahoward/#{ This.lib }"
6
5
 
6
+ task :license do
7
+ open('LICENSE', 'w'){|fd| fd.puts "same as ruby's"}
8
+ end
7
9
 
8
10
  task :default do
9
- puts(Rake::Task.tasks.map{|task| task.name} - ['default'])
11
+ puts((Rake::Task.tasks.map{|task| task.name.gsub(/::/,':')} - ['default']).sort)
12
+ end
13
+
14
+ task :test do
15
+ run_tests!
16
+ end
17
+
18
+ namespace :test do
19
+ task(:unit){ run_tests!(:unit) }
20
+ task(:functional){ run_tests!(:functional) }
21
+ task(:integration){ run_tests!(:integration) }
22
+ end
23
+
24
+ def run_tests!(which = nil)
25
+ which ||= '**'
26
+ test_dir = File.join(This.dir, "test")
27
+ test_glob ||= File.join(test_dir, "#{ which }/**_test.rb")
28
+ test_rbs = Dir.glob(test_glob).sort
29
+
30
+ div = ('=' * 119)
31
+ line = ('-' * 119)
32
+
33
+ test_rbs.each_with_index do |test_rb, index|
34
+ testno = index + 1
35
+ command = "#{ This.ruby } -w -I ./lib -I ./test/lib #{ test_rb }"
36
+
37
+ puts
38
+ say(div, :color => :cyan, :bold => true)
39
+ say("@#{ testno } => ", :bold => true, :method => :print)
40
+ say(command, :color => :cyan, :bold => true)
41
+ say(line, :color => :cyan, :bold => true)
42
+
43
+ system(command)
44
+
45
+ say(line, :color => :cyan, :bold => true)
46
+
47
+ status = $?.exitstatus
48
+
49
+ if status.zero?
50
+ say("@#{ testno } <= ", :bold => true, :color => :white, :method => :print)
51
+ say("SUCCESS", :color => :green, :bold => true)
52
+ else
53
+ say("@#{ testno } <= ", :bold => true, :color => :white, :method => :print)
54
+ say("FAILURE", :color => :red, :bold => true)
55
+ end
56
+ say(line, :color => :cyan, :bold => true)
57
+
58
+ exit(status) unless status.zero?
59
+ end
10
60
  end
11
61
 
12
62
 
13
63
  task :gemspec do
14
- ignore_extensions = 'git', 'svn', 'tmp', /sw./, 'bak', 'gem'
15
- ignore_directories = 'pkg'
16
- ignore_files = 'test/log'
64
+ ignore_extensions = ['git', 'svn', 'tmp', /sw./, 'bak', 'gem']
65
+ ignore_directories = ['pkg']
66
+ ignore_files = ['test/log']
17
67
 
18
68
  shiteless =
19
69
  lambda do |list|
@@ -39,13 +89,15 @@ task :gemspec do
39
89
  version = This.version
40
90
  files = shiteless[Dir::glob("**/**")]
41
91
  executables = shiteless[Dir::glob("bin/*")].map{|exe| File.basename(exe)}
42
- has_rdoc = true #File.exist?('doc')
92
+ #has_rdoc = true #File.exist?('doc')
43
93
  test_files = "test/#{ lib }.rb" if File.file?("test/#{ lib }.rb")
44
94
  summary = object.respond_to?(:summary) ? object.summary : "summary: #{ lib } kicks the ass"
45
95
  description = object.respond_to?(:description) ? object.description : "description: #{ lib } kicks the ass"
96
+ license = object.respond_to?(:license) ? object.license : "same as ruby's"
46
97
 
47
- extensions = This.extensions
48
- if extensions.nil?
98
+ if This.extensions.nil?
99
+ This.extensions = []
100
+ extensions = This.extensions
49
101
  %w( Makefile configure extconf.rb ).each do |ext|
50
102
  extensions << ext if File.exists?(ext)
51
103
  end
@@ -67,16 +119,17 @@ task :gemspec do
67
119
  spec.platform = Gem::Platform::RUBY
68
120
  spec.summary = #{ lib.inspect }
69
121
  spec.description = #{ description.inspect }
122
+ spec.license = #{ license.inspect }
70
123
 
71
- spec.files = #{ files.inspect }
124
+ spec.files =\n#{ files.sort.pretty_inspect }
72
125
  spec.executables = #{ executables.inspect }
73
126
 
74
127
  spec.require_path = "lib"
75
128
 
76
- spec.has_rdoc = #{ has_rdoc.inspect }
77
129
  spec.test_files = #{ test_files.inspect }
78
- #spec.add_dependency 'lib', '>= version'
79
- spec.add_dependency 'fattr'
130
+
131
+ ### spec.add_dependency 'lib', '>= version'
132
+ #### spec.add_dependency 'map'
80
133
 
81
134
  spec.extensions.push(*#{ extensions.inspect })
82
135
 
@@ -89,19 +142,21 @@ task :gemspec do
89
142
  }
90
143
  end
91
144
 
92
- open("#{ lib }.gemspec", "w"){|fd| fd.puts template}
93
- This.gemspec = "#{ lib }.gemspec"
145
+ Fu.mkdir_p(This.pkgdir)
146
+ gemspec = "#{ lib }.gemspec"
147
+ open(gemspec, "w"){|fd| fd.puts(template)}
148
+ This.gemspec = gemspec
94
149
  end
95
150
 
96
151
  task :gem => [:clean, :gemspec] do
97
- Fu.mkdir_p This.pkgdir
152
+ Fu.mkdir_p(This.pkgdir)
98
153
  before = Dir['*.gem']
99
154
  cmd = "gem build #{ This.gemspec }"
100
155
  `#{ cmd }`
101
156
  after = Dir['*.gem']
102
157
  gem = ((after - before).first || after.first) or abort('no gem!')
103
- Fu.mv gem, This.pkgdir
104
- This.gem = File.basename(gem)
158
+ Fu.mv(gem, This.pkgdir)
159
+ This.gem = File.join(This.pkgdir, File.basename(gem))
105
160
  end
106
161
 
107
162
  task :readme do
@@ -125,8 +180,8 @@ task :readme do
125
180
  end
126
181
 
127
182
  template =
128
- if test(?e, 'readme.erb')
129
- Template{ IO.read('readme.erb') }
183
+ if test(?e, 'README.erb')
184
+ Template{ IO.read('README.erb') }
130
185
  else
131
186
  Template {
132
187
  <<-__
@@ -157,9 +212,18 @@ task :release => [:clean, :gemspec, :gem] do
157
212
  gems = Dir[File.join(This.pkgdir, '*.gem')].flatten
158
213
  raise "which one? : #{ gems.inspect }" if gems.size > 1
159
214
  raise "no gems?" if gems.size < 1
160
- cmd = "rubyforge login && rubyforge add_release #{ This.rubyforge_project } #{ This.lib } #{ This.version } #{ This.pkgdir }/#{ This.gem }"
215
+
216
+ cmd = "gem push #{ This.gem }"
217
+ puts cmd
218
+ puts
219
+ system(cmd)
220
+ abort("cmd(#{ cmd }) failed with (#{ $?.inspect })") unless $?.exitstatus.zero?
221
+
222
+ cmd = "rubyforge login && rubyforge add_release #{ This.rubyforge_project } #{ This.lib } #{ This.version } #{ This.gem }"
161
223
  puts cmd
162
- system cmd
224
+ puts
225
+ system(cmd)
226
+ abort("cmd(#{ cmd }) failed with (#{ $?.inspect })") unless $?.exitstatus.zero?
163
227
  end
164
228
 
165
229
 
@@ -167,26 +231,38 @@ end
167
231
 
168
232
 
169
233
  BEGIN {
234
+ # support for this rakefile
235
+ #
170
236
  $VERBOSE = nil
171
237
 
172
238
  require 'ostruct'
173
239
  require 'erb'
174
240
  require 'fileutils'
241
+ require 'rbconfig'
242
+ require 'pp'
175
243
 
244
+ # fu shortcut
245
+ #
176
246
  Fu = FileUtils
177
247
 
248
+ # cache a bunch of stuff about this rakefile/environment
249
+ #
178
250
  This = OpenStruct.new
179
251
 
180
252
  This.file = File.expand_path(__FILE__)
181
253
  This.dir = File.dirname(This.file)
182
254
  This.pkgdir = File.join(This.dir, 'pkg')
183
255
 
256
+ # grok lib
257
+ #
184
258
  lib = ENV['LIB']
185
259
  unless lib
186
- lib = File.basename(Dir.pwd)
260
+ lib = File.basename(Dir.pwd).sub(/[-].*$/, '')
187
261
  end
188
262
  This.lib = lib
189
263
 
264
+ # grok version
265
+ #
190
266
  version = ENV['VERSION']
191
267
  unless version
192
268
  require "./lib/#{ This.lib }"
@@ -196,9 +272,22 @@ BEGIN {
196
272
  end
197
273
  This.version = version
198
274
 
275
+ # we need to know the name of the lib an it's version
276
+ #
199
277
  abort('no lib') unless This.lib
200
278
  abort('no version') unless This.version
201
279
 
280
+ # discover full path to this ruby executable
281
+ #
282
+ c = Config::CONFIG
283
+ bindir = c["bindir"] || c['BINDIR']
284
+ ruby_install_name = c['ruby_install_name'] || c['RUBY_INSTALL_NAME'] || 'ruby'
285
+ ruby_ext = c['EXEEXT'] || ''
286
+ ruby = File.join(bindir, (ruby_install_name + ruby_ext))
287
+ This.ruby = ruby
288
+
289
+ # some utils
290
+ #
202
291
  module Util
203
292
  def indent(s, n = 2)
204
293
  s = unindent(s)
@@ -208,7 +297,7 @@ BEGIN {
208
297
 
209
298
  def unindent(s)
210
299
  indent = nil
211
- s.each do |line|
300
+ s.each_line do |line|
212
301
  next if line =~ %r/^\s*$/
213
302
  indent = line[%r/^\s*/] and break
214
303
  end
@@ -217,17 +306,71 @@ BEGIN {
217
306
  extend self
218
307
  end
219
308
 
309
+ # template support
310
+ #
220
311
  class Template
221
312
  def initialize(&block)
222
313
  @block = block
223
314
  @template = block.call.to_s
224
315
  end
225
316
  def expand(b=nil)
226
- ERB.new(Util.unindent(@template)).result(b||@block)
317
+ ERB.new(Util.unindent(@template)).result((b||@block).binding)
227
318
  end
228
319
  alias_method 'to_s', 'expand'
229
320
  end
230
321
  def Template(*args, &block) Template.new(*args, &block) end
231
322
 
323
+ # colored console output support
324
+ #
325
+ This.ansi = {
326
+ :clear => "\e[0m",
327
+ :reset => "\e[0m",
328
+ :erase_line => "\e[K",
329
+ :erase_char => "\e[P",
330
+ :bold => "\e[1m",
331
+ :dark => "\e[2m",
332
+ :underline => "\e[4m",
333
+ :underscore => "\e[4m",
334
+ :blink => "\e[5m",
335
+ :reverse => "\e[7m",
336
+ :concealed => "\e[8m",
337
+ :black => "\e[30m",
338
+ :red => "\e[31m",
339
+ :green => "\e[32m",
340
+ :yellow => "\e[33m",
341
+ :blue => "\e[34m",
342
+ :magenta => "\e[35m",
343
+ :cyan => "\e[36m",
344
+ :white => "\e[37m",
345
+ :on_black => "\e[40m",
346
+ :on_red => "\e[41m",
347
+ :on_green => "\e[42m",
348
+ :on_yellow => "\e[43m",
349
+ :on_blue => "\e[44m",
350
+ :on_magenta => "\e[45m",
351
+ :on_cyan => "\e[46m",
352
+ :on_white => "\e[47m"
353
+ }
354
+ def say(phrase, *args)
355
+ options = args.last.is_a?(Hash) ? args.pop : {}
356
+ options[:color] = args.shift.to_s.to_sym unless args.empty?
357
+ keys = options.keys
358
+ keys.each{|key| options[key.to_s.to_sym] = options.delete(key)}
359
+
360
+ color = options[:color]
361
+ bold = options.has_key?(:bold)
362
+
363
+ parts = [phrase]
364
+ parts.unshift(This.ansi[color]) if color
365
+ parts.unshift(This.ansi[:bold]) if bold
366
+ parts.push(This.ansi[:clear]) if parts.size > 1
367
+
368
+ method = options[:method] || :puts
369
+
370
+ Kernel.send(method, parts.join)
371
+ end
372
+
373
+ # always run out of the project dir
374
+ #
232
375
  Dir.chdir(This.dir)
233
376
  }
@@ -5,9 +5,13 @@ require 'yaml'
5
5
  require 'tempfile'
6
6
 
7
7
  module Session
8
- VERSION = '3.1.0'
8
+ VERSION = '3.1.1'
9
9
  def self.version() VERSION end
10
10
 
11
+ def Session.description
12
+ 'persistent connections with external programs like bash'
13
+ end
14
+
11
15
  @track_history = ENV['SESSION_HISTORY'] || ENV['SESSION_TRACK_HISTORY']
12
16
  @use_spawn = ENV['SESSION_USE_SPAWN']
13
17
  @use_open3 = ENV['SESSION_USE_OPEN3']
@@ -3,25 +3,45 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "session"
6
- spec.version = "3.1.0"
6
+ spec.version = "3.1.1"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "session"
9
- spec.description = "description: session kicks the ass"
9
+ spec.description = "persistent connections with external programs like bash"
10
+ spec.license = "same as ruby's"
11
+
12
+ spec.files =
13
+ ["LICENSE",
14
+ "README",
15
+ "Rakefile",
16
+ "gemspec.rb",
17
+ "lib",
18
+ "lib/session.rb",
19
+ "sample",
20
+ "sample/bash.rb",
21
+ "sample/bash.rb.out",
22
+ "sample/driver.rb",
23
+ "sample/session_idl.rb",
24
+ "sample/session_sh.rb",
25
+ "sample/sh0.rb",
26
+ "sample/stdin.rb",
27
+ "sample/threadtest.rb",
28
+ "session.gemspec",
29
+ "test",
30
+ "test/session.rb"]
10
31
 
11
- spec.files = ["gemspec.rb", "lib", "lib/session.rb", "LICENSE", "Rakefile", "README", "sample", "sample/bash.rb", "sample/bash.rb.out", "sample/driver.rb", "sample/session_idl.rb", "sample/session_sh.rb", "sample/sh0.rb", "sample/stdin.rb", "sample/threadtest.rb", "session.gemspec", "test", "test/session.rb"]
12
32
  spec.executables = []
13
33
 
14
34
  spec.require_path = "lib"
15
35
 
16
- spec.has_rdoc = true
17
36
  spec.test_files = "test/session.rb"
18
- #spec.add_dependency 'lib', '>= version'
19
- spec.add_dependency 'fattr'
37
+
38
+ ### spec.add_dependency 'lib', '>= version'
39
+ #### spec.add_dependency 'map'
20
40
 
21
41
  spec.extensions.push(*[])
22
42
 
23
43
  spec.rubyforge_project = "codeforpeople"
24
44
  spec.author = "Ara T. Howard"
25
45
  spec.email = "ara.t.howard@gmail.com"
26
- spec.homepage = "http://github.com/ahoward/session/tree/master"
46
+ spec.homepage = "https://github.com/ahoward/session"
27
47
  end
metadata CHANGED
@@ -1,41 +1,26 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: session
3
- version: !ruby/object:Gem::Version
4
- version: 3.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.1.1
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Ara T. Howard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
-
12
- date: 2010-05-20 00:00:00 -06:00
13
- default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: fattr
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0"
24
- version:
25
- description: "description: session kicks the ass"
11
+ date: 2014-02-15 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: persistent connections with external programs like bash
26
14
  email: ara.t.howard@gmail.com
27
15
  executables: []
28
-
29
16
  extensions: []
30
-
31
17
  extra_rdoc_files: []
32
-
33
- files:
34
- - gemspec.rb
35
- - lib/session.rb
18
+ files:
36
19
  - LICENSE
37
- - Rakefile
38
20
  - README
21
+ - Rakefile
22
+ - gemspec.rb
23
+ - lib/session.rb
39
24
  - sample/bash.rb
40
25
  - sample/bash.rb.out
41
26
  - sample/driver.rb
@@ -46,33 +31,29 @@ files:
46
31
  - sample/threadtest.rb
47
32
  - session.gemspec
48
33
  - test/session.rb
49
- has_rdoc: true
50
- homepage: http://github.com/ahoward/session/tree/master
51
- licenses: []
52
-
34
+ homepage: https://github.com/ahoward/session
35
+ licenses:
36
+ - same as ruby's
37
+ metadata: {}
53
38
  post_install_message:
54
39
  rdoc_options: []
55
-
56
- require_paths:
40
+ require_paths:
57
41
  - lib
58
- required_ruby_version: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: "0"
63
- version:
64
- required_rubygems_version: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: "0"
69
- version:
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
70
52
  requirements: []
71
-
72
53
  rubyforge_project: codeforpeople
73
- rubygems_version: 1.3.5
54
+ rubygems_version: 2.0.3
74
55
  signing_key:
75
- specification_version: 3
56
+ specification_version: 4
76
57
  summary: session
77
- test_files:
58
+ test_files:
78
59
  - test/session.rb