pretty_chat 0.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.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ begin
4
+ require "pretty_chat"
5
+ rescue LoadError
6
+ require "rubygems"
7
+ require "pretty_chat"
8
+ end
9
+
10
+ puts PrettyChat::Parser.new(*ARGV).parse
@@ -0,0 +1,33 @@
1
+ module PrettyChat
2
+ class Parser
3
+ attr_accessor :input, :names, :padding, :output
4
+
5
+ def initialize(*names)
6
+ abort "You must provide a list of names of the chat participants." if names.empty?
7
+ self.input = `pbpaste`
8
+ self.names = names
9
+ self.output = []
10
+ end
11
+
12
+ def parse
13
+ names.each do |name|
14
+ input.gsub!(/^#{name}\n/, "#{name}: ")
15
+ input.gsub!(/^\d{1,2}:\d{2}\n/, "")
16
+ end
17
+
18
+ current_name = ""
19
+
20
+ input.each_line do |line|
21
+ matches = line.match(/^([\w\s]+): /)
22
+ if matches
23
+ current_name = matches[1]
24
+ else
25
+ line = "#{current_name}: #{line}"
26
+ end
27
+ output << line
28
+ end
29
+
30
+ output.join
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,3 @@
1
+ module PrettyChat
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "pretty_chat/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "pretty_chat"
7
+ s.version = PrettyChat::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Jimmy Cuadra"]
10
+ s.email = ["jimmy@jimmycuadra.com"]
11
+ s.homepage = ""
12
+ s.summary = %q{A command line tool to clean up chat logs.}
13
+ s.description = %q{A command line tool to clean up chat logs.}
14
+
15
+ s.rubyforge_project = "pretty_chat"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pretty_chat
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Jimmy Cuadra
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-07-21 00:00:00 Z
14
+ dependencies: []
15
+
16
+ description: A command line tool to clean up chat logs.
17
+ email:
18
+ - jimmy@jimmycuadra.com
19
+ executables:
20
+ - pretty_chat
21
+ extensions: []
22
+
23
+ extra_rdoc_files: []
24
+
25
+ files:
26
+ - .gitignore
27
+ - Gemfile
28
+ - Rakefile
29
+ - bin/pretty_chat
30
+ - lib/pretty_chat.rb
31
+ - lib/pretty_chat/version.rb
32
+ - pretty_chat.gemspec
33
+ homepage: ""
34
+ licenses: []
35
+
36
+ post_install_message:
37
+ rdoc_options: []
38
+
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ requirements: []
54
+
55
+ rubyforge_project: pretty_chat
56
+ rubygems_version: 1.7.2
57
+ signing_key:
58
+ specification_version: 3
59
+ summary: A command line tool to clean up chat logs.
60
+ test_files: []
61
+
62
+ has_rdoc: