gumdrop 0.7.5 → 0.8.0

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.
@@ -1,4 +1,3 @@
1
- puts "Gumdrop v#{Gumdrop::VERSION} building..."
2
1
 
3
2
  configure do
4
3
 
@@ -72,6 +71,13 @@ generate do
72
71
 
73
72
  end
74
73
 
74
+ # All Gumdrop Hooks: on_start, on_before_scan, on_scan, on_before_generate, on_generate, on_before_render, on_render, on_end
75
+ on_start do |site|
76
+ puts "Gumdrop v#{Gumdrop::VERSION} building..."
77
+ end
78
+ # on_end do |site| end
79
+
80
+
75
81
  # Example of using a content filter to compress CSS output
76
82
  # require 'yui/compressor'
77
83
  # content_filter do |content, info|
@@ -104,7 +110,27 @@ view_helpers do
104
110
 
105
111
  end
106
112
 
113
+ # Add (thor) tasks to gumdrop command
114
+ # for more: https://github.com/wycats/thor/wiki
115
+ # tasks do
116
+
117
+ # desc 'sync', "Syncs with public server using rsync (if configured)"
118
+ # method_option :build, :aliases => '-b', :desc => 'Build content before syncing'
119
+ # method_option :dry_run, :aliases => '-d', :desc => 'Dry run'
120
+ # def sync
121
+ # SITE.build if options[:build]
122
+ # config= SITE.config
123
+ # output= SITE.config.output_dir
124
+ # cmd= "rsync -avz --delete #{output} #{config.server_user}@#{config.server}:#{config.server_path}"
125
+ # puts "Running:\n#{cmd}\n"
126
+ # system(cmd) unless options[:dry_run]
127
+ # end
128
+
129
+ # end
130
+
131
+
107
132
  # Any specialized code for your site goes here...
108
133
 
109
134
  require 'slim'
110
135
  Slim::Engine.set_default_options pretty:true
136
+
@@ -7,26 +7,16 @@ USER='user'
7
7
  SERVER='server.com'
8
8
  FOLDER="~/#{SERVER}"
9
9
 
10
- # Build folder (change if you change Gumdrop.config.output_dir)
11
- OUTPUT="output/"
12
-
13
10
  desc "Build source files into output_dir"
14
11
  task :build do
15
- system("bundle exec gumdrop -b")
12
+ Gumdrop::CLI::Internal.new.build
16
13
  end
17
14
 
18
15
  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."
16
+ task :server do
17
+ Gumdrop::CLI::Internal.new.server
29
18
  end
19
+ task :serve => :server
30
20
 
31
21
  desc "Outputs the Gumdrop version"
32
22
  task :version do
@@ -35,4 +25,14 @@ end
35
25
 
36
26
  task :default do
37
27
  puts `rake -T`
38
- end
28
+ end
29
+
30
+ desc "Syncs with public server using rsync (if configured)"
31
+ task :sync do
32
+ site= Gumdrop::Site.new Gumdrop.fetch_site_file
33
+ output= File.expand_path site.config.output_dir
34
+ cmd= "rsync -avz --delete #{output} #{USER}@#{SERVER}:#{FOLDER}"
35
+ puts "Running:\n#{cmd}\n"
36
+ system(cmd)
37
+ puts "Done."
38
+ end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 7
8
- - 5
9
- version: 0.7.5
7
+ - 8
8
+ - 0
9
+ version: 0.8.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matt McCray
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-06-27 00:00:00 -05:00
17
+ date: 2012-06-30 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -57,7 +57,7 @@ dependencies:
57
57
  type: :runtime
58
58
  version_requirements: *id003
59
59
  - !ruby/object:Gem::Dependency
60
- name: trollop
60
+ name: listen
61
61
  prerelease: false
62
62
  requirement: &id004 !ruby/object:Gem::Requirement
63
63
  none: false
@@ -70,7 +70,7 @@ dependencies:
70
70
  type: :runtime
71
71
  version_requirements: *id004
72
72
  - !ruby/object:Gem::Dependency
73
- name: i18n
73
+ name: thor
74
74
  prerelease: false
