jabber-tee 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,40 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jabber-tee (0.1.1)
5
+ choosy (>= 0.4.8)
6
+ highline (>= 1.5.2)
7
+ xmpp4r (>= 0.5)
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ ZenTest (4.5.0)
13
+ autotest (4.4.6)
14
+ ZenTest (>= 4.4.1)
15
+ autotest-notification (2.3.1)
16
+ autotest (~> 4.3)
17
+ choosy (0.4.8)
18
+ diff-lcs (1.1.2)
19
+ highline (1.6.1)
20
+ rspec (2.5.0)
21
+ rspec-core (~> 2.5.0)
22
+ rspec-expectations (~> 2.5.0)
23
+ rspec-mocks (~> 2.5.0)
24
+ rspec-core (2.5.1)
25
+ rspec-expectations (2.5.0)
26
+ diff-lcs (~> 1.1.2)
27
+ rspec-mocks (2.5.0)
28
+ xmpp4r (0.5)
29
+
30
+ PLATFORMS
31
+ ruby
32
+
33
+ DEPENDENCIES
34
+ autotest
35
+ autotest-notification
36
+ choosy (>= 0.4.8)
37
+ highline (>= 1.5.2)
38
+ jabber-tee!
39
+ rspec
40
+ xmpp4r (>= 0.5)
data/README.markdown CHANGED
@@ -13,6 +13,14 @@ The command line tool can be installed with:
13
13
  The general idea is that you can pipe anything from the console into this, and it will be sent to the remote jabber server:
14
14
 
15
15
  cat huge_text_file.txt | jabber-tee -u peon@bigcorp.com --room working-hard@rooms.bigcorp.com --nick 'Worker Drone'
16
+
17
+ or
18
+
19
+ echo "I am $(whoami) at $(hostname)" | jabber-tee --to somebody@somewhere.com
20
+
21
+ Alternatively, you can supply a list of arguments that will be run as a command, which is essentially equivalent:
22
+
23
+ jabber-tee --to somebody@somewhere.com -- echo "I am $(whoami) at $(hostname)"
16
24
 
17
25
  # Configuration
18
26
 
@@ -24,12 +32,13 @@ An example configuration file:
24
32
  username: my.name@jabber.org
25
33
  nick: 'Gabe'
26
34
 
27
- # Individual profiles that customize global variables
35
+ # Individual profiles that customize global variables
28
36
  profiles:
29
37
  new-hotness:
30
38
  # Uses the standard username, above
31
39
  nick: 'Mr. Super Cool'
32
40
  room: 'HipCentral'
41
+ password: 'secret'
33
42
 
34
43
  somebody.else:
35
44
  username: supercooldude@gmail.com
data/Rakefile CHANGED
@@ -4,52 +4,16 @@ $LOAD_PATH.unshift File.expand_path("../spec", __FILE__)
4
4
  require 'fileutils'
5
5
  require 'rake'
6
6
  require 'rubygems'
7
- require 'spec/rake/spectask'
8
- require 'jabber-tee/version'
7
+ require 'rspec/core/rake_task'
8
+ require 'choosy/rake'
9
9
 
10
10
  task :default => :spec
11
11
 
12
12
  desc "Run the RSpec tests"
