gumdrop 0.3 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. data/ChangeLog.md +6 -0
  2. data/lib/gumdrop/cli.rb +4 -4
  3. data/lib/gumdrop/generator.rb +2 -15
  4. data/lib/gumdrop/stitch_ex.rb +14 -0
  5. data/lib/gumdrop/template/backbone/Gemfile +29 -0
  6. data/lib/gumdrop/template/backbone/Rakefile +38 -0
  7. data/lib/gumdrop/template/backbone/app_src/app.js.coffee +32 -0
  8. data/lib/gumdrop/template/backbone/app_src/init.js.coffee +10 -0
  9. data/lib/gumdrop/template/backbone/app_src/utils/index.js.coffee +29 -0
  10. data/lib/gumdrop/template/backbone/config.ru +21 -0
  11. data/lib/gumdrop/template/backbone/data/config.yml +4 -0
  12. data/lib/gumdrop/template/backbone/lib/javascript/all.js.coffee +18 -0
  13. data/lib/gumdrop/template/backbone/lib/javascript/backbone.js +1158 -0
  14. data/lib/gumdrop/template/backbone/lib/javascript/hogan.js +509 -0
  15. data/lib/gumdrop/template/backbone/lib/javascript/jquery.js +9266 -0
  16. data/lib/gumdrop/template/backbone/lib/javascript/underscore.js +981 -0
  17. data/lib/gumdrop/template/backbone/lib/site.rb +58 -0
  18. data/lib/gumdrop/template/backbone/lib/stitch_compilers.rb +85 -0
  19. data/lib/gumdrop/template/backbone/lib/view_helpers.rb +17 -0
  20. data/lib/gumdrop/template/backbone/powrc +2 -0
  21. data/lib/gumdrop/template/backbone/source/default.htaccess +22 -0
  22. data/lib/gumdrop/template/backbone/source/favicon.ico +0 -0
  23. data/lib/gumdrop/template/backbone/source/feed.xml.builder.txt +23 -0
  24. data/lib/gumdrop/template/backbone/source/index.html.erb +2 -0
  25. data/lib/gumdrop/template/backbone/source/theme/screen.css.sass +9 -0
  26. data/lib/gumdrop/template/backbone/source/theme/scripts/app.js.coffee +4 -0
  27. data/lib/gumdrop/template/backbone/source/theme/styles/_tools.scss +434 -0
  28. data/lib/gumdrop/template/backbone/source/theme/templates/app.template.slim +14 -0
  29. data/lib/gumdrop/template/backbone/source/theme/templates/site.template.slim +33 -0
  30. data/lib/gumdrop/version.rb +1 -1
  31. metadata +39 -13
data/ChangeLog.md CHANGED
@@ -1,3 +1,9 @@
1
+ # v0.3.2
2
+ - Removed references to 'twitter' from cli message.
3
+
4
+ # v0.3.1
5
+ - Early version of a backbone (webapp) site template
6
+
1
7
  # v0.3
2
8
  - Better logging support
3
9
  - Removed twitter-bootstrap template
data/lib/gumdrop/cli.rb CHANGED
@@ -8,9 +8,9 @@ opts = Trollop::options do
8
8
  The simple, static, CMS.
9
9
 
10
10
  Examples:
11
- gumdrop --create my_new_site --template twitter
11
+ gumdrop --create my_new_site --template backbone
12
12
  Is the same as:
13
- gumdrop -c my_new_site -t twitter
13
+ gumdrop -c my_new_site -t backbone
14
14
 
15
15
  Options:
16
16
  EOS
@@ -18,7 +18,7 @@ EOS
18
18
  opt :debug, "Enable debugging output"
19
19
  opt :quiet, "No output"
20
20
  opt :create, "Create a gumdrop project", :type=>String
21
- opt :template, "Specify template to use for new project (default || twitter)", :type=>String, :default=>'default'
21
+ opt :template, "Specify template to use for new project (default || backbone)", :type=>String, :default=>'default'
22
22
  opt :build, "Build HTML output"
23
23
  opt :server, "Runs development server"
24
24
  opt :port, "Specifies port to run server on", :type=>:int
@@ -64,4 +64,4 @@ else
64
64
  require 'pp'
65
65
  puts "Unknown options"
66
66
  pp opts
67
- end
67
+ end
@@ -1,18 +1,3 @@
1
-
2
- require 'stitch'
3
- require 'jsmin'
4
-
5
- class Stitch::Source
6
- # Patch for gumdrop style filenames
7
- def name
8
- name = path.relative_path_from(root)
9
- name = name.dirname + name.basename(".*")
10
- name.to_s.gsub(".js", '')
11
- end
12
- end
13
-
14
-
15
-
16
1
  module Gumdrop
17
2
 
18
3
  class Generator
@@ -68,9 +53,11 @@ module Gumdrop
68
53
  end
69
54
 
70
55
  def stitch(name, opts)
56
+ require 'gumdrop/stitch_ex'
71
57
  page name do
72
58
  content= Stitch::Package.new(opts).compile
73
59
  if opts[:compress]
60
+ require 'jsmin'
74
61
  JSMin.minify content
75
62
  else
76
63
  content
@@ -0,0 +1,14 @@
1
+
2
+ require 'stitch'
3
+
4
+
5
+ class Stitch::Source
6
+ # Patch for gumdrop style filenames
7
+ def name
8
+ name = path.relative_path_from(root)
9
+ name = name.dirname + name.basename(".*")
10
+ name.to_s.gsub(".js", '')
11
+ end
12
+ end
13
+
14
+
@@ -0,0 +1,29 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "i18n"
4
+ gem "sinatra"
5
+ gem "active_support"
6
+
7
+ gem "rake"
8
+ gem "gumdrop"
9
+
10
+ # Add your dependencies here:
11
+
12
+ gem "slim"
13
+ gem "sass"
14
+ gem "coffee-script"
15
+
16
+ gem 'jsmin'
17
+ gem 'stitch-rb'
18
+
19
+ # For markdown support, a couple of options:
20
+ # gem "rdiscount"
21
+ # gem 'maruku'
22
+
23
+ # For template support:
24
+ # gem "less"
25
+ # gem "haml"
26
+
27
+ # For xml generation support:
28
+ # gem 'builder'
29
+
@@ -0,0 +1,38 @@
1
+ require 'rubygems'
2
+ require "bundler/setup"
3
+ require 'gumdrop'
4
+
5
+ # For the SYNC task
6
+ USER='user'
7
+ SERVER='server.com'
8
+ FOLDER="~/#{SERVER}"
9
+
10
+ # Build folder (change if you change Gumdrop.config.output_dir)
11
+ OUTPUT="output/"
12
+
13
+ desc "Build source files into output_dir"
14
+ task :build do
15
+ system("bundle exec gumdrop -b")
16
+ end
17
+
18
+ desc "Run development server"
19
+ task :serve do
20
+ system("bundle exec gumdrop -s")
21
+ end
22
+
23
+ desc "Syncs with public server using rsync (if configured)"
24
+ task :sync do
25
+ cmd= "rsync -avz --delete #{OUTPUT} #{USER}@#{SERVER}:#{FOLDER}"
26
+ puts "Running:\n#{cmd}\n"
27
+ system(cmd)
28
+ puts "Done."
29
+ end
30
+
31
+ desc "Outputs the Gumdrop version"
32
+ task :version do
33
+ puts Gumdrop::VERSION
34
+ end
35
+
36
+ task :default do
37
+ puts `rake -T`
38
+ end
@@ -0,0 +1,32 @@
1
+ { log, warn }= require('utils')
2
+
3
+ class Application extends Backbone.Model
4
+
5
+ initialize: ->
6
+ @initializers= []
7
+ @set isReady:no
8
+
9
+ addInitializer: (fn)->
10
+ if @get 'isReady'
11
+ fn.call this, @options
12
+ else
13
+ @initializers.push fn
14
+
15
+ start: (options)->
16
+ if @get 'isReady'
17
+ # You can only 'start' the app once!
18
+ warn "You can only start the application once!"
19
+ this
20
+ else
21
+ log "Init!"
22
+ @trigger 'app:init:before', app:this, options:options
23
+ for fn in @initializers
24
+ fn.call this, options
25
+ @trigger 'app:init:after', app:this, options:options
26
+ delete @initializers
27
+ @options= options
28
+ @set isReady:yes
29
+ this
30
+
31
+ module.exports= new Application
32
+
@@ -0,0 +1,10 @@
1
+ lib?('all').globalize()
2
+
3
+ app= require('app')
4
+
5
+ $ ->
6
+ app.start
7
+ debug: true
8
+
9
+
10
+ module.exports= app
@@ -0,0 +1,29 @@
1
+ ((has_console)->
2
+
3
+ # TODO: Implement all the other usual console tricks
4
+ log_methods= if has_console
5
+ log: ->
6
+ console.log arguments...
7
+ warn: ->
8
+ console.warn arguments...
9
+ error: ->
10
+ console.error arguments...
11
+ info: ->
12
+ console.info arguments...
13
+ else
14
+ # Create a bunch of NOOPs
15
+ # TODO: Decide if a fallback to non-console folks should be provided? (I'm thinking no.)
16
+ log: -> # noop
17
+ warn: -> # noop
18
+ error: -> # noop
19
+ info: -> # noop
20
+
21
+ module.exports= log_methods
22
+ module.exports.globalize= (ctx=window)->
23
+ for nam, fn of log_methods
24
+ ctx[name]= fn
25
+
26
+ )(window.console?)
27
+
28
+
29
+
@@ -0,0 +1,21 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+
11
+ require 'gumdrop'
12
+
13
+ Gumdrop.config.auto_run= false
14
+ Gumdrop.config.force_reload= true
15
+
16
+ require 'rack/static'
17
+ #use Rack::Static, :urls => ["/media"], :root => "source"
18
+ use Rack::Static, :urls => ["/theme/images"], :root => "source"
19
+
20
+
21
+ run Gumdrop::Server
@@ -0,0 +1,4 @@
1
+ title: My Site
2
+ tagline: My home on thar intarwebs!
3
+ author: Matt McCray
4
+ url: http://www.mysite.com
@@ -0,0 +1,18 @@
1
+ all_libs= {}
2
+
3
+ expose= (name, as)->
4
+ all_libs[as]= lib= require(name)
5
+ exports[as]= lib
6
+
7
+ # Listing of all the libraries
8
+
9
+ expose 'jquery', '$'
10
+ expose 'backbone', 'Backbone'
11
+ expose 'hogan', 'Hogan'
12
+ expose 'underscore', '_'
13
+
14
+ # Helper to assign all libs
15
+ exports.globalize= (ctx=window)->
16
+ for own name, lib of all_libs
17
+ ctx[name]= lib unless ctx[name]?
18
+ this