markwiki 0.0.1.pre.1 → 0.0.3
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.
- checksums.yaml +4 -4
- data/README.md +1 -7
- data/exe/markwiki +4 -0
- data/lib/markwiki.rb +8 -1
- data/lib/markwiki/init.rb +79 -6
- data/lib/markwiki/version.rb +1 -1
- data/markwiki.gemspec +3 -2
- data/static/.markwiki.cfg +1 -0
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1512f8243b2ad01cc508a9b0252c5fe53ad4265
|
4
|
+
data.tar.gz: 4205aa8069fdcbc13b8a532f57a8be05ccbf2218
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95277f16c02c465fe357e168a917dc4070a21850c8c7fd1d453c3d821e93b2982c882668c7f4abc8cc63879d05221e8abc2231c1c8b213160c679afdcb4686a4
|
7
|
+
data.tar.gz: 718a20cb7c964f206b4b784b1e20743c709daecceaf599b09d945b3414cdbe1c2fd468b193f952aad6b5c4e5fe5964b34c843b36afeb7aad3aa2dea7c2c42ab4
|
data/README.md
CHANGED
@@ -2,13 +2,7 @@
|
|
2
2
|
|
3
3
|
Markwiki is a Ruby gem designed to ease the development and maintenance of locally designed static sites using Markdown. Too often, at least for me, static site generators aren't intuitive to use, aren't focused for simple static sites (not blogs), or most often don't support GitHub flavoured Markdown (GFM).
|
4
4
|
|
5
|
-
Markwiki
|
6
|
-
|
7
|
-
Create a site with markwiki --init <NAME>
|
8
|
-
Write website stuff (Markdown, CSS (SASS?), and JS)
|
9
|
-
Compile and upload to your server with markwiki --launch
|
10
|
-
|
11
|
-
Simple, eh?
|
5
|
+
Markwiki follows the philosophy that you should have to do as little configuration as possible, with the ability to customize as much as possible. A Markwiki site begins as a skeleton directory structure as a YAML or JSON file, known as a *configuration*. These configurations are designed to be as intuitive as possible.
|
12
6
|
|
13
7
|
## Installation
|
14
8
|
|
data/exe/markwiki
CHANGED
data/lib/markwiki.rb
CHANGED
@@ -1,8 +1,15 @@
|
|
1
1
|
# @author Bryce Davis <me@bryceadavis.com>
|
2
2
|
require "markwiki/version"
|
3
3
|
require "markwiki/init"
|
4
|
+
require "jewel"
|
4
5
|
|
5
6
|
# Main driver for Markwiki
|
6
7
|
module Markwiki
|
7
|
-
|
8
|
+
# Topmost API for Markwiki
|
9
|
+
class Markwiki
|
10
|
+
# Create a new Markwiki site
|
11
|
+
def init_site(name)
|
12
|
+
Init.init_site(name)
|
13
|
+
end
|
14
|
+
end
|
8
15
|
end
|
data/lib/markwiki/init.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# @author Bryce Davis <me@bryceadavis.com>
|
2
2
|
require 'json' # For JSON parsing
|
3
|
+
require 'yaml' # For YAML parsing
|
4
|
+
require 'jewel' # For access to static resources
|
3
5
|
|
4
6
|
module Markwiki
|
5
7
|
# The default Markwiki skeleton, to be converted to JSON.
|
@@ -22,10 +24,67 @@ module Markwiki
|
|
22
24
|
}
|
23
25
|
|
24
26
|
# Wrapper class for Markwiki initialization
|
25
|
-
class Init
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
class Init < Jewel::Gem
|
28
|
+
root "../.."
|
29
|
+
|
30
|
+
# Creates the Markwiki directory structure from a
|
31
|
+
# configuration.
|
32
|
+
#
|
33
|
+
# @param site_name [String] the name of Markwiki site
|
34
|
+
# @param config [Hash] a Markwiki configuration Hash
|
35
|
+
def self.init_site(site_name, config: self.load_default_config)
|
36
|
+
Dir.mkdir(site_name)
|
37
|
+
|
38
|
+
# Create the directories
|
39
|
+
config.each_key do |key|
|
40
|
+
if config[key].is_a? Hash
|
41
|
+
Dir.mkdir(File.join(site_name, config[key]["dir_name"]))
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Create the files
|
46
|
+
config.each_key do |key|
|
47
|
+
# We have top-level files
|
48
|
+
if config[key].is_a? Array and key.eql? "files"
|
49
|
+
config[key].each do |file|
|
50
|
+
unless file.eql? ".markwiki.cfg"
|
51
|
+
#puts File.join(site_name, file)
|
52
|
+
FileUtils.touch(File.join(site_name, file))
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# We have a subdirectory
|
58
|
+
if config[key].is_a? Hash
|
59
|
+
config[key].each_key do |subdiropt|
|
60
|
+
if config[key][subdiropt].is_a? Array and subdiropt.eql? "files"
|
61
|
+
config[key][subdiropt].each do |file|
|
62
|
+
#puts File.join(site_name, config[key]["dir_name"], file)
|
63
|
+
FileUtils.touch(File.join(site_name, config[key]["dir_name"], file))
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Create the Markwiki configuration
|
71
|
+
if config.eql? self.load_default_config
|
72
|
+
# Path to the default configuration
|
73
|
+
path = self.root.static(".markwiki.cfg").to_s
|
74
|
+
FileUtils.cp(path, "#{site_name}")
|
75
|
+
else
|
76
|
+
File.open("#{site_name}/.markwiki.cfg", "w") do |file|
|
77
|
+
file.write(self.generate_yaml_config(config))
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# Generate a YAML representation of a configuration
|
83
|
+
#
|
84
|
+
# @param config [Hash] a Markwiki configuration
|
85
|
+
# @return [String] a YAML representation of the configuration
|
86
|
+
def self.generate_yaml_config(config)
|
87
|
+
YAML.dump(config)
|
29
88
|
end
|
30
89
|
|
31
90
|
# Generate a JSON String representation of a Markwiki
|
@@ -33,7 +92,7 @@ module Markwiki
|
|
33
92
|
#
|
34
93
|
# @return [String] the Markwiki configuration as a JSON String
|
35
94
|
def self.generate_json_config
|
36
|
-
|
95
|
+
CONFIG.to_json
|
37
96
|
end
|
38
97
|
|
39
98
|
# Generate a prettified JSON String representation of a
|
@@ -41,7 +100,7 @@ module Markwiki
|
|
41
100
|
#
|
42
101
|
# @return [String] the Markwiki configuration as a JSON String
|
43
102
|
def self.generate_pretty_json_config
|
44
|
-
JSON.pretty_generate
|
103
|
+
JSON.pretty_generate CONFIG
|
45
104
|
end
|
46
105
|
|
47
106
|
# Get a Hash representation of a default Markwiki
|
@@ -64,6 +123,7 @@ module Markwiki
|
|
64
123
|
# @param img_files [Array<String>] an Array of image files
|
65
124
|
# @return [Hash] a new Markwiki configuration Hash
|
66
125
|
def self.generate_config(
|
126
|
+
name: "markwiki",
|
67
127
|
files: ["index.html"],
|
68
128
|
css: "css",
|
69
129
|
css_files: ["styles.css"],
|
@@ -72,6 +132,7 @@ module Markwiki
|
|
72
132
|
img: "img",
|
73
133
|
img_files: [])
|
74
134
|
{
|
135
|
+
"name" => name,
|
75
136
|
"files".to_s => files + [".markwiki.cfg"],
|
76
137
|
"css".to_s => {
|
77
138
|
"dir_name" => css,
|
@@ -87,5 +148,17 @@ module Markwiki
|
|
87
148
|
}
|
88
149
|
}
|
89
150
|
end
|
151
|
+
|
152
|
+
# Load the default Markwiki configuration file
|
153
|
+
#
|
154
|
+
# @return [Hash] the default configuration as a Hash
|
155
|
+
def self.load_default_config
|
156
|
+
config = nil
|
157
|
+
path = self.root.static(".markwiki.cfg").to_s
|
158
|
+
file = File.open(path, "r") { |file|
|
159
|
+
config = YAML.load(file)
|
160
|
+
}
|
161
|
+
config
|
162
|
+
end
|
90
163
|
end
|
91
164
|
end
|
data/lib/markwiki/version.rb
CHANGED
data/markwiki.gemspec
CHANGED
@@ -30,8 +30,9 @@ Gem::Specification.new do |spec|
|
|
30
30
|
|
31
31
|
spec.add_development_dependency "bundler", "~> 1.10"
|
32
32
|
spec.add_development_dependency "rake", "~> 10.0"
|
33
|
-
spec.add_development_dependency "rspec", '~>
|
33
|
+
spec.add_development_dependency "rspec", '~> 3'
|
34
34
|
spec.add_development_dependency "yard", '~> 0'
|
35
35
|
|
36
|
-
spec.add_runtime_dependency "json", '~>
|
36
|
+
spec.add_runtime_dependency "json", '~> 1'
|
37
|
+
spec.add_runtime_dependency "jewel", "~> 0"
|
37
38
|
end
|
data/static/.markwiki.cfg
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markwiki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryce Davis
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: yard
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -68,6 +68,20 @@ dependencies:
|
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: json
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: jewel
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - "~>"
|
@@ -125,9 +139,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
139
|
version: '0'
|
126
140
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
141
|
requirements:
|
128
|
-
- - "
|
142
|
+
- - ">="
|
129
143
|
- !ruby/object:Gem::Version
|
130
|
-
version:
|
144
|
+
version: '0'
|
131
145
|
requirements: []
|
132
146
|
rubyforge_project:
|
133
147
|
rubygems_version: 2.4.6
|