13
- Spec::Rake::SpecTask.new(:spec) do |t|
14
- t.spec_files = FileList['spec/**/*_spec.rb']
15
- t.spec_opts = ['-b', '-c', '-f', 'p']
16
- t.fail_on_error = false
17
- end
18
-
19
- begin
20
- require 'jeweler'
21
- Jeweler::Tasks.new do |gem|
22
- gem.name = 'jabber-tee'
23
- gem.version = JabberTee::Version.to_s
24
- gem.executables = %W{jabber-tee}
25
- gem.summary = 'Simple command line utility for piping the output from one command to both the console and a remote jabber server.'
26
- gem.description = "Installs the 'jabber-tee' utility for sending messages to a remote jabber server. Instead of a standard client, it reads from standard in and continues to write to the console."
27
- gem.email = ['madeonamac@gmail.com']
28
- gem.authors = ['Gabe McArthur']
29
- gem.homepage = 'http://github.com/gabemc/jabber-tee'
30
- gem.files = FileList["[A-Z]*", "{bin,lib,spec}/**/*"]
31
-
32
- gem.add_dependency 'highline', '>=1.5.2'
33
- gem.add_dependency 'xmpp4r', '>=0.5'
34
-
35
- gem.add_development_dependency 'rspec', '>=1.3.0'
36
- end
37
- rescue LoadError
38
- puts "Jeweler or dependencies are not available. Install it with: sudo gem install jeweler"
39
- end
13
+ RSpec::Core::RakeTask.new :spec
40
14
 
41
- desc "Deploys the gem to rubygems.org"
42
- task :gem => :release do
43
- system("gem build jabber-tee.gemspec")
44
- system("gem push jabber-tee-#{JabberTee::Version.to_s}.gem")
45
- end
46
-
47
- desc "Does the full release cycle."
48
15
  task :deploy => [:gem, :clean] do
49
16
  end
50
17
 
51
18
  desc "Cleans the gem files up."
52
- task :clean do
53
- FileUtils.rm(Dir.glob('*.gemspec'))
54
- FileUtils.rm(Dir.glob('*.gem'))
55
- end
19
+ task :clean => ['gem:clean']
data/bin/jabber-tee CHANGED
@@ -2,4 +2,4 @@
2
2
  $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
3
 
4
4
  require 'jabber-tee/cli'
5
- JabberTee::CLI.new(ARGV).execute!
5
+ JabberTee::CLI.new.execute!(ARGV)
data/lib/VERSION.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ version:
3
+ major: 0
4
+ minor: 2
5
+ tiny: 0
6
+ date: 31/03/2011
@@ -1,164 +1,52 @@
1
- require 'optparse'
2
1
  require 'jabber-tee/errors'
3
- require 'jabber-tee/version'
4
- require 'jabber-tee/client'
5
- require 'jabber-tee/configuration'
2
+ require 'jabber-tee/executor'
3
+ require 'choosy'
6
4
 
7
5
  module JabberTee
8
6
  class CLI
9
- attr_reader :options, :args
10
-
11
- def initialize(args)
12
- @args = args
13
- end
14
-
15
- def execute!
16
- begin
17
- parse!(@args.dup)
18
- config = load_configuration
19
-
20
- if config.destination_missing?
21
- raise JabberTee::ConfigurationError.new("Either the --to or --room flag is required.")
22
- end
23
-
24
- client = Client.new(config)
25
- client.pump!
26
- rescue SystemExit => e
27
- raise
28
- rescue JabberTee::ConfigurationError => e
29
- print_error(e.message)
30
- rescue OptionParser::InvalidOption => e
31
- print_error(e.message)
32
- rescue Exception => e
33
- STDERR.puts e.backtrace
34
- print_error(e.message)
35
- end
7
+ def execute!(args)
8
+ command.execute!(args)
36
9
  end
37
10
 
38
- def parse!(args)
39
- parse_options(args)
40
- validate_args(args)
11
+ def parse!(args, propagate=false)
12
+ command.parse!(args, propagate)
41
13
  end
42
14
 
43
- def parse_options(args)
44
- @options ||= {}
45
- @parsed_options ||= OptionParser.new do |opts|
46
- opts.banner = "Usage: #{File.basename($0)} [OPTIONS] "
47
- opts.separator <<DESC
48
- Description:
49
- This is a simple tool for reading from STDIN and writing
50
- to both STDOUT and a remote jabber server. It does not handle
51
- reading from STDERR, so you will need to re-direct 2>&1 before
52
- piping it to this tool.
15
+ def command
16
+ Choosy::Command.new :'jabber-tee' do
17
+ printer :standard
18
+ executor Executor.new
53
19
 
