├── .gitignore ├── .gitmodules ├── .travis.yml ├── LICENSE ├── README.md ├── config.json ├── libs ├── Utils.coffee ├── jenkins.coffee └── wrapper.coffee ├── package.json ├── templates ├── android │ ├── .gitignore │ ├── README.md │ ├── android.iml │ ├── app │ │ ├── app.iml │ │ ├── build.gradle │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── assets │ │ │ ├── error.html │ │ │ └── index.html │ │ │ ├── java │ │ │ └── ro │ │ │ │ └── northpole │ │ │ │ └── mind │ │ │ │ └── webview │ │ │ │ └── ShowWebView.java │ │ │ └── res │ │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── layout │ │ │ └── show_web_view.xml │ │ │ ├── menu │ │ │ └── show_web_view.xml │ │ │ ├── values-v11 │ │ │ └── styles.xml │ │ │ ├── values-v14 │ │ │ └── styles.xml │ │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ │ └── values │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── import-summary.txt │ └── settings.gradle └── desktop │ ├── .gitignore │ ├── README.md │ ├── favicon.png │ ├── index.html │ ├── linux │ └── package.json ├── test └── UtilsTests.coffee └── wiki ├── Help.md ├── Home.md ├── Infrastructure.md ├── Notes.md └── snapshot.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # node-waf configuration 20 | .lock-wscript 21 | 22 | # Compiled binary addons (http://nodejs.org/api/addons.html) 23 | build/Release 24 | 25 | # Dependency directory 26 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git 27 | node_modules 28 | 29 | env.properties 30 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "templates/ios7"] 2 | path = templates/ios7 3 | url = https://github.com/mess110/SVWebViewController 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "0.12" 4 | git: 5 | submodules: false 6 | before_install: 7 | - sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules 8 | - git submodule update --init --recursive 9 | notifications: 10 | email: false 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Cristian Mircea Messel 2 | 3 | Webview is an Open Source project licensed under the terms of 4 | the LGPLv3 license. Please see 5 | or 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | glassic 2 | ============== 3 | 4 | [![Build Status](https://travis-ci.org/mess110/glassic.svg?branch=master)](https://travis-ci.org/mess110/glassic) 5 | 6 | [![glassic](wiki/snapshot.png)](https://mess110.github.com/glassic/) 7 | 8 | 9 | Simple webview application generator for: 10 | 11 | * android 12 | * ios 13 | * linux via nw.js 14 | * mac via nw.js 15 | * windows via nw.js 16 | 17 | ## Requirements 18 | 19 | Developed with: 20 | 21 | $ node --version 22 | v0.12.7 23 | 24 | ## Installation 25 | 26 | ### Easy way 27 | 28 | Use [glassic wizzard](https://github.com/mess110/glassic) to generate your application 29 | and run *start.sh* from the generated archive. 30 | 31 | ### Extra easy way 32 | 33 | Use [glassic wizzard](https://github.com/mess110/glassic) to generate your application 34 | and use the build servers. *TODO* 35 | 36 | ### Hard way: 37 | 38 | git clone https://github.com/mess110/glassic.git 39 | cd glassic/ 40 | vim config.json 41 | npm run glassic 42 | 43 | This will install dependencies, compile according to [config.json](config.json) 44 | and run the help command. 45 | 46 | ## Getting started 47 | 48 | [![asciicast](https://asciinema.org/a/1r8ci9q4zupt8w0w0a0tils96.png)](https://asciinema.org/a/1r8ci9q4zupt8w0w0a0tils96) 49 | 50 | Assuming you went through the installation steps, you now the git repositories 51 | for your applications. They can be found in the [templates](templates/) folder. 52 | 53 | Lets run the desktop app: 54 | 55 | npm run demo:linux 56 | 57 | or build the android apk: 58 | 59 | npm run demo:android 60 | 61 | [Documentation and more info can be found here](wiki/Home.md). 62 | 63 | To view the list of commands: 64 | 65 | npm run help 66 | 67 | ## License 68 | 69 | Please see [LICENSE](https://github.com/mess110/glassic/blob/master/LICENSE) for licensing details. 70 | 71 | ## Author 72 | 73 | Cristian Mircea Messel, [@mess110](https://twitter.com/mess110) 74 | -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CoolBeans", 3 | "url": "https://cool-beans.com/", 4 | "desktop": { 5 | "width": 800, 6 | "height": 600, 7 | "fullscreen": false, 8 | "resizable": false 9 | }, 10 | "android": { 11 | "packageName": "fallen.software.coolbeans", 12 | "screenOrientation": "unspecified", 13 | "windowSoftInputMode": "stateUnspecified", 14 | "offline": false, 15 | "offlineRepo": "git@github.com:mess110/glassic.git#offline-html", 16 | "fullscreen": false 17 | }, 18 | "ios": { 19 | "fullscreen": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /libs/Utils.coffee: -------------------------------------------------------------------------------- 1 | assert = require('assert') 2 | validUrl = require('valid-url') 3 | 4 | module.exports = class Utils 5 | 6 | @clone: (obj) -> 7 | JSON.parse(JSON.stringify(obj)) 8 | 9 | @getAndroidPackagePath: (config) -> 10 | @validateConfig(config) 11 | config.android.packageName.replace(/\./g, '/') 12 | 13 | @validateConfig: (config) -> 14 | assert.equal(typeof(config.name), 'string') 15 | assert.equal(typeof(config.url), 'string') 16 | 17 | assert.equal(validUrl.isUri(config.url)?, true) 18 | tmpName = /^[0-9A-Za-z\-\_\ \!\@\#\?\+\.\,]*$/.exec(config.name) 19 | assert.equal(config.name, tmpName) 20 | 21 | assert.equal(typeof(config.desktop), 'object') 22 | assert.equal(typeof(config.desktop.fullscreen), 'boolean') 23 | assert.equal(typeof(config.desktop.resizable), 'boolean') 24 | assert.equal(typeof(config.desktop.width), 'number') 25 | assert.equal(typeof(config.desktop.height), 'number') 26 | 27 | assert.equal(typeof(config.android), 'object') 28 | assert.equal(typeof(config.android.fullscreen), 'boolean') 29 | assert.equal(typeof(config.android.packageName), 'string') 30 | assert.equal(typeof(config.android.windowSoftInputMode), 'string') 31 | assert.notEqual(['unspecified', 'portrait', 'landscape'].indexOf(config.android.screenOrientation), -1) 32 | assert.equal(typeof(config.android.screenOrientation), 'string') 33 | assert.notEqual(['stateUnspecified', 'stateUnchanged', 'stateHidden', 34 | 'stateAlwaysHidden', 'stateVisible', 'stateAlwaysVisible', 35 | 'adjustUnspecified', 'adjustResize', 'adjustPan'].indexOf(config.android.windowSoftInputMode), -1) 36 | assert.equal(typeof(config.android.offline), 'boolean') 37 | if config.android.offline == true 38 | assert.equal(typeof(config.android.offlineRepo), 'string') 39 | 40 | assert.equal(config.android.packageName.split('.').length >= 3, true) 41 | tmpPackageName = config.android.packageName.replace(/\W+\./g) 42 | assert.equal(config.android.packageName, tmpPackageName) 43 | 44 | assert.equal(typeof(config.ios), 'object') 45 | assert.equal(typeof(config.ios.fullscreen), 'boolean') 46 | 47 | config 48 | 49 | @replaceVars: (path, returnPath, files, config) -> 50 | cd path 51 | 52 | for file in files 53 | sed '-i', /\$\{name\}/g, config.name, file 54 | sed '-i', /\$\{url\}/g, config.url, file 55 | sed '-i', /\$\{desktop\.width\}/g, config.desktop.width, file 56 | sed '-i', /\$\{desktop\.height\}/g, config.desktop.height, file 57 | sed '-i', /\$\{desktop\.fullscreen\}/g, config.desktop.fullscreen.toString(), file 58 | sed '-i', /\$\{desktop\.resizable\}/g, config.desktop.resizable.toString(), file 59 | sed '-i', /\$\{android\.packageName\}/g, config.android.packageName, file 60 | sed '-i', /\$\{android\.screenOrientation\}/g, config.android.screenOrientation, file 61 | sed '-i', /\$\{android\.windowSoftInputMode\}/g, config.android.windowSoftInputMode, file 62 | sed '-i', /\$\{android\.fullscreen\}/g, config.android.fullscreen.toString(), file 63 | sed '-i', /\$\{android\.offline\}/g, config.android.offline.toString(), file 64 | 65 | cd returnPath 66 | 67 | @moveDesktopIcon: -> 68 | if test('-e', 'assets/favicon.png') 69 | mv('-f', 'assets/favicon.png', 'templates/desktop/favicon.png') 70 | 71 | @moveAndroidIcons: -> 72 | for iconSize in ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi'] 73 | if test('-e', "assets/#{iconSize}.png") 74 | mv('-f', "assets/#{iconSize}.png", "templates/android/app/src/main/res/drawable-#{iconSize}/ic_launcher.png") 75 | 76 | @moveSrcToPackageFolder: (path, returnPath, files, config) -> 77 | cd path 78 | 79 | packagePath = "app/src/main/java/#{@getAndroidPackagePath(config)}" 80 | mkdir('-p', packagePath) 81 | 82 | for file in files 83 | if test('-e', file) 84 | mv('-f', file, packagePath) 85 | 86 | cd returnPath 87 | 88 | @checkoutTemplates: -> 89 | if (exec('git checkout templates/').code != 0) 90 | echo 'Error: Git checkout failed' 91 | exit(1) 92 | 93 | @cloneOfflineRepo: (path, returnPath, config) -> 94 | unless config.android.offline 95 | return 96 | 97 | cd path 98 | cd 'app/src/main/' 99 | 100 | rm '-rf', 'assets/' 101 | 102 | repoUrl = config.android.offlineRepo 103 | if repoUrl.includes('#') 104 | splita = repoUrl.split('#') 105 | repoUrl = splita[0] 106 | branchName = splita[1] 107 | 108 | echo "Repo url: #{repoUrl}" 109 | if (exec("git clone #{repoUrl} assets").code != 0) 110 | echo 'Error: Git clone offline repo failed' 111 | exit(1) 112 | 113 | if branchName? 114 | echo "Repo branch: #{branchName}" 115 | cd 'assets/' 116 | if (exec("git checkout #{branchName}").code != 0) 117 | echo "Error: Could not find branch: #{branchName}" 118 | exit(1) 119 | cd '..' 120 | 121 | cd '../../..' 122 | cd returnPath 123 | -------------------------------------------------------------------------------- /libs/jenkins.coffee: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | assert = require('assert') 4 | require 'shelljs/global' 5 | 6 | Utils = require('./Utils.coffee') 7 | config = require('../config.json') 8 | 9 | Utils.validateConfig(config) 10 | 11 | assert.equal(typeof(config.email), 'string') 12 | 13 | exec("echo 'GLASSIC_CONFIG_EMAIL=#{config.email}' >> env.properties") 14 | -------------------------------------------------------------------------------- /libs/wrapper.coffee: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require 'shelljs/global' 4 | 5 | Utils = require('./Utils.coffee') 6 | config = require('../config.json') 7 | 8 | Utils.validateConfig(config) 9 | Utils.checkoutTemplates() 10 | 11 | desktopFiles = ['README.md', 'package.json', 'index.html'] 12 | Utils.replaceVars('templates/desktop', '../..', desktopFiles, config) 13 | Utils.moveDesktopIcon() 14 | 15 | androidFiles = [ 16 | 'README.md' 17 | 'app/build.gradle' 18 | 'app/src/main/AndroidManifest.xml' 19 | 'app/src/main/res/values/strings.xml' 20 | 'app/src/main/res/menu/show_web_view.xml' 21 | 'app/src/main/java/ro/northpole/mind/webview/ShowWebView.java' 22 | ] 23 | Utils.replaceVars('templates/android', '../..', androidFiles, config) 24 | 25 | javaSrcFiles = [ 26 | 'app/src/main/java/ro/northpole/mind/webview/ShowWebView.java' 27 | ] 28 | Utils.moveSrcToPackageFolder('templates/android', '../..', javaSrcFiles, config) 29 | Utils.moveAndroidIcons() 30 | Utils.cloneOfflineRepo('templates/android', '../..', config) 31 | 32 | ios7Files = [ 33 | 'Demo/Classes/ViewController.m' 34 | ] 35 | Utils.replaceVars('templates/ios7', '../..', ios7Files, config) 36 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "glassic", 3 | "version": "1.0.0", 4 | "description": "Simple webview application generator", 5 | "scripts": { 6 | "glassic": "npm install && npm run test && npm run compile && npm run help", 7 | "install": "npm run update:submodules", 8 | "jenkins": "./node_modules/coffee-script/bin/coffee libs/jenkins.coffee", 9 | "update:submodules": "git submodule update --init --recursive && git submodule foreach git pull origin master", 10 | "compile": "./node_modules/coffee-script/bin/coffee libs/wrapper.coffee", 11 | "compile:android": "cd templates/android && ./gradlew clean && ./gradlew build", 12 | "test": "./node_modules/mocha/bin/mocha --compilers coffee:coffee-script/register", 13 | "test:watch": "./node_modules/mocha/bin/mocha -w --compilers coffee:coffee-script/register", 14 | "help": "cat wiki/Help.md", 15 | "help:android": "cat templates/android/README.md", 16 | "help:desktop": "cat templates/desktop/README.md", 17 | "help:apk": "ls templates/android/app/build/outputs/apk/", 18 | "help:ios": "echo 'See templates/ios7/README.md for compiling instructions.'", 19 | "demo:android": "npm run compile:android && npm run help:apk", 20 | "demo:linux": "cd templates/desktop; ./linux", 21 | "package:desktop": "cd templates && tar -zcvf desktop.tar.gz desktop/ && cd .." 22 | }, 23 | "repository": { 24 | "type": "git", 25 | "url": "git+ssh://git@github.com/mess110/glassic.git" 26 | }, 27 | "author": "Cristian Mircea Messel", 28 | "license": "LGPL-3.0", 29 | "homepage": "https://github.com/mess110/glassic", 30 | "devDependencies": { 31 | "coffee-script": "^1.10.0", 32 | "mocha": "^2.3.3", 33 | "shelljs": "^0.5.3", 34 | "valid-url": "^1.0.9" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /templates/android/.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | 19 | # Local configuration file (sdk path, etc) 20 | local.properties 21 | 22 | # Proguard folder generated by Eclipse 23 | proguard/ 24 | 25 | # Log Files 26 | *.log 27 | 28 | # Android Studio Navigation editor temp files 29 | .navigation/ 30 | 31 | # Android Studio captures folder 32 | captures/ 33 | 34 | .idea/ 35 | -------------------------------------------------------------------------------- /templates/android/README.md: -------------------------------------------------------------------------------- 1 | # ${name} 2 | 3 | This is the Android webview application for [${url}](${url}). 4 | -------------------------------------------------------------------------------- /templates/android/android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /templates/android/app/app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /templates/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 21 5 | buildToolsVersion "23.0.1" 6 | 7 | defaultConfig { 8 | applicationId "${android.packageName}" 9 | minSdkVersion 11 10 | targetSdkVersion 21 11 | } 12 | 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile 'com.android.support:appcompat-v7:21.0.0' 23 | compile 'com.android.support:support-v4:21.0.0' 24 | } 25 | -------------------------------------------------------------------------------- /templates/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 19 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /templates/android/app/src/main/assets/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | No Connection 8 | 9 | 10 | 95 | 96 | 97 |

