Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

first commit

  • Loading branch information...
commit 67dc70bc4970eef8036ef0c9fd92a6854b684970 0 parents
@danwaz authored
7 .gitignore
@@ -0,0 +1,7 @@
+build/*
+Gemfile.lock
+.DS_Store*
+ehthumbs.db
+Icon?
+Thumbs.db
+.sass-cache/*
6 Gemfile
@@ -0,0 +1,6 @@
+source :rubygems
+
+gem "middleman", "~>2.0.14"
+gem "guard-middleman", "~> 0.1.0"
+gem "rb-fsevent"
+gem "therubyracer"
11 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 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 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 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  source/index.html.haml
@@ -0,0 +1,2 @@
+%h1#header
+ Whoops! Cannot access the Spotify API!
9,266 source/js/libs/jquery-1.7.1.js
9,266 additions, 0 deletions not shown
11 source/layouts/layout.haml
@@ -0,0 +1,11 @@
+!!!
+%html
+ %head
+ %meta{:charset => "utf-8"}
+ / Always force latest IE rendering engine (even in intranet) & Chrome Frame
+ %meta{:content => "IE=edge,chrome=1", "http-equiv" => "X-UA-Compatible"}
+ = stylesheet_link_tag "site.css"
+ = yield_content :head
+ %body{:class => page_classes, :onload => "sp = getSpotifyApi(1); app = sp.require('app'); app.init();"}
+ #main{:role => "main"}
+ = yield
12 source/manifest.json
@@ -0,0 +1,12 @@
+{
+ "BundleType": "Application",
+ "AppIcon": {
+ "36x18": "tutorial.png"
+ },
+ "AppName": {
+ "en": "My App"
+ },
+ "SupportedLanguages": [
+ "en"
+ ]
+}
33 source/stylesheets/site.css.scss
@@ -0,0 +1,33 @@
+@import "compass";
+
+$link-color: #0388a6;
+$link-hover-color: #009ce0;
+$link-focus-color: false;
+$link-active-color: false;
+$link-visited-color: false;
+
+$font-color: white;
+$font-family: sans-serif;
+$base-font-size: 12px;
+$base-line-height: 18px;
+
+$total-cols: 12;
+$col-width: 4em;
+$gutter-width: 1em;
+$side-gutter-width: $gutter-width;
+
+@include global-reset;
+
+body {
+ font-family: $font-family;
+ color: $font-color;
+}
+
+a {
+ @include link-colors($link-color, $link-hover-color, $link-focus-color, $link-active-color, $link-visited-color);
+}
+
+#main {
+ padding: 50px;
+}
+
8 spotify_build.sh
@@ -0,0 +1,8 @@
+#the name of your application folder is the same name used to access your app in the spotify client
+#e.g. spotify:app:$appDirectory
+appDirectory="powerhour"
+
+mkdir -p ~/Spotify
+mkdir -p ~/Spotify/$appDirectory
+rm -rf ~/Spotify/$appDirectory/*
+cp -R build/* ~/Spotify/$appDirectory
Please sign in to comment.
Something went wrong with that request. Please try again.