54
- The configuration file should live under ~/.jabber-tee.yml.
55
- Please see http://github.com/gabemc/jabber-tee for more
56
- information.
57
-
58
- Options:
59
- DESC
60
- opts.separator " Connecting:"
61
- opts.on('-u', '--username USERNAME',
62
- "The user@host.org name to connect",
63
- "to the jabber server.") do |u|
64
- options[:username] = u
65
- end
66
- opts.on('-p', '--password PASSWORD',
67
- "The password for the user to connect",
68
- "to the jabber server. If not given",
69
- "it must be defined in your",
70
- "~/.jabber-tee.yml file.") do |p|
71
- options[:password] = p
72
- end
73
- opts.on('-n', '--nick NICKNAME',
74
- "The nickname to use when connecting",
75
- "to the server.") do |n|
76
- options[:nick] = n
77
- end
78
- =begin
79
- opts.on('-a', '--anonymous',
80
- "Disregards the username information and",
81
- "logs in using anonymous authentication.") do |a|
82
- options[:anonymous] = true
83
- end
84
- =end
85
- opts.on('-P', '--profile PROFILE',
86
- "The name of the profile, as defined in",
87
- "the ~/.jabber-tee.yml file to use to",
88
- "connect with.") do |p|
89
- options[:profile] = p
90
- end
91
- =begin
92
- opts.on('--sasl',
93
- "By default, the connection does not",
94
- "use SASL authentication.",
95
- "This enables SASL connections") do |s|
96
- options[:sasl] = true
20
+ section 'Description:' do
21
+ para 'This is a simple tool for reading from STDIN and writing to both STDOUT and a remote jabber server. It does not handle reading from STDERR, so you will need to re-direct 2>&1 before piping it to this tool.'
22
+ para 'The configuration file should live under ~/.jabber-tee.yml. Please see http://github.com/gabemc/jabber-tee for more information.'
97
23
  end
98
- opts.on('--digest',
99
- "When not using SASL, you can use the digest",
100
- "authentication mechanism.") do |d|
101
- options[:digest] = true
102
- end
103
- =end
104
- opts.separator ""
105
24
 
106
- opts.separator " Output: (One required)"
107
- opts.on('-t', '--to TO',
108
- "Who to send the message to.") do |t|
109
- options[:to] = t
110
- end
111
- opts.on('-r', '--room ROOM',
112
- "The room to send the messages to.") do |r|
113
- options[:room] = r
25
+ section 'Connections:' do
26
+ string :username, "The user@host.org name used to connect to the jabber server."
27
+ string :password, "The password for the user to connect with to the jabber server. If not given, it must be defined in your configuration file."
28
+ string :nick, "The nickname to use when connecting to the server."
29
+ string :Profile, "The name of the profile defined in the ~/.jabber-tee.yml or /etc/jabber-tee.yml configuration file to connect with."
30
+ #string :anonymous, "Disregards the username information and logs in using anonymous authentication."
31
+ #boolean_ :sasl, "By default, the connection does not use SASL authentication. This enables SASL connections."
32
+ #boolean_ :digest, "When not using SASL, you can use the digest authentication mechanism."
114
33
  end
115
- opts.separator ""
116
34
 
117
- opts.separator " Informative:"
118
- opts.on('-v', '--version',
119
- "Show the version information") do |v|
120
- puts "#{File.basename($0)} version: #{JabberTee::Version.to_s}"
121
- exit
122
- end
123
- opts.on('-h', '--help',
124
- "Show this help message") do
125
- puts opts
126
- exit
35
+ section 'Ouput: (One required)' do
36
+ string :to, "Who to send the message to."
37
+ string :room, "The room to send the messages to."
127
38
  end
