Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
danwaz committed Mar 6, 2012
0 parents commit 67dc70b
Show file tree
Hide file tree
Showing 12 changed files with 9,529 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
@@ -0,0 +1,7 @@
build/*
Gemfile.lock
.DS_Store*
ehthumbs.db
Icon?
Thumbs.db
.sass-cache/*
6 changes: 6 additions & 0 deletions Gemfile
@@ -0,0 +1,6 @@
source :rubygems

gem "middleman", "~>2.0.14"
gem "guard-middleman", "~> 0.1.0"
gem "rb-fsevent"
gem "therubyracer"
11 changes: 11 additions & 0 deletions Guardfile
@@ -0,0 +1,11 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme

guard 'middleman' do
watch(%r{^config.rb})
watch(%r{^data/.*})
watch(%r{^source/.*})

watch(%r{^views/.*})
watch(%r{^public/.*})
end
106 changes: 106 additions & 0 deletions config.rb
@@ -0,0 +1,106 @@
###
# Compass
###

# Susy grids in Compass
# First: gem install compass-susy-plugin
# require 'susy'

# Change Compass configuration
# compass_config do |config|
# config.output_style = :compact
# end

###
# Haml
###

# CodeRay syntax highlighting in Haml
# First: gem install haml-coderay
# require 'haml-coderay'

# CoffeeScript filters in Haml
# First: gem install coffee-filter
# require 'coffee-filter'

# Automatic image dimensions on image_tag helper
# activate :automatic_image_sizes

###
# Page command
###

# Per-page layout changes:
#
# With no layout
# page "/path/to/file.html", :layout => false
#
# With alternative layout
# page "/path/to/file.html", :layout => :otherlayout
#
# A path which all have the same layout
# with_layout :admin do
# page "/admin/*"
# end

# Proxy (fake) files
# page "/this-page-has-no-template.html", :proxy => "/template-file.html" do
# @which_fake_page = "Rendering a fake page with a variable"
# end

###
# Helpers
###

# Methods defined in the helpers block are available in templates
# helpers do
# def some_helper
# "Helping"
# end
# end

# Change the CSS directory
# set :css_dir, "alternative_css_directory"

# Change the JS directory
# set :js_dir, "alternative_js_directory"

# Change the images directorymanifest.json
# set :images_dir, "alternative_image_directory"

# Build-specific configuration
configure :build do
# For example, change the Compass output style for deployment
# activate :minify_css

# Minify Javascript on build
# activate :minify_javascript

# Enable cache buster
# activate :cache_buster

# Use relative URLs
# activate :relative_assets

# Compress PNGs after build
# First: gem install middleman-smusher
# require "middleman-smusher"
# activate :smusher

# Or use a different image path
# set :http_path, "/Content/images/"
end

#spotify build
module Middleman::Features::SpotifyBuild
class << self
def registered(app)
app.after_build do
`./spotify_build.sh`
end
end
alias :included :registered
end
end

activate :spotify_build
47 changes: 47 additions & 0 deletions readme.md
@@ -0,0 +1,47 @@
Spotify Middleman Bootstrap
===========================
Spotify Middleman Bootstrap is a [Middleman](http://middlemanapp.com/) template for creating Spotify Apps in Haml, Sass, and Coffeescript!

Requirements
------------

* Middleman `gem install middleman`
* Bundler `gem install bundler`
* Ruby 1.9.x recommended
* [Spotify Dev Account](http://developer.spotify.com/en/spotify-apps-api/developer-signup/)

Install
------------

Clone project into `~/.middleman` folder.

Usage
-----

Create a new Middleman project.

middleman init MySpotifyApp --template=spotify-middleman-bootstrap

Run bundler in `/MyStotifyApp` folder.

bundle install

Configure
---------

Open `spotify_build.sh` and modify the `appDirectory` variable. This is the folder your app is saved to and the name used to access your app in the Spotify client.

Open `source/manifest.json` to modify your app information.

Automatic Build
---------------

Run `guard` in `/MyStotifyApp` folder.

After each save, your project will be built and copied to the `~/Spotify` directory.

Resources
---------

* [Spotify Developer](http://developer.spotify.com/en/spotify-apps-api/resources/)
* [Middleman](http://middlemanapp.com/)
20 changes: 20 additions & 0 deletions source/app.js.coffee
@@ -0,0 +1,20 @@
require "js/libs/jquery-1.7.1"

init = ->
updatePageWithTrackDetails()
player.observe models.EVENT.CHANGE, (e) ->
updatePageWithTrackDetails() if e.data.curtrack is true

updatePageWithTrackDetails = ->
header = "#header"
playerTrackInfo = player.track
unless playerTrackInfo?
$(header).html "Nothing playing!"
else
track = playerTrackInfo.data
$(header).html track.name + " <br /> " + track.album.name + "<br />By: " + track.album.artist.name

sp = getSpotifyApi(1)
models = sp.require("sp://import/scripts/api/models")
player = models.player
exports.init = init
2 changes: 2 additions & 0 deletions source/index.html.haml
@@ -0,0 +1,2 @@
%h1#header
Whoops! Cannot access the Spotify API!

0 comments on commit 67dc70b

Please sign in to comment.