Permalink
Browse files

Rename tent-server to tentd

  • Loading branch information...
1 parent 99ed314 commit 131f435d9b8e1d6c855b8796b02fdc8113709239 @titanous titanous committed Sep 3, 2012
Showing with 345 additions and 345 deletions.
  1. +1 −1 Guardfile
  2. +3 −3 README.md
  3. +0 −17 lib/tent-server.rb
  4. +0 −30 lib/tent-server/api.rb
  5. +0 −24 lib/tent-server/model.rb
  6. +0 −18 lib/tent-server/model/permission.rb
  7. +17 −0 lib/tentd.rb
  8. +30 −0 lib/tentd/api.rb
  9. +1 −1 lib/{tent-server → tentd}/api/apps.rb
  10. +1 −1 lib/{tent-server → tentd}/api/authentication_finalize.rb
  11. +4 −4 lib/{tent-server → tentd}/api/authentication_lookup.rb
  12. +1 −1 lib/{tent-server → tentd}/api/authentication_verification.rb
  13. +1 −1 lib/{tent-server → tentd}/api/authorizable.rb
  14. +1 −1 lib/{tent-server → tentd}/api/authorization.rb
  15. +1 −1 lib/{tent-server → tentd}/api/core_profile_data.rb
  16. +1 −1 lib/{tent-server → tentd}/api/followers.rb
  17. +1 −1 lib/{tent-server → tentd}/api/followings.rb
  18. +1 −1 lib/{tent-server → tentd}/api/groups.rb
  19. +1 −1 lib/{tent-server → tentd}/api/middleware.rb
  20. +3 −3 lib/{tent-server → tentd}/api/posts.rb
  21. +1 −1 lib/{tent-server → tentd}/api/profile.rb
  22. +4 −4 lib/{tent-server → tentd}/api/router.rb
  23. +1 −1 lib/{tent-server → tentd}/api/router/caching_headers.rb
  24. +1 −1 lib/{tent-server → tentd}/api/router/extract_params.rb
  25. +1 −1 lib/{tent-server → tentd}/api/router/serialize_response.rb
  26. 0 lib/{tent-server → tentd}/core_ext/hash/slice.rb
  27. 0 lib/{tent-server → tentd}/datamapper/array_property.rb
  28. 0 lib/{tent-server → tentd}/datamapper/binary_string_property.rb
  29. 0 lib/{tent-server → tentd}/datamapper/query.rb
  30. +1 −1 lib/{tent-server → tentd}/json_patch.rb
  31. +24 −0 lib/tentd/model.rb
  32. +3 −3 lib/{tent-server → tentd}/model/app.rb
  33. +3 −3 lib/{tent-server → tentd}/model/app_authorization.rb
  34. +5 −5 lib/{tent-server → tentd}/model/follower.rb
  35. +3 −3 lib/{tent-server → tentd}/model/following.rb
  36. +2 −2 lib/{tent-server → tentd}/model/group.rb
  37. +3 −3 lib/{tent-server → tentd}/model/notification_subscription.rb
  38. +3 −3 lib/{tent-server → tentd}/model/permissible.rb
  39. +18 −0 lib/tentd/model/permission.rb
  40. +3 −3 lib/{tent-server → tentd}/model/post.rb
  41. +2 −2 lib/{tent-server → tentd}/model/post_attachment.rb
  42. +1 −1 lib/{tent-server → tentd}/model/profile_info.rb
  43. +1 −1 lib/{tent-server → tentd}/model/random_public_id.rb
  44. +1 −1 lib/{tent-server → tentd}/rack_request.rb
  45. +1 −1 lib/{tent-server → tentd}/tent_version.rb
  46. +1 −1 lib/{tent-server → tentd}/version.rb
  47. +1 −1 spec/fabricators/app_authorizations_fabricator.rb
  48. +1 −1 spec/fabricators/apps_fabricator.rb
  49. +1 −1 spec/fabricators/followers_fabricator.rb
  50. +1 −1 spec/fabricators/followings_fabricator.rb
  51. +1 −1 spec/fabricators/groups_fabricator.rb
  52. +1 −1 spec/fabricators/post_attachments_fabricator.rb
  53. +1 −1 spec/fabricators/posts_fabricator.rb
  54. +1 −1 spec/fabricators/profile_infos_fabricator.rb
  55. +10 −10 spec/integration/api/apps_spec.rb
  56. +17 −17 spec/integration/api/followers_spec.rb
  57. +24 −24 spec/integration/api/followings_spec.rb
  58. +7 −7 spec/integration/api/groups_spec.rb
  59. +18 −18 spec/integration/api/posts_spec.rb
  60. +13 −13 spec/integration/api/profile_spec.rb
  61. +5 −5 spec/integration/api/router_spec.rb
  62. +20 −20 spec/integration/model/follower_spec.rb
  63. +1 −1 spec/integration/model/following_spec.rb
  64. +1 −1 spec/integration/model/group_spec.rb
  65. +1 −1 spec/integration/model/notification_subscription_spec.rb
  66. +16 −16 spec/integration/model/post_spec.rb
  67. +1 −1 spec/spec_helper.rb
  68. +6 −6 spec/support/json_request.rb
  69. +2 −2 spec/unit/api/authentication_finalize_spec.rb
  70. +11 −11 spec/unit/api/authentication_lookup_spec.rb
  71. +2 −2 spec/unit/api/authentication_verification_spec.rb
  72. +5 −5 spec/unit/api/authorizable_spec.rb
  73. +2 −2 spec/unit/api/authorization_spec.rb
  74. +2 −2 spec/unit/api/caching_headers_spec.rb
  75. +7 −7 spec/unit/core_profile_data_spec.rb
  76. +11 −11 spec/unit/json_patch_spec.rb
  77. +1 −1 spec/unit/tent_version_spec.rb
  78. +3 −3 tent-server.gemspec → tentd.gemspec