128
- opts.separator ""
129
-
130
- end.parse!(args)
131
- end
132
-
133
- def validate_args(args)
134
- if args.length > 0
135
- raise JabberTee::ConfigurationError.new("This command takes no extra arguments: #{args[0]}")
136
- end
137
- end
138
-
139
- private
140
- def print_error(e)
141
- STDERR.puts "#{File.basename($0)}: #{e}"
142
- STDERR.puts "#{File.basename($0)}: Try '--help' for more information"
143
- exit 1
144
- end
145
-
146
- JABBER_FILE = '.jabber-tee.yml'
147
39
 
148
- def load_configuration
149
- home = ENV['HOME'] # TODO: Windows users?
150
- config_file = File.join(home, JABBER_FILE)
40
+ section 'Informative:' do
41
+ help
42
+ version Choosy::Version.load_from_parent
43
+ end
151
44
 
152
- if File.exists?(config_file)
153
- reader = ConfigurationReader.new(config_file)
154
- if options.has_key?(:profile)
155
- reader.profile(options[:profile]).merge(options)
156
- else
157
- reader.profile.merge(options)
45
+ arguments do |builder|
46
+ metaname '[-- COMMAND]'
47
+ count :at_least => 0
158
48
  end
159
- else
160
- Configuration.new(options)
161
49
  end
162
50
  end
163
- end # CLI
51
+ end#CLI
164
52
  end
@@ -1,6 +1,4 @@
1
1
  require 'jabber-tee/errors'
2
-
3
- require 'rubygems'
4
2
  require 'xmpp4r'
5
3
  require 'xmpp4r/muc'
6
4
 
@@ -20,20 +18,8 @@ module JabberTee
20
18
  end
21
19
  end
22
20
 
23
- def pump!
24
- if $stdin.tty?
25
- $STDERR.puts "Unable to pipe jabber-tee from a TTY"
26
- exit(1)
27
- else
28
- $stdin.each do |line|
29
- line.chomp!
30
- say(line)
31
- puts line
32
- end
33
- end
34
- end
35
-
36
21
  def say(message)
22
+ message.chomp!
37
23
  if config.in_room?
38
24
  @muc.say(message)
39
25
  else
@@ -1,20 +1,15 @@
1
1
  require 'jabber-tee/errors'
2
-
3
- require 'rubygems'
4
2
  require 'highline/import'
5
3
  require 'yaml'
6
4
 
7
5
  module JabberTee
8
-
9
6
  class ConfigurationReader
10
7
  def initialize(yaml_file)
11
8
  if !File.exists?(yaml_file)
12
9
  raise JabberTee::ConfigurationError.new("Unable to locate the configuration file.")
13
10
  end
14
11
 
15
- yaml = nil
16
- file = File.open(yaml_file) {|f| yaml = f.read }
17
- @config = YAML::load(yaml)
12
+ @config = YAML::load_file(yaml_file)
18
13
  end
19
14
 
20
15
  def profile(name=nil)
@@ -28,7 +23,7 @@ module JabberTee
28
23
  end
29
24
  profile = profiles[name]
30
25
  if profile.nil?
31
- raise JabberTee::ConfigurationError.new("Unable to load the #{name} profile from your home configuration.")
26
+ raise JabberTee::ConfigurationError.new("Unable to load the '#{name}' profile from your home configuration.")
32
27
  end
33
28
  config.merge(profile)
34
29
  end
@@ -36,46 +31,34 @@ module JabberTee
36
31
  end
37
32
 
38
33
  class Configuration
39
- ATTRIBUTES = ['username', 'nick', 'password', 'anonymous', 'sasl', 'digest', 'room', 'to']
34
+ ATTRIBUTES = [:username, :nick, :password, :anonymous, :room, :to]
40
35
 
41
36
  attr_reader :username, :nick, :to, :room
42
37
 
43
38
  def initialize(options=nil)
39
+ @username = @nick = @to = @room = @anonymous = @password = nil
44
40
  if !options.nil?
