Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
311 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
coverage/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,69 @@ | ||
require 'rubygems' | ||
require 'rake' | ||
|
||
# begin | ||
# require 'jeweler' | ||
# Jeweler::Tasks.new do |gem| | ||
# gem.name = "twitter" | ||
# gem.summary = %Q{wrapper for the twitter api} | ||
# gem.email = "nunemaker@gmail.com" | ||
# gem.homepage = "http://github.com/jnunemaker/twitter" | ||
# gem.authors = ["John Nunemaker"] | ||
# gem.rubyforge_project = "twitter" | ||
# gem.files = FileList["[A-Z]*", "{examples,lib,test}/**/*"] | ||
# | ||
# gem.add_dependency('oauth', '>= 0.3.5') | ||
# gem.add_dependency('mash', '0.0.3') | ||
# gem.add_dependency('httparty', '0.4.3') | ||
# | ||
# gem.add_development_dependency('thoughtbot-shoulda', '>= 2.10.1') | ||
# gem.add_development_dependency('jeremymcanally-matchy', '0.4.0') | ||
# gem.add_development_dependency('mocha', '0.9.4') | ||
# gem.add_development_dependency('fakeweb', '>= 1.2.5') | ||
# end | ||
# | ||
# Jeweler::RubyforgeTasks.new do |rubyforge| | ||
# rubyforge.doc_task = "rdoc" | ||
# end | ||
# rescue LoadError | ||
# puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com" | ||
# end | ||
|
||
require 'rake/testtask' | ||
Rake::TestTask.new(:test) do |test| | ||
test.libs << 'lib' << 'test' | ||
test.pattern = 'test/**/*_test.rb' | ||
test.verbose = false | ||
end | ||
|
||
begin | ||
require 'rcov/rcovtask' | ||
Rcov::RcovTask.new do |test| | ||
test.libs << 'test' | ||
test.pattern = 'test/**/*_test.rb' | ||
test.verbose = true | ||
end | ||
rescue LoadError | ||
task :rcov do | ||
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov" | ||
end | ||
end | ||
|
||
|
||
task :default => :test | ||
|
||
require 'rake/rdoctask' | ||
Rake::RDocTask.new do |rdoc| | ||
if File.exist?('VERSION.yml') | ||
config = YAML.load(File.read('VERSION.yml')) | ||
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}" | ||
else | ||
version = "" | ||
end | ||
|
||
rdoc.rdoc_dir = 'rdoc' | ||
rdoc.title = "giggly #{version}" | ||
rdoc.rdoc_files.include('README*') | ||
rdoc.rdoc_files.include('lib/**/*.rb') | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Giggly | ||
class Friend < User | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Giggly | ||
module Javascript | ||
|
||
end | ||
end | ||
|
||
directory = File.expand_path(File.dirname(__FILE__)) | ||
|
||
require File.join(directory, 'javascript', 'helper') | ||
require File.join(directory, 'javascript', 'socialize') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
module Gigya | ||
module Javscript | ||
module Helper | ||
|
||
# The Javascript helper should be totally generic to the api that is being used | ||
# So that if there is a future api it can be wrapped in a class and include this | ||
|
||
def include_gigya_api(service) | ||
'<script type="text/javascript" src="http://cdn.gigya.com/JS/gigya.js?services=' + service.to_s + '"></script>' | ||
end | ||
|
||
def javascript(&block) | ||
out = '<script type="text/javascript">' | ||
out += yield.to_s | ||
out += '</script>' | ||
out | ||
end | ||
|
||
def to_var(name, object, scope_to_window = false) | ||
"#{scope_to_window ? '' : 'var '}#{name.to_s} = #{javascriptify_object object};" | ||
end | ||
|
||
# borrowed mainly from the ym4r_gm plugin | ||
def javascriptify_object(object) | ||
if object.is_a? String | ||
"'#{escape_javascript object}'" | ||
elsif object.is_a? Array | ||
'[' + object.collect{ |o| javascriptify_variable(o) }.join(',') + ']' | ||
elsif object.is_a? Hash | ||
'{' + object.to_a.collect{ |o| "#{o[0].to_s} : #{javascriptify_variable(o[1])}" }.join(',') + '}' | ||
elsif object.nil? | ||
'undefined' | ||
else | ||
object.to_s | ||
end | ||
end | ||
|
||
# from rails | ||
def escape_javascript(javascript) | ||
javascript.gsub(/\r\n|\n|\r/, "\\n").gsub("\"") { |m| "\\#{m}" } | ||
end | ||
|
||
end | ||
end | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module Gigya | ||
module Javascript | ||
class Socialize | ||
include Gigya::Javascript::Helper | ||
|
||
attr_accessor :api_key, :enabled_providers, :disabled_providers, :config | ||
|
||
def initialize(config) | ||
@api_key = config[:api_key] | ||
@enabled_providers = config[:enabled_providers] || [] | ||
@disabled_providers = config[:disabled_providers] || [] | ||
|
||
@config = to_config | ||
end | ||
|
||
def to_config | ||
{ | ||
'APIKey' => @api_key, | ||
'enabledProviders' => @enabled_providers, | ||
'disabledProviders' => @disabled_providers, | ||
} | ||
end | ||
|
||
# Socialize specific JS methods | ||
|
||
def config_to_js(config_var_name = :gigya_config) | ||
to_var(config_var_name, to_config) | ||
end | ||
|
||
def include_gigya_socialize | ||
include_gigya_api :socialize | ||
end | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.