View
@@ -1,6 +1,6 @@
guard 'rspec', :version => 2 do
watch(%r{^spec/.+_spec\.rb$})
- watch(%r{^lib/tent-server/(.+)\.rb$}) { |m| "spec/unit/#{m[1]}_spec.rb" }
+ watch(%r{^lib/tentd/(.+)\.rb$}) { |m| "spec/unit/#{m[1]}_spec.rb" }
watch(%r{^lib/[^/]+\.rb$}) { "spec" }
watch(%r{spec/(spec_helper|support/).*\.rb}) { "spec" }
end
View
@@ -1,20 +1,20 @@
-# Tent::Server
+# TentD
TODO: Write a gem description
## Installation
Add this line to your application's Gemfile:
- gem 'tent-server'
+ gem 'tentd'
And then execute:
$ bundle
Or install it yourself as:
- $ gem install tent-server
+ $ gem install tentd
## Usage
View
@@ -1,17 +0,0 @@
-require 'tent-server/version'
-require 'tent-client'
-
-module TentServer
- autoload :API, 'tent-server/api'
- autoload :Action, 'tent-server/action'
- autoload :JsonPatch, 'tent-server/json_patch'
- autoload :TentVersion, 'tent-server/tent_version'
- autoload :RackRequest, 'tent-server/rack_request'
-
- def self.new(options={})
- DataMapper.setup(:default, options[:database] || ENV['DATABASE_URL'])
- API.new
- end
-end
-
-require 'tent-server/model'
View
@@ -1,30 +0,0 @@
-module TentServer
- class API
- PER_PAGE = 50
- MAX_PER_PAGE = 200
- MEDIA_TYPE = 'application/vnd.tent.v0+json'
-
- autoload :Apps, 'tent-server/api/apps'
- autoload :Posts, 'tent-server/api/posts'
- autoload :Groups, 'tent-server/api/groups'
- autoload :Profile, 'tent-server/api/profile'
- autoload :Followers, 'tent-server/api/followers'
- autoload :Followings, 'tent-server/api/followings'
- autoload :CoreProfileData, 'tent-server/api/core_profile_data'
- autoload :AuthenticationLookup, 'tent-server/api/authentication_lookup'
- autoload :AuthenticationVerification, 'tent-server/api/authentication_verification'
- autoload :AuthenticationFinalize, 'tent-server/api/authentication_finalize'
- autoload :Authorization, 'tent-server/api/authorization'
- autoload :Authorizable, 'tent-server/api/authorizable'
- autoload :Router, 'tent-server/api/router'
- autoload :Middleware, 'tent-server/api/middleware'
- include Router
-
- mount Apps
- mount Posts
- mount Groups
- mount Profile
- mount Followers
- mount Followings
- end
-end
View
@@ -1,24 +0,0 @@
-require 'data_mapper'
-require 'dm-ar-finders'
-require 'tent-server/datamapper/array_property'
-require 'tent-server/datamapper/binary_string_property'
-require 'tent-server/datamapper/query'
-
-module TentServer
- module Model
- require 'tent-server/model/permissible'
- require 'tent-server/model/random_public_id'
- require 'tent-server/model/post'
- require 'tent-server/model/post_attachment'
- require 'tent-server/model/follower'
- require 'tent-server/model/following'
- require 'tent-server/model/app'
- require 'tent-server/model/app_authorization'
- require 'tent-server/model/notification_subscription'
- require 'tent-server/model/profile_info'
- require 'tent-server/model/group'
- require 'tent-server/model/permission'
- end
-end
-
-DataMapper.finalize
@@ -1,18 +0,0 @@
-module TentServer
- module Model
- class Permission
- include DataMapper::Resource
-
- storage_names[:default] = "permissions"
-
- belongs_to :post, 'TentServer::Model::Post', :required => false
- belongs_to :group, 'TentServer::Model::Group', :required => false, :parent_key => :public_id
- belongs_to :following, 'TentServer::Model::Following', :required => false
- belongs_to :follower_visibility, 'TentServer::Model::Follower', :required => false
- belongs_to :follower_access, 'TentServer::Model::Follower', :required => false
-
- property :id, Serial
- property :visible, Boolean
- end
- end
-end
View
@@ -0,0 +1,17 @@
+require 'tentd/version'
+require 'tent-client'
+
+module TentD
+ autoload :API, 'tentd/api'
+ autoload :Action, 'tentd/action'
+ autoload :JsonPatch, 'tentd/json_patch'
+ autoload :TentVersion, 'tentd/tent_version'
+ autoload :RackRequest, 'tentd/rack_request'
+
+ def self.new(options={})
+ DataMapper.setup(:default, options[:database] || ENV['DATABASE_URL'])
+ API.new
+ end
+end
+
+require 'tentd/model'
View
@@ -0,0 +1,30 @@
+module TentD
+ class API
+ PER_PAGE = 50
+ MAX_PER_PAGE = 200
+ MEDIA_TYPE = 'application/vnd.tent.v0+json'
+
+ autoload :Apps, 'tentd/api/apps'
+ autoload :Posts, 'tentd/api/posts'
+ autoload :Groups, 'tentd/api/groups'
+ autoload :Profile, 'tentd/api/profile'
+ autoload :Followers, 'tentd/api/followers'
+ autoload :Followings, 'tentd/api/followings'
+ autoload :CoreProfileData, 'tentd/api/core_profile_data'
+ autoload :AuthenticationLookup, 'tentd/api/authentication_lookup'
+ autoload :AuthenticationVerification, 'tentd/api/authentication_verification'
+ autoload :AuthenticationFinalize, 'tentd/api/authentication_finalize'
+ autoload :Authorization, 'tentd/api/authorization'
+ autoload :Authorizable, 'tentd/api/authorizable'
+ autoload :Router, 'tentd/api/router'
+ autoload :Middleware, 'tentd/api/middleware'
+ include Router
+
+ mount Apps
+ mount Posts
+ mount Groups
+ mount Profile
+ mount Followers
+ mount Followings
+ end
+end
@@ -1,4 +1,4 @@
-module TentServer
+module TentD
class API
class Apps
include Router
@@ -1,4 +1,4 @@
-module TentServer
+module TentD
class API
class AuthenticationFinalize < Middleware
def action(env)
@@ -1,16 +1,16 @@
-module TentServer
+module TentD
class API
class AuthenticationLookup < Middleware
def action(env)
return env unless env['HTTP_AUTHORIZATION']
env['hmac'] = Hash[env['HTTP_AUTHORIZATION'].scan(/([a-z]+)="([^"]+)"/i)]
case env['hmac']['id'].to_s[0,1]
when 's'
- env.potential_auth = TentServer::Model::Follower.first(:mac_key_id => env['hmac']['id'])
+ env.potential_auth = TentD::Model::Follower.first(:mac_key_id => env['hmac']['id'])
when 'a'
- env.potential_auth = TentServer::Model::App.first(:mac_key_id => env['hmac']['id'])
+ env.potential_auth = TentD::Model::App.first(:mac_key_id => env['hmac']['id'])
when 'u'
- env.potential_auth = TentServer::Model::AppAuthorization.first(:mac_key_id => env['hmac']['id'])
+ env.potential_auth = TentD::Model::AppAuthorization.first(:mac_key_id => env['hmac']['id'])
end
env.hmac.secret = env.potential_auth.mac_key
env.hmac.algorithm = env.potential_auth.mac_algorithm
@@ -1,7 +1,7 @@
require 'openssl'
require 'base64'
-module TentServer
+module TentD
class API
class AuthenticationVerification < Middleware
def action(env)
@@ -1,4 +1,4 @@
-module TentServer
+module TentD
class API
module Authorizable
class Error < StandardError
@@ -1,4 +1,4 @@
-module TentServer
+module TentD
class API
class Authorization < Middleware
def action(env)
@@ -1,6 +1,6 @@
require 'hashie'
-module TentServer
+module TentD
class API
class CoreProfileData < Hashie::Mash
def expected_version
@@ -1,4 +1,4 @@
-module TentServer
+module TentD
class API
class Followers
include Router
@@ -1,4 +1,4 @@
-module TentServer
+module TentD
class API
class Followings
include Router
@@ -1,4 +1,4 @@
-module TentServer
+module TentD
class API
class Groups
include Router
@@ -1,6 +1,6 @@
require 'hashie'
-module TentServer
+module TentD
class API
class Middleware
include Authorizable
@@ -1,4 +1,4 @@
-module TentServer
+module TentD
class API
class Posts
include Router
@@ -56,9 +56,9 @@ def action(env)
conditions[:type] = env.current_auth.post_types
end
if env.params.limit
- conditions[:limit] = [env.params.limit.to_i, TentServer::API::MAX_PER_PAGE].min
+ conditions[:limit] = [env.params.limit.to_i, TentD::API::MAX_PER_PAGE].min
else
- conditions[:limit] = TentServer::API::PER_PAGE
+ conditions[:limit] = TentD::API::PER_PAGE
end
if conditions[:limit] == 0
env.response = []
@@ -1,4 +1,4 @@
-module TentServer
+module TentD
class API
class Profile
include Router
@@ -19,12 +19,12 @@ def merge_route(route)
end
end
-module TentServer
+module TentD
class API
module Router
- autoload :ExtractParams, 'tent-server/api/router/extract_params'
- autoload :SerializeResponse, 'tent-server/api/router/serialize_response'
- autoload :CachingHeaders, 'tent-server/api/router/caching_headers'
+ autoload :ExtractParams, 'tentd/api/router/extract_params'
+ autoload :SerializeResponse, 'tentd/api/router/serialize_response'
+ autoload :CachingHeaders, 'tentd/api/router/caching_headers'
def self.included(base)
base.extend(ClassMethods)
@@ -1,6 +1,6 @@
require 'time'
-module TentServer
+module TentD
class API
module Router
class CachingHeaders
@@ -1,4 +1,4 @@
-module TentServer
+module TentD
class API
module Router
class ExtractParams
@@ -1,6 +1,6 @@
require 'json'
-module TentServer
+module TentD
class API
module Router
class SerializeResponse
File renamed without changes.
@@ -1,4 +1,4 @@
-module TentServer
+module TentD
class JsonPatch
OPERATIONS = %w( add remove replace move copy test )
View
@@ -0,0 +1,24 @@
+require 'data_mapper'
+require 'dm-ar-finders'
+require 'tentd/datamapper/array_property'
+require 'tentd/datamapper/binary_string_property'
+require 'tentd/datamapper/query'
+
+module TentD
+ module Model
+ require 'tentd/model/permissible'
+ require 'tentd/model/random_public_id'
+ require 'tentd/model/post'
+ require 'tentd/model/post_attachment'
+ require 'tentd/model/follower'
+ require 'tentd/model/following'
+ require 'tentd/model/app'
+ require 'tentd/model/app_authorization'
+ require 'tentd/model/notification_subscription'
+ require 'tentd/model/profile_info'
+ require 'tentd/model/group'
+ require 'tentd/model/permission'
+ end
+end
+
+DataMapper.finalize
@@ -1,7 +1,7 @@
require 'securerandom'
-require 'tent-server/core_ext/hash/slice'
+require 'tentd/core_ext/hash/slice'
-module TentServer
+module TentD
module Model
class App
include DataMapper::Resource
@@ -23,7 +23,7 @@ class App
property :created_at, DateTime
property :updated_at, DateTime
- has n, :authorizations, 'TentServer::Model::AppAuthorization', :constraint => :destroy
+ has n, :authorizations, 'TentD::Model::AppAuthorization', :constraint => :destroy
def self.create_from_params(params)
create(params.slice(:name, :description, :url, :icon, :redirect_uris, :scopes))
@@ -1,6 +1,6 @@
require 'securerandom'
-module TentServer
+module TentD
module Model
class AppAuthorization
include DataMapper::Resource
@@ -22,8 +22,8 @@ class AppAuthorization
property :created_at, DateTime
property :updated_at, DateTime
- belongs_to :app, 'TentServer::Model::App'
- has n, :notification_subscriptions, 'TentServer::Model::NotificationSubscription', :constraint => :destroy
+ belongs_to :app, 'TentD::Model::App'
+ has n, :notification_subscriptions, 'TentD::Model::NotificationSubscription', :constraint => :destroy
end
end
end
Oops, something went wrong.

0 comments on commit 131f435

Please sign in to comment.