45
41
  merge(options)
46
42
  end
47
43
  end
48
44
 
49
- def merge(options)
50
- #self if options.nil?
45
+ def merge(options=nil)
46
+ return self if options.nil?
51
47
  ATTRIBUTES.each do |attr|
52
- if options.has_key?(attr.to_sym) || options.has_key?(attr)
53
- value = options[attr.to_sym] || options[attr]
54
- instance_variable_set("@#{attr}", value)
55
- end
48
+ value = options[attr] || options[attr.to_s]
49
+ instance_variable_set("@#{attr}", value) if value
56
50
  end
57
51
  self
58
52
  end
59
53
 
60
54
  def password
61
- if @password.nil?
62
- @password = ask("#{username}: password: ") {|q| q.echo = false }
63
- end
64
- @password
55
+ @password ||= ask("#{username}: password: ") {|q| q.echo = false }
65
56
  end
66
57
 
67
58
  def anonymous?
68
59
  !@anonymous.nil? && username.nil?
69
60
  end
70
61
 
71
- def sasl?
72
- !@sasl.nil?
73
- end
74
-
75
- def digest?
76
- !@digest.nil?
77
- end
78
-
79
62
  def in_room?
80
63
  !@room.nil?
81
64
  end
@@ -83,9 +66,5 @@ module JabberTee
83
66
  def destination_missing?
84
67
  @room.nil? && @to.nil?
85
68
  end
86
-
87
- def to_s
88
- "<JabberTee::Configuration{:username => '#{username}', :room => '#{room}', :to => '#{to}', :anonymous => #{anonymous?}, :sasl => #{sasl?}}>"
89
- end
90
69
  end
91
70
  end
@@ -0,0 +1,69 @@
1
+ require 'jabber-tee/errors'
2
+ require 'jabber-tee/client'
3
+ require 'jabber-tee/configuration'
4
+ require 'choosy/terminal'
5
+
6
+ module JabberTee
7
+ class Executor
8
+ include Choosy::Terminal
9
+
10
+ JABBER_FILE_LOCATIONS = [
11
+ File.join(ENV['HOME'], '.jabber-tee.yml'),
12
+ '/etc/jabber-tee.yml'
13
+ ]
14
+
15
+ def execute!(args, options)
16
+ command = format_command(args)
17
+ if command && stdin?
18
+ die "Cannot both execute command and read from STDIN"
19
+ elsif command.nil? && !stdin?
20
+ die "Unable to read from STDIN"
21
+ end
22
+
23
+ client = create_client(options)
24
+ code = pipe_in(command) do |line|
25
+ client.say(line)
26
+ puts line
27
+ end
28
+
29
+ exit code.to_i
30
+ end
31
+
32
+ private
33
+ def create_client(options)
34
+ config = load_configuration(options)
35
+ if config.destination_missing?
36
+ die "Either the --to or --room flag is required."
37
+ end
38
+
39
+ Client.new(config)
40
+ end
41
+
42
+ def format_command(args)
43
+ if args.length > 0
44
+ if !command_exists?(args[0])
45
+ die "Not a recognized command: #{args[0]}"
46
+ else
47
+ args.join(' ')
48
+ end
49
+ else
50
+ nil
51
+ end
52
+ end
53
+
54
+ def load_configuration(options)
55
+ begin
56
+ config_file = JABBER_FILE_LOCATIONS.select {|l| File.exists?(l)}
57
+
58
+ if !config_file.nil? && File.exists?(config_file[0])
59
+ reader = ConfigurationReader.new(config_file[0])
60
+ reader.profile(options[:Profile]).merge(options)
61
+ else
62
+ Configuration.new(options)
63
+ end
64
+ rescue JabberTee::ConfigurationError => e
65
+ die e.message
66
+ end
67
+ end
68
+ end
69
+ end
@@ -44,16 +44,6 @@ module JabberTee
44
44
  c.anonymous?.should be(false)
