GithubHelp home page GithubHelp logo

gui's Introduction

Stories in Ready Windows Build status Linux/Mac Build Status Dependency Status devDependency Status Code Climate

Overview

The purpose of excercism GUI is to provide an alternative to the command line interface (CLI) for exercism.io.

It aims to be a cross-platform desktop app that lowers the barrier of entry for people which feel more comfortable with a graphical interface than the command line.

Installing and running the app

Note:

Currently there is no installer available, this is a planned feature. Check ticket #6 for more details

The application is distributed using a compressed package (.tar.gz for Linux/MacOS and .zip for Windows) To start using it, simply download the appropiate package for your platform from here and extract it anywhere you like in the file system.

All the needed files for the app to run are contained within the extracted folder, nothing is installed outside of it.

To start the app, go to the extracted folder and double click on the exercism-gui executable.

Upgrade

Until an installer is available, upgrading is a manual process. To "upgrade" simply download the new package and extract over the old files. Or extract to a new folder and remove the old version. Removing the old folder is completely safe as no user information is stored in it (unless you explicitly configure the exercism folder to be under it, which is not recommended)

Remove

Until an installer is available, removing is simply a matter of deleting the extracted folder.

Supported platforms

Platform Architecture
GNU/Linux (any distro) 64 Bits (x64)
MacOS X 64 Bits (x64)
Windows 7,8,10 64 Bits (x64)
Windows 7,8,10 32 Bits (x86, ia32)

Contributing guide

Contributions are more than welcome!

To help with the code a basic knowledge of Javascript is required.

If Javascript or programming is not your thing, there are many ways to help:

  • Testing the app on the different supported platforms (nothing fancy, just using it normally is enough)
  • Design: if you have some thoughts on how to improve the UI or UX, let's hear them!
  • Writing docs to help newcomers getting started
  • Giving feedback: things that are not clear or hard to understand

Project overview

This is an application written with the help of the following technologies:

  • ember.js An awesome javascript web framework
  • electron To build the cross-platform desktop app
  • ember-electron an ember.js addon that facilitates ember and electron integration (dev, packaging, running tests, etc.)
  • node.js and node packages to communicate with the desktop (notifications, file system, etc.)

Project structure

This is a standard ember.js app (wrapped with electron) so if you are familiar with ember and ember-cli you can jump right into.

If you are not familiar with the framework, getting to know ember is needed, but it is very easy to get started with. Some resources:

The project uses the "pod" folder structure (you don't need to worry about this if using ember-cli generators as this is handled automatically, just be aware if creating files manually)

Coding conventions

At build time, files are inspected with jshint so make sure there are not warnings.

Writing tests

  • Follow ember conventions as close as possible https://guides.emberjs.com/v2.6.0/testing/
  • Use data-test-XYZ selectors to find HTML components during tests, which helps decoupling the HTML layout from finding stuff (thus we avoid breaking tests if we decide to do some re-designing). We use ember-test-selectors addon to help manage this.

Setting up the dev env

Prerequisites:

Clone and get started

After forking and cloning the exercism/gui repo, install the dependencies:

$ cd /path/to/repo
$ yarn install
$ bower install

Start the dev app

$ ember electron

Note: The dev server by default uses ember-cli-mirage to intercept outgoing requests and mock API responses. This has the purpose of avoiding extra load on the API and be able to develop even if the API servers are down. If you want to disable this, set an envar DISABLE_EMBER_CLI_MIRAGE with a value of true:

$ DISABLE_EMBER_CLI_MIRAGE=true ember electron

Running tests

To run the tests, do

$ ember electron:test

If you want to leave the test running on each file save, TDD style:

$ ember electron:test --server

Debugging

Dev

You have the regular debugging tools at your disposal: chromium dev tools, devtron and ember inspector.

You can access the chromium dev tools via the menu in the dev server window (View -> Toggle Developer Tools) or by shortcut (Ctrl+Shift+I on Linux)

TODO: specify dev tools shortcuts for Mac/Windows

You can access the ember inspector and devtron from their respective tabs within the dev tools.

Production

In production, chrome dev tools can be accessed by right clicking on at app and selecting View -> Toggle Developer Tools

Packaging

In order to package the app, run the following

ember electron:package --platform <your_platform> --arch <your_architecture>

This will output a package under the ./electron-builds folder

Note: If you are on OSX or Linux and Have Wine configured, you can also cross-compile for Windows

Submitting a PR

  • If there is a ticket connected to the PR, add it as prefix in the subject. e.g. gh-3 some comment closes #3
  • If the commit closes one or several tickets, add comment like so closes #<ticket_number>

gui's People

Contributors

haroenv avatar holandes22 avatar kyatul avatar rootulp avatar sjwarner-bp avatar waffle-iron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gui's Issues

node-gyp requires python 2 on windows

On my Windows 7 system Python 3 is my primary python version. When running npm install in the root gui directory I get the following error:

C:\Users\robertph\code\gui\node_modules\electron-rebuild\node_modules\nslog>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Python executable "C:\Users\robertph\AppData\Local\Programs\Python\Python35-32\python.EXE" is v3.5.1, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack     at failPythonVersion (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:406:14)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:395:9
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:204:7)
gyp ERR! stack     at emitTwo (events.js:87:13)
     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at maybeClose (internal/child_process.js:827:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\robertph\code\gui\node_modules\electron-rebuild\node_modules\nslog
gyp ERR! node -v v4.4.6
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok

This is fixed by including the --python switch: npm install --python=python2.7

Use ember-cli-flash as fallback notifications

During the demo I used node-notifier as a way to notify events via the desktop notifications.

What happens is this is not available? Would be better to wrap the notifier service to fallback to
ember-cli-flash and have notifications within the app in case the desktop notifications
are disabled or unavailable (Need to check of a reliable way to determine the availability)

Fix key shortcuts and context menu

There is currently kind of a mess with shortcuts, menu and context-menu This ticket is to layout the possible ways we can fix/refactor the code dealing with this thing.

Shortcuts

Some shortcuts like "toggle full screen", "toggle developer tools" and "reload" do not work in the packaged version until you add an application menu (pointed to me by the ember-electron creator here adopted-ember-addons/ember-electron#75).

In order to make those shortcuts work we have some options:

  1. Add an application menu (I like this the least as it changes completely the look of the app by having an extra menu on top of the nav bar)
  2. Use something like this package https://github.com/parro-it/electron-localshortcut to register shortcuts
  3. On top of adding the shortcuts we could add our own menu in the navbar, and triggering different actions that will act upon the window: For example requireNode('remote').getCurrentWindow().toggleDevTools(); to toggle dev tools

Context Menu

The context menu event is supposed to work from the main process (electron.js) but this wasn't working (see #26) after packaging. Currently I added an ugly hack of adding an event listener within the app route (for some reason it works within the rendered process with remote).

Some options

  1. This might be a bug in ember-electron (context-menu works on the main process with the quick-start project after packaging) in which case a fix over there is needed. Here is the ticket adopted-ember-addons/ember-electron#71
  2. Use ember event handlers https://guides.emberjs.com/v2.6.0/components/handling-events/ to listen for contextMenu instead of attaching directly to window

Also, limit options in context menu to editing stuff (copy/paste/undo/redo, etc.) and put stuff like toggle dev tools and full screen in main menu

Installers for all platforms

At first, we can simple distribute the packages in zip or tar.gz format. But would be nice
to have at a later stage installers that have specific platform behavior.

Installer should

  • Add shortcut link
    • In windows to the menu
    • On Linux add a launcher (check this work for all the desktop envs)
    • On Mac not sure what is best practice - investigate
  • Distribution
    • Use deb, RPM and snap packages for Linux
      • Optionally we can have repositories for some of the main distros (Debian/Ubuntu/Fedora/Arch - this will require package maintainers)
    • For Windows provide an msi installer
    • For Mac investigate what is the best way to distribute installers
  • auto-update support
    • For Mac an Windows. This requires having a Squirrel service to broadcast new updates
    • For Linux these should be handled via distro package manager

electron libs that can help with this

The best choice seems to be https://github.com/electron-userland/electron-builder

These also look good
- https://github.com/Aluxian/electron-superkit
- windows installer https://github.com/electron/grunt-electron-installer
- for macosx https://github.com/LinusU/node-appdmg or https://github.com/electron/grunt-electron-installer

Submit exercise

Relevant endpoint is:

http://exercism.io/api/v1/submissions/<track_id>/<ex-id>?key=<api_key>

It should show a link to the submitted exercise on success.

We need to test that file is uploaded exactly as it is on disk and not modified in any way.

We can inspect the exercism folder to present the list of current files in the track (better to filter out files that are already submitted, not sure yet how to
achieve this, maybe diffing the file content)

Add debug info

Something similar to the debug option in CLI. Will be useful to ask for this info if an issue is opened

This can be a subsection on the help.

- Version
- Latest release version
- OS/Architecture
- Home Dir
- Config file
- Exercises Directory
Testing API endpoints
        * GitHub API
        * XAPI
        * API

We have all this info (except for pinging API endpoints) but it is scattered instead of being available in one place

Fetch exercise

The relevant endpoints are:

http://exercism.io/api/v1/exercises?key=<api_key>
http://x.exercism.io/v2/exercises/elixir?key=<api_key>
http://x.exercism.io/v2/exercises?key=<api_key> (all)

Not sure how the cli prints the status, but we should show something similar.

Not Submitted:    1 problem
elixir (List Ops) /home/pablo/exercism/elixir/list-ops

unchanged: 1, updated: 0, new: 0

One question here is: fetch the next problem in the selected track or have a global action that fetches for all the tracks, regardless of the selection.

Feature request: First run wizard.

When I first start the app, I worked out I needed to put in my API key, did that and hit save, I'm still on the configuration screen. What do I do next? (This is not a support request)

There needs to be a first run wizard that prompts for an API key and which language you're interested in then takes you to the relevant track.

Refresh models

By model I mean tracks, track, status, etc.

Due to ember-data nature, resources are obtained from the local cache if available.
This is great as it makes the app snappy after the track list has been loaded. But,
this being a desktop app, there is no "reload" button, so I think it might be useful
to provide a way to refresh the models

Set up CI

  • Running tests
  • Build package/installer and upload to GH releases for all platforms

Add service worker support for a nicer offline experience

This is low priority, but it can really enhance the UX if connection goes down. We can show previously fetched content instead of an ugly disconnected error in case the connection goes down.

Todo:

  • Verify bundled chromium in electron supports service worker
  • Service worker requires the server to have SSL enabled, so until that is done this cannot be active (although service worker should fallback gracefully to just show the disconnected error)
  • UpUp js lib can really help out here

Skip exercise

Skips a problem given a track ID and problem slug

Add comprehensive README

  • Project overview
  • Contributing guide
    • project structure overview
    • coding conventions
    • Setting up dev env
    • Running the dev server
    • Running the tests
    • Packaging
  • add badges
    • build status
    • code climate
    • node deps up-to-date

Add help section

  • Description of exercism
  • Description of the gui app
  • Links to help and docs from the website

Upgrade to ember-electron 2.0

That version has some enhancements in the packaging area so is worth to upgrade.
Is now currently in Beta, but we can start testing it out in a branch.

Updating Windows PATH

Hi, I posted a reply to exercism/exercism#3077 (comment) a while back and @kytrinyx has asked me to move my question here:

I just have a question; Is it supposed to add the exercism.exe to the PATH? It didn't on my machine and so adding C:\Program Files\Exercism to the path would have to be documented also. I don't know any C# but maybe this could become part of the installation in future versions? Adding things to the Windows PATH can often be a cause for mistakes for beginners, and tbh I'm still not immune from messing up my PATH!

Packaging

The main problem right now is to have a way to cross-compile for all platforms.
Is not easy in a developer laptop so using hosted services is the way to go.

A wiki at electron-builder has very useful info on how to use hosted
services to have a multi-platform build. Sounds promising https://github.com/electron-userland/electron-builder/wiki/Multi-Platform-Build

CI automation options

  • OSX: OSX support at travis https://docs.travis-ci.com/user/osx-ci-environment/
  • Linux: standard travis ci image
  • Windows: Use Wine in the Linux instance at travis or use appveyor
  • Is multilib an option? Do we need a 32bit machine to build 32bit packages or we
    can do it from 64bit machine?

Package configuration

  • Add window icon
  • Set initial window size
  • Do we need to do some clean-up up on closing the app?

Refactor API interaction to use ember-data

We currently have a mess in the exercism service where it is used to both communicate with the API and gather local files info.
It makes more sense that all the communication to the API is done with ember-data (currently only the tracks endpoints use ember-data) as it will take
care of serialization, errors, etc. Plus it will be easier to test and use ember-cli-mirage.

The reason I decided to initially take a more manual approach was that the API requires quite a lot of modifications to the ActiveRecord adpater/serializer
since the API URLs and responses do not follow clear conventions (they change from endpoint to endpoint) and it uses two different hostnames.
This was fine at the beginning as it allowed to iterate quickly and get a prototype working faster, but leveraging ember-data is the way forward as it will
result in a much more maintainable code

Icons for tracks not visible

I just started the GUI, turned on Dev Tools and found that the URL to fetch for icon is wrong.

Error -
http://exercism.io/img/tracks/cpp.png Failed to load resource: the server responded with a status of 404 (Not Found)
The actual URL (which I fetched from the website is - http://exercism.io/tracks/cpp/icon

Flatten folders within Windows package

Should be like in Linux/Mac where there is only one folder under root: /exercism-gui-linux-x64.

In windows package is /electron-builds/exercism-gui-win32-ia32

Basically look for something similar to the C flag of tar in 7z

Add contextual right click menu

By default electron apps do not have a contextual right menu (for example, when you select some text and right click to copy it). This is not totally needed but it would add to a better UX

The road to 1.0

The main blocker to reach 1.0 as far as I'm concerned is the lack of an installer (#6). Seems that that feature will take time to implement (see my last comment in the ticket #6).
Maybe someone with more experience in electron can contribute here and speed it up.

/cc @kytrinyx not sure what is the best approach moving forward here, would love your feedback on this. As I see it, we have two options:

  1. We wait to have proper installers and only then give the GUI as an option for the CLI tool in the website.
  2. We start giving the GUI as an option for the CLI tool in the website right now (as a standalone tar.gz package that people should manually update)

Also, please let me know if there are other issues or features you'd like to include to make a plan for a release. General feedback is welcome :)

Restore

Downloads the most recent iteration for each of your solutions on exercism.io.

Give warnings on un-submitted files that won't be overwritten and need to be moved manually

Override probot/stale defaults, if necessary

Per the discussion in exercism/discussions#128 we
will be installing the probot/stale integration on the Exercism organization on
April 10th, 2017.

By default, probot will comment on issues that are older than 60 days, warning
that they are stale. If there is no movement in 7 days, the bot will close the issue.
By default, anything with the labels security or pinned will not be closed by
probot.

If you wish to override these settings, create a .github/stale.yml file as described
in https://github.com/probot/stale#usage, and make sure that it is merged
before April 10th.

If the defaults are fine for this repository, then there is nothing further to do.
You may close this issue.

Clean up code from demo and add tests

This must be done before moving forward on implementing new features.

  • Need to figure out how tests are run within the electron environment
  • Use mirage for dev mocks and acceptance tests
  • Add requireNode to jshint.rc
  • Update ember to latest
  • update addons and pin them down

Coordinate with CLI team for feature parity

It would be nice to have the same feature set in both clients. Need to contact someone from the CLI team to get evaluate new features being implemented in the CLI and see how they can be added to the GUI app.

@kytrinyx is there anyone in particular I can have a chat with over there to discuss this?

Add an index page

This is the first content the user will see. We should have here:

  • Notify on new version of the desktop app (check on start releases page of GH)
  • Get started button: if configured, takes you to tracks section otherwise to configuration section

SSL support

Once the server supports SSL, we need to find a way to verify the host.
Research how to do so with HTTP clients we use (ember-ajax or any other nodejs libs)

In the meantime, I prefer to have the address to the API not being configurable by the user
but hard-coded

sort-of failed Windows installer creation

I've just been trying to create a Windows installer using electron-winstaller, but it's failing due to the use of - in exercism-gui.

On Windows 7, I downloaded the exercism-gui-win32-x64-v0.1.0-beta.1.zip and unpacked it. In this directory I ran npm install --save electron-winstaller and added in the following build.js script to the root dir:

var electronInstaller = require('electron-winstaller');

resultPromise = electronInstaller.createWindowsInstaller({
  appDirectory: 'C:\\Users\\robertph\\Downloads\\exercism-gui-win32-x64-v0.1.0-beta.1\\exercism-gui-win32-x64',
  outputDirectory: 'C:\\Users\\robertph\\Downloads\\exercism-gui-win32-x64-v0.1.0-beta.1\\dist',
  authors: 'exercism',
});

resultPromise.then(() => console.log("It worked!"), (e) => console.log(`No dice: ${e}`));

then in the root dir ran node .\build.js getting the following error output:

No dice: Error: Failed with exit code: 4294967295
Output:

System.AggregateException: One or more errors occurred. ---> System.Exception: Failed to compile WiX template, command invoked was: 'candle.exe -nologo -ext WixNetFxExtension -out "C:\Users\robertph\Downloads\exercism-gui-win32-x64-v0.1.0-beta.1\dist\Setup.wixobj" "C:\Users\robertph\Downloads\exercism-gui-win32-x64-v0.1.0-beta.1\dist\Setup.wxs"'

Output was:
Setup.wxs
C:\Users\robertph\Downloads\exercism-gui-win32-x64-v0.1.0-beta.1\dist\Setup.wxs(20) : error CNDL0014 : The Component/@Id attribute's value, 'exercism-gui.exe', is not a legal identifier.  Identifiers may contain ASCII characters A-Z, a-z, digits, underscores (_), or periods (.).  Every identifier must begin with either a letter or an underscore.
C:\Users\robertph\Downloads\exercism-gui-win32-x64-v0.1.0-beta.1\dist\Setup.wxs(21) : error CNDL0014 : The File/@Id attribute's value, 'exercism-gui.exe', is not a legal identifier.  Identifiers may contain ASCII characters A-Z, a-z, digits, underscores (_), or periods (.).  Every identifier must begin with either a letter or an underscore.
C:\Users\robertph\Downloads\exercism-gui-win32-x64-v0.1.0-beta.1\dist\Setup.wxs(34) : error CNDL0014 : The ComponentRef/@Id attribute's value, 'exercism-gui.exe', is not a legal identifier.  Identifiers may contain ASCII characters A-Z, a-z, digits, underscores (_), or periods (.).  Every identifier must begin with either a letter or an underscore.
   at Squirrel.Update.Program.<createMsiPackage>d__20.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at Squirrel.Update.Program.Releasify(String package, String targetDir, String packagesDir, String bootstrapperExe, String backgroundGif, String signingOpts, String baseUrl, String setupIcon, Boolean generateMsi)
   at Squirrel.Update.Program.executeCommandLine(String[] args)
   at Squirrel.Update.Program.main(String[] args)
   at Squirrel.Update.Program.Main(String[] args)
---> (Inner Exception #0) System.Exception: Failed to compile WiX template, command invoked was: 'candle.exe -nologo -ext WixNetFxExtension -out "C:\Users\robertph\Downloads\exercism-gui-win32-x64-v0.1.0-beta.1\dist\Setup.wixobj" "C:\Users\robertph\Downloads\exercism-gui-win32-x64-v0.1.0-beta.1\dist\Setup.wxs"'

Output was:
Setup.wxs
C:\Users\robertph\Downloads\exercism-gui-win32-x64-v0.1.0-beta.1\dist\Setup.wxs(20) : error CNDL0014 : The Component/@Id attribute's value, 'exercism-gui.exe', is not a legal identifier.  Identifiers may contain ASCII characters A-Z, a-z, digits, underscores (_), or periods (.).  Every identifier must begin with either a letter or an underscore.
C:\Users\robertph\Downloads\exercism-gui-win32-x64-v0.1.0-beta.1\dist\Setup.wxs(21) : error CNDL0014 : The File/@Id attribute's value, 'exercism-gui.exe', is not a legal identifier.  Identifiers may contain ASCII characters A-Z, a-z, digits, underscores (_), or periods (.).  Every identifier must begin with either a letter or an underscore.
C:\Users\robertph\Downloads\exercism-gui-win32-x64-v0.1.0-beta.1\dist\Setup.wxs(34) : error CNDL0014 : The ComponentRef/@Id attribute's value, 'exercism-gui.exe', is not a legal identifier.  Identifiers may contain ASCII characters A-Z, a-z, digits, underscores (_), or periods (.).  Every identifier must begin with either a letter or an underscore.
   at Squirrel.Update.Program.<createMsiPackage>d__20.MoveNext()<---

The specific error is 'exercism-gui.exe', is not a legal identifier, I tried changing exercism-gui to exercism_gui in a few places, including in the Setup.wxs file that is created, where I believe the illegal identifier is, but as it is overwritten each time this has no effect. I don't know where exercism-gui would need to be changed for this to take effect. I've not run the ember build command from this dir as I've run into various difficulties getting the electron program set up on windows, which I'll open separate issues for.

A Setup.exe is created in the dist directory that when double-clicked runs the exercism-gui app, & installs a bunch of files in my AppData directory, but not the actual app.

If I get the time, I'll try a few more experiments. Hope this is some help.

Save track selection

The app selector, being a component, gets destroyed on leaving the parent route. Store the selected
track in a service to store the state throughout the session

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.