Skip to content

Commit

Permalink
Skeleton with Diaspora Client. Check.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhitomirskiyi committed Sep 9, 2011
0 parents commit 91cab26
Show file tree
Hide file tree
Showing 66 changed files with 10,907 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.bundle
db/*.sqlite3
log/*.log
tmp/

config/EpicParties.private.pem
1 change: 1 addition & 0 deletions .rvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rvm --create use 1.9.2@epic_parties
52 changes: 52 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
source 'http://rubygems.org'

gem 'rails', '3.0.9'

gem 'sqlite3'
gem "haml-rails"
gem "jquery-rails"

gem 'devise', '~> 1.2.1'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'

# Bundle the extra gems:
# gem 'bj'
gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'

# Diaspora
gem 'diaspora-client', #:git => 'git://github.com/diaspora/diaspora-client.git'
:path => "~/workspace/diaspora-client"



group :test do
gem 'capybara', '~> 0.3.9'
gem 'rest-client'
gem 'database_cleaner', '0.6.0'

gem 'cucumber-rails', '0.3.2'
gem 'factory_girl_rails', :require => false
gem 'rspec-rails', '~> 2.4'
gem 'shoulda-matchers'
end

group :development, :test do
gem "nifty-generators"
gem 'sqlite3'
gem 'ruby-debug-base19', '0.11.23' if RUBY_VERSION.include? '1.9.1'
gem 'ruby-debug19' if RUBY_VERSION.include? '1.9'
gem 'ruby-debug' if defined?(Rubinius).nil? && RUBY_VERSION.include?('1.8')
end


195 changes: 195 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
PATH
remote: ~/workspace/diaspora-client
specs:
diaspora-client (0.1.0)
activerecord
faraday
jwt (>= 0.1.3)
oauth2 (= 0.4.1)
sinatra

GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
actionmailer (3.0.9)
actionpack (= 3.0.9)
mail (~> 2.2.19)
actionpack (3.0.9)
activemodel (= 3.0.9)
activesupport (= 3.0.9)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.5.0)
rack (~> 1.2.1)
rack-mount (~> 0.6.14)
rack-test (~> 0.5.7)
tzinfo (~> 0.3.23)
activemodel (3.0.9)
activesupport (= 3.0.9)
builder (~> 2.1.2)
i18n (~> 0.5.0)
activerecord (3.0.9)
activemodel (= 3.0.9)
activesupport (= 3.0.9)
arel (~> 2.0.10)
tzinfo (~> 0.3.23)
activeresource (3.0.9)
activemodel (= 3.0.9)
activesupport (= 3.0.9)
activesupport (3.0.9)
addressable (2.2.6)
arel (2.0.10)
bcrypt-ruby (2.1.4)
builder (2.1.2)
capybara (0.3.9)
culerity (>= 0.2.4)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (>= 0.0.3)
childprocess (0.1.9)
ffi (~> 1.0.6)
columnize (0.3.4)
cucumber (1.0.1)
builder (>= 2.1.2)
diff-lcs (>= 1.1.2)
gherkin (~> 2.4.5)
json (>= 1.4.6)
term-ansicolor (>= 1.0.5)
cucumber-rails (0.3.2)
cucumber (>= 0.8.0)
culerity (0.2.15)
database_cleaner (0.6.0)
devise (1.2.1)
bcrypt-ruby (~> 2.1.2)
orm_adapter (~> 0.0.3)
warden (~> 1.0.3)
diff-lcs (1.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
factory_girl (1.3.3)
factory_girl_rails (1.0.1)
factory_girl (~> 1.3)
railties (>= 3.0.0)
faraday (0.6.1)
addressable (~> 2.2.4)
multipart-post (~> 1.1.0)
rack (< 2, >= 1.1.0)
ffi (1.0.9)
gherkin (2.4.5)
json (>= 1.4.6)
haml (3.1.2)
haml-rails (0.3.4)
actionpack (~> 3.0)
activesupport (~> 3.0)
haml (~> 3.0)
railties (~> 3.0)
i18n (0.5.0)
jquery-rails (1.0.12)
railties (~> 3.0)
thor (~> 0.14)
json (1.5.3)
json_pure (1.5.3)
jwt (0.1.3)
json (>= 1.2.4)
linecache (0.46)
rbx-require-relative (> 0.0.4)
mail (2.2.19)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
multi_json (1.0.3)
multipart-post (1.1.3)
nifty-generators (0.4.6)
nokogiri (1.5.0)
oauth2 (0.4.1)
faraday (~> 0.6.1)
multi_json (>= 0.0.5)
orm_adapter (0.0.5)
polyglot (0.3.1)
rack (1.2.3)
rack-mount (0.6.14)
rack (>= 1.0.0)
rack-test (0.5.7)
rack (>= 1.0)
rails (3.0.9)
actionmailer (= 3.0.9)
actionpack (= 3.0.9)
activerecord (= 3.0.9)
activeresource (= 3.0.9)
activesupport (= 3.0.9)
bundler (~> 1.0)
railties (= 3.0.9)
railties (3.0.9)
actionpack (= 3.0.9)
activesupport (= 3.0.9)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.4)
rake (0.9.2)
rbx-require-relative (0.0.5)
rdoc (3.8)
rest-client (1.6.3)
mime-types (>= 1.16)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
rspec-mocks (~> 2.6.0)
rspec-core (2.6.4)
rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)
rspec-rails (2.6.1)
actionpack (~> 3.0)
activesupport (~> 3.0)
railties (~> 3.0)
rspec (~> 2.6.0)
ruby-debug (0.10.4)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.4.0)
ruby-debug-base (0.10.4)
linecache (>= 0.3)
rubyzip (0.9.4)
selenium-webdriver (2.0.1)
childprocess (>= 0.1.9)
ffi (>= 1.0.7)
json_pure
rubyzip
shoulda-matchers (1.0.0.beta2)
sinatra (1.2.6)
rack (~> 1.1)
tilt (< 2.0, >= 1.2.2)
sqlite3 (1.3.3)
term-ansicolor (1.0.5)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.9)
polyglot (>= 0.3.1)
tzinfo (0.3.29)
warden (1.0.4)
rack (>= 1.0)

PLATFORMS
ruby

DEPENDENCIES
capybara (~> 0.3.9)
cucumber-rails (= 0.3.2)
database_cleaner (= 0.6.0)
devise (~> 1.2.1)
diaspora-client!
factory_girl_rails
haml-rails
jquery-rails
nifty-generators
nokogiri
rails (= 3.0.9)
rest-client
rspec-rails (~> 2.4)
ruby-debug
shoulda-matchers
sqlite3
20 changes: 20 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright 2011 Diaspora Inc. http://blog.joindiaspora.com

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Sample Application That Uses Diaspora Client Gem


[Diaspora Client Gem](https://github.com/diaspora/diaspora-client)


[Diaspora](https://github.com/diaspora/diaspora-client)

See LICENSE.txt for licensing details.
7 changes: 7 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)
require 'rake'

SampleApp::Application.load_tasks
3 changes: 3 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class ApplicationController < ActionController::Base
protect_from_forgery
end
12 changes: 12 additions & 0 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class HomeController < ApplicationController
respond_to :html

def show
if current_user
flash[:notice] = "YAY!"
render "success"
else
end
end
end

2 changes: 2 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module ApplicationHelper
end
23 changes: 23 additions & 0 deletions app/helpers/error_messages_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module ErrorMessagesHelper
# Render error messages for the given objects. The :message and :header_message options are allowed.
def error_messages_for(*objects)
options = objects.extract_options!
options[:header_message] ||= I18n.t(:"activerecord.errors.header", :default => "Invalid Fields")
options[:message] ||= I18n.t(:"activerecord.errors.message", :default => "Correct the following errors and try again.")
messages = objects.compact.map { |o| o.errors.full_messages }.flatten
unless messages.empty?
content_tag(:div, :class => "error_messages") do
list_items = messages.map { |msg| content_tag(:li, msg) }
content_tag(:h2, options[:header_message]) + content_tag(:p, options[:message]) + content_tag(:ul, list_items.join.html_safe)
end
end
end

module FormBuilderAdditions
def error_messages(options = {})
@template.error_messages_for(@object, options)
end
end
end

ActionView::Helpers::FormBuilder.send(:include, ErrorMessagesHelper::FormBuilderAdditions)
22 changes: 22 additions & 0 deletions app/helpers/layout_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# These helper methods can be called in your template to set variables to be used in the layout
# This module should be included in all views globally,
# to do so you may need to add this line to your ApplicationController
# helper :layout
module LayoutHelper
def title(page_title, show_title = true)
content_for(:title) { h(page_title.to_s) }
@show_title = show_title
end

def show_title?
@show_title
end

def stylesheet(*args)
content_for(:head) { stylesheet_link_tag(*args) }
end

def javascript(*args)
content_for(:head) { javascript_include_tag(*args) }
end
end
19 changes: 19 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable, :rememberable, :trackable

validates_length_of :diaspora_id, :maximum => 127

has_one :access_token, :class_name => "DiasporaClient::AccessToken", :dependent => :destroy

# Create a new user account with data from a diaspora pod
# @option opts [String] :diaspora_id The new user's diaspora id
def self.find_or_create_with_diaspora opts
puts opts.inspect
if user = self.find_by_diaspora_id(opts[:diaspora_id])
user
else
self.create!(opts)
end
end

end
4 changes: 4 additions & 0 deletions app/views/home/show.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
= form_tag('/auth/diaspora', :method => :get) do
= text_field_tag :diaspora_id, '', :placeholder => "Diaspora ID"
= submit_tag :connect

1 change: 1 addition & 0 deletions app/views/home/success.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
You are on the success page
Loading

0 comments on commit 91cab26

Please sign in to comment.