elliottcable-jello 5 → 6

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.markdown CHANGED
@@ -1,6 +1,5 @@
1
1
  Jello
2
2
  =====
3
-
4
3
  Because everybody likes "paste & jello" sandwiches, right? I know I did when I
5
4
  was a kid.
6
5
 
@@ -61,8 +60,8 @@ them:
61
60
  # Now foo.rb, bar.rb, one.rb, and two.rb would be executed on incoming
62
61
  # pastes
63
62
 
64
- Finally, you can use pasteboards other than the general one (see `man pbcopy`
65
- for more information about this):
63
+ You can also use pasteboards other than the general one (see `man pbcopy` for
64
+ more information about this):
66
65
 
67
66
  require 'jello'
68
67
 
@@ -70,4 +69,13 @@ for more information about this):
70
69
  paste.gsub! /abc/, 'def'
71
70
  end
72
71
 
73
- Jello.start!
72
+ Jello.start!
73
+
74
+ Finally, you can create a Jello [property list][plist] for [launchd][] that
75
+ will keep jello running all the time, even after you restart. Just run
76
+ `rake launchd` from the Jello distribution directory. (This requires that you
77
+ install the [LaunchDoctor][] gem first!)
78
+
79
+ [launchd]: <http://en.wikipedia.org/wiki/Launchd> "launchd on Wikipedia"
80
+ [plist]: <http://en.wikipedia.org/wiki/Property_list> "Property list on Wikipedia"
81
+ [LaunchDoctor]: <http://github.com/elliottcable/launchdr> "elliottcable's launchdr on GitHub"
data/Rakefile.rb CHANGED
@@ -19,7 +19,7 @@ begin
19
19
  g.email = ['Jello@elliottcable.com']
20
20
  g.summary = 'A library to watch the OS X pasteboard, and process/modify incoming pastes.'
21
21
  g.url = 'http://github.com/elliottcable/jello'
22
- g.development_dependencies = ['elliottcable-echoe >= 3.0.2', 'rspec', 'rcov', 'yard', 'stringray']
22
+ g.development_dependencies = ['echoe >= 3.0.2', 'rspec', 'rcov', 'yard', 'stringray']
23
23
  g.manifest_name = '.manifest'
24
24
  g.retain_gemspec = true
25
25
  g.rakefile_name = 'Rakefile.rb'
@@ -36,10 +36,19 @@ begin
36
36
  end
37
37
 
38
38
  rescue LoadError
39
- desc 'You need the `elliottcable-echoe` gem to package Jello'
39
+ desc 'You need the `echoe` gem to package Jello'
40
40
  task :package
41
41
  end
42
42
 
43
+ begin
44
+ require 'launchdr/task'
45
+
46
+ LaunchDr::Task.new :launchd, :bin => 'jello', :arguments => ['grabup', 'shortener']
47
+ rescue LoadError
48
+ desc 'You need the `elliottcable-launchdr` gem to generate a launchd property list'
49
+ task :launchd
50
+ end
51
+
43
52
  # =======================
44
53
  # = Spec/Coverage tasks =
45
54
  # =======================
data/bin/jello CHANGED
@@ -44,8 +44,8 @@ The follow moulds are included for your enjoyment:
44
44
  options[:period] = p
45
45
  end
46
46
 
47
- opts.on("-D", "--[no-]daemonize", "Fork the process") do |D|
48
- options[:daemonize] = D
47
+ opts.on("-D", "--[no-]daemonize", "Fork the process") do |dd|
48
+ options[:daemonize] = dd
49
49
  end
50
50
 
51
51
  opts.on_tail("--help", "Show this help") do
data/jello.gemspec CHANGED
@@ -2,23 +2,23 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{jello}
5
- s.version = "5"
5
+ s.version = "6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["elliottcable"]
9
- s.date = %q{2008-11-01}
9
+ s.date = %q{2009-02-11}
10
10
  s.default_executable = %q{jello}
11
11
  s.description = %q{A library to watch the OS X pasteboard, and process/modify incoming pastes.}
12
12
  s.email = ["Jello@elliottcable.com"]
13
13
  s.executables = ["jello"]
14
14
  s.extra_rdoc_files = ["bin/jello", "lib/jello/core_ext/kernel.rb", "lib/jello/logger.rb", "lib/jello/mould.rb", "lib/jello/pasteboard.rb", "lib/jello.rb", "README.markdown"]
