-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit bf0ec05
Showing
291 changed files
with
4,459 additions
and
0 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,56 @@ | ||
\#* | ||
**/*.db | ||
**/*.log | ||
*~ | ||
.#* | ||
.DS_Store | ||
.dotest | ||
.idea | ||
.loadpath | ||
.project | ||
.ruby-version | ||
bin/* | ||
shared/pids/puma.state | ||
public/dispatch.cgi | ||
public/dispatch.fcgi | ||
public/dispatch.rb | ||
httpd | ||
pgsql | ||
config/*-public.asc | ||
config/mongrel_cluster.yml | ||
db/*.sql | ||
db/schema.rb | ||
doc/**/* | ||
Gemfile.lock | ||
*/Gemfile.lock | ||
lib/products_index_profiler.rb | ||
log/*.log | ||
pkg | ||
public/assets | ||
public/attachments | ||
public/blank_iframe.html | ||
public/ckeditora | ||
sandbox/* | ||
spree_dev | ||
spree_test | ||
testapp | ||
**/spec/dummy | ||
tmp | ||
public/google_base.xml | ||
public/template_google_base.xml | ||
coverage/* | ||
var | ||
TAGS | ||
nbproject | ||
./vendor | ||
tags | ||
*.swp | ||
rerun.txt | ||
test_app | ||
.rvmrc | ||
**/coverage | ||
*/.sass-cache | ||
.localeapp | ||
.ruby-gemset | ||
database.yml | ||
.gem |
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,27 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'rails', '~> 4.2.7.1' | ||
gem 'spree_core', '3.1.1' | ||
gem 'spree_api', '3.1.1' | ||
gem 'spree_backend', '3.1.1' | ||
gem 'spree_auth_devise', '~> 3.1.0' | ||
gem 'coffee-script', '2.4.1' | ||
gem 'turbolinks', '5.0.1' | ||
gem 'rest-client', '2.0.0' | ||
|
||
gem 'rack-cors', :require => 'rack/cors' | ||
gem 'coffee-rails', '~> 4.1.1' | ||
gem 'sass-rails', '~> 5.0.0' | ||
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw] | ||
gem 'uglifier', '3.0.4' | ||
gem 'sqlite3', platforms: [:ruby, :mingw, :mswin, :x64_mingw] | ||
|
||
gem 'statsd-ruby' | ||
|
||
platforms :ruby do | ||
gem 'mysql2', '0.4.5' | ||
end | ||
|
||
gem 'activerecord-session_store', '1.0.0' | ||
|
||
gem 'puma', '3.6.2' |
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,23 @@ | ||
Spree ADMIN UI and Backend API for Awesome website | ||
|
||
Setup for Development: | ||
--------------------- | ||
|
||
A) Installing Spree Gems | ||
|
||
Currently we dont have gem repo, so to install spree patched gem follow this step | ||
|
||
* bundle install | ||
* bundle exec rake gem:build | ||
* bundle exec rake gem:install | ||
|
||
B) Configuring Website Backend | ||
|
||
|
||
* Ensure database configurations are updated in database.yml file | ||
* bundle install | ||
* rake db:create | ||
* rake db:migrate | ||
* rake db:seed | ||
|
||
C) Start sever by rails s |
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,28 @@ | ||
== README | ||
|
||
This README would normally document whatever steps are necessary to get the | ||
application up and running. | ||
|
||
Things you may want to cover: | ||
|
||
* Ruby version | ||
|
||
* System dependencies | ||
|
||
* Configuration | ||
|
||
* Database creation | ||
|
||
* Database initialization | ||
|
||
* How to run the test suite | ||
|
||
* Services (job queues, cache servers, search engines, etc.) | ||
|
||
* Deployment instructions | ||
|
||
* ... | ||
|
||
|
||
Please feel free to use a different markup language if you do not plan to run | ||
<tt>rake doc:app</tt>. |
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,6 @@ | ||
README.rdoc# 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__) | ||
|
||
Rails.application.load_tasks |
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,16 @@ | ||
// This is a manifest file that'll be compiled into application.js, which will include all the files | ||
// listed below. | ||
// | ||
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, | ||
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. | ||
// | ||
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the | ||
// compiled file. | ||
// | ||
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details | ||
// about supported directives. | ||
// | ||
//= require jquery | ||
//= require jquery_ujs | ||
//= require turbolinks | ||
//= require_tree . |
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,15 @@ | ||
/* | ||
* This is a manifest file that'll be compiled into application.css, which will include all the files | ||
* listed below. | ||
* | ||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, | ||
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. | ||
* | ||
* You're free to add application-wide styles to this file and they'll appear at the bottom of the | ||
* compiled file so the styles you add here take precedence over styles defined in any styles | ||
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new | ||
* file per style scope. | ||
* | ||
*= require_tree . | ||
*= require_self | ||
*/ |
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,23 @@ | ||
class ApplicationController < ActionController::Base | ||
# Prevent CSRF attacks by raising an exception. | ||
# For APIs, you may want to use :null_session instead. | ||
protect_from_forgery with: :exception | ||
|
||
rescue_from CanCan::AccessDenied do |exception| | ||
redirect_to root_url, :alert => exception.message | ||
end | ||
|
||
def after_sign_in_path_for(resource_or_scope) | ||
stored_location_for(resource_or_scope) || signed_in_root_path(resource_or_scope) | ||
|
||
if resource_or_scope.has_spree_role?("catalog") | ||
'/admin/products' | ||
else | ||
'/admin/orders' | ||
end | ||
end | ||
|
||
def after_sign_out_path_for(resource_or_scope) | ||
'/admin/login' | ||
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,10 @@ | ||
module ApplicationHelper | ||
def isUserAdmin user | ||
Spree::Role.find_each do |admin| | ||
if user.try(:has_spree_role?, admin.name) | ||
return admin.name | ||
end | ||
end | ||
return "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,40 @@ | ||
require "statsd-ruby" | ||
|
||
ENV['STATSD_HOST'] ||= 'localhost' | ||
ENV['STATSD_PORT'] ||= '8125' | ||
|
||
module MyStatsd | ||
def self.statsd | ||
@statsd ||= Statsd.new(ENV['STATSD_HOST'], ENV['STATSD_PORT']) | ||
end | ||
|
||
class Middleware | ||
attr_accessor :app | ||
|
||
def initialize(app) | ||
@app = app | ||
end | ||
|
||
def call(env) | ||
(status, headers, body), response_time = call_with_timing(env) | ||
puts "in middleware, path is: #{env['REQUEST_PATH']}" | ||
statsd.timing("#{env['REQUEST_PATH']}.response", response_time) | ||
statsd.increment("#{env['REQUEST_PATH']}.response_codes.#{status.to_s.gsub(/\d{2}$/,'xx')}") | ||
# Rack response | ||
[status, headers, body] | ||
rescue Exception => exception | ||
statsd.increment("#{env['REQUEST_PATH']}.response_codes.5xx") | ||
raise | ||
end | ||
|
||
def call_with_timing(env) | ||
start = Time.now | ||
result = @app.call(env) | ||
[result, ((Time.now - start) * 1000).round] | ||
end | ||
|
||
def statsd | ||
MyStatsd.statsd | ||
end | ||
end | ||
end |
Empty file.
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,4 @@ | ||
# This file is used by Rack-based servers to start the application. | ||
|
||
require ::File.expand_path('../config/environment', __FILE__) | ||
run Rails.application |
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,44 @@ | ||
require File.expand_path('../boot', __FILE__) | ||
require_relative '../app/middleware/my_statsd.rb' | ||
|
||
require 'rails/all' | ||
|
||
# Require the gems listed in Gemfile, including any gems | ||
# you've limited to :test, :development, or :production. | ||
Bundler.require(*Rails.groups) | ||
|
||
module WebBackend | ||
class Application < Rails::Application | ||
config.to_prepare do | ||
# Load application's model / class decorators | ||
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*.rb")) do |c| | ||
Rails.configuration.cache_classes ? require(c) : load(c) | ||
end | ||
|
||
end | ||
|
||
# Settings in config/environments/* take precedence over those specified here. | ||
# Application configuration should go into files in config/initializers | ||
# -- all .rb files in that directory are automatically loaded. | ||
|
||
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. | ||
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. | ||
# config.time_zone = 'Central Time (US & Canada)' | ||
|
||
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. | ||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] | ||
# config.i18n.default_locale = :de | ||
|
||
# Do not swallow errors in after_commit/after_rollback callbacks. | ||
config.active_record.raise_in_transactional_callbacks = true | ||
|
||
config.middleware.insert_before 0, "Rack::Cors" do | ||
allow do | ||
origins '*' | ||
resource '*', :headers => :any, :methods => [:get, :post, :options, :put, :delete] | ||
end | ||
end | ||
|
||
config.middleware.use MyStatsd::Middleware | ||
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,3 @@ | ||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) | ||
|
||
require 'bundler/setup' # Set up gems listed in the Gemfile. |
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,5 @@ | ||
# Load the Rails application. | ||
require File.expand_path('../application', __FILE__) | ||
|
||
# Initialize the Rails application. | ||
Rails.application.initialize! |
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,43 @@ | ||
Rails.application.configure do | ||
# Settings specified here will take precedence over those in config/application.rb. | ||
|
||
# In the development environment your application's code is reloaded on | ||
# every request. This slows down response time but is perfect for development | ||
# since you don't have to restart the web server when you make code changes. | ||
|
||
config.cache_classes = false | ||
|
||
# Do not eager load code on boot. | ||
config.eager_load = false | ||
|
||
# Show full error reports and disable caching. | ||
config.consider_all_requests_local = true | ||
config.action_controller.perform_caching = false | ||
|
||
# Don't care if the mailer can't send. | ||
config.action_mailer.raise_delivery_errors = false | ||
|
||
# Print deprecation notices to the Rails logger. | ||
config.active_support.deprecation = :log | ||
|
||
# Raise an error on page load if there are pending migrations. | ||
#config.active_record.migration_error = :page_load | ||
|
||
# Debug mode disables concatenation and preprocessing of assets. | ||
# This option may cause significant delays in view rendering with a large | ||
# number of complex assets. | ||
config.assets.debug = true | ||
|
||
# Asset digests allow you to set far-future HTTP expiration dates on all assets, | ||
# yet still be able to expire them through the digest params. | ||
config.assets.digest = true | ||
|
||
# Adds additional error checking when serving assets at runtime. | ||
# Checks for improperly declared sprockets dependencies. | ||
# Raises helpful error messages. | ||
config.assets.raise_runtime_errors = true | ||
ActionMailer::Base.delivery_method = :sendmail | ||
|
||
# Raises error for missing translations | ||
# config.action_view.raise_on_missing_translations = true | ||
end |
Oops, something went wrong.