45
45
  end
46
46
 
47
- it "should set SASL mode to false by default" do
48
- c = Configuration.new
49
- c.sasl?.should be(false)
50
- end
51
-
52
- it "should set the digest mode to false by default" do
53
- c = Configuration.new
54
- c.digest?.should be(false)
55
- end
56
-
57
47
  it "should se the 'in_room?' attribute to false by default" do
58
48
  c = Configuration.new
59
49
  c.in_room?.should be(false)
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jabber-tee
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
- - 1
9
- - 1
10
- version: 0.1.1
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Gabe McArthur
@@ -15,8 +14,8 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-09-24 00:00:00 -07:00
19
- default_executable: jabber-tee
17
+ date: 2011-03-31 00:00:00 -07:00
18
+ default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: highline
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 7
30
28
  segments:
31
29
  - 1
32
30
  - 5
@@ -42,7 +40,6 @@ dependencies:
42
40
  requirements:
43
41
  - - ">="
44
42
  - !ruby/object:Gem::Version
45
- hash: 1
46
43
  segments:
47
44
  - 0
48
45
  - 5
@@ -50,21 +47,59 @@ dependencies:
50
47
  type: :runtime
51
48
  version_requirements: *id002
52
49
  - !ruby/object:Gem::Dependency
53
- name: rspec
50
+ name: choosy
54
51
  prerelease: false
55
52
  requirement: &id003 !ruby/object:Gem::Requirement
56
53
  none: false
57
54
  requirements:
58
55
  - - ">="
59
56
  - !ruby/object:Gem::Version
60
- hash: 27
61
57
  segments:
62
- - 1
63
- - 3
64
58
  - 0
65
- version: 1.3.0
66
- type: :development
59
+ - 4
60
+ - 8
61
+ version: 0.4.8
62
+ type: :runtime
67
63
  version_requirements: *id003
64
+ - !ruby/object:Gem::Dependency
65
+ name: rspec
66
+ prerelease: false
67
+ requirement: &id004 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ type: :development
76
+ version_requirements: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ name: autotest
79
+ prerelease: false
80
+ requirement: &id005 !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ segments:
86
+ - 0
87
+ version: "0"
88
+ type: :development
89
+ version_requirements: *id005
90
+ - !ruby/object:Gem::Dependency
91
+ name: autotest-notification
92
+ prerelease: false
93
+ requirement: &id006 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ segments:
99
+ - 0
100
+ version: "0"
101
+ type: :development
102
+ version_requirements: *id006
68
103
  description: Installs the 'jabber-tee' utility for sending messages to a remote jabber server. Instead of a standard client, it reads from standard in and continues to write to the console.
69
104
  email:
70
105
  - madeonamac@gmail.com
@@ -72,30 +107,31 @@ executables:
72
107
  - jabber-tee
73
108
  extensions: []
74
109
 
75
- extra_rdoc_files:
76
- - README.markdown
110
+ extra_rdoc_files: []
111
+
77
112
  files:
113
+ - Gemfile
78
114
  - README.markdown
115
+ - Gemfile.lock
79
116
  - Rakefile
80
117
  - bin/jabber-tee
81
- - lib/VERSION
118
+ - lib/jabber-tee/errors.rb
82
119
  - lib/jabber-tee/cli.rb
83
120
  - lib/jabber-tee/client.rb
121
+ - lib/jabber-tee/executor.rb
84
122
  - lib/jabber-tee/configuration.rb
85
- - lib/jabber-tee/errors.rb
86
- - lib/jabber-tee/version.rb
87
- - spec/cli_spec.rb
88
- - spec/configuration_spec.rb
123
+ - lib/VERSION.yml
89
124
  - spec/helpers.rb
90
- - spec/test-config-1.yaml
125
+ - spec/configuration_spec.rb
91
126
  - spec/test-config-2.yaml