15
- s.files = ["bin/jello", "lib/jello/core_ext/kernel.rb", "lib/jello/logger.rb", "lib/jello/mould.rb", "lib/jello/pasteboard.rb", "lib/jello.rb", "moulds/fail.rb", "moulds/grabup_fixer.rb", "moulds/say.rb", "moulds/shortener.rb", "Rakefile.rb", "README.markdown", "spec/jello_spec.rb", ".manifest", "jello.gemspec"]
15
+ s.files = ["bin/jello", "lib/jello/core_ext/kernel.rb", "lib/jello/logger.rb", "lib/jello/mould.rb", "lib/jello/pasteboard.rb", "lib/jello.rb", "moulds/fail.rb", "moulds/grabup_fixer.rb", "moulds/say.rb", "moulds/shortener.rb", "moulds/growl.rb", "Rakefile.rb", "README.markdown", "spec/jello_spec.rb", ".manifest", "jello.gemspec"]
16
16
  s.has_rdoc = true
17
17
  s.homepage = %q{http://github.com/elliottcable/jello}
18
18
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Jello", "--main", "README.markdown"]
19
19
  s.require_paths = ["lib"]
20
20
  s.rubyforge_project = %q{jello}
21
- s.rubygems_version = %q{1.3.0}
21
+ s.rubygems_version = %q{1.3.1}
22
22
  s.summary = %q{A library to watch the OS X pasteboard, and process/modify incoming pastes.}
23
23
 
24
24
  if s.respond_to? :specification_version then
@@ -26,20 +26,20 @@ Gem::Specification.new do |s|
26
26
  s.specification_version = 2
27
27
 
28
28
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
29
- s.add_development_dependency(%q<elliottcable-echoe>, [">= 0", "= 3.0.2"])
29
+ s.add_development_dependency(%q<echoe>, [">= 0", "= 3.0.2"])
30
30
  s.add_development_dependency(%q<rspec>, [">= 0"])
31
31
  s.add_development_dependency(%q<rcov>, [">= 0"])
32
32
  s.add_development_dependency(%q<yard>, [">= 0"])
33
33
  s.add_development_dependency(%q<stringray>, [">= 0"])
34
34
  else
35
- s.add_dependency(%q<elliottcable-echoe>, [">= 0", "= 3.0.2"])
35
+ s.add_dependency(%q<echoe>, [">= 0", "= 3.0.2"])
36
36
  s.add_dependency(%q<rspec>, [">= 0"])
37
37
  s.add_dependency(%q<rcov>, [">= 0"])
38
38
  s.add_dependency(%q<yard>, [">= 0"])
39
39
  s.add_dependency(%q<stringray>, [">= 0"])
40
40
  end
41
41
  else
42
- s.add_dependency(%q<elliottcable-echoe>, [">= 0", "= 3.0.2"])
42
+ s.add_dependency(%q<echoe>, [">= 0", "= 3.0.2"])
43
43
  s.add_dependency(%q<rspec>, [">= 0"])
44
44
  s.add_dependency(%q<rcov>, [">= 0"])
45
45
  s.add_dependency(%q<yard>, [">= 0"])
@@ -84,7 +84,7 @@ module Jello
84
84
  out = IO::popen command, 'w+'
85
85
  out.print something
86
86
  out.close
87
- something
87
+ @current = something
88
88
  end
89
89
 
90
90
 
data/lib/jello.rb CHANGED
@@ -3,7 +3,7 @@ require 'jello/pasteboard'
3
3
  require 'jello/mould'
4
4
 
5
5
  module Jello
6
- Version = 5
6
+ Version = 6
7
7
 
8
8
  def self.start! options = {}
9
9
  options = {:verbose => false, :period => 0.5}.merge(options)
data/moulds/growl.rb ADDED
@@ -0,0 +1,4 @@
1
+ Jello::Mould.new do |paste|
2
+ `echo 'Jello just operated on [#{paste.gsub "'", "'\\''" }]' | growlnotify "Jello"`
3
+ paste
4
+ end
data/moulds/shortener.rb CHANGED
@@ -4,8 +4,8 @@ require 'open-uri'
4
4
  require 'JSON'
5
5
 
6
6
  Paths = {
7
- 'google' => :search,
8
- /my-site\.name/ => %r{^http://my-site\.name/(.+)\.xhtml$}
7
+ 'G' => %r ^http://.*\.google(\.[\w]{2,5}){1,2}/search\?.+$ ,
8
+ 'wp' => %r ^http://.*\.wikipedia\.org/wiki/.+$
9
9
  }
10
10
 
11
11
  Jello::Mould.new do |paste, board|
@@ -19,15 +19,23 @@ Jello::Mould.new do |paste, board|
19
19
  # as twitter or a text message, feel free to simply delete this section
20
20
  # of the URL by hand after pasting. (⌥⌫ is helpful!)
21
21
  #
22
- # We also check if the URI matches a key of the Paths constant, and
23
- # process the URI based on the value matched to that key if it matches.
24
- # Keys can be stringish or regexish, in the latter case, it will run it
25
- # matches. Values can be stringish or regexish, in the latter case,
26
- # the last matching group will be used as the parameter.
27
- base = nil
28
- matcher = Paths.select {|matcher,baser| uri.to_s =~ (matcher.is_a?(Regexp) ? matcher : /#{matcher}/) } .first
22
+ # We also check if the URI matches a value of the Paths constant, and
23
+ # process the URI based on the key of the first value that matches.
24
+ # Values can be stringish or regexish, and will be assumed to match if
25
+ # they apply against the URI. Keys can be stringish or regexish, and are
26
+ # applied against the URI to get the actual base string. A stringish
27
+ # will be used directly as the base; the contents of a regex's first
28
+ # group will be used if possible; a value of nil will prevent any basing
29
+ # from happening.
30
+ matcher = Paths.select {|baser,matcher| uri.to_s =~ (matcher.is_a?(Regexp) ? matcher : /#{matcher.to_s}/) } .first
29
31
  if matcher
30
- base = uri.to_s.match( matcher[1] )
32
+ case baser = matcher[0]
33
+ when Regexp then base = uri.to_s.match(baser)[1]
34
+ when NilClass then base = nil
35
+ else base = baser.to_s
36
+ end
37
+ else
38
+ base = uri.host.match( /(?:[\w\d\-\.]+\.)?([\w\d\-]+)\.[\w]{2,4}/ )[1]
31
39
  end
32
40
 
33
41
  unless base and (base = base[1])
@@ -56,7 +64,7 @@ Jello::Mould.new do |paste, board|
56
64
  rescue OpenURI::HTTPError => e
57
65
  short = {'url' => paste}
58
66
  end
59
- shortened = [short['url'], base].join('?')
67
+ shortened = [short['url'], base].compact.join('?')
60
68
  shortened.length < paste.length ? shortened : paste
61
69
  end
62
70
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elliottcable-jello
3
3
  version: !ruby/object:Gem::Version
4
- version: "5"
4
+ version: "6"
5
5
  platform: ruby
6
6
  authors:
7
7
  - elliottcable
@@ -9,11 +9,12 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-01 00:00:00 -07:00
12
+ date: 2009-02-11 00:00:00 -08:00
13
13
  default_executable: jello
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: elliottcable-echoe
16
+ name: echoe
17
+ type: :development
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
@@ -26,6 +27,7 @@ dependencies:
26
27
  version:
27
28
  - !ruby/object:Gem::Dependency
28
29
  name: rspec
30
+ type: :development
29
31
  version_requirement:
30
32
  version_requirements: !ruby/object:Gem::Requirement
31
33
  requirements:
@@ -35,6 +37,7 @@ dependencies:
35
37
  version:
36
38
  - !ruby/object:Gem::Dependency
37
39
  name: rcov
40
+ type: :development
38
41
  version_requirement:
39
42
  version_requirements: !ruby/object:Gem::Requirement
40
43
  requirements:
@@ -44,6 +47,7 @@ dependencies:
44
47
  version:
45
48
  - !ruby/object:Gem::Dependency
46
49
  name: yard
50
+ type: :development
47
51
  version_requirement:
48
52
  version_requirements: !ruby/object:Gem::Requirement
49
53
  requirements:
@@ -53,6 +57,7 @@ dependencies:
53
57
  version:
54
58
  - !ruby/object:Gem::Dependency
55
59
  name: stringray
60
+ type: :development
56
61
  version_requirement:
57
62
  version_requirements: !ruby/object:Gem::Requirement
58
63
  requirements:
@@ -86,6 +91,7 @@ files:
86
91
  - moulds/grabup_fixer.rb
87
92
  - moulds/say.rb
88
93
  - moulds/shortener.rb
94
+ - moulds/growl.rb
89
95
  - Rakefile.rb
90
96
  - README.markdown
91
97
  - spec/jello_spec.rb