75
75
  requirement: &id005 !ruby/object:Gem::Requirement
76
76
  none: false
@@ -83,7 +83,7 @@ dependencies:
83
83
  type: :runtime
84
84
  version_requirements: *id005
85
85
  - !ruby/object:Gem::Dependency
86
- name: bundle
86
+ name: i18n
87
87
  prerelease: false
88
88
  requirement: &id006 !ruby/object:Gem::Requirement
89
89
  none: false
@@ -95,6 +95,19 @@ dependencies:
95
95
  version: "0"
96
96
  type: :runtime
97
97
  version_requirements: *id006
98
+ - !ruby/object:Gem::Dependency
99
+ name: bundle
100
+ prerelease: false
101
+ requirement: &id007 !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ segments:
107
+ - 0
108
+ version: "0"
109
+ type: :runtime
110
+ version_requirements: *id007
98
111
  description: The sweet 'n simple cms/prototyping tool for creating static html websites and webapps.
99
112
  email: matt@elucidata.net
100
113
  executables:
@@ -107,26 +120,30 @@ files:
107
120
  - .gitignore
108
121
  - ChangeLog.md
109
122
  - Gemfile
123
+ - Gemfile.lock
110
124
  - License
111
125
  - Rakefile
112
126
  - Readme.md
113
127
  - bin/gumdrop
114
128
  - gumdrop.gemspec
115
129
  - lib/gumdrop.rb
116
- - lib/gumdrop/callbacks.rb
117
- - lib/gumdrop/cli.rb
130
+ - lib/gumdrop/cli/external.rb
131
+ - lib/gumdrop/cli/internal.rb
118
132
  - lib/gumdrop/content.rb
119
133
  - lib/gumdrop/context.rb
120
134
  - lib/gumdrop/data_manager.rb
121
135
  - lib/gumdrop/generator.rb
122
- - lib/gumdrop/hash_object.rb
123
- - lib/gumdrop/proxy_handler.rb
124
136
  - lib/gumdrop/server.rb
125
137
  - lib/gumdrop/site.rb
126
- - lib/gumdrop/sprockets_support.rb
127
- - lib/gumdrop/stitch_support.rb
138
+ - lib/gumdrop/support/base_packager.rb
139
+ - lib/gumdrop/support/callbacks.rb
140
+ - lib/gumdrop/support/hash_object.rb
141
+ - lib/gumdrop/support/proxy_handler.rb
142
+ - lib/gumdrop/support/sprockets.rb
143
+ - lib/gumdrop/support/stitch.rb
128
144
  - lib/gumdrop/version.rb
129
145
  - lib/gumdrop/view_helpers.rb
146
+ - notes.md
130
147
  - specs/content_spec.rb
131
148
  - specs/deferred_loader_spec.rb
132
149
  - specs/fixtures/expected/posts/post1.html
@@ -172,7 +189,6 @@ files:
172
189
  - templates/backbone/source/theme/templates/site.template.slim
173
190
  - templates/blank/Gemfile
174
191
  - templates/blank/Gumdrop
175
- - templates/blank/Rakefile
176
192
  - templates/default/Gemfile
177
193
  - templates/default/Gumdrop
178
194
  - templates/default/Rakefile
