pelargir-spread 0.5

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 @@
1
+ 10/22/08 - Initial version [Matthew Bass]
@@ -0,0 +1,16 @@
1
+ Copyright (c) 2007-2008 Matthew Bass (http://matthewbass.com)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software
4
+ and associated documentation files (the "Software"), to deal in the Software without
5
+ restriction, including without limitation the rights to use, copy, modify, merge, publish,
6
+ distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
7
+ Software is furnished to do so, subject to the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be included in all copies or
10
+ substantial portions of the Software.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
13
+ BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
14
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
15
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,44 @@
1
+ = spread
2
+
3
+ Makes it easy to add tell-a-friend functionality to any Rails app.
4
+
5
+
6
+ == Installation
7
+
8
+ Install the gem directly:
9
+
10
+ gem sources -a http://gems.github.com (you only have to do this once)
11
+ sudo gem install pelargir-spread
12
+
13
+ Or install the gem in your Rails project as a plugin:
14
+
15
+ script/plugin install git://github.com/pelargir/spread.git
16
+
17
+ Or clone the project:
18
+
19
+ git clone git://github.com/pelargir/spread.git
20
+
21
+
22
+ == Usage
23
+
24
+ Use spread's view helper to embed a link on the page you want to share:
25
+
26
+ <%= spread :something %>
27
+
28
+ Let your controller know you're using spread:
29
+
30
+ class SomeController < ActionController::Base
31
+ spread :something
32
+ end
33
+
34
+ That's all there is to it! (Spread's templates are currently static.
35
+ I'm working on making them overrideable so expect that soon.)
36
+
37
+
38
+ == Resources
39
+
40
+ Repository: http://github.com/pelargir/spread
41
+ Blog: http://matthewbass.com
42
+ Author: Matthew Bass
43
+
44
+ Extraction work sponsored by Terralien
@@ -0,0 +1,22 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ desc 'Test the spread plugin.'
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << 'lib'
11
+ t.pattern = 'test/**/*_test.rb'
12
+ t.verbose = true
13
+ end
14
+
15
+ desc 'Generate documentation for the spread plugin.'
16
+ Rake::RDocTask.new(:rdoc) do |rdoc|
17
+ rdoc.rdoc_dir = 'rdoc'
18
+ rdoc.title = 'spread'
19
+ rdoc.options << '--line-numbers' << '--inline-source'
20
+ rdoc.rdoc_files.include('README')
21
+ rdoc.rdoc_files.include('lib/**/*.rb')
22
+ end
data/init.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'spread'
2
+ require 'spread/controller'
@@ -0,0 +1,17 @@
1
+ require 'rake'
2
+
3
+ begin
4
+ puts "=========================================================="
5
+ puts "Attempting to copy required files into your application..."
6
+ puts "=========================================================="
7
+ RAKE_FILE = File.join(File.dirname(__FILE__), '/tasks/spread.rake')
8
+ load RAKE_FILE
9
+
10
+ Rake::Task['spread:install_files'].invoke
11
+ puts "=========================================================="
12
+ puts "Success!"
13
+ puts "=========================================================="
14
+ rescue Exception => ex
15
+ puts "FAILED TO COPY FILES DURING INSTALL. PLEASE RUN rake spread:install_files."
16
+ puts "EXCEPTION: #{ex}"
17
+ end
@@ -0,0 +1,9 @@
1
+ module Spread
2
+ def spread(action)
3
+ html = image_tag "spread/email.png", :alt => "Share with a friend", :size => "16x16", :valign => "middle"
4
+ html += link_to "Share with a friend", :action => action, :url => request.url
5
+ content_tag :div, html
6
+ end
7
+ end
8
+
9
+ ActionView::Base.send :include, Spread
@@ -0,0 +1,25 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "spread"
3
+ s.version = "0.5"
4
+ s.date = "2008-10-22"
5
+ s.summary = "Makes it easy to add tell-a-friend functionality to any Rails app."
6
+ s.email = "pelargir@gmail.com"
7
+ s.homepage = "http://github.com/pelargir/spread"
8
+ s.description = "Makes it easy to add tell-a-friend functionality to any Rails app."
9
+ s.has_rdoc = true
10
+ s.authors = ["Matthew Bass"]
11
+ s.files = [
12
+ "CHANGELOG",
13
+ "files/public/images/spread/email.png",
14
+ "init.rb",
15
+ "install.rb",
16
+ "lib/spread.rb",
17
+ "MIT-LICENSE",
18
+ "Rakefile",
19
+ "README",
20
+ "spread.gemspec",
21
+ "tasks/spread.rake"
22
+ ]
23
+ s.rdoc_options = ["--main", "README"]
24
+ s.extra_rdoc_files = ["README"]
25
+ end
@@ -0,0 +1,39 @@
1
+ require 'find'
2
+
3
+ module Spread
4
+ class Assets
5
+ @source = File.expand_path(File.join(File.dirname(__FILE__), '..', 'files'))
6
+ @destination = RAILS_ROOT
7
+ class << self
8
+ attr_accessor :source, :destination
9
+ end
10
+
11
+ def self.install
12
+ paths = []
13
+ Find.find(source) do |path|
14
+ Find.prune if path =~ /\/\..+/
15
+ Find.prune if path =~ /CVS/
16
+ paths << path
17
+ end
18
+ paths.each do |path|
19
+ dest_path = path.gsub(source, destination)
20
+ if File.directory?(path)
21
+ FileUtils.mkdir_p(dest_path) unless File.exists?(dest_path)
22
+ else
23
+ FileUtils.cp(path, dest_path)
24
+ end
25
+ end
26
+ rescue Exception => e
27
+ puts "Error trying to copy files: #{e.inspect}"
28
+ raise e
29
+ end
30
+
31
+ end
32
+ end
33
+
34
+ namespace :spread do
35
+ desc "Install files required by spread"
36
+ task :install_files do
37
+ Spread::Assets.install
38
+ end
39
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pelargir-spread
3
+ version: !ruby/object:Gem::Version
4
+ version: "0.5"
5
+ platform: ruby
6
+ authors:
7
+ - Matthew Bass
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-10-22 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Makes it easy to add tell-a-friend functionality to any Rails app.
17
+ email: pelargir@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README
24
+ files:
25
+ - CHANGELOG
26
+ - files/public/images/spread/email.png
27
+ - init.rb
28
+ - install.rb
29
+ - lib/spread.rb
30
+ - MIT-LICENSE
31
+ - Rakefile
32
+ - README
33
+ - spread.gemspec
34
+ - tasks/spread.rake
35
+ has_rdoc: true
36
+ homepage: http://github.com/pelargir/spread
37
+ post_install_message:
38
+ rdoc_options:
39
+ - --main
40
+ - README
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: "0"
48
+ version:
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ version:
55
+ requirements: []
56
+
57
+ rubyforge_project:
58
+ rubygems_version: 1.2.0
59
+ signing_key:
60
+ specification_version: 2
61
+ summary: Makes it easy to add tell-a-friend functionality to any Rails app.
62
+ test_files: []
63
+