deplot 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/LICENSE +1 -1
  2. data/README.md +14 -4
  3. data/bin/deplot +30 -5
  4. data/deplot.gemspec +1 -1
  5. metadata +3 -3
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 Cyril Nusko
1
+ Copyright (c) 2012 Cyril Nusko
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to
data/README.md CHANGED
@@ -3,17 +3,27 @@ deplot
3
3
 
4
4
  Deplot is a static web site generator with a ruby DSL.
5
5
 
6
- Usage
6
+ Intention
7
+ ---------
8
+
9
+ Deplot is intended to simplify the progress of creating and maintaining a static web site. Its main advantages are:
10
+
11
+ * Separating content from markup with layout (template) files
12
+ * Independency from specific markup languages by using [tilt][tilt] in both layout and content files
13
+ * Simplifying the design/development workflow with a pre-built Guardfile that allows [guard][guard] to recompile any asset or the whole project if a source file changes.
14
+ * Easy deployment with a folder structure ready for [git-ftp][git-ftp]
15
+
16
+ Installation and usage
7
17
  -----
8
18
 
9
- Deplot separates content from markup. If the deplot gem is installed, calling `deplot new <project_name>` will create a project directory with all the files and directories needed to get a new site started. You can also use an existing skeleton with `deplot new <project_name> <git_url>`, which will clone the specified git repo. Deplot's built upon a custom DSL that's used to describe your site's pages (in the `Deplotfile`):
19
+ Install the deplot gem via rubygems.org: `gem install deplot`. Or build it directly from the sources with `gem build deplot.gemspec; gem install deplot-0.0.x.gem` in the cloned repo. For both `gem install` commands, admin rights may be required.
20
+
21
+ If the deplot gem is installed, calling `deplot new <project_name>` will create a project directory with all the files and directories needed to get a new site started. You can also use an existing skeleton with `deplot new <project_name> <git_url>`, which will clone the specified git repo. Deplot's built upon a custom DSL that's used to describe your site's pages (in the `Deplotfile`):
10
22
 
11
23
  ```ruby
12
24
  path "/" do
13
25
  render "index.markdown"
14
26
  end
15
-
16
- publish
17
27
  ```
18
28
 
19
29
  You can create multiple pages from multiple source files with `render_all` (the `#` is replaced by the file name with `.html` extension):
data/bin/deplot CHANGED
@@ -9,7 +9,11 @@ require 'tilt'
9
9
  $assets_dir = Dir.pwd+"/assets"
10
10
  $content_dir = Dir.pwd+"/content"
11
11
  $root_dir = Dir.pwd
12
+
13
+ $is_currently_rendering = false
14
+
12
15
  $template_arguments = {}
16
+ $global_variables = {}
13
17
  $variables = {}
14
18
 
15
19
  $tasks = []
@@ -26,7 +30,11 @@ def content_dir dir
26
30
  $content_dir = $root_dir + "/" + dir.gsub(/^\//, "").gsub(/\/$/, "")
27
31
  end
28
32
  def variables vars
29
- $variables.merge! vars
33
+ if $is_currently_rendering
34
+ $variables.merge! vars
35
+ else
36
+ $global_variables.merge! vars
37
+ end
30
38
  end
31
39
  def layout file
32
40
  $layout = file
@@ -56,9 +64,12 @@ def path path, &block
56
64
  $layout = "layout.erb"
57
65
  $options = {}
58
66
  $variables = {}
59
-
67
+ $is_currently_rendering = true
68
+
60
69
  # set
61
70
  block.call
71
+
72
+ $is_currently_rendering = false
62
73
 
63
74
  # remember
64
75
  if $render_type == "render-all"
@@ -113,6 +124,7 @@ def publish
113
124
  puts "Publishing site..."
114
125
  $tasks.each do |task|
115
126
  action, path, source, $layout, options, variables = task
127
+ variables.merge! $global_variables
116
128
  content = ""
117
129
  $template_arguments = {:path => "", :source => "", :file_name => "", :depth => 0}
118
130
  $template_arguments.merge! variables
@@ -380,12 +392,26 @@ EOF
380
392
  File.open "style.less", "w" do |file|
381
393
  file.write <<-EOF
382
394
  body {
395
+ margin: 0;
383
396
  font-family: "Helvetica", sans-serif;
397
+ background-color: #EEE;
384
398
  }
385
399
  #wrapper {
386
400
  width: 500px;
387
- margin: 0px auto;
401
+ padding: 10px;
402
+ margin: 10px auto;
403
+ background-color: #FFF;
404
+ border: 3px solid #DDD;
405
+ }
406
+ p {
407
+ color: #444;
408
+ }
409
+ h1 {
410
+ margin-bottom: 20px;
411
+ padding-bottom: 8px;
412
+ border-bottom: 1px solid #EEE;
388
413
  }
414
+
389
415
  EOF
390
416
  end
391
417
  end
@@ -396,8 +422,6 @@ EOF
396
422
  path '/' do
397
423
  render "index.markdown"
398
424
  end
399
-
400
- publish
401
425
  EOF
402
426
  end
403
427
  # Guardfile
@@ -512,6 +536,7 @@ EOF
512
536
  end
513
537
  $LOAD_PATH.unshift(Dir.pwd)
514
538
  load "Deplotfile"
539
+ publish
515
540
  end
516
541
  end
517
542
  Deplot.start
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'deplot'
3
- s.version = '0.0.1'
3
+ s.version = '0.0.2'
4
4
  s.date = '2012-04-09'
5
5
  s.description = "A ruby static web site generator"
6
6
  s.summary = s.description
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deplot
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Cyril Nusko