gumdrop 0.6.0 → 0.6.1

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.
data/ChangeLog.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v0.6.1
2
+ - Content filters are run for dev server requests now too.
3
+ - Added config.env, defaults to 'production' (override from cli with -e)
4
+
1
5
  # v0.6
2
6
  - Extracted Gumdrop::Build into Gumdrop::Site. Removed static Gumdrop#site.
3
7
 
data/Notes.md CHANGED
@@ -5,14 +5,7 @@
5
5
  - `set :source_dir, ['./source/a', './source/b']
6
6
  - What would happen with conflicts, last one in wins?
7
7
  - Multiple data_dir too?
8
- - Refactor code to not use Gumdrop as a singleton (static really)
9
8
  - Add YamlDoc support for nodes? (Tilt compiler? or in Content)
10
-
11
-
12
- - `Gumdrop.mode` :build, :serve (other?)
13
- - `Gumdrop.env` (specified via -e on cli, default: production)
14
- - Easy access to ENV in RenderingContext (MODE as well)
15
-
16
9
  - configure block for each env/mode?
17
10
 
18
11
  # TODO:
data/Readme.md CHANGED
@@ -6,7 +6,7 @@ Gumdrop is a small and sweet cms/prototype tool. It can generate static html wit
6
6
 
7
7
  gem install gumdrop
8
8
 
9
- # Quick Ref
9
+ # CLI Quick Ref
10
10
 
11
11
  ### Create New Site
12
12
 
@@ -49,49 +49,126 @@ You can then create new sites based on your local template:
49
49
  Local templates are stored under `~/.gumdrop/templates/`.
50
50
 
51
51
 
52
- # Gumdrop Site Structure
53
-
54
- *NOTE:* The following is based on the `default` template, the structure is configurable based on your needs.
55
-
56
- This is the file structure that is generated when you run `gumdrop --create site_root`. You can change whatever you'd like under `source/`, this is just a starting point.
57
-
58
- site_root/
59
- source/
60
- favicon.ico
61
- index.html.erb
62
- theme/
63
- screen.css.scss
64
- scripts/
65
- app.js.coffee
66
- styles/
67
- _tools.css.scss
68
- templates/
69
- site.template.erb
70
- Gemfile
71
- Gumdrop
72
- config.ru
73
- Rakefile
52
+
53
+ # Gumdrop File
54
+
55
+ Gumdrop looks for a file named `Gumdrop` to indicate the root folder of your project. It'll walk up the directory structure looking for one, so you can run Gumdrop commands from sub-folders.
56
+
57
+ The `Gumdrop` file is where you configure your site, generate dynamic content, assign view_helpers and more.
58
+
59
+ Here's the `Gumdrop` file created by the default template:
60
+
61
+ puts "Gumdrop v#{Gumdrop::VERSION} building..."
62
+
63
+ configure do
64
+
65
+ set :site_title, "My Site"
66
+ set :site_tagline, "My home on thar intarwebs!"
67
+ set :site_author, "Me"
68
+ set :site_url, "http://www.mysite.com"
74
69
 
70
+ # All the supported build configuration settings and their defaults:
71
+ # set :relative_paths, true
72
+ # set :proxy_enabled, true
73
+ # set :output_dir, "./output"
74
+ # set :source_dir, "./source"
75
+ # set :data_dir, './data'
76
+ # set :log, './logs/build.log'
77
+ # set :ignore, %w(.DS_Store .gitignore .git .svn .sass-cache)
78
+ # set :server_timeout, 15
79
+ # set :server_port, 4567
75
80
 
76
- When you run `gumdrop --build` or `rake build` it will generate an `output/` folder.
81
+ end
77
82
 
78
- site_root/
79
- output/ (** GENERATED CONTENT **)
80
- index.html
81
- theme/
82
- screen.css
83
- scripts/
84
- app.js
85
83
 
86
- You'll notice the templates and partials aren't included in the output.
84
+ # Skipping files entirely from build process... Like they don't exist.
85
+ # skip 'file-to-ignore.html'
86
+ # skip 'dont-show/**/*'
87
87
 
88
- # Gumdrop File
88
+ # Ignores source file(s) from compilation, but does load the content into memory
89
+ # ignore 'pages/**/*.*'
89
90
 
90
- Gumdrop looks for a file named `Gumdrop` to indicate the root project folder. It'll walk up the directory structure looking for one, so you can run Gumdrop commands from sub-folders.
91
+ # NOTE: Skipping and ignoring matches like a file glob (it use File.fnmatch in fact)
92
+ # (this doesn't work for files detected by stitch)
91
93
 
92
- The `Gumdrop` file is where you configure your site, generate dynamic content, assign view_helpers and more.
93
94
 
94
- Have a look at the file here: https://github.com/darthapo/gumdrop/blob/master/templates/default/Gumdrop
95
+ # Example site-level generator
96
+ generate do
97
+
98
+ # Requires a about.template.XX file
99
+ # page "about.html",
100
+ # :template=>'about',
101
+ # :passthru=>'Available in the template'
102
+
103
+ # page 'robots.txt' do
104
+ # # And content returned will be put in the file
105
+ # """
106
+ # User-Agent: *
107
+ # Disallow: /
108
+ # """
109
+ # end
110
+
111
+ # Maybe for a tumblr-like pager
112
+ # pager= Gumdrop.data.pager_for :posts, base_path:'posts/page', page_size:5
113
+
114
+ # pager.each do |page|
115
+ # page "#{page.uri}.html",
116
+ # template:'post_page',
117
+ # posts:page.items,
118
+ # pager:pager,
119
+ # current_page:pager.current_page
120
+ # end
121
+
122
+ # Assemble javscript files in a CommonJS-like way with stitch-rb
123
+ # stitch 'app.js', # JavaScript to assemble
124
+ # :identifier=>'app', # variable name for the library
125
+ # :paths=>['./app'],
126
+ # :root=>'./app',
127
+ # :dependencies=>[], # List of scripts to prepend to top of file (non moduled)
128
+ # :prune=>false, # If true, removes the source files from Gumdrop.site hash
129
+ # :compress=>:jsmin, # Options are :jsmin, :yuic, :uglify
130
+ # :obfuscate=>false, # For compressors that support munging/mangling
131
+ # :keep_src=>true # Creates another file, ex: app-src.js
132
+
133
+ end
134
+
135
+ # Example of using a content filter to compress CSS output
136
+ # require 'yui/compressor'
137
+ # content_filter do |content, info|
138
+ # if info.ext == '.css'
139
+ # puts " Compress: #{info.filename}"
140
+ # compressor= YUI::CssCompressor.new
141
+ # compressor.compress( content )
142
+ # else
143
+ # content
144
+ # end
145
+ # end
146
+
147
+
148
+ # View helpers (available in rendering context):
149
+ view_helpers do
150
+
151
+ # Calculate the years for a copyright
152
+ def copyright_years(start_year, divider="–")
153
+ end_year = Date.today.year
154
+ if start_year == end_year
155
+ "#{start_year}"
156
+ else
157
+ "#{start_year}#{divider}#{end_year}"
158
+ end
159
+ end
160
+
161
+ #
162
+ # Your custom helpers go here!
163
+ #
164
+
165
+ end
166
+
167
+ # Any specialized code for your site goes here...
168
+
169
+ require 'slim'
170
+ Slim::Engine.set_default_options pretty:true
171
+
95
172
 
96
173
  # Need To Document:
97
174
 
data/lib/gumdrop/cli.rb CHANGED
@@ -28,6 +28,7 @@ Examples:
28
28
  Options:
29
29
  EOS
30
30
  opt :build, "Build HTML output"
31
+ opt :environment, "Specify config.env", :type=>String, :default=>'production'
31
32
  opt :new, "Create new data item (specify collection name)", :type=>String
32
33
  opt :server, "Runs development server"
33
34
  opt :port, "Specifies port to run server on", :type=>:int
@@ -56,6 +57,7 @@ unless opts[:create_given] or opts[:build_given] or opts[:server_given] or opts[
56
57
  Trollop::die "No commands specified"
57
58
  end
58
59
 
60
+ Gumdrop::DEFAULT_OPTIONS[:env]= opts[:environment] || 'production'
59
61
 
60
62
  # BUILD
61
63
 
@@ -43,7 +43,9 @@ module Gumdrop
43
43
  content_type :css if content.ext == '.css' # Meh?
44
44
  content_type :js if content.ext == '.js' # Meh?
45
45
  content_type :xml if content.ext == '.xml' # Meh?
46
- content.render
46
+ output= content.render
47
+ site.content_filters.each {|f| output= f.call(output, self) }
48
+ output
47
49
  else
48
50
  site.report "[#{$$}] *Static: #{file_path}"
49
51
  send_file File.join( site.src_path, file_path)
data/lib/gumdrop/site.rb CHANGED
@@ -13,13 +13,8 @@ module Gumdrop
13
13
  log: './logs/build.log',
14
14
  ignore: %w(.DS_Store .gitignore .git .svn .sass-cache),
15
15
  server_timeout: 15,
16
- # server_port: 4567
17
- }
18
-
19
- LOG_LEVELS = {
20
- info: 0,
21
- warning: 1,
22
- error: 2
16
+ # server_port: 4567,
17
+ env: 'production'
23
18
  }
24
19
 
25
20
  class Site
@@ -1,5 +1,5 @@
1
1
  module Gumdrop
2
2
 
3
- VERSION = "0.6.0" unless defined?(::Gumdrop::VERSION)
3
+ VERSION = "0.6.1" unless defined?(::Gumdrop::VERSION)
4
4
 
5
5
  end
data/lib/gumdrop.rb CHANGED
@@ -13,7 +13,7 @@ module Gumdrop
13
13
  autoload :HashObject, "gumdrop/hash_object"
14
14
  autoload :Pager, "gumdrop/data_manager"
15
15
  autoload :Server, "gumdrop/server"
16
- autoload :Site, "gumdrop/site"
16
+ # autoload :Site, "gumdrop/site"
17
17
  autoload :VERSION, "gumdrop/version"
18
18
  autoload :ViewHelpers, "gumdrop/view_helpers"
19
19
 
@@ -57,3 +57,5 @@ module Gumdrop
57
57
  end
58
58
 
59
59
  end
60
+
61
+ require 'gumdrop/site'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 6
8
- - 0
9
- version: 0.6.0
8
+ - 1
9
+ version: 0.6.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matt McCray