Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
THIS IS COMMBADGE
Browse files Browse the repository at this point in the history
  • Loading branch information
cvan committed Jul 4, 2013
0 parents commit 37bcdef
Show file tree
Hide file tree
Showing 384 changed files with 52,549 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .gitignore
@@ -0,0 +1,37 @@
*.egg-info
*.elc
*.less.css
*.po.js
*.pyc
*.styl.css
*.swp
*~
.#*
.DS_Store
.buildout
.emacs.d/.autosaves
.emacs.d/.emacs-places
.emacs.d/history
.emacs.d/site/nxhtml
.emacs.d/tramp
.emacs.desktop
.ipython
.virtualenvs
.zsh/cache
TAGS
build
dist
hearth/locales/*.js
hearth/media/css/include.css
hearth/media/include.css
hearth/media/include.js
hearth/media/js/include.js
hearth/templates.js
node_modules
npm-debug.log
settings_local.js
smokealarm/captures/
tags
yulelog_*
.node-version
settings_local.py
3 changes: 3 additions & 0 deletions LICENSE
@@ -0,0 +1,3 @@
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
88 changes: 88 additions & 0 deletions Makefile
@@ -0,0 +1,88 @@
UUID = "8af8c763-da9b-444d-a911-206f9e225b55"
VERSION = `date "+%Y.%m.%d_%H.%M.%S"`
VERSION_INT = $(shell date "+%Y%m%d%H%M%S")
TMP = _tmp
TEMPLATES = $(wildcard \
hearth/templates/*.html \
public/templates/**/*.html \
)
STYL_FILES = $(wildcard \
hearth/media/css/*.styl \
public/media/css/**/*.styl \
)
CSS_FILES = $(STYL_FILES:.styl=.styl.css)
COMPILED_TEMPLATES = hearth/templates.js

compile: $(COMPILED_TEMPLATES) $(CSS_FILES)

fastcompile:
node damper.js --compile

$(COMPILED_TEMPLATES): $(TEMPLATES)
node damper.js --compile nunjucks

%.styl.css: %.styl
node damper.js --compile stylus --path $<

l10n: clean fastcompile
cd locale ; \
./omg_new_l10n.sh

langpacks:
mkdir -p hearth/locales
for po in `find locale -name "*.po"` ; do \
lang=`basename \`dirname \\\`dirname $$po\\\`\` | tr "_" "-"`; \
node scripts/generate_langpacks.js $$po $$lang; \
mv $$po.js hearth/locales/$$lang.js ; \
done

test: clean fastcompile
cd smokealarm ; \
casperjs test tests

package: compile
cd hearth/ && zip -r ../$(VERSION).zip * && cd ../

# This is what the iframe src points to.
DOMAIN?=marketplace.firefox.com

# This is what the app will be named on the device.
NAME?=Marketplace

log: clean
@mkdir -p TMP && cp -pR yulelog/* TMP/.
@# We have to have a temp file to work around a bug in Mac's version of sed :(
@sed -i'.bak' -e 's/marketplace\.firefox\.com/$(DOMAIN)/g' TMP/main.js
@sed -i'.bak' -e 's/{version}/$(VERSION_INT)/g' TMP/manifest.webapp
@sed -i'.bak' -e 's/"Marketplace"/"$(NAME)"/g' TMP/manifest.webapp
@rm -f TMP/*.bak
@cd TMP && zip -q -r ../yulelog_$(NAME)_$(VERSION_INT).zip * && cd ../
@rm -rf TMP
@echo "Created file: yulelog_$(NAME)_$(VERSION_INT).zip"

clean:
@rm -rf TMP \
$(CSS_FILES) \
$(COMPILED_TEMPLATES) \
hearth/locales/* \
hearth/media/css/include.css \
hearth/media/js/include.*

raw_includes: clean compile langpacks
echo "/* $(VERSION) */" > hearth/media/include.css
echo "/* $(VERSION) */" > hearth/media/include.js
cat amd/amd.js >> hearth/media/include.js
python build.py

includes: raw_includes
./node_modules/.bin/cleancss hearth/media/include.css > hearth/media/css/include.css
rm -f hearth/media/include.css
mv hearth/media/include.js hearth/media/js/
./node_modules/.bin/uglifyjs hearth/media/js/include.js -o hearth/media/js/include.js -m -c --screw-ie8

lint:
# You need closure-linter installed for this.
gjslint --nojsdoc -r hearth/media/js/ -e lib

deploy:
git fetch && git reset --hard origin/master && npm install && make includes
225 changes: 225 additions & 0 deletions README.md
@@ -0,0 +1,225 @@
# Commbadge

Commbadge is the front-end for the Communication Dashboard for the Firefox Marketplace (mozilla/fireplace).


## Installation

```bash
npm install -d
```

Our dependencies:

