shoppy 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +34 -0
- data/app/.DS_Store +0 -0
- data/app/api/apihelpers/api_auth.rb +50 -0
- data/app/api/base.rb +7 -0
- data/app/api/v1/auth.rb +57 -0
- data/app/api/v1/test.rb +15 -0
- data/app/api/v1/users.rb +50 -0
- data/app/api/v1/v1_api.rb +15 -0
- data/app/api/vo/user_vo.rb +7 -0
- data/app/assets/fonts/.DS_Store +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/app/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/images/.DS_Store +0 -0
- data/app/assets/images/Sorting icons.psd +0 -0
- data/app/assets/images/back_disabled.png +0 -0
- data/app/assets/images/back_enabled.png +0 -0
- data/app/assets/images/back_enabled_hover.png +0 -0
- data/app/assets/images/favicon.ico +0 -0
- data/app/assets/images/forward_disabled.png +0 -0
- data/app/assets/images/forward_enabled.png +0 -0
- data/app/assets/images/forward_enabled_hover.png +0 -0
- data/app/assets/images/shoppy.svg +34 -0
- data/app/assets/images/sort_asc.png +0 -0
- data/app/assets/images/sort_asc_disabled.png +0 -0
- data/app/assets/images/sort_both.png +0 -0
- data/app/assets/images/sort_desc.png +0 -0
- data/app/assets/images/sort_desc_disabled.png +0 -0
- data/app/assets/images/spritemap.png +0 -0
- data/app/assets/images/spritemap@2x.png +0 -0
- data/app/assets/javascripts/.DS_Store +0 -0
- data/app/assets/javascripts/bootstrap.js +2114 -0
- data/app/assets/javascripts/bootstrap.min.js +6 -0
- data/app/assets/javascripts/jasny-bootstrap.min.js +6 -0
- data/app/assets/javascripts/jquery.dataTables.min.js +155 -0
- data/app/assets/javascripts/main.js +29 -0
- data/app/assets/javascripts/shoppy.js +31 -0
- data/app/assets/stylesheets/.DS_Store +0 -0
- data/app/assets/stylesheets/bootstrap.css +6203 -0
- data/app/assets/stylesheets/jasny-bootstrap.css +621 -0
- data/app/assets/stylesheets/jquery.dataTables.min.css +1 -0
- data/app/assets/stylesheets/jquery.dataTables_themeroller.css +330 -0
- data/app/assets/stylesheets/shoppy.css +23 -0
- data/app/assets/stylesheets/style.sass +79 -0
- data/app/controllers/.DS_Store +0 -0
- data/app/controllers/shoppy/accounts_controller.rb +102 -0
- data/app/controllers/shoppy/application_controller.rb +23 -0
- data/app/controllers/shoppy/brands_controller.rb +60 -0
- data/app/controllers/shoppy/cart_controller.rb +46 -0
- data/app/controllers/shoppy/categories_controller.rb +72 -0
- data/app/controllers/shoppy/concerns/.keep +0 -0
- data/app/controllers/shoppy/customer_addresses_controller.rb +90 -0
- data/app/controllers/shoppy/home_controller.rb +9 -0
- data/app/controllers/shoppy/inventories_controller.rb +62 -0
- data/app/controllers/shoppy/locations_controller.rb +80 -0
- data/app/controllers/shoppy/logs_controller.rb +9 -0
- data/app/controllers/shoppy/manufacturers_controller.rb +77 -0
- data/app/controllers/shoppy/options_controller.rb +63 -0
- data/app/controllers/shoppy/orders_controller.rb +130 -0
- data/app/controllers/shoppy/products_controller.rb +98 -0
- data/app/controllers/shoppy/reviews_controller.rb +70 -0
- data/app/controllers/shoppy/sessions_controller.rb +5 -0
- data/app/controllers/shoppy/settings_controller.rb +26 -0
- data/app/controllers/shoppy/shipments_controller.rb +125 -0
- data/app/controllers/shoppy/variants_controller.rb +104 -0
- data/app/helpers/shoppy/accounts_helper.rb +5 -0
- data/app/helpers/shoppy/application_helper.rb +19 -0
- data/app/helpers/shoppy/brands_helper.rb +4 -0
- data/app/helpers/shoppy/cart_helper.rb +66 -0
- data/app/helpers/shoppy/categories_helper.rb +4 -0
- data/app/helpers/shoppy/customer_addresses_helper.rb +4 -0
- data/app/helpers/shoppy/home_helper.rb +5 -0
- data/app/helpers/shoppy/inventories_helper.rb +53 -0
- data/app/helpers/shoppy/locations_helper.rb +4 -0
- data/app/helpers/shoppy/logs_helper.rb +4 -0
- data/app/helpers/shoppy/manufacturers_helper.rb +4 -0
- data/app/helpers/shoppy/options_helper.rb +43 -0
- data/app/helpers/shoppy/orders_helper.rb +61 -0
- data/app/helpers/shoppy/products_helper.rb +65 -0
- data/app/helpers/shoppy/reviews_helper.rb +4 -0
- data/app/helpers/shoppy/settings_helper.rb +5 -0
- data/app/helpers/shoppy/shipments_helper.rb +43 -0
- data/app/helpers/shoppy/variants_helper.rb +4 -0
- data/app/models/shoppy/.DS_Store +0 -0
- data/app/models/shoppy/admin.rb +5 -0
- data/app/models/shoppy/brand.rb +23 -0
- data/app/models/shoppy/cart_item.rb +13 -0
- data/app/models/shoppy/category.rb +50 -0
- data/app/models/shoppy/concerns/.DS_Store +0 -0
- data/app/models/shoppy/concerns/models/api_token_authenticatable.rb +36 -0
- data/app/models/shoppy/concerns/models/hashable.rb +60 -0
- data/app/models/shoppy/concerns/models/optionable.rb +60 -0
- data/app/models/shoppy/concerns/models/promotional.rb +36 -0
- data/app/models/shoppy/concerns/models/taggable.rb +44 -0
- data/app/models/shoppy/customer.rb +10 -0
- data/app/models/shoppy/customer_address.rb +44 -0
- data/app/models/shoppy/inventory.rb +18 -0
- data/app/models/shoppy/log.rb +8 -0
- data/app/models/shoppy/manufacturer.rb +35 -0
- data/app/models/shoppy/options_group.rb +57 -0
- data/app/models/shoppy/options_item.rb +18 -0
- data/app/models/shoppy/order.rb +15 -0
- data/app/models/shoppy/order_line.rb +16 -0
- data/app/models/shoppy/payment_method.rb +19 -0
- data/app/models/shoppy/product.rb +43 -0
- data/app/models/shoppy/review.rb +12 -0
- data/app/models/shoppy/setting.rb +11 -0
- data/app/models/shoppy/shipment.rb +11 -0
- data/app/models/shoppy/stock_location.rb +47 -0
- data/app/models/shoppy/user.rb +37 -0
- data/app/models/shoppy/variant.rb +48 -0
- data/app/views/.DS_Store +0 -0
- data/app/views/accounts/admins.html.erb +104 -0
- data/app/views/accounts/customers.html.erb +106 -0
- data/app/views/accounts/show.html.erb +50 -0
- data/app/views/brands/index.html.erb +85 -0
- data/app/views/brands/show.html.erb +31 -0
- data/app/views/cart/index.html.erb +52 -0
- data/app/views/categories/index.html.erb +84 -0
- data/app/views/categories/show.html.erb +29 -0
- data/app/views/customer_addresses/index.html.erb +112 -0
- data/app/views/customer_addresses/show.html.erb +50 -0
- data/app/views/devise/confirmations/new.html.erb +12 -0
- data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/devise/passwords/edit.html.erb +16 -0
- data/app/views/devise/passwords/new.html.erb +12 -0
- data/app/views/devise/registrations/edit.html.erb +29 -0
- data/app/views/devise/registrations/new.html.erb +23 -0
- data/app/views/devise/sessions/new.html.erb +33 -0
- data/app/views/devise/shared/_links.erb +25 -0
- data/app/views/devise/unlocks/new.html.erb +12 -0
- data/app/views/home/index.html.erb +4 -0
- data/app/views/inventories/.DS_Store +0 -0
- data/app/views/inventories/index.html.erb +119 -0
- data/app/views/layouts/.DS_Store +0 -0
- data/app/views/layouts/shoppy.html.erb +27 -0
- data/app/views/locations/index.html.erb +120 -0
- data/app/views/locations/show.html.erb +58 -0
- data/app/views/logs/index.html.erb +49 -0
- data/app/views/manufacturers/index.html.erb +119 -0
- data/app/views/manufacturers/show.html.erb +62 -0
- data/app/views/options/index.html.erb +90 -0
- data/app/views/options/show.html.erb +32 -0
- data/app/views/orders/index.html.erb +174 -0
- data/app/views/orders/show.html.erb +74 -0
- data/app/views/products/index.html.erb +102 -0
- data/app/views/products/show.html.erb +112 -0
- data/app/views/reviews/index.html.erb +58 -0
- data/app/views/reviews/show.html.erb +46 -0
- data/app/views/settings/show.html.erb +50 -0
- data/app/views/shared/_custom_file_input.html.erb +12 -0
- data/app/views/shared/_flashes.html.erb +21 -0
- data/app/views/shared/_navigation.html.erb +66 -0
- data/app/views/shipments/index.html.erb +97 -0
- data/app/views/shipments/show.html.erb +84 -0
- data/app/views/variants/index.html.erb +119 -0
- data/app/views/variants/show.html.erb +114 -0
- data/bin/shoppy +183 -0
- data/config/routes.rb +124 -0
- data/db/.DS_Store +0 -0
- data/db/migrate/001__setup_hstore.rb +9 -0
- data/db/migrate/002__create_logs.rb +11 -0
- data/db/migrate/003__devise_create_users.rb +49 -0
- data/db/migrate/004__add_personal_info_to_user.rb +8 -0
- data/db/migrate/005__create_user_addresses.rb +16 -0
- data/db/migrate/006__create_categories.rb +11 -0
- data/db/migrate/007__create_brands.rb +10 -0
- data/db/migrate/008__create_manufacturers.rb +19 -0
- data/db/migrate/009__create_options_groups.rb +10 -0
- data/db/migrate/010__create_options_items.rb +10 -0
- data/db/migrate/011__create_products.rb +14 -0
- data/db/migrate/012__create_product_options_joint_table.rb +9 -0
- data/db/migrate/013__create_stock_locations.rb +18 -0
- data/db/migrate/014__create_variants.rb +12 -0
- data/db/migrate/015__add_promotional_to_variant.rb +8 -0
- data/db/migrate/016__create_inventories.rb +12 -0
- data/db/migrate/017__create_payment_methods.rb +9 -0
- data/db/migrate/018__create_cart_items.rb +12 -0
- data/db/migrate/019__create_orders.rb +11 -0
- data/db/migrate/020__create_order_lines.rb +14 -0
- data/db/migrate/021__add_type_to_user.rb +5 -0
- data/db/migrate/022__rename_user_address_to_customer_address.rb +5 -0
- data/db/migrate/023__create_shipments.rb +12 -0
- data/db/migrate/024__add_shipment_id_to_order_line.rb +5 -0
- data/db/migrate/025__change_user_gender_to_not_nullable.rb +5 -0
- data/db/migrate/026__add_category_id_to_product.rb +5 -0
- data/db/migrate/027__add_attachment_brand_image_to_brands.rb +11 -0
- data/db/migrate/028__add_delivery_date_to_shipment.rb +5 -0
- data/db/migrate/029__add_customer_info_to_order.rb +13 -0
- data/db/migrate/030__add_status_to_order.rb +5 -0
- data/db/migrate/031__add_default_address_to_user.rb +5 -0
- data/db/migrate/032__add_options_to_variant.rb +5 -0
- data/db/migrate/033__add_display_to_options_groups.rb +5 -0
- data/db/migrate/034__add_points_to_variant.rb +5 -0
- data/db/migrate/035__add_points_to_user.rb +5 -0
- data/db/migrate/036__define_ids.rb +25 -0
- data/db/migrate/037__create_seed_users.rb +13 -0
- data/db/migrate/038__add_name_to_customer_address.rb +5 -0
- data/db/migrate/039__create_reviews.rb +14 -0
- data/db/migrate/040__alter_table_customer_address.rb +5 -0
- data/db/migrate/041__create_settings.rb +23 -0
- data/lib/.DS_Store +0 -0
- data/lib/shoppy.rb +13 -0
- data/lib/shoppy/client.rb +53 -0
- data/lib/shoppy/engine.rb +4 -0
- data/lib/shoppy/version.rb +3 -0
- data/lib/tasks/shoppy_tasks.rake +4 -0
- data/lib/template/.gitignore +20 -0
- data/lib/template/Gemfile +46 -0
- data/lib/template/Gemfile.lock +218 -0
- data/lib/template/Rakefile +6 -0
- data/lib/template/app/assets/images/.keep +0 -0
- data/lib/template/app/assets/javascripts/application.js +13 -0
- data/lib/template/app/assets/stylesheets/application.css +15 -0
- data/lib/template/app/controllers/accounts_controller.rb +3 -0
- data/lib/template/app/controllers/application_controller.rb +3 -0
- data/lib/template/app/controllers/brands_controller.rb +3 -0
- data/lib/template/app/controllers/cart_controller.rb +3 -0
- data/lib/template/app/controllers/categories_controller.rb +3 -0
- data/lib/template/app/controllers/concerns/.keep +0 -0
- data/lib/template/app/controllers/customer_addresses_controller.rb +3 -0
- data/lib/template/app/controllers/home_controller.rb +3 -0
- data/lib/template/app/controllers/inventories_controller.rb +3 -0
- data/lib/template/app/controllers/locations_controller.rb +3 -0
- data/lib/template/app/controllers/logs_controller.rb +3 -0
- data/lib/template/app/controllers/manufacturers_controller.rb +3 -0
- data/lib/template/app/controllers/options_controller.rb +3 -0
- data/lib/template/app/controllers/orders_controller.rb +3 -0
- data/lib/template/app/controllers/products_controller.rb +3 -0
- data/lib/template/app/controllers/reviews_controller.rb +3 -0
- data/lib/template/app/controllers/sessions_controller.rb +3 -0
- data/lib/template/app/controllers/settings_controller.rb +3 -0
- data/lib/template/app/controllers/shipments_controller.rb +3 -0
- data/lib/template/app/controllers/variants_controller.rb +3 -0
- data/lib/template/app/helpers/.keep +0 -0
- data/lib/template/app/helpers/orders_helper.rb +4 -0
- data/lib/template/app/mailers/.keep +0 -0
- data/lib/template/app/models/.keep +0 -0
- data/lib/template/app/models/account.rb +4 -0
- data/lib/template/app/models/admin.rb +4 -0
- data/lib/template/app/models/brand.rb +3 -0
- data/lib/template/app/models/cart_item.rb +3 -0
- data/lib/template/app/models/category.rb +3 -0
- data/lib/template/app/models/concerns/.keep +0 -0
- data/lib/template/app/models/concerns/hashable.rb +4 -0
- data/lib/template/app/models/customer.rb +4 -0
- data/lib/template/app/models/customer_address.rb +3 -0
- data/lib/template/app/models/inventory.rb +3 -0
- data/lib/template/app/models/log.rb +3 -0
- data/lib/template/app/models/manufacturer.rb +3 -0
- data/lib/template/app/models/option_item.rb +3 -0
- data/lib/template/app/models/options_group.rb +3 -0
- data/lib/template/app/models/order.rb +3 -0
- data/lib/template/app/models/order_line.rb +3 -0
- data/lib/template/app/models/payment_method.rb +3 -0
- data/lib/template/app/models/product.rb +3 -0
- data/lib/template/app/models/review.rb +3 -0
- data/lib/template/app/models/setting.rb +3 -0
- data/lib/template/app/models/shipment.rb +3 -0
- data/lib/template/app/models/stock_location.rb +3 -0
- data/lib/template/app/models/variant.rb +3 -0
- data/lib/template/app/views/layouts/.keep +0 -0
- data/lib/template/bin/bundle +3 -0
- data/lib/template/bin/rails +8 -0
- data/lib/template/bin/rake +8 -0
- data/lib/template/bin/spring +18 -0
- data/lib/template/config.ru +4 -0
- data/lib/template/config/application.rb +23 -0
- data/lib/template/config/boot.rb +4 -0
- data/lib/template/config/database.yml +86 -0
- data/lib/template/config/environment.rb +5 -0
- data/lib/template/config/environments/development.rb +37 -0
- data/lib/template/config/environments/production.rb +78 -0
- data/lib/template/config/environments/test.rb +39 -0
- data/lib/template/config/initializers/assets.rb +8 -0
- data/lib/template/config/initializers/backtrace_silencers.rb +7 -0
- data/lib/template/config/initializers/cookies_serializer.rb +3 -0
- data/lib/template/config/initializers/devise.rb +256 -0
- data/lib/template/config/initializers/filter_parameter_logging.rb +4 -0
- data/lib/template/config/initializers/inflections.rb +16 -0
- data/lib/template/config/initializers/mime_types.rb +4 -0
- data/lib/template/config/initializers/session_store.rb +3 -0
- data/lib/template/config/initializers/wrap_parameters.rb +14 -0
- data/lib/template/config/locales/devise.en.yml +59 -0
- data/lib/template/config/locales/en.yml +23 -0
- data/lib/template/config/routes.rb +3 -0
- data/lib/template/config/secrets.yml +22 -0
- data/lib/template/db/migrate/.keep +0 -0
- data/lib/template/db/seeds.rb +7 -0
- data/lib/template/lib/assets/.keep +0 -0
- data/lib/template/lib/tasks/.keep +0 -0
- data/lib/template/log/.keep +0 -0
- data/lib/template/public/404.html +67 -0
- data/lib/template/public/422.html +67 -0
- data/lib/template/public/500.html +66 -0
- data/lib/template/public/favicon.ico +0 -0
- data/lib/template/public/robots.txt +5 -0
- data/lib/template/test/controllers/.keep +0 -0
- data/lib/template/test/fixtures/.keep +0 -0
- data/lib/template/test/helpers/.keep +0 -0
- data/lib/template/test/integration/.keep +0 -0
- data/lib/template/test/mailers/.keep +0 -0
- data/lib/template/test/models/.keep +0 -0
- data/lib/template/test/test_helper.rb +10 -0
- data/lib/template/vendor/assets/javascripts/.keep +0 -0
- data/lib/template/vendor/assets/stylesheets/.keep +0 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +78 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/assets.rb +8 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +56 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/integration/navigation_test.rb +10 -0
- data/test/shoppy/Users/alybadawy/exp/shoppy/lib/template/Gemfile.lock +217 -0
- data/test/shoppy/Users/alybadawy/exp/shoppy/lib/template/README.rdoc +28 -0
- data/test/shoppy/Users/alybadawy/exp/shoppy/lib/template/config.ru +4 -0
- data/test/shoppy_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- metadata +495 -0
data/bin/shoppy
ADDED
@@ -0,0 +1,183 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
require 'highline/import'
|
5
|
+
require 'colorize'
|
6
|
+
|
7
|
+
require 'shoppy/version'
|
8
|
+
require 'shoppy/client'
|
9
|
+
|
10
|
+
@hostname = ""
|
11
|
+
@license = ""
|
12
|
+
@baseurl = ""
|
13
|
+
@user_control_email_sender = ""
|
14
|
+
|
15
|
+
|
16
|
+
def help
|
17
|
+
%Q(
|
18
|
+
Usage: shoppy [COMMAND]
|
19
|
+
|
20
|
+
Commands:
|
21
|
+
-n, new Creats a new shoppy Application in the current directory.
|
22
|
+
-h, help Prints this help document
|
23
|
+
-v, version Prints the siteleaf gem version
|
24
|
+
|
25
|
+
|
26
|
+
See https://github.com/siteleaf/siteleaf-gem for additional documentation.
|
27
|
+
)
|
28
|
+
end
|
29
|
+
|
30
|
+
def shoppy_exists?
|
31
|
+
Dir[File.join(Dir.pwd, 'shoppy')] == [] ? false : true
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
def print_header
|
36
|
+
3.times { puts "" }
|
37
|
+
puts "****************************************************************".bold.blue
|
38
|
+
puts " _____ _ _ ____ _____ _______ __ ".bold.blue
|
39
|
+
puts " / ____| | | |/ __ \\| __ \\| __ \\ \\ / / ".bold.blue
|
40
|
+
puts " | (___ | |__| | | | | |__) | |__) \\ \\_/ / ".bold.blue
|
41
|
+
puts " \\___ \\| __ | | | | ___/| ___/ \\ / ".bold.blue
|
42
|
+
puts " ____) | | | | |__| | | | | | | ".bold.blue
|
43
|
+
puts " |_____/|_| |_|\\____/|_| |_| |_| ".bold.blue
|
44
|
+
puts " ".bold.blue
|
45
|
+
puts " Product of Fourteen Inch LLC ".bold.blue
|
46
|
+
puts "****************************************************************".bold.blue
|
47
|
+
|
48
|
+
2.times { puts "" }
|
49
|
+
puts "Initating Shoppy ....."
|
50
|
+
2.times { puts "" }
|
51
|
+
end
|
52
|
+
|
53
|
+
def print_footer
|
54
|
+
2.times { puts "" }
|
55
|
+
puts "Thanks for using Shoppy, by Fourteen Inch LLC.".bold.green
|
56
|
+
2.times { puts "" }
|
57
|
+
end
|
58
|
+
|
59
|
+
def verify_license
|
60
|
+
while @hostname == "" do @hostname = ask("Enter hostname: (e.g. 'example.com')") end
|
61
|
+
while @license == "" do @license = ask("Enter Shoppy License key") end
|
62
|
+
|
63
|
+
puts ""
|
64
|
+
puts "Authorizing..."
|
65
|
+
2.times {puts ""}
|
66
|
+
if (auth = Shoppy::Client.auth(@hostname, @license)) && (auth.is_a?(Hash)) && (auth.has_key?('active'))
|
67
|
+
case auth['active']
|
68
|
+
when 'true'
|
69
|
+
puts "License verified successfully. Thanks for purchasing Shoppy from Fourteen Inch LLC.".green
|
70
|
+
2.times {puts ""}
|
71
|
+
|
72
|
+
return true
|
73
|
+
when 'false'
|
74
|
+
puts "Your Shoppy License has expired. Please contact Fourteen Inch LLC to renew it.".red
|
75
|
+
puts "http://shoppy.fourteeninch.com".red
|
76
|
+
2.times {puts ""}
|
77
|
+
return false
|
78
|
+
when 'not found'
|
79
|
+
puts "Invalid License key or host name. Please check entered information and try again.".red
|
80
|
+
puts "If you need a new license to use Shoppy, please contact Fourteen Inch LLC".red
|
81
|
+
puts "http://shoppy.fourteeninch.com".red
|
82
|
+
2.times {puts ""}
|
83
|
+
return false
|
84
|
+
end
|
85
|
+
else
|
86
|
+
puts "Something wrong happend. Check your internet connection, or try again later".red
|
87
|
+
2.times {puts ""}
|
88
|
+
return false
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def copy_target
|
93
|
+
FileUtils.mkdir_p('shoppy')
|
94
|
+
files = Dir.glob(File.join(File.expand_path(File.dirname(__FILE__)), '../lib/template/**/*'))
|
95
|
+
files += Dir.glob(File.join(File.expand_path(File.dirname(__FILE__)),'../lib/template/**/.*'))
|
96
|
+
puts "Copying Core files".bold.blue
|
97
|
+
files.each do |full_file_path|
|
98
|
+
file = full_file_path.split('/../')[1]
|
99
|
+
file = file[13..file.length]
|
100
|
+
dir, filename = File.dirname(file), File.basename(file)
|
101
|
+
dest = File.join('shoppy', dir)
|
102
|
+
puts ("Copying core file: " + File.join(dest, filename)).green unless File.directory?(full_file_path)
|
103
|
+
sleep 0.1
|
104
|
+
FileUtils.mkdir_p(dest)
|
105
|
+
FileUtils.copy_file(full_file_path, File.join(dest, filename)) unless File.directory?(full_file_path)
|
106
|
+
end
|
107
|
+
sleep 0.1
|
108
|
+
end
|
109
|
+
|
110
|
+
def copy_migrations
|
111
|
+
puts "Copying migration files".bold.blue
|
112
|
+
files = Dir.glob(File.join(File.expand_path(File.dirname(__FILE__)), '../db/migrate/**/*'))
|
113
|
+
files.each do |full_file_path|
|
114
|
+
file = full_file_path.split('/../')[1]
|
115
|
+
file = file[11..file.length].split('__')
|
116
|
+
dest = File.join('shoppy', 'db', 'migrate')
|
117
|
+
FileUtils.mkdir_p(dest)
|
118
|
+
filename = Time.now.strftime("%Y%m%d") + "000" + file[0] + '_' + file[1]
|
119
|
+
puts ('copying migration: ' + file[1]).green unless File.directory?(full_file_path)
|
120
|
+
FileUtils.copy_file(full_file_path, File.join(dest, filename)) unless File.directory?(full_file_path)
|
121
|
+
sleep 0.1
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def make_constants
|
126
|
+
2.times { puts "" }
|
127
|
+
puts "creating application constants (config/initializers/app_constants.rb)"
|
128
|
+
File.open('shoppy/config/initializers/app_constants.rb', 'w') do |f|
|
129
|
+
f.puts "# File auto generated on #{Time.now}"
|
130
|
+
f.puts "#"
|
131
|
+
f.puts "# Please don't change the values below."
|
132
|
+
f.puts ""
|
133
|
+
f.puts "HOSTNAME = '#{@hostname}'"
|
134
|
+
f.puts "BASEURL = '#{@baseurl}'"
|
135
|
+
f.puts "USER_CONTROL_EMAILS_SENDER = '#{@user_control_email_sender}'"
|
136
|
+
f.puts "LICENSE = '#{@license}'"
|
137
|
+
f.puts "CURRENCY_UNIT = '$'"
|
138
|
+
end
|
139
|
+
sleep 0.2
|
140
|
+
end
|
141
|
+
|
142
|
+
|
143
|
+
def main
|
144
|
+
case ARGV[0]
|
145
|
+
when '-v', 'version'
|
146
|
+
puts "Shoppy V" + Shoppy::VERSION
|
147
|
+
when '-h', 'help'
|
148
|
+
puts help
|
149
|
+
when '-n', 'new'
|
150
|
+
print_header
|
151
|
+
if shoppy_exists?
|
152
|
+
puts "There is already a 'shoppy' instance in the the current directory.".red
|
153
|
+
else
|
154
|
+
license = verify_license
|
155
|
+
if license == true
|
156
|
+
while @baseurl == "" do @baseurl = ask("Enter base URL: (e.g. 'http://#{@hostname}')") end
|
157
|
+
while @user_control_email_sender == "" do @user_control_email_sender = ask("Enter accounts' manager e-mail addres: (e.g. 'accounts@#{@hostname}')") end
|
158
|
+
copy_target
|
159
|
+
make_constants
|
160
|
+
copy_migrations
|
161
|
+
Dir.chdir('shoppy') do
|
162
|
+
sleep 0.2
|
163
|
+
puts "Running: bundle install".bold.blue
|
164
|
+
system "bundle install"
|
165
|
+
sleep 0.2
|
166
|
+
puts "Running: rake db:create".bold.blue
|
167
|
+
system "rake db:create"
|
168
|
+
sleep 0.1
|
169
|
+
puts "Running: rake db:migrate".bold.blue
|
170
|
+
system "rake db:migrate"
|
171
|
+
end
|
172
|
+
print_footer
|
173
|
+
else
|
174
|
+
return 0
|
175
|
+
end
|
176
|
+
end
|
177
|
+
else
|
178
|
+
puts "Invalid arguments."
|
179
|
+
puts help
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
main
|
data/config/routes.rb
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
devise_for :admins
|
3
|
+
|
4
|
+
constraints subdomain: "api" do
|
5
|
+
mount Base => '/'
|
6
|
+
end
|
7
|
+
|
8
|
+
root to: "home#index"
|
9
|
+
|
10
|
+
## Accounts' routes.
|
11
|
+
get '/accounts/admins' => 'accounts#admins'
|
12
|
+
post '/accounts/admins' => 'accounts#newAdmin'
|
13
|
+
get '/accounts/customers' => 'accounts#customers'
|
14
|
+
post '/accounts/customers' => 'accounts#newCustomer'
|
15
|
+
get '/accounts/:user_id' => 'accounts#show'
|
16
|
+
put '/accounts/:user_id' => 'accounts#edit'
|
17
|
+
delete '/accounts/:user_id' => 'accounts#delete'
|
18
|
+
|
19
|
+
## Customers' Addresses
|
20
|
+
get '/accounts/:customer_id/addresses' => 'customer_addresses#index'
|
21
|
+
post '/accounts/:customer_id/addresses' => 'customer_addresses#new'
|
22
|
+
get '/accounts/:customer_id/addresses/:address_id' => 'customer_addresses#show'
|
23
|
+
put '/accounts/:customer_id/addresses/:address_id' => 'customer_addresses#edit'
|
24
|
+
delete '/accounts/:customer_id/addresses/:address_id' => 'customer_addresses#delete'
|
25
|
+
|
26
|
+
## Customer' Cart
|
27
|
+
get '/accounts/:customer_id/cart' => 'cart#index'
|
28
|
+
delete '/accounts/:customer_id/cart' => 'cart#empty'
|
29
|
+
delete '/accounts/:customer_id/cart/:cart_item_id' => 'cart#delete'
|
30
|
+
|
31
|
+
## stock locations' routes
|
32
|
+
get '/locations' => 'locations#index'
|
33
|
+
post '/locations' => 'locations#new'
|
34
|
+
get '/locations/:location_id' => 'locations#show'
|
35
|
+
put '/locations/:location_id' => 'locations#edit'
|
36
|
+
delete '/locations/:location_id' => 'locations#delete'
|
37
|
+
|
38
|
+
# Inventories routes
|
39
|
+
get '/locations/:location_id/inventories' => 'inventories#index'
|
40
|
+
post '/locations/:location_id/inventories' => 'inventories#new'
|
41
|
+
put '/locations/:location_id/transfer' => 'inventories#transfer'
|
42
|
+
|
43
|
+
# Brands' routes
|
44
|
+
get '/products/brands' => 'brands#index'
|
45
|
+
post '/products/brands' => 'brands#new'
|
46
|
+
get '/products/brands/:brand_id' => 'brands#show'
|
47
|
+
put '/products/brands/:brand_id' => 'brands#edit'
|
48
|
+
delete '/products/brands/:brand_id' => 'brands#delete'
|
49
|
+
|
50
|
+
## Categories' routes
|
51
|
+
get '/products/categories' => 'categories#index'
|
52
|
+
post '/products/categories' => 'categories#new'
|
53
|
+
get '/products/categories/:category_id' => 'categories#show'
|
54
|
+
put '/products/categories/:category_id' => 'categories#edit'
|
55
|
+
delete '/products/categories/:category_id' => 'categories#delete'
|
56
|
+
|
57
|
+
## Manufacturers' routes
|
58
|
+
get '/products/manufacturers' => 'manufacturers#index'
|
59
|
+
post '/products/manufacturers' => 'manufacturers#new'
|
60
|
+
get '/products/manufacturers/:manufacturer_id' => 'manufacturers#show'
|
61
|
+
put '/products/manufacturers/:manufacturer_id' => 'manufacturers#edit'
|
62
|
+
delete '/products/manufacturers/:manufacturer_id' => 'manufacturers#delete'
|
63
|
+
|
64
|
+
## Options' routes
|
65
|
+
get '/products/options' => 'options#index'
|
66
|
+
post '/products/options' => 'options#new'
|
67
|
+
get '/products/options/:options_group_id' => 'options#show'
|
68
|
+
put '/products/options/:options_group_id' => 'options#edit'
|
69
|
+
delete '/products/options/:options_group_id' => 'options#delete'
|
70
|
+
|
71
|
+
## Products' routes
|
72
|
+
get '/products/items' => 'products#index'
|
73
|
+
post '/products/items' => 'products#new'
|
74
|
+
get '/products/items/:product_id' => 'products#show'
|
75
|
+
put '/products/items/:product_id' => 'products#edit'
|
76
|
+
delete '/products/items/:product_id' => 'products#delete'
|
77
|
+
|
78
|
+
## Reviews
|
79
|
+
get '/products/items/:product_id/reviews' => 'reviews#index'
|
80
|
+
get '/reviews' => 'reviews#index'
|
81
|
+
get '/reviews/:review_id' => 'reviews#show'
|
82
|
+
put '/reviews/:review_id' => 'reviews#edit'
|
83
|
+
delete '/reviews/:review_id' => 'reviews#delete'
|
84
|
+
|
85
|
+
## producs' Variants
|
86
|
+
get '/products/items/:product_id/variants' => 'variants#index'
|
87
|
+
post '/products/items/:product_id/variants' => 'variants#new'
|
88
|
+
get '/products/items/:product_id/variants/:variant_id' => 'variants#show'
|
89
|
+
put '/products/items/:product_id/variants/:variant_id' => 'variants#edit'
|
90
|
+
delete '/products/items/:product_id/variants/:variant_id' => 'variants#delete'
|
91
|
+
|
92
|
+
## Orders' Routes
|
93
|
+
get '/accounts/:customer_id/orders' => 'orders#index'
|
94
|
+
get '/orders' => 'orders#index'
|
95
|
+
post '/orders' => 'orders#new'
|
96
|
+
get '/orders/:order_id' => 'orders#show'
|
97
|
+
put '/orders/:order_id' => 'orders#edit'
|
98
|
+
delete '/orders/:order_id' => 'orders#delete'
|
99
|
+
|
100
|
+
|
101
|
+
## Shipments
|
102
|
+
get '/orders/:order_id/shipments' => 'shipments#index'
|
103
|
+
get '/shipments' => 'shipments#index'
|
104
|
+
post '/shipments' => 'shipments#new'
|
105
|
+
get '/shipments/:shipment_id' => 'shipments#show'
|
106
|
+
put '/shipments/:shipment_id' => 'shipments#edit'
|
107
|
+
delete '/shipments/:shipment_id' => 'shipments#delete'
|
108
|
+
|
109
|
+
## Logs
|
110
|
+
get '/logs/' => 'logs#index'
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
data/db/.DS_Store
ADDED
Binary file
|
@@ -0,0 +1,49 @@
|
|
1
|
+
class DeviseCreateUsers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table(:users) do |t|
|
4
|
+
## Database authenticatable
|
5
|
+
t.string :email, null: false, default: ""
|
6
|
+
t.string :encrypted_password, null: false, default: ""
|
7
|
+
|
8
|
+
## Recoverable
|
9
|
+
t.string :reset_password_token
|
10
|
+
t.datetime :reset_password_sent_at
|
11
|
+
|
12
|
+
## Rememberable
|
13
|
+
t.datetime :remember_created_at
|
14
|
+
|
15
|
+
## Trackable
|
16
|
+
t.integer :sign_in_count, default: 0, null: false
|
17
|
+
t.datetime :current_sign_in_at
|
18
|
+
t.datetime :last_sign_in_at
|
19
|
+
t.string :current_sign_in_ip
|
20
|
+
t.string :last_sign_in_ip
|
21
|
+
|
22
|
+
## Confirmable
|
23
|
+
# t.string :confirmation_token
|
24
|
+
# t.datetime :confirmed_at
|
25
|
+
# t.datetime :confirmation_sent_at
|
26
|
+
# t.string :unconfirmed_email # Only if using reconfirmable
|
27
|
+
|
28
|
+
# Lockable
|
29
|
+
t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
30
|
+
t.string :unlock_token # Only if unlock strategy is :email or :both
|
31
|
+
t.datetime :locked_at
|
32
|
+
|
33
|
+
|
34
|
+
# API Token
|
35
|
+
t.string :api_token, null: false, default: ""
|
36
|
+
t.datetime :api_token_expires_at
|
37
|
+
t.boolean :api_token_active, null: false, default: false
|
38
|
+
|
39
|
+
|
40
|
+
t.timestamps
|
41
|
+
end
|
42
|
+
|
43
|
+
add_index :users, :email, unique: true
|
44
|
+
add_index :users, :reset_password_token, unique: true
|
45
|
+
# add_index :users, :confirmation_token, unique: true
|
46
|
+
add_index :users, :unlock_token, unique: true
|
47
|
+
add_index :users, :api_token, unique: true
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class AddPersonalInfoToUser < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_column :users, :name, :string, null: true, limit: 100
|
4
|
+
add_column :users, :gender, :string, null: false, default: "", limit: 10
|
5
|
+
add_column :users, :birthdate, :date, null: true
|
6
|
+
add_column :users, :phone, :string, null: true, limit: 25
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateUserAddresses < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :user_addresses do |t|
|
4
|
+
t.string :add_line1, null: false, limit: 75
|
5
|
+
t.string :add_line2, null: true, limit: 75
|
6
|
+
t.string :city, null: false, limit: 25
|
7
|
+
t.string :state, null: true, limit: 25
|
8
|
+
t.string :country, null: false, limit: 25
|
9
|
+
t.string :zip, null: false, limit: 5
|
10
|
+
|
11
|
+
t.references :customer
|
12
|
+
|
13
|
+
t.timestamps
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class CreateCategories < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :categories do |t|
|
4
|
+
t.string :name, null: false, uniqune: true, limit: 100
|
5
|
+
t.references "parent_category"
|
6
|
+
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
add_index :categories, :name, unique: true
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreateManufacturers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :manufacturers do |t|
|
4
|
+
t.string :name, null: false, unique: true, limit: 100
|
5
|
+
t.string :email, null: true, limit: 100
|
6
|
+
t.string :phone, null: true, limit: 20
|
7
|
+
t.string :website, null: true, limit: 100
|
8
|
+
t.string :add_line1, null: true, limit: 75
|
9
|
+
t.string :add_line2, null: true, limit: 75
|
10
|
+
t.string :city, null: true, limit: 25
|
11
|
+
t.string :state, null: true, limit: 25
|
12
|
+
t.string :country, null: true, limit: 25
|
13
|
+
t.string :zip, null: true, limit: 5
|
14
|
+
|
15
|
+
t.timestamps
|
16
|
+
end
|
17
|
+
add_index :manufacturers, :name, unique: true
|
18
|
+
end
|
19
|
+
end
|