127
+ - spec/test-config-1.yaml
92
128
  has_rdoc: true
93
129
  homepage: http://github.com/gabemc/jabber-tee
94
130
  licenses: []
95
131
 
96
132
  post_install_message:
97
- rdoc_options:
98
- - --charset=UTF-8
133
+ rdoc_options: []
134
+
99
135
  require_paths:
100
136
  - lib
101
137
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -103,7 +139,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
103
139
  requirements:
104
140
  - - ">="
105
141
  - !ruby/object:Gem::Version
106
- hash: 3
107
142
  segments:
108
143
  - 0
109
144
  version: "0"
@@ -112,7 +147,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
147
  requirements:
113
148
  - - ">="
114
149
  - !ruby/object:Gem::Version
115
- hash: 3
116
150
  segments:
117
151
  - 0
118
152
  version: "0"
@@ -123,7 +157,5 @@ rubygems_version: 1.3.7
123
157
  signing_key:
124
158
  specification_version: 3
125
159
  summary: Simple command line utility for piping the output from one command to both the console and a remote jabber server.
126
- test_files:
127
- - spec/helpers.rb
128
- - spec/configuration_spec.rb
129
- - spec/cli_spec.rb
160
+ test_files: []
161
+
data/lib/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.1.1
@@ -1,12 +0,0 @@
1
- require 'scanf'
2
-
3
- module JabberTee
4
- class Version
5
- CURRENT = File.read(File.dirname(__FILE__) + '/../VERSION')
6
- MAJOR, MINOR, TINY = CURRENT.scanf('%d.%d.%d')
7
-
8
- def self.to_s
9
- CURRENT
10
- end
11
- end
12
- end
data/spec/cli_spec.rb DELETED
@@ -1,72 +0,0 @@
1
- require 'helpers'
2
- require 'jabber-tee/cli'
3
-
4
- module JabberTee
5
-
6
- module CLIHelper
7
- def parse(*args)
8
- cli = CLI.new(args)
9
- cli.parse_options(args)
10
- cli
11
- end
12
-
13
- def validate(*args)
14
- cli = CLI.new(args)
15
- cli.parse_options(args)
16
- cli.validate_args(args)
17
- cli
18
- end
19
-
20
- def check(sym, flags, value)
21
- flags.each do |flag|
22
- if value.is_a?(String)
23
- parse(flag, value).options[sym].should eql(value)
24
- else
25
- parse(flag).options[sym].should eql(value)
26
- end
27
- end
28
- end
29
- end
30
-
31
- describe "Jabber Tee CLI interface" do
32
- include CLIHelper
33
-
34
- describe "when just checking arguments" do
35
- it "should parse the username correctly" do
36
- check(:username, ['-u', '--username'], 'someuser')
37
- end
38
-
39
- it "should parse the password correctly" do
40
- check(:password, ['-p', '--password'], 'super_!!_secret')
41
- end
42
- =begin
43
- it "should parse the sasl flag correctly" do
44
- check(:sasl, ['--sasl'], true)
45
- end
46
-
47
- it "should parse the digest flag correctly" do
48
- check(:digest, ['--digest'], true)
49
- end
50
- it "should parse the anonymous flag correctly" do
51
- check(:anonymous, ['-a', '--anonymous'], true)
52
- end
53
- =end
54
-
55
- it "should parse the room flag correctly" do
56
- check(:room, ['-r', '--room'], 'ROOM')
57
- end
58
-
59
- it "should parse the nickname flag correctly" do
60
- check(:nick, ['-n', '--nick'], 'nickname!')
61
- end
62
- end
63
-
64
- describe "while validating the arguments" do
65
- CE = JabberTee::ConfigurationError
66
-
67
- it "should fail when there are extra arguments" do
68
- attempting_to { validate('extra-arg') }.should raise_error(CE, /extra/)
69
- end
70
- end
71
- end
72
- end