- `stylus`: For stylesheets


### Getting node/npm


#### OS X

```bash
brew install node
```

And make sure that `/usr/local/share/npm/bin` is in your `$PATH`, à la: ::

```bash
export PATH=/usr/local/share/npm/bin:$PATH
```


## Usage

From the terminal, run the following command

```bash
node damper.js
```

The damper will also run a Stylus watcher (to recompile CSS as it's edited)
and a template watcher (to recompile templates as they're edited).



## Glossary

<dl>
<dt>Ashes</dt>
<dd>A secure debug information collection server</dd>

<dt>Chimney</dt>
<dd>A bridge between Flue and the actual Zamboni API</dd>

<dt>Damper</dt>
<dd>A node.js server that serves a browser-friendly version of Fireplace</dd>

<dt>Flue</dt>
<dd>A mocked-out version of the Marketplace API.</dd>

<dt>Hearth</dt>
<dd>The source code for Fireplace.</dd>

<dt>Inferno</dt>
<dd>A build server which generates a packaged version of the Marketplace.</dd>

<dt>Smoke Alarm</dt>
<dd>A functional test runner for great justice.</dd>

<dt>Yule Log</dt>
<dd>A fake version of Fireplace to provide the Gaia team with a package that can
be shipped and later upgraded to the real Fireplace.</dd>
</dl>


## Installation

```bash
npm install -d
```

Our dependencies:

- `nunjucks`: For templates
- `stylus`: For stylesheets

If you plan on doing compilation (i.e.: you're Wil Clouser), you'll also need

- `clean-css`: For minifying CSS or whatever
- `requirejs`: For warming up Spaceheater
- `uglify-js`: For minifying JS and L10n string extraction


### Flue

Comprehensive Flue documentation can be found in
[Flue's README](https://github.com/mozilla/fireplace/blob/master/flue/README.rst).


### Yule Log

Docs can be found in
[Yule Log's README](https://github.com/mozilla/fireplace/blob/master/yulelog/README.md)


### Getting node/npm


#### OS X

```bash
brew install node
```

And make sure that `/usr/local/share/npm/bin` is in your `$PATH`, à la: ::

```bash
export PATH=/usr/local/share/npm/bin:$PATH
```


## Usage

From the terminal, run the following command

```bash
node damper.js
```

This will start a local server on 0.0.0.0:8675 by default.

To control the hostname and port you can use the following otions

```bash
node damper.js --host 127.0.0.1 --port 8888
```

In addition to an HTTP server, the damper will also run a Stylus watcher (to
recompile CSS as it's edited) and a template watcher (to recompile templates
as they're edited).

For instructions on running Flue (the mock API server), please see the [Flue
docs](https://github.com/mozilla/fireplace/blob/master/flue/README.rst).


### Compiling

To run the compilation process, which compiles templates, CSS, and locale
files, run the damper with the `--compile` argument:

```bash
node damper.js --compile
```

The damper will not start a local server in this case, but a `strings.po` file
will be generated.


### Compiling Includes

If you need to compile include files (i.e.: for Space Heater or a less HTTP-
heavy version of the project), run `make includes`. This will generate two files:

```
hearth/media/js/include.js
hearth/media/css/include.css
```

The CSS in `include.css` is generated in the order in which CSS files are
included in `hearth/index.html`.

`include.js` uses a lightweight AMD loader (rather than require.js). This keeps
file size down and also makes it possible to name-mangle internal keywords which
otherwise wouldn't be minifiable. Note that the only safe globals are `require`
and `define`---using any other non-browser globals will result in errors. I.e.:
accessing `_` without requiring `'underscore'` will cause the code to fail. Also
note that all modules must include a name as the first parameter.

Note that you need the dev dependencies to run this compilation. You can get
them by running `npm install -d`.


## Localizing

A detailed guide to extracting strings and creating JS language packs can be
found [on the wiki](https://github.com/mozilla/fireplace/wiki/L10n#extracting-strings).


## The API

[Read the docs.](http://firefox-marketplace-api.readthedocs.org/)


## Bugs

- If new templates or ``.styl`` files are added, they will not be recognized
until the damper is restarted. Deleted files may also cause problems.


## Tests

Install casper

```bash
brew install casperjs
```

### Running unit tests

Load [http://localhost:8675/tests](http://localhost:8675/tests) in your browser.


### Running functional tests

Before you run the functional tests, make sure your `settings_local.js` file has
the subset of keys found in
[`settings_travis.js`](https://github.com/mozilla/fireplace/blob/master/hearth/media/js/settings_travis.js).

```bash
make test
```

## Local Development With Nginx

See [Using Fireplace with Zamboni](https://github.com/mozilla/fireplace/wiki/Using-Fireplace-with-Zamboni)

0 comments on commit 37bcdef

Please sign in to comment.