No Connection :(

98 |

Check your WiFi or Mobile Internet!

99 |
100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /templates/android/app/src/main/assets/index.html: -------------------------------------------------------------------------------- 1 | Find me in app/src/main/assets/index.html 2 | -------------------------------------------------------------------------------- /templates/android/app/src/main/java/ro/northpole/mind/webview/ShowWebView.java: -------------------------------------------------------------------------------- 1 | package ${android.packageName}; 2 | 3 | import android.annotation.TargetApi; 4 | import android.net.ConnectivityManager; 5 | import android.net.NetworkInfo; 6 | import android.os.Bundle; 7 | import android.app.Activity; 8 | import android.content.Context; 9 | import android.view.Window; 10 | import android.view.WindowManager; 11 | import android.webkit.WebSettings; 12 | import android.webkit.WebView; 13 | import android.webkit.WebViewClient; 14 | 15 | import ${android.packageName}.R; 16 | 17 | 18 | public class ShowWebView extends Activity { 19 | 20 | private WebView webView; 21 | 22 | public void onCreate(Bundle savedInstanceState) { 23 | 24 | super.onCreate(savedInstanceState); 25 | 26 | if (${android.fullscreen}) { 27 | this.requestWindowFeature(Window.FEATURE_NO_TITLE); 28 | this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 29 | } 30 | 31 | setContentView(R.layout.show_web_view); 32 | 33 | webView = (WebView) findViewById(R.id.webView1); 34 | webView.setWebViewClient(new MyWebViewClient()); 35 | 36 | if (${android.offline}) { 37 | startWebView("file:///android_asset/index.html"); 38 | } else { 39 | if (haveNetworkConnection()) { 40 | startWebView("${url}"); 41 | } else { 42 | startWebView("file:///android_asset/error.html"); 43 | } 44 | } 45 | } 46 | 47 | @TargetApi(16) 48 | private WebSettings initHighSettings(WebSettings webSettings) { 49 | webSettings.setAllowUniversalAccessFromFileURLs(true); 50 | return webSettings; 51 | } 52 | 53 | private void startWebView(String url) { 54 | 55 | WebSettings webSettings = webView.getSettings(); 56 | // webView.setSoundEffectsEnabled(true); 57 | // webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); 58 | // webView.setScrollbarFadingEnabled(false); 59 | 60 | webSettings.setJavaScriptEnabled(true); 61 | webSettings.setDomStorageEnabled(true); 62 | initHighSettings(webSettings); 63 | 64 | // webSettings.setLoadWithOverviewMode(true); 65 | // webSettings.setUseWideViewPort(true); 66 | // webSettings.setBuiltInZoomControls(true); 67 | 68 | // webSettings.setJavaScriptCanOpenWindowsAutomatically(true); 69 | // webSettings.setDatabaseEnabled(true); 70 | // webSettings.setAllowUniversalAccessFromFileURLs(true); 71 | // webSettings.setAppCacheEnabled(true); 72 | // webSettings.setLayoutAlgorithm(webView.getSettings().getLayoutAlgorithm().NORMAL); 73 | // webSettings.setLoadWithOverviewMode(true); 74 | // webSettings.setUseWideViewPort(false); 75 | 76 | webView.loadUrl(url); 77 | } 78 | 79 | private class MyWebViewClient extends WebViewClient { 80 | @Override 81 | public boolean shouldOverrideUrlLoading(WebView view, String url) { 82 | return false; 83 | } 84 | } 85 | 86 | @Override 87 | public void onBackPressed() { 88 | if (webView.canGoBack()) { 89 | webView.goBack(); 90 | } else { 91 | super.onBackPressed(); 92 | } 93 | } 94 | 95 | private boolean haveNetworkConnection() { 96 | boolean haveConnectedWifi = false; 97 | boolean haveConnectedMobile = false; 98 | 99 | ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); 100 | NetworkInfo[] netInfo = cm.getAllNetworkInfo(); 101 | 102 | for (NetworkInfo ni : netInfo) { 103 | if (ni.getTypeName().equalsIgnoreCase("WIFI")) { 104 | if (ni.isConnected()) { 105 | haveConnectedWifi = true; 106 | } 107 | } 108 | if (ni.getTypeName().equalsIgnoreCase("MOBILE")) { 109 | if (ni.isConnected()) { 110 | haveConnectedMobile = true; 111 | } 112 | } 113 | } 114 | return haveConnectedWifi || haveConnectedMobile; 115 | } 116 | 117 | } 118 | -------------------------------------------------------------------------------- /templates/android/app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mess110/glassic/928224702cddef7b31018841cdf2247f8b896807/templates/android/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /templates/android/app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mess110/glassic/928224702cddef7b31018841cdf2247f8b896807/templates/android/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /templates/android/app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mess110/glassic/928224702cddef7b31018841cdf2247f8b896807/templates/android/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /templates/android/app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mess110/glassic/928224702cddef7b31018841cdf2247f8b896807/templates/android/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /templates/android/app/src/main/res/layout/show_web_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | -------------------------------------------------------------------------------- /templates/android/app/src/main/res/menu/show_web_view.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /templates/android/app/src/main/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /templates/android/app/src/main/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /templates/android/app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 64dp 9 | 10 | 11 | -------------------------------------------------------------------------------- /templates/android/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /templates/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ${name} 5 | Hello world! 6 | Settings 7 | 8 | 9 | -------------------------------------------------------------------------------- /templates/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /templates/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | repositories { 4 | jcenter() 5 | } 6 | dependencies { 7 | classpath 'com.android.tools.build:gradle:1.2.3' 8 | } 9 | } 10 | 11 | allprojects { 12 | repositories { 13 | jcenter() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /templates/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mess110/glassic/928224702cddef7b31018841cdf2247f8b896807/templates/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /templates/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 15:27:10 PDT 2013 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip 7 | -------------------------------------------------------------------------------- /templates/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /templates/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /templates/android/import-summary.txt: -------------------------------------------------------------------------------- 1 | ECLIPSE ANDROID PROJECT IMPORT SUMMARY 2 | ====================================== 3 | 4 | Ignored Files: 5 | -------------- 6 | The following files were *not* copied into the new Gradle project; you 7 | should evaluate whether these are still needed in your project and if 8 | so manually move them: 9 | 10 | * LICENSE 11 | * README.md 12 | * ic_launcher-web.png 13 | * proguard-project.txt 14 | 15 | Replaced Jars with Dependencies: 16 | -------------------------------- 17 | The importer recognized the following .jar files as third party 18 | libraries and replaced them with Gradle dependencies instead. This has 19 | the advantage that more explicit version information is known, and the 20 | libraries can be updated automatically. However, it is possible that 21 | the .jar file in your project was of an older version than the 22 | dependency we picked, which could render the project not compileable. 23 | You can disable the jar replacement in the import wizard and try again: 24 | 25 | android-support-v4.jar => com.android.support:support-v4:20.0.0 26 | 27 | Replaced Libraries with Dependencies: 28 | ------------------------------------- 29 | The importer recognized the following library projects as third party 30 | libraries and replaced them with Gradle dependencies instead. This has 31 | the advantage that more explicit version information is known, and the 32 | libraries can be updated automatically. However, it is possible that 33 | the source files in your project were of an older version than the 34 | dependency we picked, which could render the project not compileable. 35 | You can disable the library replacement in the import wizard and try 36 | again: 37 | 38 | appcompat-v7 => [com.android.support:appcompat-v7:20.0.0] 39 | 40 | Moved Files: 41 | ------------ 42 | Android Gradle projects use a different directory structure than ADT 43 | Eclipse projects. Here's how the projects were restructured: 44 | 45 | * AndroidManifest.xml => app/src/main/AndroidManifest.xml 46 | * assets/ => app/src/main/assets/ 47 | * res/ => app/src/main/res/ 48 | * src/ => app/src/main/java/ 49 | 50 | Next Steps: 51 | ----------- 52 | You can now build the project. The Gradle project needs network 53 | connectivity to download dependencies. 54 | 55 | Bugs: 56 | ----- 57 | If for some reason your project does not build, and you determine that 58 | it is due to a bug or limitation of the Eclipse to Gradle importer, 59 | please file a bug at http://b.android.com with category 60 | Component-Tools. 61 | 62 | (This import summary is for your information only, and can be deleted 63 | after import once you are satisfied with the results.) 64 | -------------------------------------------------------------------------------- /templates/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /templates/desktop/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | -------------------------------------------------------------------------------- /templates/desktop/README.md: -------------------------------------------------------------------------------- 1 | # ${name} 2 | 3 | This application is a webview for [${url}](${url}). 4 | 5 | ## Requirements 6 | 7 | $ node --version 8 | v0.12.7 9 | 10 | ## Installation 11 | 12 | npm install 13 | 14 | ## Running 15 | 16 | ### Linux 17 | 18 | ./linux 19 | 20 | ### Windows 21 | 22 | TODO 23 | 24 | ### Mac 25 | 26 | TODO 27 | -------------------------------------------------------------------------------- /templates/desktop/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mess110/glassic/928224702cddef7b31018841cdf2247f8b896807/templates/desktop/favicon.png -------------------------------------------------------------------------------- /templates/desktop/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ${name} 5 | 6 | 7 | 8 | loading 9 | 10 | 11 | -------------------------------------------------------------------------------- /templates/desktop/linux: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | npm install 4 | ./node_modules/nw/bin/nw 5 | -------------------------------------------------------------------------------- /templates/desktop/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "${name}", 3 | "version": "1.0.0", 4 | "main": "index.html", 5 | "author": "", 6 | "window": { 7 | "title": "${name}", 8 | "icon": "favicon.png", 9 | "toolbar": false, 10 | "frame": true, 11 | "width": ${desktop.width}, 12 | "height": ${desktop.height}, 13 | "position": "center", 14 | "kiosk": ${desktop.fullscreen}, 15 | "resizable": ${desktop.resizable} 16 | }, 17 | "webkit": { 18 | "plugin": true 19 | }, 20 | "dependencies": { 21 | "nw": "^0.12.3" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/UtilsTests.coffee: -------------------------------------------------------------------------------- 1 | assert = require('assert') 2 | 3 | utils = require('../libs/Utils.coffee') 4 | config = require('../config.json') 5 | 6 | shouldHaveError = (cfg) -> 7 | assert.throws (-> 8 | utils.validateConfig(cfg) 9 | ), Error 10 | 11 | describe 'Utils', -> 12 | 13 | describe 'clone', -> 14 | 15 | it 'works', -> 16 | hash = utils.clone({hello: 1}) 17 | assert.equal(hash.hello, 1) 18 | 19 | describe 'validateConfig', -> 20 | 21 | beforeEach -> 22 | @c = utils.clone(config) 23 | 24 | it 'is valid', -> 25 | utils.validateConfig(config) 26 | 27 | it 'requires name', -> 28 | delete @c.name 29 | shouldHaveError(@c) 30 | 31 | it 'requires a valid name', -> 32 | @c.name = {} 33 | shouldHaveError(@c) 34 | 35 | @c.name = 'asd;' 36 | shouldHaveError(@c) 37 | 38 | @c.name = 'H3llo?+-_ #World!@' 39 | utils.validateConfig(@c) 40 | 41 | it 'requires url', -> 42 | delete @c.url 43 | shouldHaveError(@c) 44 | 45 | it 'requires a valid url', -> 46 | @c.url = {} 47 | shouldHaveError(@c) 48 | 49 | @c.url = 'asd' 50 | shouldHaveError(@c) 51 | 52 | describe 'desktop', -> 53 | 54 | it 'is a hash', -> 55 | @c.desktop = 'desktop' 56 | shouldHaveError(@c) 57 | 58 | it 'is required', -> 59 | @c.desktop = 'desktop' 60 | shouldHaveError(@c) 61 | 62 | it 'requires desktop.width', -> 63 | delete @c.desktop.width 64 | shouldHaveError(@c) 65 | 66 | it 'requires desktop.width to be a number', -> 67 | @c.desktop.width = 'string' 68 | shouldHaveError(@c) 69 | 70 | it 'requires desktop.height', -> 71 | delete @c.desktop.height 72 | shouldHaveError(@c) 73 | 74 | it 'requires desktop.height to be a number', -> 75 | @c.desktop.height = 'string' 76 | shouldHaveError(@c) 77 | 78 | it 'requires desktop.fullscreen', -> 79 | delete @c.desktop.fullscreen 80 | shouldHaveError(@c) 81 | 82 | it 'requires desktop.fullscreen to be boolean', -> 83 | @c.desktop.fullscreen = 'string' 84 | shouldHaveError(@c) 85 | 86 | it 'requires desktop.resizable', -> 87 | delete @c.desktop.resizable 88 | shouldHaveError(@c) 89 | 90 | it 'requires desktop.fullscreen to be boolean', -> 91 | @c.desktop.resizable = 'string' 92 | shouldHaveError(@c) 93 | 94 | describe 'android', -> 95 | it 'is a hash', -> 96 | @c.android = 'android' 97 | shouldHaveError(@c) 98 | 99 | it 'is required', -> 100 | delete @c.android 101 | shouldHaveError(@c) 102 | 103 | it 'has android.packageName key', -> 104 | delete @c.android.packageName 105 | shouldHaveError(@c) 106 | 107 | it 'requires android.packageName to be a string', -> 108 | @c.android.packageName = {} 109 | shouldHaveError(@c) 110 | 111 | it 'requires android.packageName to have minimum 2 dots', -> 112 | @c.android.packageName = 'asd.asd' 113 | shouldHaveError(@c) 114 | 115 | it 'has android.windowSoftInputMode key', -> 116 | delete @c.android.windowSoftInputMode 117 | shouldHaveError(@c) 118 | 119 | it 'requires android.windowSoftInputMode to be a string', -> 120 | @c.android.windowSoftInputMode = {} 121 | shouldHaveError(@c) 122 | 123 | it 'requires android.screenOrientation to be a valid value', -> 124 | @c.android.windowSoftInputMode = 'foo' 125 | shouldHaveError(@c) 126 | 127 | it 'has android.screenOrientation key', -> 128 | delete @c.android.screenOrientation 129 | shouldHaveError(@c) 130 | 131 | it 'requires android.screenOrientation to be a string', -> 132 | @c.android.screenOrientation = {} 133 | shouldHaveError(@c) 134 | 135 | it 'requires android.screenOrientation to be a valid value', -> 136 | @c.android.screenOrientation = 'foo' 137 | shouldHaveError(@c) 138 | 139 | # https://docs.oracle.com/javase/specs/jls/se6/html/packages.html#7.7 140 | describe 'requires android.packageName to be a valid JAVA package path', -> 141 | 142 | it 'allows underscore, alpha numeric and .', -> 143 | @c.android.packageName = '!asd' 144 | shouldHaveError(@c) 145 | 146 | @c.android.packageName = 'hello.world.now' 147 | utils.validateConfig(@c) 148 | 149 | it 'does not contain a keyword' 150 | 151 | it 'does not start with a number' 152 | 153 | it 'requires android.offline', -> 154 | delete @c.android.offline 155 | shouldHaveError(@c) 156 | 157 | it 'requires android.offline to be boolean', -> 158 | @c.android.offline = 'string' 159 | shouldHaveError(@c) 160 | 161 | it 'requires android.offlineRepo to be string', -> 162 | @c.android.offline = true 163 | @c.android.offlineRepo = true 164 | shouldHaveError(@c) 165 | 166 | it 'requires android.fullscreen', -> 167 | delete @c.android.fullscreen 168 | shouldHaveError(@c) 169 | 170 | it 'requires android.fullscreen to be boolean', -> 171 | @c.android.fullscreen = 'string' 172 | shouldHaveError(@c) 173 | 174 | describe 'ios', -> 175 | 176 | it 'is a hash', -> 177 | @c.ios = 'ios' 178 | shouldHaveError(@c) 179 | 180 | it 'is required', -> 181 | delete @c.ios 182 | shouldHaveError(@c) 183 | 184 | it 'requires ios.fullscreen', -> 185 | delete @c.ios.fullscreen 186 | shouldHaveError(@c) 187 | 188 | it 'requires ios.fullscreen to be boolean', -> 189 | @c.ios.fullscreen = 'string' 190 | shouldHaveError(@c) 191 | 192 | describe 'getAndroidPackagePath', -> 193 | 194 | it 'validates config before converting', -> 195 | c = utils.clone(config) 196 | delete c.url 197 | shouldHaveError(c) 198 | 199 | it 'replaces . with /', -> 200 | packagePath = utils.getAndroidPackagePath(config) 201 | assert.equal(packagePath, config.android.packageName.replace(/\./g, '/')) 202 | -------------------------------------------------------------------------------- /wiki/Help.md: -------------------------------------------------------------------------------- 1 | glassic 2 | ------- 3 | 4 | Generates webview applications for android, ios, linux and windows. 5 | 6 | You get git repositories customized with your app name and url. 7 | 8 | commands 9 | -------- 10 | 11 | npm run glassic 12 | 13 | npm run demo:linux 14 | npm run demo:android 15 | 16 | npm run help 17 | npm run help:ios 18 | 19 | -------------------------------------------------------------------------------- /wiki/Home.md: -------------------------------------------------------------------------------- 1 | ## TLDR 2 | 3 | Convert website into application for different platforms. 4 | 5 | ## How does it work? 6 | 7 | - Template apps are created per technology (ex: android, ios, nw.js) 8 | - A config file will be used to tweak different aspects of the templates 9 | - The templates will have several customizable parameters 10 | - The source code of the generated applications can be found in **templates/** 11 | 12 | ## Commands 13 | 14 | Here is an overview of what the commands do. 15 | 16 | npm run help 17 | 18 | - prints help 19 | 20 | npm install 21 | 22 | - updates glassic 23 | - installs dependencies 24 | - compiles according to **config.json** 25 | - prints help 26 | 27 | npm run glassic 28 | 29 | - alias for npm install 30 | 31 | npm run demo:linux 32 | 33 | - installs linux dependencies 34 | - runs the application 35 | 36 | npm run demo:android 37 | 38 | - installs android dependencies 39 | - runs the clean task 40 | - compiles the application 41 | - prints android help 42 | 43 | ## TODO 44 | 45 | - web 46 | - build server 47 | - https 48 | - package apps 49 | - https://github.com/nwjs/nw.js/wiki/how-to-package-and-distribute-your-apps 50 | - android app 51 | - document android version 52 | - document build howto 53 | - dekstop app 54 | - windows runner 55 | - mac runner 56 | - iphone app 57 | - name 58 | - fullscreen 59 | - include and respect licenses 60 | - improve instructions from email 61 | -------------------------------------------------------------------------------- /wiki/Infrastructure.md: -------------------------------------------------------------------------------- 1 | ## Infrastructure 2 | 3 | TODO: add uml 4 | 5 | ## Build Machines 6 | 7 | ### general build machine 8 | 9 | These steps are common for all build machines 10 | 11 | sudo apt-get install git unzip lib32stdc++6 lib32z1 mailutils openjdk-7-jdk 12 | 13 | - install jenkins 14 | (* - add plugin https://wiki.jenkins-ci.org/display/JENKINS/Cors+Filter+Plugin *) 15 | - add plugin nodejs 16 | - add cors plugin 17 | - add android plugin 18 | 19 | - enable remote builds 20 | - add file parameter 21 | 22 | A job can be triggered with CURL: 23 | 24 | curl -X POST http://glassic-jenkins.at.struktu.ro:8080/job/build-android/build --form file0=@CoolBeans-glassic.zip --form json='{"parameter": [{"name":"generated.zip", "file":"file0"}]}' 25 | 26 | ### node build machine 27 | 28 | Used for the desktop app. When packaging will be a thing, this will 29 | probably need to be separated per OS. 30 | 31 | ### android build machine 32 | 33 | Used for building the android app. 34 | 35 | - ./android update sdk --no-ui 36 | -------------------------------------------------------------------------------- /wiki/Notes.md: -------------------------------------------------------------------------------- 1 | ## Syntax highlighting 2 | 3 | 4 | You can also highlight snippets of text (we use the excellent [Pygments][] library). 5 | 6 | [Pygments]: http://pygments.org/ 7 | 8 | 9 | Here's an example of some Python code: 10 | 11 | ``` 12 | #!python 13 | 14 | def wiki_rocks(text): 15 | formatter = lambda t: "funky"+t 16 | return formatter(text) 17 | ``` 18 | 19 | 20 | You can check out the source of this page to see how that's done, and make sure to bookmark [the vast library of Pygment lexers][lexers], we accept the 'short name' or the 'mimetype' of anything in there. 21 | [lexers]: http://pygments.org/docs/lexers/ 22 | -------------------------------------------------------------------------------- /wiki/snapshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mess110/glassic/928224702cddef7b31018841cdf2247f8b896807/wiki/snapshot.png --------------------------------------------------------------------------------