manic 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Will automatically pull in this gem and all its
4
+ # dependencies specified in the gemspec
5
+ gem "manic", :path => File.expand_path("..", __FILE__)
6
+
7
+ # These are development dependencies
8
+ gem "rake"
9
+ gem "tilt"
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Justin Baker
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,19 @@
1
+ manic
2
+ ======================================
3
+ Manic is a static site generator, with configuration in ruby.
4
+ `bin/manic` looks for `config.manic` in the current working directory.. parsing site into output
5
+
6
+ usage
7
+ ======================================
8
+ Manic.config do
9
+ # set global variables
10
+ site_title "Ink site yo"
11
+ author "Justin Baker"
12
+
13
+ # extend with helper method
14
+ plugin TagHelper
15
+ plugin "filename"
16
+
17
+ # add helper method for use in templates
18
+ img_tag lambda{|src| "<img src=\"#{src}\" />"}
19
+ end
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+
2
+ require "bundler"
3
+ Bundler.setup
4
+ gemspec = eval(File.read("manic.gemspec"))
5
+
6
+ task :build => "#{gemspec.full_name}.gem"
7
+
8
+ file "#{gemspec.full_name}.gem" => gemspec.files + ["manic.gemspec"] do
9
+ system "gem build manic.gemspec"
10
+ system "gem install manic-#{Manic::VERSION}.gem"
11
+ end
data/bin/manic ADDED
@@ -0,0 +1,9 @@
1
+ #! /usr/bin/env ruby
2
+ $LOAD_PATH << File.join(File.dirname(__FILE__), "../lib/")
3
+ require "manic"
4
+ conf = File.join(Dir.pwd,"config.manic")
5
+ if File.exists?(conf)
6
+ load(conf)
7
+ else
8
+ puts "Manic config file not found. Check your mind."
9
+ end
@@ -0,0 +1,5 @@
1
+ module TagHelper
2
+ def tag(el)
3
+ "<tag>"
4
+ end
5
+ end
data/lib/manic/base.rb ADDED
@@ -0,0 +1,12 @@
1
+ class Manic
2
+ class Base
3
+
4
+ class << self
5
+ attr_accessor :root, :site_root, :output_root
6
+ end
7
+
8
+ end
9
+ end
10
+ Manic::Base.site_root = "site"
11
+ Manic::Base.output_root = "output"
12
+ Manic::Base.root = Dir.pwd
@@ -0,0 +1,22 @@
1
+ class Manic
2
+ class Config
3
+
4
+ def plugin(file)
5
+ if file.is_a?(String)
6
+ require(file)
7
+ else
8
+ Base.extend(file)
9
+ end
10
+ end
11
+
12
+ def method_missing(meth, *args)
13
+ isproc = args[0].is_a?(Proc)
14
+ if isproc
15
+ Config.send(:define_method, meth, args[0])
16
+ else
17
+ Config.class_eval "def Base.#{meth}; @#{meth}; end; def Base.#{meth}=(var); @#{meth} = var; end; Base.#{meth} = \"#{args[0]}\""
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,4 @@
1
+ class Manic
2
+ # Version number
3
+ VERSION = "0.0.1"
4
+ end
data/lib/manic.rb ADDED
@@ -0,0 +1,20 @@
1
+ require "tilt"
2
+ %w{base config}.each{|l| require "manic/#{l}"}
3
+ class Manic
4
+
5
+ def self.config(&block)
6
+ Config.new.instance_eval(&block)
7
+ Dir.glob("#{Manic::Base.site_root}/**/*").each do |file|
8
+ new_file = File.path(file).split("/")
9
+ new_file = new_file.size > 1 ? new_file.pop : new_file
10
+ new_file = new_file.split(".")[0] + ".html"
11
+ result = Tilt.new(file).render(Manic::Base, :current_file => file)
12
+ File.open("#{Manic::Base.output_root}/#{new_file}", 'w') {|f| f.write(result) }
13
+ puts "Parsing #{File.path(file)} into #{Manic::Base.output_root}/#{File.path(new_file)}"
14
+ end
15
+ end
16
+
17
+
18
+
19
+ end
20
+
metadata ADDED
@@ -0,0 +1,59 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: manic
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Justin Baker
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-02-05 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: a manic static site generator, with config in ruby, plugin support
15
+ email:
16
+ - jbaker95@uncc.edu
17
+ executables:
18
+ - manic
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - lib/manic/base.rb
23
+ - lib/manic/config.rb
24
+ - lib/manic/version.rb
25
+ - lib/manic.rb
26
+ - example/tag_helper.rb
27
+ - bin/manic
28
+ - LICENSE
29
+ - Rakefile
30
+ - Gemfile
31
+ - README.md
32
+ homepage: http://github.com/justinbaker/manic
33
+ licenses: []
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ segments:
45
+ - 0
46
+ hash: 556736847
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ! '>='
51
+ - !ruby/object:Gem::Version
52
+ version: 1.3.6
53
+ requirements: []
54
+ rubyforge_project: manic
55
+ rubygems_version: 1.8.15
56
+ signing_key:
57
+ specification_version: 3
58
+ summary: a manic static site generator, plugin support
59
+ test_files: []