dailycred 0.1.8 → 0.1.21
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +0 -4
- data/Gemfile +3 -15
- data/README.md +34 -190
- data/Rakefile +0 -41
- data/dailycred.gemspec +5 -7
- data/lib/dailycred.rb +86 -1
- data/lib/generators/dailycred_generator.rb +44 -92
- data/lib/generators/templates/info.html.erb +1 -1
- data/lib/generators/templates/migration_create_user.rb +10 -54
- data/lib/generators/templates/omniauth.rb +17 -6
- data/lib/generators/templates/sessions_controller.rb +2 -8
- data/lib/generators/templates/user.rb +23 -1
- data/lib/middleware/middleware.rb +57 -0
- data/lib/omniauth/strategies/dailycred.rb +62 -0
- data/lib/omniauth-dailycred/version.rb +5 -0
- data/spec/omniauth/strategies/dailycred_spec.rb +22 -0
- data/spec/{helper_spec.rb → spec_helper.rb} +3 -3
- metadata +23 -107
- checksums.yaml +0 -7
- data/.travis.yml +0 -3
- data/Guardfile +0 -15
- data/app/controllers/sessions_controller.rb +0 -31
- data/app/views/sessions/info.html.erb +0 -13
- data/config/routes.rb +0 -7
- data/docs/lib/dailycred/acts_as_dailycred.html +0 -42
- data/docs/lib/dailycred/client.html +0 -214
- data/docs/lib/dailycred/engine.html +0 -112
- data/docs/lib/dailycred/helper.html +0 -125
- data/docs/lib/dailycred/middleware.html +0 -42
- data/docs/lib/dailycred/tests_helper.html +0 -42
- data/docs/lib/dailycred/user.html +0 -133
- data/docs/lib/dailycred.html +0 -42
- data/docs/lib/generators/dailycred_generator.html +0 -42
- data/docs/lib/generators/templates/migration_create_user.html +0 -39
- data/docs/lib/generators/templates/omniauth.html +0 -71
- data/docs/lib/generators/templates/sessions_controller.html +0 -96
- data/docs/lib/generators/templates/user.html +0 -42
- data/docs/lib/middleware/middleware.html +0 -38
- data/docs/lib/omniauth/strategies/dailycred.html +0 -199
- data/docs/lib/omniauth-dailycred/version.html +0 -38
- data/docs/lib/user/user.html +0 -129
- data/dummy/.gitignore +0 -16
- data/dummy/Gemfile +0 -40
- data/dummy/README.rdoc +0 -28
- data/dummy/Rakefile +0 -6
- data/dummy/app/assets/images/rails.png +0 -0
- data/dummy/app/assets/javascripts/application.js +0 -16
- data/dummy/app/assets/stylesheets/application.css +0 -13
- data/dummy/app/controllers/application_controller.rb +0 -17
- data/dummy/app/controllers/concerns/.keep +0 -0
- data/dummy/app/helpers/application_helper.rb +0 -2
- data/dummy/app/mailers/.keep +0 -0
- data/dummy/app/models/.keep +0 -0
- data/dummy/app/models/concerns/.keep +0 -0
- data/dummy/app/models/user.rb +0 -3
- data/dummy/app/views/layouts/application.html.erb +0 -14
- data/dummy/bin/bundle +0 -3
- data/dummy/bin/rails +0 -4
- data/dummy/bin/rake +0 -4
- data/dummy/config/application.rb +0 -22
- data/dummy/config/boot.rb +0 -4
- data/dummy/config/database.yml +0 -25
- data/dummy/config/environment.rb +0 -5
- data/dummy/config/environments/development.rb +0 -27
- data/dummy/config/environments/production.rb +0 -80
- data/dummy/config/environments/test.rb +0 -36
- data/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/dummy/config/initializers/inflections.rb +0 -16
- data/dummy/config/initializers/mime_types.rb +0 -5
- data/dummy/config/initializers/omniauth.rb +0 -9
- data/dummy/config/initializers/secret_token.rb +0 -12
- data/dummy/config/initializers/session_store.rb +0 -3
- data/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/dummy/config/locales/en.yml +0 -23
- data/dummy/config/routes.rb +0 -50
- data/dummy/config.ru +0 -4
- data/dummy/db/migrate/20130417131939_create_users.rb +0 -64
- data/dummy/db/schema.rb +0 -36
- data/dummy/db/seeds.rb +0 -7
- data/dummy/lib/assets/.keep +0 -0
- data/dummy/lib/tasks/.keep +0 -0
- data/dummy/log/.keep +0 -0
- data/dummy/public/404.html +0 -27
- data/dummy/public/422.html +0 -26
- data/dummy/public/500.html +0 -26
- data/dummy/public/favicon.ico +0 -0
- data/dummy/public/robots.txt +0 -5
- data/dummy/test/controllers/.keep +0 -0
- data/dummy/test/fixtures/.keep +0 -0
- data/dummy/test/helpers/.keep +0 -0
- data/dummy/test/integration/.keep +0 -0
- data/dummy/test/mailers/.keep +0 -0
- data/dummy/test/models/.keep +0 -0
- data/dummy/test/test_helper.rb +0 -15
- data/dummy/vendor/assets/javascripts/.keep +0 -0
- data/dummy/vendor/assets/stylesheets/.keep +0 -0
- data/lib/dailycred/acts_as_dailycred.rb +0 -74
- data/lib/dailycred/client.rb +0 -106
- data/lib/dailycred/engine.rb +0 -53
- data/lib/dailycred/helper.rb +0 -61
- data/lib/dailycred/middleware.rb +0 -70
- data/lib/dailycred/tests_helper.rb +0 -5
- data/lib/dailycred/user.rb +0 -63
- data/lib/dailycred/version.rb +0 -3
- data/lib/generators/templates/login.html.erb +0 -13
- data/script/download_info.rb +0 -11
- data/spec/support/dailycred_spec.rb +0 -72
- data/spec/support/shared_examples.rb +0 -40
- data/test/generator_test.rb +0 -83
- data/test/test_helper.rb +0 -6
data/dummy/config/database.yml
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# SQLite version 3.x
|
2
|
-
# gem install sqlite3
|
3
|
-
#
|
4
|
-
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
-
# gem 'sqlite3'
|
6
|
-
development:
|
7
|
-
adapter: sqlite3
|
8
|
-
database: db/development.sqlite3
|
9
|
-
pool: 5
|
10
|
-
timeout: 5000
|
11
|
-
|
12
|
-
# Warning: The database defined as "test" will be erased and
|
13
|
-
# re-generated from your development database when you run "rake".
|
14
|
-
# Do not set this db to the same as development or production.
|
15
|
-
test:
|
16
|
-
adapter: sqlite3
|
17
|
-
database: db/test.sqlite3
|
18
|
-
pool: 5
|
19
|
-
timeout: 5000
|
20
|
-
|
21
|
-
production:
|
22
|
-
adapter: sqlite3
|
23
|
-
database: db/production.sqlite3
|
24
|
-
pool: 5
|
25
|
-
timeout: 5000
|
data/dummy/config/environment.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
-
|
4
|
-
# In the development environment your application's code is reloaded on
|
5
|
-
# every request. This slows down response time but is perfect for development
|
6
|
-
# since you don't have to restart the web server when you make code changes.
|
7
|
-
config.cache_classes = false
|
8
|
-
|
9
|
-
# Do not eager load code on boot.
|
10
|
-
config.eager_load = false
|
11
|
-
|
12
|
-
# Show full error reports and disable caching.
|
13
|
-
config.consider_all_requests_local = true
|
14
|
-
config.action_controller.perform_caching = false
|
15
|
-
|
16
|
-
# Don't care if the mailer can't send.
|
17
|
-
config.action_mailer.raise_delivery_errors = false
|
18
|
-
|
19
|
-
# Print deprecation notices to the Rails logger.
|
20
|
-
config.active_support.deprecation = :log
|
21
|
-
|
22
|
-
# Raise an error on page load if there are pending migrations
|
23
|
-
config.active_record.migration_error = :page_load
|
24
|
-
|
25
|
-
# Debug mode disables concatenation and preprocessing of assets.
|
26
|
-
config.assets.debug = true
|
27
|
-
end
|
@@ -1,80 +0,0 @@
|
|
1
|
-
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
-
|
4
|
-
# Code is not reloaded between requests.
|
5
|
-
config.cache_classes = true
|
6
|
-
|
7
|
-
# Eager load code on boot. This eager loads most of Rails and
|
8
|
-
# your application in memory, allowing both thread web servers
|
9
|
-
# and those relying on copy on write to perform better.
|
10
|
-
# Rake tasks automatically ignore this option for performance.
|
11
|
-
config.eager_load = true
|
12
|
-
|
13
|
-
# Full error reports are disabled and caching is turned on.
|
14
|
-
config.consider_all_requests_local = false
|
15
|
-
config.action_controller.perform_caching = true
|
16
|
-
|
17
|
-
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
18
|
-
# Add `rack-cache` to your Gemfile before enabling this.
|
19
|
-
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
20
|
-
# config.action_dispatch.rack_cache = true
|
21
|
-
|
22
|
-
# Disable Rails's static asset server (Apache or nginx will already do this).
|
23
|
-
config.serve_static_assets = false
|
24
|
-
|
25
|
-
# Compress JavaScripts and CSS.
|
26
|
-
config.assets.js_compressor = :uglifier
|
27
|
-
# config.assets.css_compressor = :sass
|
28
|
-
|
29
|
-
# Whether to fallback to assets pipeline if a precompiled asset is missed.
|
30
|
-
config.assets.compile = false
|
31
|
-
|
32
|
-
# Generate digests for assets URLs.
|
33
|
-
config.assets.digest = true
|
34
|
-
|
35
|
-
# Version of your assets, change this if you want to expire all your assets.
|
36
|
-
config.assets.version = '1.0'
|
37
|
-
|
38
|
-
# Specifies the header that your server uses for sending files.
|
39
|
-
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
40
|
-
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
41
|
-
|
42
|
-
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
43
|
-
# config.force_ssl = true
|
44
|
-
|
45
|
-
# Set to :debug to see everything in the log.
|
46
|
-
config.log_level = :info
|
47
|
-
|
48
|
-
# Prepend all log lines with the following tags.
|
49
|
-
# config.log_tags = [ :subdomain, :uuid ]
|
50
|
-
|
51
|
-
# Use a different logger for distributed setups.
|
52
|
-
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
53
|
-
|
54
|
-
# Use a different cache store in production.
|
55
|
-
# config.cache_store = :mem_cache_store
|
56
|
-
|
57
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
58
|
-
# config.action_controller.asset_host = "http://assets.example.com"
|
59
|
-
|
60
|
-
# Precompile additional assets.
|
61
|
-
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
62
|
-
# config.assets.precompile += %w( search.js )
|
63
|
-
|
64
|
-
# Ignore bad email addresses and do not raise email delivery errors.
|
65
|
-
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
66
|
-
# config.action_mailer.raise_delivery_errors = false
|
67
|
-
|
68
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
69
|
-
# the I18n.default_locale when a translation can not be found).
|
70
|
-
config.i18n.fallbacks = true
|
71
|
-
|
72
|
-
# Send deprecation notices to registered listeners.
|
73
|
-
config.active_support.deprecation = :notify
|
74
|
-
|
75
|
-
# Disable automatic flushing of the log to improve performance.
|
76
|
-
# config.autoflush_log = false
|
77
|
-
|
78
|
-
# Use default logging formatter so that PID and timestamp are not suppressed.
|
79
|
-
config.log_formatter = ::Logger::Formatter.new
|
80
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
-
|
4
|
-
# The test environment is used exclusively to run your application's
|
5
|
-
# test suite. You never need to work with it otherwise. Remember that
|
6
|
-
# your test database is "scratch space" for the test suite and is wiped
|
7
|
-
# and recreated between test runs. Don't rely on the data there!
|
8
|
-
config.cache_classes = true
|
9
|
-
|
10
|
-
# Do not eager load code on boot. This avoids loading your whole application
|
11
|
-
# just for the purpose of running a single test. If you are using a tool that
|
12
|
-
# preloads Rails for running tests, you may have to set it to true.
|
13
|
-
config.eager_load = false
|
14
|
-
|
15
|
-
# Configure static asset server for tests with Cache-Control for performance.
|
16
|
-
config.serve_static_assets = true
|
17
|
-
config.static_cache_control = "public, max-age=3600"
|
18
|
-
|
19
|
-
# Show full error reports and disable caching.
|
20
|
-
config.consider_all_requests_local = true
|
21
|
-
config.action_controller.perform_caching = false
|
22
|
-
|
23
|
-
# Raise exceptions instead of rendering exception templates.
|
24
|
-
config.action_dispatch.show_exceptions = false
|
25
|
-
|
26
|
-
# Disable request forgery protection in test environment.
|
27
|
-
config.action_controller.allow_forgery_protection = false
|
28
|
-
|
29
|
-
# Tell Action Mailer not to deliver emails to the real world.
|
30
|
-
# The :test delivery method accumulates sent emails in the
|
31
|
-
# ActionMailer::Base.deliveries array.
|
32
|
-
config.action_mailer.delivery_method = :test
|
33
|
-
|
34
|
-
# Print deprecation notices to the stderr.
|
35
|
-
config.active_support.deprecation = :stderr
|
36
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
-
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
-
|
6
|
-
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
-
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Add new inflection rules using the following format. Inflections
|
4
|
-
# are locale specific, and you may define rules for as many different
|
5
|
-
# locales as you wish. All of these examples are active by default:
|
6
|
-
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
-
# inflect.plural /^(ox)$/i, '\1en'
|
8
|
-
# inflect.singular /^(ox)en/i, '\1'
|
9
|
-
# inflect.irregular 'person', 'people'
|
10
|
-
# inflect.uncountable %w( fish sheep )
|
11
|
-
# end
|
12
|
-
|
13
|
-
# These inflection rules are supported but not enabled by default:
|
14
|
-
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
-
# inflect.acronym 'RESTful'
|
16
|
-
# end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
Rails.configuration.DAILYCRED_CLIENT_ID = "37a067dd-3fef-4efd-909a-38b8081c5867"
|
2
|
-
Rails.configuration.DAILYCRED_SECRET_KEY = "b622f8a7-fa92-4fe8-bb74-b5bad5db79d3-817ddff2-6fa1-4499-ae47-69ea0d4c5c44"
|
3
|
-
|
4
|
-
# configure where users should be redirected after authentication
|
5
|
-
#
|
6
|
-
# Rails.configuration.DAILYCRED_OPTIONS = {
|
7
|
-
# :after_auth => '/hello', #after login
|
8
|
-
# :after_unauth => '/goodbye' #after logout
|
9
|
-
# }
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Your secret key for verifying the integrity of signed cookies.
|
4
|
-
# If you change this key, all old signed cookies will become invalid!
|
5
|
-
|
6
|
-
# Make sure the secret is at least 30 characters and all random,
|
7
|
-
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
-
# You can use `rake secret` to generate a secure secret key.
|
9
|
-
|
10
|
-
# Make sure your secret_key_base is kept private
|
11
|
-
# if you're sharing your code publicly.
|
12
|
-
Dummy::Application.config.secret_key_base = 'cb5a0759593cd5f1cb9802a3c05fb35cd7348e8b867a69136addced11ff4763bc78da24db0b3e9d0fefd8696dc35de025090e9800b992b33d68ee2afcaf1895f'
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
-
# is enabled by default.
|
5
|
-
|
6
|
-
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
-
ActiveSupport.on_load(:action_controller) do
|
8
|
-
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
|
-
end
|
10
|
-
|
11
|
-
# To enable root element in JSON for ActiveRecord objects.
|
12
|
-
# ActiveSupport.on_load(:active_record) do
|
13
|
-
# self.include_root_in_json = true
|
14
|
-
# end
|
data/dummy/config/locales/en.yml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# Files in the config/locales directory are used for internationalization
|
2
|
-
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
-
# than English, add the necessary files in this directory.
|
4
|
-
#
|
5
|
-
# To use the locales, use `I18n.t`:
|
6
|
-
#
|
7
|
-
# I18n.t 'hello'
|
8
|
-
#
|
9
|
-
# In views, this is aliased to just `t`:
|
10
|
-
#
|
11
|
-
# <%= t('hello') %>
|
12
|
-
#
|
13
|
-
# To use a different locale, set it with `I18n.locale`:
|
14
|
-
#
|
15
|
-
# I18n.locale = :es
|
16
|
-
#
|
17
|
-
# This would use the information in config/locales/es.yml.
|
18
|
-
#
|
19
|
-
# To learn more, please read the Rails Internationalization guide
|
20
|
-
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
-
|
22
|
-
en:
|
23
|
-
hello: "Hello world"
|
data/dummy/config/routes.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
Dummy::Application.routes.draw do
|
2
|
-
mount Dailycred::Engine => '/auth', :as => 'dailycred_engine'
|
3
|
-
# The priority is based upon order of creation: first created -> highest priority.
|
4
|
-
# See how all your routes lay out with "rake routes".
|
5
|
-
|
6
|
-
# You can have the root of your site routed with "root"
|
7
|
-
# root to: 'welcome#index'
|
8
|
-
|
9
|
-
# Example of regular route:
|
10
|
-
# get 'products/:id' => 'catalog#view'
|
11
|
-
|
12
|
-
# Example of named route that can be invoked with purchase_url(id: product.id)
|
13
|
-
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
|
14
|
-
|
15
|
-
# Example resource route (maps HTTP verbs to controller actions automatically):
|
16
|
-
# resources :products
|
17
|
-
|
18
|
-
# Example resource route with options:
|
19
|
-
# resources :products do
|
20
|
-
# member do
|
21
|
-
# get 'short'
|
22
|
-
# post 'toggle'
|
23
|
-
# end
|
24
|
-
#
|
25
|
-
# collection do
|
26
|
-
# get 'sold'
|
27
|
-
# end
|
28
|
-
# end
|
29
|
-
|
30
|
-
# Example resource route with sub-resources:
|
31
|
-
# resources :products do
|
32
|
-
# resources :comments, :sales
|
33
|
-
# resource :seller
|
34
|
-
# end
|
35
|
-
|
36
|
-
# Example resource route with more complex sub-resources:
|
37
|
-
# resources :products do
|
38
|
-
# resources :comments
|
39
|
-
# resources :sales do
|
40
|
-
# get 'recent', on: :collection
|
41
|
-
# end
|
42
|
-
# end
|
43
|
-
|
44
|
-
# Example resource route within a namespace:
|
45
|
-
# namespace :admin do
|
46
|
-
# # Directs /admin/products/* to Admin::ProductsController
|
47
|
-
# # (app/controllers/admin/products_controller.rb)
|
48
|
-
# resources :products
|
49
|
-
# end
|
50
|
-
end
|
data/dummy/config.ru
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
class CreateUsers < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
if !table_exists? :users
|
4
|
-
create_table :users do |t|
|
5
|
-
t.string :provider
|
6
|
-
t.string :uid
|
7
|
-
t.string :email
|
8
|
-
t.string :username
|
9
|
-
t.boolean :verified
|
10
|
-
t.boolean :admin
|
11
|
-
t.string :referred_by
|
12
|
-
t.string :token
|
13
|
-
t.text :tags
|
14
|
-
t.text :referred
|
15
|
-
t.text :access_tokens
|
16
|
-
t.boolean :subscribed
|
17
|
-
t.string :display
|
18
|
-
t.text :identities
|
19
|
-
t.datetime :created
|
20
|
-
|
21
|
-
t.timestamps
|
22
|
-
end
|
23
|
-
else
|
24
|
-
safe_column :users, :provider, :string
|
25
|
-
safe_column :users, :uid, :string
|
26
|
-
safe_column :users, :email, :string
|
27
|
-
safe_column :users, :username, :string
|
28
|
-
safe_column :users, :verified, :boolean
|
29
|
-
safe_column :users, :admin, :boolean
|
30
|
-
safe_column :users, :referred, :string
|
31
|
-
safe_column :users, :token, :string
|
32
|
-
safe_column :users, :tags, :text
|
33
|
-
safe_column :users, :referred, :text
|
34
|
-
safe_column :users, :access_tokens, :text
|
35
|
-
safe_column :users, :display, :string
|
36
|
-
safe_column :users, :subscribed, :boolean
|
37
|
-
safe_column :users, :identities, :text
|
38
|
-
safe_column :users, :created, :datetime
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.down
|
43
|
-
drop_table :users
|
44
|
-
end
|
45
|
-
|
46
|
-
private
|
47
|
-
|
48
|
-
def table_exists? table
|
49
|
-
ActiveRecord::Base.connection.table_exists?(table.to_s)
|
50
|
-
end
|
51
|
-
|
52
|
-
def column_exists?(table, column)
|
53
|
-
begin
|
54
|
-
ActiveRecord::Base.connection.columns(table.to_s).map(&:name).include?(column.to_s)
|
55
|
-
rescue NoMethodError #actual_columns is empty and it doesn't respond to the map method
|
56
|
-
false
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def safe_column table, name, type
|
61
|
-
add_column table.to_sym, name.to_sym, type.to_sym unless column_exists? table, name
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
data/dummy/db/schema.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
# This file is auto-generated from the current state of the database. Instead
|
3
|
-
# of editing this file, please use the migrations feature of Active Record to
|
4
|
-
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
-
#
|
6
|
-
# Note that this schema.rb definition is the authoritative source for your
|
7
|
-
# database schema. If you need to create the application database on another
|
8
|
-
# system, you should be using db:schema:load, not running all the migrations
|
9
|
-
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
-
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
-
#
|
12
|
-
# It's strongly recommended that you check this file into your version control system.
|
13
|
-
|
14
|
-
ActiveRecord::Schema.define(version: 20130417131939) do
|
15
|
-
|
16
|
-
create_table "users", force: true do |t|
|
17
|
-
t.string "provider"
|
18
|
-
t.string "uid"
|
19
|
-
t.string "email"
|
20
|
-
t.string "username"
|
21
|
-
t.boolean "verified"
|
22
|
-
t.boolean "admin"
|
23
|
-
t.string "referred_by"
|
24
|
-
t.string "token"
|
25
|
-
t.text "tags"
|
26
|
-
t.text "referred"
|
27
|
-
t.text "access_tokens"
|
28
|
-
t.boolean "subscribed"
|
29
|
-
t.string "display"
|
30
|
-
t.text "identities"
|
31
|
-
t.datetime "created"
|
32
|
-
t.datetime "created_at"
|
33
|
-
t.datetime "updated_at"
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
data/dummy/db/seeds.rb
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
-
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
-
#
|
4
|
-
# Examples:
|
5
|
-
#
|
6
|
-
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
7
|
-
# Mayor.create(name: 'Emanuel', city: cities.first)
|
data/dummy/lib/assets/.keep
DELETED
File without changes
|
data/dummy/lib/tasks/.keep
DELETED
File without changes
|
data/dummy/log/.keep
DELETED
File without changes
|
data/dummy/public/404.html
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<style>
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/404.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
-
</div>
|
25
|
-
<p>If you are the application owner check the logs for more information.</p>
|
26
|
-
</body>
|
27
|
-
</html>
|
data/dummy/public/422.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<style>
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/422.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The change you wanted was rejected.</h1>
|
23
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
data/dummy/public/500.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<style>
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/500.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>We're sorry, but something went wrong.</h1>
|
23
|
-
</div>
|
24
|
-
<p>If you are the application owner check the logs for more information.</p>
|
25
|
-
</body>
|
26
|
-
</html>
|
data/dummy/public/favicon.ico
DELETED
File without changes
|
data/dummy/public/robots.txt
DELETED
File without changes
|
data/dummy/test/fixtures/.keep
DELETED
File without changes
|
data/dummy/test/helpers/.keep
DELETED
File without changes
|
File without changes
|
data/dummy/test/mailers/.keep
DELETED
File without changes
|
data/dummy/test/models/.keep
DELETED
File without changes
|
data/dummy/test/test_helper.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
ENV["RAILS_ENV"] = "test"
|
2
|
-
require File.expand_path('../../config/environment', __FILE__)
|
3
|
-
require 'rails/test_help'
|
4
|
-
|
5
|
-
class ActiveSupport::TestCase
|
6
|
-
ActiveRecord::Migration.check_pending!
|
7
|
-
|
8
|
-
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
|
9
|
-
#
|
10
|
-
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
11
|
-
# -- they do not yet inherit this setting
|
12
|
-
fixtures :all
|
13
|
-
|
14
|
-
# Add more helper methods to be used by all tests here...
|
15
|
-
end
|
File without changes
|
File without changes
|
@@ -1,74 +0,0 @@
|
|
1
|
-
module ActsAsDailycred
|
2
|
-
def acts_as_dailycred
|
3
|
-
serialize :tags, Array
|
4
|
-
serialize :referred, Array
|
5
|
-
serialize :access_tokens, Hash
|
6
|
-
serialize :identities, Hash
|
7
|
-
|
8
|
-
extend ActsAsDailycred::SingletonMethods
|
9
|
-
include ActsAsDailycred::InstanceMethods
|
10
|
-
include Dailycred::Helpers
|
11
|
-
end
|
12
|
-
module SingletonMethods
|
13
|
-
def find_or_create_with_omniauth(model)
|
14
|
-
@user = User.find_by_provider_and_uid(model['provider'], model['uid']) || User.new
|
15
|
-
@user.update_from_dailycred model[:info]
|
16
|
-
@user
|
17
|
-
end
|
18
|
-
end
|
19
|
-
module InstanceMethods
|
20
|
-
def tag tag
|
21
|
-
dc = get_client
|
22
|
-
response = dc.tag self.uid, tag
|
23
|
-
json = JSON.parse(response.body)
|
24
|
-
if json['worked']
|
25
|
-
self.tags << tag
|
26
|
-
save!
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def untag tag
|
31
|
-
dc = get_client
|
32
|
-
response = dc.untag self.uid, tag
|
33
|
-
json = JSON.parse(response.body)
|
34
|
-
if json['worked']
|
35
|
-
self.tags.delete tag
|
36
|
-
save!
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
#deprecated, use @user.display
|
41
|
-
def display_name
|
42
|
-
self.display
|
43
|
-
end
|
44
|
-
|
45
|
-
def referral_link url
|
46
|
-
"https://www.dailycred.com/r/#{self.uid}?redirect_uri=#{url}"
|
47
|
-
end
|
48
|
-
def reset_password
|
49
|
-
get_client.reset_password self.email
|
50
|
-
end
|
51
|
-
|
52
|
-
def update_from_dailycred dc
|
53
|
-
bad = ['updated_at', 'created_at']
|
54
|
-
dc.each do |k,v|
|
55
|
-
self.send("#{k}=", v) if self.respond_to?(k) and !bad.include?(k.to_s)
|
56
|
-
end
|
57
|
-
save!
|
58
|
-
end
|
59
|
-
|
60
|
-
def fire_event key, val=""
|
61
|
-
get_client.event self.uid, key, val
|
62
|
-
end
|
63
|
-
|
64
|
-
def get_client
|
65
|
-
@dailycred ||= Dailycred::Client.new Rails.configuration.DAILYCRED_CLIENT_ID, Rails.configuration.DAILYCRED_SECRET_KEY
|
66
|
-
end
|
67
|
-
|
68
|
-
def connect_path provider
|
69
|
-
"/auth/dailycred?identity_provider=#{provider.to_s}"
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
73
|
-
require 'active_record'
|
74
|
-
ActiveRecord::Base.extend ActsAsDailycred
|