Gem Version

Shopapp gem - gem for Shoplift clients.

Shoplift apps: ShopApps

ShopApps (or shopapps when refering to a set of them) are Shoplift applications, and if they are written in Rails, they can be made with Shopapp gem. It provides quick start, UI template and controllers that force authentication with Authlift, Shoplift OAuth provider.

Development Setup

  • You must have account with Shoplift with membership for "zwr" company, which is used for all app development.
  • ShopApp will work on any *nix, but is designed on and for development on OSX
  • Postgres (latest), typically via Brew
  • You will need Ruby 2.5.1, and typically via RVM, and few gems:

    gem install bundler
    gem install rails
    gem install shopapp
    

Creating a Shoplift App with Shopitup

Just do the following:

shopitapp demolift
cd demolift
rails g scaffold something code:string company:belongs_to
rails db:migrate
rails s

Hit the newly created route: http://localhost:3999/somethings

Shopapps side by side - set development port

By default, Rails apps in development run on port 3000. It is recommended to run each app on a different post, so that they can be developed in parallel on the same machine and keep sessions separate.

Shoplift apps typically run on ports 3031 (Authlift) onwards. Get your own port and set it through dev_port environment variable.

dev_port=3123 shopitapp demolift

Shopapps to github

This gem is meant for Shoplift team, so Shopitapp will set the Git remote to zwr/project_name location on GitHub. If you want a different location, set the github_organization and github_project_name or use skip_github_remote=1.

Setting variable skip_github_push=1 will create a remote but not push. If you do not set it, make sure that you had previously created the remote on github and exchanged public keys properly.

Following skips Git remote completely, but will still create Git repo and commit initial code to it:

skip_github_remote=1 shopitapp demolift

Following creates default remote (zwr/demolift), but does not push:

skip_github_push=1 shopitapp demolift

Developing shopapps

Favicon

Make a 610x610 PNG, for Z-ware colors use 7800a1 -> 7086d6. Then drag that icon to https://faviconit.com and copy all returned files except the instructions to /public/favicon/ folder.

Add the following line to the head of your layouts and make sure it does not contain anything else regarding favicons:

= shopapp3_favicon

Localized shopapps

Shopapp gem and authlift provide all you need for localization. If you want your shopapp to support i18n, add two methods to your ApplicationController:

  • Create method supported_locales which should return an array of language codes, for example ['fi', 'en', 'sv'].
  • Override method set_locale, most likely like this:

    def set_locale I18n.locale = current_user['language'].to_sym || I18n.default_locale end

Developing this gem

To build new version of this gem, change the version in shopapp.gemspec and run:

gem build shopapp.gemspec ; gem push shopapp-0.2.71.gem; gem install shopapp