data/lib/gumdrop/cli.rb DELETED
@@ -1,167 +0,0 @@
1
-
2
- require 'trollop'
3
-
4
- banner_text= <<-EOS
5
-
6
- Gumdrop v#{ Gumdrop::VERSION }
7
- The simple, sweet, static CMS.
8
-
9
- EOS
10
-
11
- opts = Trollop::options do
12
- banner banner_text
13
-
14
- # opt :verbose,"Verbose output"
15
- # opt :debug, "Enable debugging output"
16
- opt :quiet, "No console output"
17
-
18
- if Gumdrop.in_site_folder?
19
- banner <<-EOS
20
-
21
- Examples:
22
- gumdrop --build
23
- gumdrop -b
24
- gumdrop --new Post
25
- gumdrop --server
26
- gumdrop -s -p 8080 -r
27
-
28
- Options:
29
- EOS
30
- opt :build, "Build HTML output"
31
- opt :environment, "Specify config.env", :type=>String, :default=>'production'
32
- opt :new, "Create new data item (specify collection name)", :type=>String
33
- opt :server, "Runs development server"
34
- opt :port, "Specifies port to run server on", :type=>:int
35
- opt :reload, "Force reloading on dev server"
36
- opt :template, "Create local template from this site (specify template name)", :type=>String
37
- else
38
- banner <<-EOS
39
-
40
- Examples:
41
- gumdrop --create my_site
42
- gumdrop -c new_site --template backbone
43
-
44
- Options:
45
- EOS
46
- opt :create, "Create a gumdrop project", :type=>String
47
- opt :template, "Template to create new project from", :type=>String, :default=>'default'
48
- opt :list, "List available templates"
49
- end
50
-
51
- end
52
-
53
- # NO COMMANDS GIVEN
54
-
55
- unless opts[:create_given] or opts[:build_given] or opts[:server_given] or opts[:new_given] or opts[:template_given] or opts[:list_given]
56
- puts banner_text
57
- Trollop::die "No commands specified"
58
- end
59
-
60
- Gumdrop::DEFAULT_OPTIONS[:env]= opts[:environment] || 'production'
61
-
62
- # BUILD
63
-
64
- if opts[:build_given]
65
- puts banner_text unless opts[:quiet_given]
66
- Gumdrop.run(opts)
67
-
68
-
69
- # SERVER
70
-
71
- elsif opts[:server_given]
72
- puts banner_text unless opts[:quiet_given]
73
- Gumdrop::Server
74
-
75
-
76
- # LIST TEMPLATES
77
-
78
- elsif opts[:list_given]
79
- # List templates
80
- puts banner_text unless opts[:quiet_given]
81
- here= File.dirname(__FILE__)
82
- lib_dir= File.expand_path File.join(here, '../../templates', '*')
83
- user_dir= File.expand_path File.join("~", ".gumdrop", "templates", "*")
84
- puts "Gem Templates:"
85
- Dir[lib_dir].each do |name|
86
- puts " #{File.basename name}" if File.directory?(name)
87
- end
88
- puts "Local Templates:"
89
- Dir[user_dir].each do |name|
90
- puts " #{File.basename name}" if File.directory?(name)
91
- end
92
-
93
-
94
- # NEW DATA COLLECTION ITEM
95
-
96
- elsif opts[:new_given]
97
- puts banner_text unless opts[:quiet_given]
98
- puts "Not implemented yet..."
99
-
100
-
101
- # CREATE NEW SITE
102
-
103
- elsif opts[:create_given]
104
- puts banner_text unless opts[:quiet_given]
105
-
106
- require 'fileutils'
107
- here= File.dirname(__FILE__)
108
- lib_root= File.expand_path File.join(here, '../../')
109
- user_gumdrop_dir= File.expand_path File.join("~", ".gumdrop")
110
- there= File.expand_path( opts[:create] )
111
- template_name = opts[:template]
112
-
113
- if File.file? there
114
- puts "You cannot specify a file as the target!"
115
- elsif !File.directory? there
116
- FileUtils.mkdir_p there
117
- end
118
-
119
- # from gem...
120
- if File.directory? File.join(lib_root, 'templates', template_name)
121
- # FileUtils.cp_r Dir[File.join(here, "template", template_name, "*")], there
122
- puts "Creating gumdrop project (from template:#{template_name})"
123
- puts " #{there}"
124
- FileUtils.cp_r File.join(lib_root, "templates", template_name, "."), there
125
- puts "Done."
126
-
127
- # local template...
128
- elsif File.directory? File.join(user_gumdrop_dir, 'templates', template_name)
129
- # FileUtils.cp_r Dir[File.join(here, "template", template_name, "*")], there
130
- puts "Creating gumdrop project (from local template:#{template_name})"
131
- puts " #{there}"
132
- FileUtils.cp_r File.join(user_gumdrop_dir, "templates", template_name, "."), there
133
- puts "Done."
134
-
135
- else
136
- puts "Invalid template '#{template_name}'!"
137
- end
138
-
139
-
140
- # SAVE CURRENT SITE AS TEMPLATE
141
-
142
- elsif opts[:template_given]
143
- # Save as template...
144
- puts banner_text unless opts[:quiet_given]
145
- template= opts[:template]
146
- template_path = File.expand_path File.join('~', '.gumdrop', 'templates', template)
147
- if File.exists? template_path
148
- puts "A template named '#{template}' already exists!"
149
- else
150
- require 'fileutils'
151
- puts "Creating template: #{template}"
152
- puts " ~/.gumdrop/templates/#{template}"
153
- site_root= Gumdrop.site_folder
154
- FileUtils.mkdir_p File.dirname(template_path)
155
- FileUtils.cp_r File.join(site_root, "."), template_path
156
- puts "Done."
157
- end
158
-
159
-
160
- # UNKNOWN COMMAND
161
-
162
- else
163
- puts banner_text
164
- require 'pp'
165
- puts "Unknown options"
166
- pp opts
167
- end
@@ -1,3 +0,0 @@
1
- require 'sprockets'
2
-
3
- # Any sprockets extentions/helpers
@@ -1,114 +0,0 @@
1
-
2
- require 'stitch-rb'
3
-
4
- class Stitch::Source
5
- # Patch for gumdrop style filenames
6
- def name
7
- name = path.relative_path_from(root)
8
- name = name.dirname + name.basename(".*")
9
- name.to_s.gsub(".js", '')
10
- end
11
- end
12
-
13
-
14
- # Custom Compilers
15
-
16
-
17
- class SerenadeCompiler < Stitch::Compiler
18
-
19
- extensions :serenade
20
-
21
- def compile(path)
22
- content= File.read(path)
23
- viewname= File.basename(path).gsub('.serenade', '').gsub('.html', '').gsub('.', '_')
24
- %{
25
- Serenade.view(#{ viewname.to_json }, #{content.to_json});
26
- }
27
- end
28
-
29
- end
30
-
31
- # Not so sure on this one...
32
- class HoganCompiler < Stitch::Compiler
33
- # List of supported extensions
34
- extensions :mustache
35
-
36
- # A compile method which takes a file path,
37
- # and returns a compiled string
38
- def compile(path)
39
- content = File.read(path)
40
- %{
41
- var template = Hogan.compile(#{content.to_json});
42
- module.exports = (function(data){ return template.render(data); });
43
- }
44
- end
45
- end
46
-
47
- module CssJsCode
48
-
49
- def export_js_code(path)
50
- content= File.read(path)
51
- %{
52
- var css = #{ transpile(content, File.extname(path)).to_json },
53
- node = null;
54
- module.exports= {
55
- content: css,
56
- add: function(to){
57
- if(node != null) return;
58
- if(to == null) to= document.getElementsByTagName('HEAD')[0] || document.body;
59
- node= document.createElement('style');
60
- node.innerHTML= css;
61
- to.appendChild(node);
62
- return this;
63
- },
64
- remove: function() {
65
- if(node != null) {
66
- node.parentNode.removeChild(node);
67
- node = null;
68
- }
69
- return this;
70
- }
71
- };
72
- }
73
- end
74
-
75
- def transpile(content, ext)
76
- content
77
- end
78
-
79
- end
80
-
81
- class CssCompiler < Stitch::Compiler
82
- include CssJsCode
83
-
84
- extensions :css
85
-
86
- def compile(path)
87
- export_js_code path
88
- end
89
-
90
- end
91
-
92
-
93
- begin
94
- require 'sass'
95
-
96
- class SassCompiler < Stitch::Compiler
97
- include CssJsCode
98
-
99
- extensions :sass, :scss
100
-
101
- def compile(path)
102
- export_js_code path
103
- end
104
-
105
- def transpile(content, ext)
106
- type = (ext == '.sass') ? :sass : :scss
107
- Sass::Engine.new(content, :syntax=>type).render
108
- end
109
- end
110
-
111
- rescue
112
- # Sass Not available
113
- end
114
-