Skip to content

Commit

Permalink
Attempting to load alternative default project image with fallback; u…
Browse files Browse the repository at this point in the history
…pdated README with absolute image URLs for display outside GitHub
  • Loading branch information
Chris Bowley committed Nov 16, 2017
1 parent b1f7ef8 commit 262ec78
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 41 deletions.
72 changes: 39 additions & 33 deletions README.md
@@ -1,16 +1,14 @@
# Appcelerator Atom package
# Appcelerator Titanium package for Atom

Appcelerator build tools and UI package for the Atom text editor.
Appcelerator Titanium build tools and UI for the [Atom text editor](https://atom.io).

<img src="images/screenshot.png" width="900px" height="591px" alt="Appcelerator Titanium for Atom screenshot" />
<img src="https://github.com/appcelerator/atom-appcelerator-titanium/blob/master/images/screenshot.png?raw=true" width="900px" height="591px" alt="Appcelerator Titanium for Atom screenshot" />

### Atom
## Getting Started

[Atom](https://atom.io) is an open source text editor built on [Electron](http://electron.atom.io) which provides a framework for building desktop apps for Mac, Windows and Linux using web technologies.

### Installation
Some of the features in this package are implemented as providers for services in the [Atom IDE](https://ide.atom.io) package. Install `atom-ide-ui` from the Atom package installer.

While this is not in the public Atom package library you need to manually install it.
** :bangbang: While this is not in the public Atom package library you need to manually install it. **

1. Clone or download the project and run from the project directory:

Expand All @@ -22,13 +20,21 @@ While this is not in the public Atom package library you need to manually instal

3. Relaunch Atom

#### Dependency
---

Using the Atom package manager: Preferences/Settings > Install > Search for `appcelerator-titanium`.

Using the CLI:

```
apm install appcelerator-titanium
```


Some of the features in this package are implemented as providers for services in the [Atom IDE](https://ide.atom.io) package. Install `atom-ide-ui` from the Atom package installer.

# Features
## Features

## Commands
### Commands

Command | Description
--- | ---
Expand All @@ -41,81 +47,81 @@ appc:open style | Open the related Alloy TSS file
appc:open controller | Open the related JavaScript file
appc:open close related | Toggle the related Alloy XML, TSS and Javascript files

## Build tools
### Build tools

TBD



## Auto-completion
### Auto-completion

Auto-completion support is provided to help speed up development by providing quick references to Titanium APIs and Alloy markup as well as references to modules, widgets and assets within your project.

### Titanium and Alloy
#### Titanium and Alloy

Titanium APIs and Alloy markup suggestions are provided in Titanium JavaScript and Alloy XML and TSS files. This includes classes, properties, methods and events. Where appropriate additional information is provided with a link to the online documentation. Deprecated properties are also indicated.

<img src="images/autocomplete_alloy_class.png" width="385px" height="222px" alt="Alloy markup class auto-complete" />
<img src="https://github.com/appcelerator/atom-appcelerator-titanium/blob/master/images/autocomplete_alloy_class.png?raw=true" width="385px" height="222px" alt="Alloy markup class auto-complete" />

### Project references
#### Project references

Suggestions for other controllers, modules and widgets are presented when referencing through a Titanium function or Alloy markup.

<img src="images/autocomplete_alloy_widget.png" width="324px" height="83px" alt="Alloy markup widget reference auto-complete" />
<img src="https://github.com/appcelerator/atom-appcelerator-titanium/blob/master/images/autocomplete_alloy_widget.png?raw=true" width="324px" height="83px" alt="Alloy markup widget reference auto-complete" />

### Class and ID references
#### Class and ID references

Suggestions for classes and IDs declared or defined in related Alloy XML and TSS files are presented.

<img src="images/autocomplete_tss_class.png" width="251px" height="86px" alt="TSS class reference auto-complete" />
<img src="https://github.com/appcelerator/atom-appcelerator-titanium/blob/master/images/autocomplete_tss_class.png?raw=true" width="251px" height="86px" alt="TSS class reference auto-complete" />

### Images
#### Images

Image suggestions are presented where appropriate, including a thumbnail preview and information about the scaled versions available.

<img src="images/autocomplete_tss_image.png" width="558px" height="155px" alt="TSS image reference auto-complete" />
<img src="https://github.com/appcelerator/atom-appcelerator-titanium/blob/master/images/autocomplete_tss_image.png?raw=true" width="558px" height="155px" alt="TSS image reference auto-complete" />

## Alloy file and component generation
### Alloy file and component generation

<img src="images/generate_dialog.png" width="639px" height="218px" alt="Alloy file and component generate dialog" />
<img src="https://github.com/appcelerator/atom-appcelerator-titanium/blob/master/images/generate_dialog.png?raw=true" width="639px" height="218px" alt="Alloy file and component generate dialog" />

A UI for the `alloy generate` command is provided. The Generate File dialog is presented by clicking the + icon in the toolbar or using the command from the menu or palette. Select the type of file or component to generate and provide the required information. The generated file(s) are then opened.

## Open related files
### Open related files

Opening related Alloy files is supported (see above commands list).

* From View, open related Style and/or Controller
* From Style, open related View and/or Controller
* From Controller, open related View and/or Style

## Jump-to-definition
### Jump-to-definition

Jump-to-definition support is provided for quickly accessing the definiion or usage of Alloy markup and to easily generate new definitions. Images can be opened directly from their path.

### Alloy
#### Alloy

From Views, click through to style definitions for tags, classes and IDs, in related or global TSS. Click through to event definitions in the related controller.

<img src="images/definitions_tag.png" width="257px" height="129px" alt="View tag style definition" />
<img src="https://github.com/appcelerator/atom-appcelerator-titanium/blob/master/images/definitions_tag.png?raw=true" width="257px" height="129px" alt="View tag style definition" />

A prompt is displayed to generate undefined styles or functions.

<img src="images/definitions_generate_tag.png" width="539px" height="74px" alt="View tag style generate definition" />
<img src="https://github.com/appcelerator/atom-appcelerator-titanium/blob/master/images/definitions_generate_tag.png?raw=true" width="539px" height="74px" alt="View tag style generate definition" />

### Strings
#### Strings

Click on localised string references to jump to their definition. The option to generate undefined strings is provided.

### Images
#### Images

Click on an image path to open the image in a new tab. For iOS, where multiple scaled images exist with the same name the first is opened (e.g. @2x).

# Contributions
## Contributions

This package would not be possible without support from the Titanium community. Auto-completion and grammar support provided by [Jong Eun Lee](https://github.com/yomybaby) through the [Titanium Alloy package](https://github.com/yomybaby/atom-titanium).

## Additional thanks
### Additional thanks

We doth our caps to:

Expand Down
20 changes: 12 additions & 8 deletions lib/tiapp.js
@@ -1,12 +1,12 @@
'use babel'

import fs from 'fs';
import path from 'path';
import xml2js from 'xml2js';
import {File} from 'atom';
import {Emitter} from 'atom';
import xml2js from 'xml2js';

const TIAPP_FILENAME = 'tiapp.xml';
const DEFAULT_ICON_FILENAME = 'DefaultIcon.png'
const EVENT_MODIFIED = 'modified';

var Tiapp = {
Expand All @@ -19,11 +19,11 @@ var Tiapp = {
this.loadFileAt(atom.project.getPaths()[0] + '/' + TIAPP_FILENAME);
},

loadFileAt: function(path) {
loadFileAt: function(filePath) {
this.isTitaniumProject = false;
const file = new File(path);
const file = new File(filePath);
if (file.existsSync()) {
const fileData = fs.readFileSync(path, 'utf-8');
const fileData = fs.readFileSync(filePath, 'utf-8');
const parser = new xml2js.Parser();
let json;
parser.parseString(fileData.substring(0, fileData.length), function (err, result) {
Expand All @@ -35,8 +35,8 @@ var Tiapp = {
if (!this.watcher) {
this.watcher = atom.project.onDidChangeFiles(events => {
for (const event of events) {
if (event.path === path && event.action === 'modified') {
this.loadFileAt(path);
if (event.filePath === filePath && event.action === 'modified') {
this.loadFileAt(filePath);
this.emitter.emit(EVENT_MODIFIED);
}
}
Expand All @@ -62,7 +62,11 @@ var Tiapp = {
},

appIcon: function() {
return atom.project.getPaths()[0] + '/' + DEFAULT_ICON_FILENAME;
const files = ['app/DefaultIcon.png', 'app/DefaultIcon-ios.png', 'DefaultIcon.png', 'DefaultIcon-ios.png'];
for (const file of files) {
filePath = path.join(atom.project.getPaths()[0], file);
if (fs.existsSync(filePath)) return filePath;
}
},

destroy: function() {
Expand Down

0 comments on commit 262ec78

Please sign in to comment.