hakii 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (7) hide show
  1. data/Gemfile +2 -0
  2. data/LICENSE +15 -0
  3. data/README.markdown +11 -0
  4. data/Rakefile +170 -0
  5. data/hakii.gemspec +41 -0
  6. data/lib/hakii.rb +7 -0
  7. metadata +72 -0
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ <Hakii is a simple and stupid static site generator.>
2
+ Copyright (C) <2011> <Andor>
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU General Public License as published by
6
+ the Free Software Foundation, either version 3 of the License, or
7
+ (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU General Public License for more details.
13
+
14
+ You should have received a copy of the GNU General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
data/README.markdown ADDED
@@ -0,0 +1,11 @@
1
+ # About Hakii
2
+
3
+ This gem is for generating static sites, then you can host the outputs on [github pages](http://pages.github.com) or other hosts.
4
+
5
+ For github pages, you can use the `rake git` command pushing the outputs to your github repo; for other hosts you should use the `rake ftp` command transporting the outputs to you host's ftp.
6
+
7
+ # Usage
8
+
9
+ # License
10
+
11
+ This gem is licensed under the [GPLv3](http://www.gnu.org/licenses/gpl-3.0.html).
data/Rakefile ADDED
@@ -0,0 +1,170 @@
1
+ # coding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'rake'
5
+ require 'date'
6
+
7
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), *%w[lib]))
8
+
9
+
10
+ ############################
11
+ #
12
+ # Helper functions
13
+ #
14
+ ############################
15
+
16
+ def name
17
+ @name ||= Dir['*.gemspec'].first.split('.').first
18
+ end
19
+
20
+ def version
21
+ line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
22
+ line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
23
+ end
24
+
25
+ def date
26
+ Date.today.to_s
27
+ end
28
+
29
+ def rubyforge_project
30
+ name
31
+ end
32
+
33
+ def gemspec_file
34
+ "#{name}.gemspec"
35
+ end
36
+
37
+ def gem_file
38
+ "#{name}-#{version}.gem"
39
+ end
40
+
41
+ def replace_header(head, header_name)
42
+ head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
43
+ end
44
+
45
+
46
+ ############################
47
+ #
48
+ # Standard tasks
49
+ #
50
+ ############################
51
+
52
+ task :default => [:test, :features]
53
+
54
+ require 'rake/testtask'
55
+ Rake::TestTask.new(:test) do |test|
56
+ test.libs << 'lib' << 'test'
57
+ test.pattern = 'test/**/test_*.rb'
58
+ test.verbose = true
59
+ end
60
+
61
+ desc "Generate RCov test coverage and open in your browser"
62
+ task :coverage do
63
+ require 'rcov'
64
+ sh "rm -fr coverage"
65
+ sh "rcov test/test_*.rb"
66
+ sh "open coverage/index.html"
67
+ end
68
+
69
+ require 'rdoc/task'
70
+ RDoc::Task.new do |rdoc|
71
+ rdoc.rdoc_dir = 'rdoc'
72
+ rdoc.title = "#{name} #{version}"
73
+ rdoc.rdoc_files.include('README*')
74
+ rdoc.rdoc_files.include('lib/**/*.rb')
75
+ end
76
+
77
+ desc "Open an irb session preloaded with this library"
78
+ task :console do
79
+ sh "irb -rubygems -r ./lib/#{name}.rb"
80
+ end
81
+
82
+
83
+ ############################
84
+ #
85
+ # Custom tasks
86
+ #
87
+ ############################
88
+
89
+ namespace :migrate do
90
+ desc "Migrate from mephisto in the current directory"
91
+ task :mephisto do
92
+ sh %q(ruby -r './lib/jekyll/migrators/mephisto' -e 'Jekyll::Mephisto.postgres(:database => "#{ENV["DB"]}")')
93
+ end
94
+ desc "Migrate from Movable Type in the current directory"
95
+ task :mt do
96
+ sh %q(ruby -r './lib/jekyll/migrators/mt' -e 'Jekyll::MT.process("#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")')
97
+ end
98
+ desc "Migrate from Typo in the current directory"
99
+ task :typo do
100
+ sh %q(ruby -r './lib/jekyll/migrators/typo' -e 'Jekyll::Typo.process("#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")')
101
+ end
102
+ end
103
+
104
+ begin
105
+ require 'cucumber/rake/task'
106
+ Cucumber::Rake::Task.new(:features) do |t|
107
+ t.cucumber_opts = "--format progress"
108
+ end
109
+ rescue LoadError
110
+ desc 'Cucumber rake task not available'
111
+ task :features do
112
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
113
+ end
114
+ end
115
+
116
+
117
+ ############################
118
+ #
119
+ # Packaging tasks
120
+ #
121
+ ############################
122
+
123
+ desc "Push the gem to github repo"
124
+ task :release => :build do
125
+ unless `git branch` =~ /^\* master$/
126
+ puts "You must be on the master branch to release!"
127
+ exit!
128
+ end
129
+ sh "git commit --allow-empty -a -m 'Release #{version}'"
130
+ sh "git tag v#{version}"
131
+ sh "git push origin master"
132
+ sh "git push origin v#{version}"
133
+ sh "gem push pkg/#{name}-#{version}.gem"
134
+ end
135
+
136
+ desc "Build the .gem file"
137
+ task :build => :gemspec do
138
+ sh "mkdir -p pkg"
139
+ sh "gem build #{gemspec_file}"
140
+ sh "mv #{gem_file} pkg"
141
+ end
142
+
143
+ desc "Automatic update the gemspec file"
144
+ task :gemspec do
145
+ # read spec file and split out manifest section
146
+ spec = File.read(gemspec_file)
147
+ head, manifest, tail = spec.split(" # = MANIFEST =\n")
148
+
149
+ # replace name version and date
150
+ replace_header(head, :name)
151
+ replace_header(head, :version)
152
+ replace_header(head, :date)
153
+ #comment this out if your rubyforge_project has a different name
154
+ #replace_header(head, :rubyforge_project)
155
+
156
+ # determine file list from git ls-files
157
+ files = `git ls-files`.
158
+ split("\n").
159
+ sort.
160
+ reject { |file| file =~ /^\./ }.
161
+ reject { |file| file =~ /^(rdoc|pkg|coverage)/ }.
162
+ map { |file| " #{file}" }.
163
+ join("\n")
164
+
165
+ # piece file back together and write
166
+ manifest = " s.files = %w[\n#{files}\n ]\n"
167
+ spec = [head, manifest, tail].join(" # = MANIFEST =\n")
168
+ File.open(gemspec_file, 'w') { |io| io.write(spec) }
169
+ puts "Updated #{gemspec_file}"
170
+ end
data/hakii.gemspec ADDED
@@ -0,0 +1,41 @@
1
+ # coding: utf-8
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = 'hakii'
5
+ s.version = '0.0.1'
6
+ s.platform = Gem::Platform::RUBY
7
+ s.authors = ["Andor"]
8
+ s.email = ["andor.chen.27@gmail.com"]
9
+ s.homepage = "http://about.ac"
10
+ s.summary = "Yet another simple and stupid static site generator."
11
+ s.description = "Hakii is a simple and stupid static site generator."
12
+ #s.rubyforge_project = s.name
13
+
14
+ s.required_rubygems_version = ">= 1.3.6"
15
+
16
+ # If you have runtime dependencies, add them here
17
+ # s.add_runtime_dependency "other", "~> 1.2"
18
+
19
+ # If you have development dependencies, add them here
20
+ s.add_development_dependency "rdoc", ">= 2.4.2"
21
+
22
+ # = MANIFEST =
23
+ s.files = %w[
24
+ Gemfile
25
+ LICENSE
26
+ README.markdown
27
+ Rakefile
28
+ hakii.gemspec
29
+ lib/hakii.rb
30
+ ]
31
+ # = MANIFEST =
32
+
33
+ # s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
34
+
35
+ # s.extensions = `git ls-files ext/extconf.rb`.split("\n")
36
+
37
+ s.require_path = %w[lib]
38
+
39
+ # For C extensions
40
+ # s.extensions = "ext/extconf.rb"
41
+ end
data/lib/hakii.rb ADDED
@@ -0,0 +1,7 @@
1
+ # coding: utf-8
2
+
3
+ module Hakii
4
+
5
+ VERSION = '0.0.1'
6
+
7
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hakii
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Andor
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-08-29 00:00:00 +08:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rdoc
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 2.4.2
25
+ type: :development
26
+ version_requirements: *id001
27
+ description: Hakii is a simple and stupid static site generator.
28
+ email:
29
+ - andor.chen.27@gmail.com
30
+ executables: []
31
+
32
+ extensions: []
33
+
34
+ extra_rdoc_files: []
35
+
36
+ files:
37
+ - Gemfile
38
+ - LICENSE
39
+ - README.markdown
40
+ - Rakefile
41
+ - hakii.gemspec
42
+ - lib/hakii.rb
43
+ has_rdoc: true
44
+ homepage: http://about.ac
45
+ licenses: []
46
+
47
+ post_install_message:
48
+ rdoc_options: []
49
+
50
+ require_paths:
51
+ - - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: "0"
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: 1.3.6
64
+ requirements: []
65
+
66
+ rubyforge_project:
67
+ rubygems_version: 1.6.2
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: Yet another simple and stupid static site generator.
71
+ test_files: []
72
+