blastr 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ == 0.0.1 2009-01-16
2
+
3
+ * Initial release containing a proof-of-concept quality implementation hacked
4
+ together during a classroom training on a completely unrelated topic.
@@ -0,0 +1,12 @@
1
+ History.txt
2
+ Manifest.txt
3
+ PostInstall.txt
4
+ README.rdoc
5
+ Rakefile
6
+ bin/blastr
7
+ lib/blastr.rb
8
+ script/console
9
+ script/destroy
10
+ script/generate
11
+ test/test_blastr.rb
12
+ test/test_helper.rb
@@ -0,0 +1,7 @@
1
+
2
+ For more information on blastr, see http://blastr.rubyforge.org
3
+
4
+ NOTE: Change this information in PostInstall.txt
5
+ You can also delete it if you don't want it.
6
+
7
+
@@ -0,0 +1,38 @@
1
+ = blastr
2
+
3
+ * http://blastr.rubyforge.org
4
+
5
+ == DESCRIPTION:
6
+
7
+ FIX (describe your package)
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * FIX (list of features or problems)
12
+
13
+ == SYNOPSIS:
14
+
15
+ FIX (code sample of usage)
16
+
17
+ == REQUIREMENTS:
18
+
19
+ * FIX (list of requirements)
20
+
21
+ == INSTALL:
22
+
23
+ * FIX (sudo gem install, anything else)
24
+
25
+ == LICENSE:
26
+
27
+ (The BSD License)
28
+
29
+ Copyright (c) 2009, Lasse Koskela
30
+ All rights reserved.
31
+
32
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
33
+
34
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
35
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
36
+ * Neither the name of this software nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
37
+
38
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,30 @@
1
+ %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
2
+ require File.dirname(__FILE__) + '/lib/blastr'
3
+
4
+ # Generate all the Rake tasks
5
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
6
+ $hoe = Hoe.new('blastr', Blastr::VERSION) do |p|
7
+ p.developer('Lasse Koskela', 'lasse.koskela@gmail.com')
8
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
9
+ #p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
10
+ p.rubyforge_name = p.name
11
+ # p.extra_deps = [
12
+ # ['activesupport','>= 2.0.2'],
13
+ # ]
14
+ p.extra_dev_deps = [
15
+ ['newgem', ">= #{::Newgem::VERSION}"]
16
+ ]
17
+ p.clean_globs |= %w[**/.DS_Store tmp *.log]
18
+ path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
19
+ #p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
20
+ p.remote_rdoc_dir = '' # Release to root
21
+ p.rsync_args = '-av --delete --ignore-errors'
22
+ p.bin_files = 'announce-svn-commits'
23
+ #puts "Methods on p:\n #{p.methods.sort.join(', ')}"
24
+ end
25
+
26
+ require 'newgem/tasks' # load /tasks/*.rake
27
+ Dir['tasks/**/*.rake'].each { |t| load t }
28
+
29
+ # TODO - want other tests/tasks run by default? Add them to the list
30
+ # task :default => [:spec, :features]
@@ -0,0 +1,138 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ PEOPLE = {
4
+ "vpeurala" => "Vill-eh Peurawla",
5
+ "mali" => "Timo Mali",
6
+ "jantti" => "Krista Jantti",
7
+ "mluo" => "Markku Luotamo",
8
+ "lkoskela" => "Lasse Koskela",
9
+ "apo" => "Mikko Apo",
10
+ "tpuronen" => "Timo Puronen",
11
+ "jari" => "Jari Makela",
12
+ "pvalkone" => "Petteri Valkonen",
13
+ "mhjort" => "Markus Hjort",
14
+ "jslindst" => "Jukka Lindstrom",
15
+ "smensola" => "Sami Mensola",
16
+ "tkarkk" => "Tuomas Kärkkäinen",
17
+ "phmietti" => "Petri Miettinen",
18
+ "ana" => "Antti Viljakainen",
19
+ "jalap" => "Janne Lappalainen",
20
+ "singen" => "Tuomas Hakkarainen",
21
+ "jaarnial" => "Jari Aarniala",
22
+ "minttu" => "Minttu Paukkunen",
23
+ "kkainu" => "Kalle Kainu",
24
+ "artsu" => "Ari Paartola",
25
+ "skarjula" => "Samuli Karjula",
26
+ "tjk" => "Teppo Kurki",
27
+ "jpaanane" => "Juha Paananen",
28
+ "harri.virtala@fi.ibm.com" => "Harri Virtala"
29
+ }
30
+
31
+ class TTSImplementation
32
+ attr_accessor :name
33
+ def initialize(name)
34
+ @name = name
35
+ end
36
+ def binary
37
+ %x[which #{@name}].strip
38
+ end
39
+ def available?
40
+ binary.empty? == false
41
+ end
42
+ def speak(msg)
43
+ %x[#{binary} "#{msg}"]
44
+ end
45
+ end
46
+
47
+ class Say < TTSImplementation
48
+ def initialize; super("say"); end
49
+ end
50
+
51
+ class Espeak < TTSImplementation
52
+ def initialize; super("espeak"); end
53
+ end
54
+
55
+ class Festival < TTSImplementation
56
+ def initialize; super("festival"); end
57
+ def speak(msg)
58
+ %x[echo "#{msg}" | #{binary} --tts]
59
+ end
60
+ end
61
+
62
+ def resolve_tts_system
63
+ return $tts unless $tts.nil?
64
+ [ Say.new, Espeak.new, Festival.new ].each do |impl|
65
+ return impl if impl.available?
66
+ end
67
+ raise "No TTS implementation found."
68
+ end
69
+
70
+ def speak(msg)
71
+ resolve_tts_system.speak(msg)
72
+ end
73
+
74
+ def full_name_of(username)
75
+ PEOPLE[username] ||= username
76
+ end
77
+
78
+ class LogEntry
79
+ attr_accessor :revision, :author, :comment
80
+ def initialize(revision, author, comment)
81
+ @revision = revision.to_i
82
+ @author = author
83
+ @comment = comment
84
+ end
85
+ def to_s
86
+ "revision #{@revision} by #{@author}: #{@comment}"
87
+ end
88
+ end
89
+
90
+ def content_of(file)
91
+ file = open(file)
92
+ content = file.read
93
+ file.close
94
+ content
95
+ end
96
+
97
+ def svn_log(working_copy_path, since_revision = 1)
98
+ revision = "#{since_revision}:HEAD"
99
+ revision = "HEAD" if since_revision == "HEAD"
100
+ cmd = "svn log #{working_copy_path} -r #{revision} > /tmp/svn.log"
101
+ system(cmd)
102
+ content_of("/tmp/svn.log")
103
+ end
104
+
105
+ def svn_log_entries(working_copy_path, since_revision = 1)
106
+ entries = []
107
+ svn_log(working_copy_path, since_revision).scan(/r(\d+)\s\|\s(.*?)\s\|.*?\n\n(.*)\n-+/).each do |entry|
108
+ entries << LogEntry.new(*entry)
109
+ end
110
+ entries
111
+ end
112
+
113
+ def latest_revision(working_copy_path)
114
+ entries = svn_log_entries(working_copy_path, "HEAD")
115
+ return entries.first.revision unless entries.empty?
116
+ 1
117
+ end
118
+
119
+ wc_path = "."
120
+ wc_path = ARGV[0] if ARGV.size > 0
121
+ revision = latest_revision(wc_path)
122
+ revision = ARGV[1].to_i if ARGV.size > 1
123
+
124
+ puts "svn path: #{wc_path}\nrevision: #{revision}\n"
125
+ speak("Observing Subversion for commits...")
126
+
127
+ while true do
128
+ svn_log_entries(wc_path, revision).each do |entry|
129
+ if entry.revision.to_i > revision
130
+ msg = "revision #{entry.revision} by #{full_name_of(entry.author)}: #{entry.comment}"
131
+ puts msg
132
+ speak(msg)
133
+ revision = entry.revision
134
+ end
135
+ end
136
+ sleep 15
137
+ end
138
+
@@ -0,0 +1,6 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ module Blastr
5
+ VERSION = '0.0.1'
6
+ end
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/blastr.rb'}"
9
+ puts "Loading blastr gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestBlastr < Test::Unit::TestCase
4
+
5
+ def setup
6
+ end
7
+
8
+ def test_truth
9
+ assert true
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ require 'stringio'
2
+ require 'test/unit'
3
+ require File.dirname(__FILE__) + '/../lib/blastr'
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blastr
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Lasse Koskela
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-01-16 00:00:00 +02:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: newgem
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.2.3
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: hoe
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.8.0
34
+ version:
35
+ description: FIX (describe your package)
36
+ email:
37
+ - lasse.koskela@gmail.com
38
+ executables:
39
+ - blastr
40
+ extensions: []
41
+
42
+ extra_rdoc_files:
43
+ - History.txt
44
+ - Manifest.txt
45
+ - PostInstall.txt
46
+ - README.rdoc
47
+ files:
48
+ - History.txt
49
+ - Manifest.txt
50
+ - PostInstall.txt
51
+ - README.rdoc
52
+ - Rakefile
53
+ - bin/blastr
54
+ - lib/blastr.rb
55
+ - script/console
56
+ - script/destroy
57
+ - script/generate
58
+ - test/test_blastr.rb
59
+ - test/test_helper.rb
60
+ has_rdoc: true
61
+ homepage: http://blastr.rubyforge.org
62
+ post_install_message:
63
+ rdoc_options:
64
+ - --main
65
+ - README.rdoc
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: "0"
73
+ version:
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: "0"
79
+ version:
80
+ requirements: []
81
+
82
+ rubyforge_project: blastr
83
+ rubygems_version: 1.2.0
84
+ signing_key:
85
+ specification_version: 2
86
+ summary: FIX (describe your package)
87
+ test_files:
88
+ - test/test_blastr.rb
89
+ - test/test_helper.rb