Skip to content
This repository has been archived by the owner on Nov 29, 2020. It is now read-only.

Commit

Permalink
scripts. googe analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgreenhall committed Oct 23, 2011
1 parent 30fc113 commit ca2af36
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 20 deletions.
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ gem 'RedCloth',:group => :development #textile
gem 'coffee-filter',:group => :development #javascript style
gem 'rack-codehighlighter',:group => :development
gem 'urlify',:group => :development #urls-that-make-sense
gem 'rack-google_analytics'
gem 'rack-contrib'
gem 'therubyracer-heroku' #give heroku a javascript engine
8 changes: 2 additions & 6 deletions README.textile
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@ Check the webpage on "heroku":http://middleman-template.heroku.com/.

A workflow might look like this:
* <code>show-it</code> and edit your <code>source/</code> files (this runs a live reload server)
* <code>built-it</code> when you are happy with your changes (this will build the static html and commit it to your heroku dev site)
* <code>test-it</code> when you are happy with your changes (this will build the static html and commit it to your heroku dev site)
* <code>publish-it</code> when you are happy with the way it looks on the dev site (this does a git merge and pushes the master to the main heroku site)

Setup happens by:
* <code>git clone [email protected]:adamgreenhall/middleman-heroku-template.git</code>
* <code>cd middleman-heroku-template</code>
* <code>bundle install</code>
* <code>heroku create your-optional-app-name-here</code>
* <code>heroku create your-optional-app-name-here-dev --remote dev </code>
* <code>git config push.default tracking</code>
* <code>git checkout -b staging --track staging/master</code>
* <code>install-it</code>
* you can follow heroku's "instructions":http://devcenter.heroku.com/articles/custom-domains for using custom domains
12 changes: 1 addition & 11 deletions config.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
google_analytics_account_number=26495302

###
# Compass
###
Expand Down Expand Up @@ -83,8 +81,7 @@ def urlify(name,replaceChar='-')

def google_analytics(acct, options = {})
url_prefix = options[:ssl] ? 'https://ssl' : 'http://www'
"<script src=\"#{url_prefix}.google-analytics.com/urchin.js\" type=\"text/javascript\">\n" +
"</script>\n" +
"<script src=\"http://www.google-analytics.com/urchin.js\" type=\"text/javascript\"></script>\n" +
"<script type=\"text/javascript\">\n" +
" _uacct = \"#{acct}\";\n" +
" urchinTracker();\n" +
Expand Down Expand Up @@ -112,13 +109,6 @@ def google_analytics(acct, options = {})
end
end




require 'rack/google_analytics'
use Rack::GoogleAnalytics, :web_property_id => "UA-#{google_analytics_account_number}-1"


# Build-specific configuration
configure :build do
# For example, change the Compass output style for deployment
Expand Down
14 changes: 14 additions & 0 deletions install-it
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby
system('bundle install')
puts 'What is your heroku app name (optional)?'
name = gets.strip
system("heroku create #{name}")
if name!=""
system("heroku create #{name}-dev --remote dev")
else
system("heroku create --remote dev")
end
system("git config push.default tracking")
system("git checkout -b dev")
system("git push dev dev:master")
system("git branch --set-upstream dev dev/master")
4 changes: 4 additions & 0 deletions publish-it
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env ruby
system('git checkout master')
system('git merge dev')
system('git push')
5 changes: 5 additions & 0 deletions show-it
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env ruby
system('git checkout dev')
system('middleman server --livereload')


4 changes: 2 additions & 2 deletions source/layout.haml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
!!!
%html{:lang=>"en"}
%head
%title #{@title||""}
%title #{(@title||data.page.title)||""}
%link{:rel=>'stylesheet', :href=>'/stylesheets/site.css', :type => "text/css"}

%body
= yield
/ %script{:type => "text/javascript", :src=>'/javascripts/d3.js'}
#{google_analytics('UA-26495302-1')}
7 changes: 7 additions & 0 deletions test-it
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env ruby
puts 'What did you change?'
msg = gets
system('middleman build')
system('git add build/*')
system("git commit -am '#{msg}'")
system("git push")

0 comments on commit ca2af36

Please sign in to comment.