nsume 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/.gitignore +1 -0
- data/lib/generators/_data/navbar.yml +4 -4
- data/lib/generators/_includes/navbar.liquid +2 -2
- data/lib/generators/_layouts/default.html +6 -6
- data/lib/generators/assets/{themes/github → css}/github.css +0 -0
- data/lib/generators/docs/index.html +4 -0
- data/lib/nsume/cli.rb +17 -26
- data/lib/nsume/configure.rb +96 -0
- data/lib/nsume/default.rb +57 -0
- data/lib/nsume/dev_helper.rb +1 -1
- data/lib/nsume/prepare.rb +59 -80
- data/lib/nsume/version.rb +1 -1
- data/lib/nsume.rb +10 -27
- data/lib/templates/_config.yml.erb +3 -3
- data/lib/templates/navbar.yml +12 -0
- data/nsume.gemspec +2 -2
- metadata +11 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7494a0763e43c7217956bacfd7417d66307a2b77
|
4
|
+
data.tar.gz: d7124304466c4a378a46a9cc56b8bc54b4351740
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a910f81ce7b0822e90d289af18ec33f62c672c6707ff6349d519cb68f6d5245c7b55069f098c878a5eda3963247aa9f65e1ab43616b4ef35807f4782c462152b
|
7
|
+
data.tar.gz: 2d4b1cf060328a75652aea94037299774b35f8d418dfeb7c2dcd972f613a03488a27ea57b6c2d2eb600a01f235ca2941020f51475561bd96f354b3a3155ae1f6
|
@@ -0,0 +1 @@
|
|
1
|
+
_site
|
@@ -1,12 +1,12 @@
|
|
1
|
-
-
|
1
|
+
- label: API
|
2
2
|
path: /docs/api/v1
|
3
3
|
dropdown: true
|
4
4
|
|
5
|
-
-
|
5
|
+
- label: Changelog
|
6
6
|
path: /changelog
|
7
7
|
|
8
|
-
-
|
8
|
+
- label: Blog
|
9
9
|
path: /blog
|
10
10
|
|
11
|
-
-
|
11
|
+
- label: Documentation
|
12
12
|
path: /docs
|
@@ -12,7 +12,7 @@
|
|
12
12
|
<ul class="nav navbar-nav">
|
13
13
|
{% for nav in site.data.navbar %}
|
14
14
|
{% if nav.dropdown %}<li class="dropdown">
|
15
|
-
<a class="dropdown-toggle" data-toggle="dropdown" href="#">{{ nav.
|
15
|
+
<a class="dropdown-toggle" data-toggle="dropdown" href="#">{{ nav.label }}
|
16
16
|
<span class="caret"></span></a>
|
17
17
|
<ul class="dropdown-menu">
|
18
18
|
{% for page in site.pages %}<li>
|
@@ -22,7 +22,7 @@
|
|
22
22
|
{% endfor %}</li>
|
23
23
|
</ul>
|
24
24
|
{% else %}<li>
|
25
|
-
<a href="{{ site.baseurl }}{{ nav.path }}">{{ nav.
|
25
|
+
<a href="{{ site.baseurl }}{{ nav.path }}">{{ nav.label }}</a>
|
26
26
|
{% endif %}
|
27
27
|
{% endfor %}</li>
|
28
28
|
</ul>
|
@@ -5,9 +5,9 @@
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
6
|
<meta charset="utf-8">
|
7
7
|
<link rel="shortcut icon" href="{{ site.baseurl }}/assets/ico/favicon.ico">
|
8
|
-
<link rel="stylesheet" href="{{ site.baseurl }}/assets/
|
9
|
-
<link rel="stylesheet" href="{{ site.baseurl }}/assets/themes/{{ site.theme }}/bootstrap.min.css" media="screen">
|
10
|
-
<link rel="stylesheet" href="{{ site.baseurl }}/assets/
|
8
|
+
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/github.css">
|
9
|
+
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/themes/{{ site.theme }}/bootstrap.min.css" media="screen">
|
10
|
+
<link rel="stylesheet" href="{{ site.baseurl }}/assets/css/bootswatch.min.css">
|
11
11
|
</head>
|
12
12
|
<body>
|
13
13
|
|
@@ -36,8 +36,8 @@
|
|
36
36
|
|
37
37
|
</div>
|
38
38
|
|
39
|
-
<script src="{{ site.baseurl }}/assets/
|
40
|
-
<script src="{{ site.baseurl }}/assets/
|
41
|
-
<script src="{{ site.baseurl }}/assets/
|
39
|
+
<script src="{{ site.baseurl }}/assets/js/jquery.min.js"></script>
|
40
|
+
<script src="{{ site.baseurl }}/assets/js/bootstrap.min.js"></script>
|
41
|
+
<script src="{{ site.baseurl }}/assets/js/bootswatch.js"></script>
|
42
42
|
</body>
|
43
43
|
</html>
|
File without changes
|
data/lib/nsume/cli.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'date'
|
2
2
|
require 'erb'
|
3
|
-
require 'faraday'
|
4
3
|
require 'yaml'
|
5
4
|
|
6
5
|
module Nsume
|
@@ -9,16 +8,17 @@ module Nsume
|
|
9
8
|
map '-v' => :version
|
10
9
|
map '-sw' => :switch
|
11
10
|
|
12
|
-
method_option :site, type: :string, aliases: '-s', default: '
|
11
|
+
method_option :site, type: :string, aliases: '-s', default: 'user', desc: 'Site [user] or [project]'
|
13
12
|
method_option :theme, type: :string, aliases: '-t', default: 'flatly', desc: 'Site theme'
|
14
|
-
method_option :navbar, type: :string, aliases: '-n', default: 'blog', desc: 'Site navbar [blog] or [api]'
|
15
13
|
desc 'init [PATH]', 'initializes a new nSume.'
|
16
14
|
def init(path=Dir.pwd)
|
17
15
|
Nsume::DevHelper.mlog __method__
|
18
16
|
|
17
|
+
Nsume.config.dest_path = path
|
18
|
+
|
19
19
|
Nsume::Prepare.generator options
|
20
20
|
Nsume::Prepare.jquery
|
21
|
-
Nsume::Prepare.
|
21
|
+
Nsume::Prepare.bootstrap_js
|
22
22
|
Nsume::Prepare.bootswatch_css
|
23
23
|
Nsume::Prepare.bootswatch_js
|
24
24
|
Nsume::Prepare.bootswatch_theme options['theme']
|
@@ -31,8 +31,8 @@ module Nsume
|
|
31
31
|
Nsume::DevHelper.mlog __method__
|
32
32
|
|
33
33
|
name = "#{Date.today.strftime("%Y-%m-%d")}-#{title}.md"
|
34
|
-
path = File.expand_path(name, Nsume.posts_path)
|
35
|
-
file = ERB.new(Nsume.post_template).result(binding)
|
34
|
+
path = File.expand_path(name, Nsume.config.posts_path)
|
35
|
+
file = ERB.new(Nsume.config.post_template).result(binding)
|
36
36
|
File.write(path, file)
|
37
37
|
|
38
38
|
Nsume::DevHelper.log "Created a posts."
|
@@ -42,45 +42,36 @@ module Nsume
|
|
42
42
|
def switch(theme)
|
43
43
|
Nsume::DevHelper.mlog __method__
|
44
44
|
|
45
|
-
path = File.join(Nsume.
|
45
|
+
path = File.join(Nsume.config.dest_path, '_config.yml')
|
46
46
|
raw = YAML.load_file(path)
|
47
47
|
raw['theme'] = theme
|
48
48
|
file = YAML.dump(raw)
|
49
49
|
File.write(path, file)
|
50
50
|
|
51
|
-
Nsume::Prepare.bootswatch_theme
|
51
|
+
Nsume::Prepare.bootswatch_theme theme
|
52
52
|
end
|
53
53
|
|
54
54
|
desc 'theme', 'Show the current theme'
|
55
55
|
def theme
|
56
|
-
path = File.join(Nsume.
|
56
|
+
path = File.join(Nsume.config.dest_path, '_config.yml')
|
57
57
|
raw = YAML.load_file(path)
|
58
58
|
puts raw['theme']
|
59
59
|
end
|
60
60
|
|
61
61
|
desc 'themes', 'List all themes'
|
62
62
|
def themes
|
63
|
-
puts
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
'journal',
|
70
|
-
'lumen',
|
71
|
-
'readable',
|
72
|
-
'simplex',
|
73
|
-
'slate',
|
74
|
-
'spacelab',
|
75
|
-
'superhero',
|
76
|
-
'united',
|
77
|
-
'yeti'
|
78
|
-
]
|
63
|
+
puts Nsume.config.themes
|
64
|
+
end
|
65
|
+
|
66
|
+
desc 'navbar [SITE]', 'Site navbar [blog] or [project] or [api]'
|
67
|
+
def navbar(site='blog')
|
68
|
+
Nsume::Prepare.navbar site
|
79
69
|
end
|
80
70
|
|
81
71
|
desc 'up', 'Start jekyll server.'
|
82
72
|
def up
|
83
|
-
system "cd #{Nsume.
|
73
|
+
system "cd #{Nsume.config.dest_path} && jekyll server --watch --baseurl ''"
|
74
|
+
rescue Interrupt
|
84
75
|
end
|
85
76
|
|
86
77
|
desc 'version', 'Print the version and exit.'
|
@@ -0,0 +1,96 @@
|
|
1
|
+
module Nsume
|
2
|
+
module Configure
|
3
|
+
class << self
|
4
|
+
attr_accessor :jquery_endpoint, :jquery_file
|
5
|
+
attr_accessor :bootstrap_endpoint, :bootstrap_css_file, :bootstrap_js_file
|
6
|
+
attr_accessor :bootswatch_endpoint, :bootswatch_css_file, :bootswatch_js_file
|
7
|
+
attr_accessor :bootswatch_theme
|
8
|
+
attr_writer :dest_path
|
9
|
+
|
10
|
+
def setup
|
11
|
+
keys.each do |key|
|
12
|
+
instance_variable_set(:"@#{key}", Nsume::Default.send(key))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def keys
|
17
|
+
@keys ||= %i[
|
18
|
+
jquery_endpoint jquery_file
|
19
|
+
bootstrap_endpoint bootstrap_css_file bootstrap_js_file
|
20
|
+
bootswatch_endpoint bootswatch_css_file bootswatch_js_file
|
21
|
+
bootswatch_theme
|
22
|
+
]
|
23
|
+
end
|
24
|
+
|
25
|
+
#
|
26
|
+
# base reader
|
27
|
+
#
|
28
|
+
def assets_css
|
29
|
+
'assets/css'
|
30
|
+
end
|
31
|
+
|
32
|
+
def assets_js
|
33
|
+
'assets/js'
|
34
|
+
end
|
35
|
+
|
36
|
+
def generators_path
|
37
|
+
Nsume.root.join('lib', 'generators').to_s
|
38
|
+
end
|
39
|
+
|
40
|
+
def templates_path
|
41
|
+
Nsume.root.join('lib', 'templates').to_s
|
42
|
+
end
|
43
|
+
|
44
|
+
def config_template
|
45
|
+
File.read(File.expand_path('_config.yml.erb', self.templates_path))
|
46
|
+
end
|
47
|
+
|
48
|
+
def navbar_template
|
49
|
+
File.read(File.expand_path('navbar.yml', self.templates_path))
|
50
|
+
end
|
51
|
+
|
52
|
+
def post_template
|
53
|
+
File.read(File.expand_path('post.md.erb', self.templates_path))
|
54
|
+
end
|
55
|
+
|
56
|
+
def themes
|
57
|
+
['amelia','cerulean','cosmo','cyborg','darkly','flatly','journal','lumen','readable','simplex','slate','spacelab','superhero','united','yeti']
|
58
|
+
end
|
59
|
+
|
60
|
+
#
|
61
|
+
# custom reader
|
62
|
+
#
|
63
|
+
def dest_path
|
64
|
+
@dest_path ||= Dir.pwd
|
65
|
+
path = @dest_path
|
66
|
+
path = File.join(path, 'tmp') if File.exists?(File.join(path, 'nsume.gemspec'))
|
67
|
+
path
|
68
|
+
end
|
69
|
+
|
70
|
+
def posts_path
|
71
|
+
path = File.expand_path('_posts', self.dest_path)
|
72
|
+
FileUtils.mkdir_p(path) unless File.exists?(path)
|
73
|
+
path
|
74
|
+
end
|
75
|
+
|
76
|
+
#
|
77
|
+
# attr writer
|
78
|
+
#
|
79
|
+
def jquery_endpoint=(url)
|
80
|
+
@jquery_endpoint = url
|
81
|
+
end
|
82
|
+
|
83
|
+
def bootstrap_endpoint=(url)
|
84
|
+
@bootstrap_endpoint = url
|
85
|
+
end
|
86
|
+
|
87
|
+
def bootswatch_endpoint=(url)
|
88
|
+
@bootswatch_endpoint = url
|
89
|
+
end
|
90
|
+
|
91
|
+
def bootswatch_theme=(theme)
|
92
|
+
@bootswatch_theme = theme
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module Nsume
|
2
|
+
module Default
|
3
|
+
JQUERY_ENDPOINT = 'https://code.jquery.com/jquery-1.10.2.min.js'.freeze
|
4
|
+
JQUERY_FILE = 'jquery.min.js'.freeze
|
5
|
+
|
6
|
+
BOOTSTRAP_ENDPOINT = 'https://raw.github.com/twbs/bootstrap/v3.1.1'.freeze
|
7
|
+
BOOTSTRAP_CSS_FILE = 'bootstrap.min.css'.freeze
|
8
|
+
BOOTSTRAP_JS_FILE = 'bootstrap.min.js'.freeze
|
9
|
+
|
10
|
+
BOOTSWATCH_ENDPOINT = 'https://raw.github.com/thomaspark/bootswatch/v3.1.1'.freeze
|
11
|
+
BOOTSWATCH_CSS_FILE = 'bootswatch.min.css'.freeze
|
12
|
+
BOOTSWATCH_JS_FILE = 'bootswatch.js'.freeze
|
13
|
+
BOOTSWATCH_THEME = 'flatly'.freeze
|
14
|
+
|
15
|
+
class << self
|
16
|
+
def options
|
17
|
+
Hash[Nsume::Configure.keys.map{|key| [key, send(key)]}]
|
18
|
+
end
|
19
|
+
|
20
|
+
def jquery_endpoint
|
21
|
+
JQUERY_ENDPOINT
|
22
|
+
end
|
23
|
+
|
24
|
+
def jquery_file
|
25
|
+
JQUERY_FILE
|
26
|
+
end
|
27
|
+
|
28
|
+
def bootstrap_endpoint
|
29
|
+
BOOTSTRAP_ENDPOINT
|
30
|
+
end
|
31
|
+
|
32
|
+
def bootstrap_css_file
|
33
|
+
BOOTSTRAP_CSS_FILE
|
34
|
+
end
|
35
|
+
|
36
|
+
def bootstrap_js_file
|
37
|
+
BOOTSTRAP_JS_FILE
|
38
|
+
end
|
39
|
+
|
40
|
+
def bootswatch_endpoint
|
41
|
+
BOOTSWATCH_ENDPOINT
|
42
|
+
end
|
43
|
+
|
44
|
+
def bootswatch_css_file
|
45
|
+
BOOTSWATCH_CSS_FILE
|
46
|
+
end
|
47
|
+
|
48
|
+
def bootswatch_js_file
|
49
|
+
BOOTSWATCH_JS_FILE
|
50
|
+
end
|
51
|
+
|
52
|
+
def bootswatch_theme
|
53
|
+
BOOTSWATCH_THEME
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/nsume/dev_helper.rb
CHANGED
data/lib/nsume/prepare.rb
CHANGED
@@ -1,114 +1,93 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
|
1
3
|
module Nsume
|
2
4
|
module Prepare
|
3
|
-
# Todo: default configure
|
4
5
|
class << self
|
5
|
-
def generator(options)
|
6
|
+
def generator(options={})
|
6
7
|
Nsume::DevHelper.mlog __method__
|
7
8
|
|
8
|
-
|
9
|
-
path = File.expand_path(name, Nsume.source_path)
|
9
|
+
path = File.expand_path('_config.yml', Nsume.config.dest_path)
|
10
10
|
unless File.exists?(path)
|
11
|
-
FileUtils.cp_r Nsume.generators_path + '/.', Nsume.
|
12
|
-
file = ERB.new(Nsume.config_template).result(binding)
|
13
|
-
File.write(path, file)
|
14
|
-
|
15
|
-
raw = []
|
16
|
-
path = File.join(Nsume.source_path, '_data', 'navbar.yml')
|
17
|
-
YAML.load_file(path).each do |navbar|
|
18
|
-
case options['navbar']
|
19
|
-
when 'blog'
|
20
|
-
case navbar['lavel'].downcase
|
21
|
-
when 'blog', 'documentation'
|
22
|
-
raw << navbar
|
23
|
-
end
|
24
|
-
when 'api'
|
25
|
-
case navbar['lavel'].downcase
|
26
|
-
when 'api', 'changelog', 'documentation'
|
27
|
-
raw << navbar
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
file = YAML.dump(raw)
|
32
|
-
File.write(path, file)
|
33
|
-
end
|
34
|
-
|
35
|
-
Nsume::DevHelper.elog path
|
36
|
-
end
|
37
|
-
|
38
|
-
def jquery(version='1.10.2')
|
39
|
-
Nsume::DevHelper.mlog __method__
|
11
|
+
FileUtils.cp_r Nsume.config.generators_path + '/.', Nsume.config.dest_path
|
40
12
|
|
41
|
-
|
42
|
-
|
43
|
-
|
13
|
+
basename = File.basename(Nsume.config.dest_path)
|
14
|
+
baseurl = '/' + basename if options['site'] == 'project'
|
15
|
+
year = Time.now.year
|
44
16
|
|
45
|
-
|
46
|
-
unless File.exists?(path)
|
47
|
-
file = Faraday.get("https://code.jquery.com/#{name}").body
|
17
|
+
file = ERB.new(Nsume.config.config_template).result(binding)
|
48
18
|
File.write(path, file)
|
49
|
-
end
|
50
|
-
|
51
|
-
Nsume::DevHelper.elog path
|
52
|
-
end
|
53
|
-
|
54
|
-
def bootstrap(version='3.1.1')
|
55
|
-
Nsume::DevHelper.mlog __method__
|
56
|
-
|
57
|
-
name = 'bootstrap.min.js'
|
58
|
-
path = File.expand_path('assets/bootstrap/dist/js', Nsume.source_path)
|
59
|
-
FileUtils.mkdir_p(path) unless File.exists?(path)
|
60
19
|
|
61
|
-
|
62
|
-
unless File.exists?(path)
|
63
|
-
file = Faraday.get("https://raw.github.com/twbs/bootstrap/v#{version}/dist/js/#{name}").body
|
64
|
-
File.write(path, file)
|
20
|
+
self.navbar options['site']
|
65
21
|
end
|
66
22
|
|
67
23
|
Nsume::DevHelper.elog path
|
68
24
|
end
|
69
25
|
|
70
|
-
def
|
71
|
-
Nsume
|
26
|
+
def jquery
|
27
|
+
asset Nsume.config.assets_js, Nsume.config.jquery_file, Nsume.config.jquery_endpoint
|
28
|
+
end
|
72
29
|
|
73
|
-
|
74
|
-
|
75
|
-
|
30
|
+
def bootstrap_js
|
31
|
+
endpoint = [Nsume.config.bootstrap_endpoint, 'dist', 'js', Nsume.config.bootstrap_js_file].join('/')
|
32
|
+
asset Nsume.config.assets_js, Nsume.config.bootstrap_js_file, endpoint
|
33
|
+
end
|
76
34
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
end
|
35
|
+
def bootswatch_css
|
36
|
+
endpoint = [Nsume.config.bootswatch_endpoint, Nsume.config.assets_css, Nsume.config.bootswatch_css_file].join('/')
|
37
|
+
asset Nsume.config.assets_css, Nsume.config.bootswatch_css_file, endpoint
|
38
|
+
end
|
82
39
|
|
83
|
-
|
40
|
+
def bootswatch_js
|
41
|
+
endpoint = [Nsume.config.bootswatch_endpoint, Nsume.config.assets_js, Nsume.config.bootswatch_js_file].join('/')
|
42
|
+
asset Nsume.config.assets_js, Nsume.config.bootswatch_js_file, endpoint
|
84
43
|
end
|
85
44
|
|
86
|
-
def
|
87
|
-
Nsume
|
45
|
+
def bootswatch_theme(theme='')
|
46
|
+
theme ||= Nsume.config.bootswatch_theme
|
47
|
+
path = File.join(Nsume.config.assets_css, 'themes', theme)
|
48
|
+
endpoint = [Nsume.config.bootswatch_endpoint, theme, Nsume.config.bootstrap_css_file].join('/')
|
49
|
+
asset path, Nsume.config.bootstrap_css_file, endpoint
|
50
|
+
end
|
88
51
|
|
89
|
-
|
90
|
-
|
91
|
-
FileUtils.mkdir_p(path) unless File.exists?(path)
|
52
|
+
def navbar(site='')
|
53
|
+
yaml = []
|
92
54
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
55
|
+
YAML.load(Nsume.config.navbar_template).each do |nav|
|
56
|
+
case site
|
57
|
+
when 'user', 'blog'
|
58
|
+
case nav['label'].downcase
|
59
|
+
when 'blog', 'documentation'
|
60
|
+
yaml << nav
|
61
|
+
end
|
62
|
+
when 'project', 'changelog'
|
63
|
+
case nav['label'].downcase
|
64
|
+
when 'changelog', 'documentation'
|
65
|
+
yaml << nav
|
66
|
+
end
|
67
|
+
when 'api'
|
68
|
+
case nav['label'].downcase
|
69
|
+
when 'api', 'changelog', 'documentation'
|
70
|
+
yaml << nav
|
71
|
+
end
|
72
|
+
end
|
97
73
|
end
|
98
74
|
|
99
|
-
Nsume
|
75
|
+
path = File.join(Nsume.config.dest_path, '_data', 'navbar.yml')
|
76
|
+
File.write(path, YAML.dump(yaml))
|
100
77
|
end
|
101
78
|
|
102
|
-
|
79
|
+
private
|
80
|
+
|
81
|
+
def asset(path, file, endpoint)
|
103
82
|
Nsume::DevHelper.mlog __method__
|
83
|
+
Nsume::DevHelper.log endpoint
|
104
84
|
|
105
|
-
|
106
|
-
path = File.expand_path("assets/themes/#{theme}", Nsume.source_path)
|
85
|
+
path = File.expand_path(path, Nsume.config.dest_path)
|
107
86
|
FileUtils.mkdir_p(path) unless File.exists?(path)
|
108
87
|
|
109
|
-
path = File.expand_path(File.join(path,
|
88
|
+
path = File.expand_path(File.join(path, file), Nsume.config.dest_path)
|
110
89
|
unless File.exists?(path)
|
111
|
-
file = Faraday.get(
|
90
|
+
file = Faraday.get(endpoint).body
|
112
91
|
File.write(path, file)
|
113
92
|
end
|
114
93
|
|
data/lib/nsume/version.rb
CHANGED
data/lib/nsume.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'pathname'
|
2
2
|
require 'thor'
|
3
3
|
|
4
|
+
require_relative 'nsume/configure'
|
5
|
+
require_relative 'nsume/default'
|
4
6
|
require_relative 'nsume/cli'
|
5
7
|
require_relative 'nsume/prepare'
|
6
8
|
require_relative 'nsume/version'
|
@@ -8,37 +10,18 @@ require_relative 'nsume/dev_helper'
|
|
8
10
|
|
9
11
|
module Nsume
|
10
12
|
class << self
|
11
|
-
def
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
# TODO: move config
|
16
|
-
def source_path
|
17
|
-
path = Dir.pwd
|
18
|
-
path = File.join(path, 'tmp') if File.exists?(File.join(path, 'nsume.gemspec'))
|
19
|
-
path
|
13
|
+
def configure
|
14
|
+
yield Nsume::Configure
|
20
15
|
end
|
21
16
|
|
22
|
-
def
|
23
|
-
Nsume
|
17
|
+
def config
|
18
|
+
Nsume::Configure
|
24
19
|
end
|
25
20
|
|
26
|
-
def
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
def config_template
|
31
|
-
File.read(File.expand_path('_config.yml.erb', Nsume.templates_path))
|
32
|
-
end
|
33
|
-
|
34
|
-
def posts_path
|
35
|
-
path = File.expand_path('_posts', Nsume.source_path)
|
36
|
-
FileUtils.mkdir_p(path) unless File.exists?(path)
|
37
|
-
path
|
38
|
-
end
|
39
|
-
|
40
|
-
def post_template
|
41
|
-
File.read(File.expand_path('post.md.erb', Nsume.templates_path))
|
21
|
+
def root
|
22
|
+
@root ||= Pathname.new(File.expand_path('../', File.dirname(__FILE__)))
|
42
23
|
end
|
43
24
|
end
|
44
25
|
end
|
26
|
+
|
27
|
+
Nsume::Configure.setup
|
@@ -3,12 +3,12 @@ redcarpet:
|
|
3
3
|
extensions: ['tables', 'with_toc_data']
|
4
4
|
pygments: true
|
5
5
|
|
6
|
-
baseurl: ''
|
6
|
+
baseurl: '<%= baseurl %>'
|
7
7
|
encoding: UTF-8
|
8
8
|
|
9
9
|
exclude: ['README.md', 'vendor', 'tmp']
|
10
10
|
|
11
|
-
name: <%=
|
12
|
-
copyright: <%=
|
11
|
+
name: <%= basename %>
|
12
|
+
copyright: <%= year %>, <%= basename %>
|
13
13
|
|
14
14
|
theme: <%= options['theme'] %>
|
data/nsume.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["ogom@hotmail.co.jp"]
|
11
11
|
spec.summary = %q{naturally consume.}
|
12
12
|
spec.description = %q{naturally consume by ruby.}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/ogom/nsume"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "thor", "~> 0.
|
21
|
+
spec.add_dependency "thor", "~> 0.19"
|
22
22
|
spec.add_dependency "faraday", "~> 0.9"
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.5"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nsume
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ogom
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.19'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.19'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: faraday
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,29 +80,34 @@ files:
|
|
80
80
|
- README.md
|
81
81
|
- Rakefile
|
82
82
|
- bin/nsume
|
83
|
+
- lib/generators/.gitignore
|
83
84
|
- lib/generators/_data/navbar.yml
|
84
85
|
- lib/generators/_includes/navbar.liquid
|
85
86
|
- lib/generators/_layouts/default.html
|
86
87
|
- lib/generators/_layouts/post.html
|
88
|
+
- lib/generators/assets/css/github.css
|
87
89
|
- lib/generators/assets/ico/favicon.ico
|
88
90
|
- lib/generators/assets/img/octonsume.png
|
89
|
-
- lib/generators/assets/themes/github/github.css
|
90
91
|
- lib/generators/blog/index.html
|
91
92
|
- lib/generators/changelog/index.html
|
93
|
+
- lib/generators/docs/index.html
|
92
94
|
- lib/generators/index.html
|
93
95
|
- lib/generators/vendor/autodoc/document.md.erb
|
94
96
|
- lib/generators/vendor/autodoc/footer.md.erb
|
95
97
|
- lib/generators/vendor/autodoc/header.md.erb
|
96
98
|
- lib/nsume.rb
|
97
99
|
- lib/nsume/cli.rb
|
100
|
+
- lib/nsume/configure.rb
|
101
|
+
- lib/nsume/default.rb
|
98
102
|
- lib/nsume/dev_helper.rb
|
99
103
|
- lib/nsume/prepare.rb
|
100
104
|
- lib/nsume/version.rb
|
101
105
|
- lib/templates/_config.yml.erb
|
106
|
+
- lib/templates/navbar.yml
|
102
107
|
- lib/templates/post.md.erb
|
103
108
|
- nsume.gemspec
|
104
109
|
- spec/nsume/version_spec.rb
|
105
|
-
homepage:
|
110
|
+
homepage: https://github.com/ogom/nsume
|
106
111
|
licenses:
|
107
112
|
- MIT
|
108
113
|
metadata: {}
|