jekyll-plus 0.1.0 → 0.2.0

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +21 -21
  3. data/README.md +209 -77
  4. data/exe/jekyll+ +56 -0
  5. data/lib/jekyll-plus.rb +28 -2
  6. data/lib/jekyll-plus/version.rb +3 -3
  7. data/lib/jekyll/commands/extract_theme.rb +152 -0
  8. data/lib/jekyll/commands/new_site.rb +260 -0
  9. data/lib/jekyll/{templates/site_template/.gitignore → site_template/.gitignore.erb} +0 -0
  10. data/lib/jekyll/{templates/classic_template → site_template}/Gemfile.erb +9 -5
  11. data/lib/jekyll/{templates/site_template → site_template}/_config.yml.erb +15 -5
  12. data/lib/jekyll/{templates/site_template → site_template}/_posts/0000-00-00-welcome-to-jekyll.md.erb +2 -0
  13. data/lib/jekyll/{templates/site_template/about.md → site_template/about.md.erb} +4 -0
  14. data/lib/jekyll/{templates/site_template/index.md → site_template/index.html.erb} +1 -0
  15. data/lib/patches/idempotent_jekyll_config.rb +41 -0
  16. data/lib/patches/jekyll_watcher.rb +59 -0
  17. data/lib/patches/listen_windows_adapter.rb +8 -0
  18. data/lib/patches/mercenary_presenter.rb +38 -0
  19. metadata +46 -38
  20. data/lib/jekyll/commands/new.rb +0 -190
  21. data/lib/jekyll/templates/classic_template/_config.yml.erb +0 -37
  22. data/lib/jekyll/templates/classic_template/theme_folders/_includes/disqus_comments.html +0 -20
  23. data/lib/jekyll/templates/classic_template/theme_folders/_includes/footer.html +0 -46
  24. data/lib/jekyll/templates/classic_template/theme_folders/_includes/google-analytics.html +0 -11
  25. data/lib/jekyll/templates/classic_template/theme_folders/_includes/head.html +0 -16
  26. data/lib/jekyll/templates/classic_template/theme_folders/_includes/header.html +0 -27
  27. data/lib/jekyll/templates/classic_template/theme_folders/_includes/icon-github.html +0 -1
  28. data/lib/jekyll/templates/classic_template/theme_folders/_includes/icon-github.svg +0 -1
  29. data/lib/jekyll/templates/classic_template/theme_folders/_includes/icon-twitter.html +0 -1
  30. data/lib/jekyll/templates/classic_template/theme_folders/_includes/icon-twitter.svg +0 -1
  31. data/lib/jekyll/templates/classic_template/theme_folders/_layouts/default.html +0 -20
  32. data/lib/jekyll/templates/classic_template/theme_folders/_layouts/home.html +0 -25
  33. data/lib/jekyll/templates/classic_template/theme_folders/_layouts/page.html +0 -14
  34. data/lib/jekyll/templates/classic_template/theme_folders/_layouts/post.html +0 -18
  35. data/lib/jekyll/templates/classic_template/theme_folders/_sass/_base.scss +0 -198
  36. data/lib/jekyll/templates/classic_template/theme_folders/_sass/_layout.scss +0 -237
  37. data/lib/jekyll/templates/classic_template/theme_folders/_sass/_syntax-highlighting.scss +0 -71
  38. data/lib/jekyll/templates/classic_template/theme_folders/assets/main.scss +0 -47
  39. data/lib/jekyll/templates/site_template/Gemfile.erb +0 -24
@@ -0,0 +1,8 @@
1
+ module Listen
2
+ module Adapter
3
+ class Windows < Base
4
+ def self.usable?
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,38 @@
1
+ module Mercenary
2
+ class Presenter
3
+ attr_accessor :command
4
+
5
+ def options_presentation
6
+ return nil unless command_options_presentation || parent_command_options_presentation
7
+ [command_options_presentation.cyan, parent_command_options_presentation].join("\n\n").rstrip
8
+ end
9
+
10
+ def parent_command_options_presentation
11
+ return nil unless command.parent
12
+ Presenter.new(command.parent).command_options_presentation
13
+ end
14
+
15
+ # adapted from https://github.com/jekyll/mercenary/pull/44
16
+ def command_options_presentation
17
+ return nil if command.options.empty?
18
+ command_options = command.options
19
+ command_options -= command.parent.options unless command.parent.nil?
20
+ command_options.map(&:to_s).join("\n")
21
+ end
22
+
23
+ def command_header
24
+ header = "\n#{command.identity}"
25
+ header << " -- #{command.description}" if command.description
26
+ header
27
+ end
28
+ end
29
+
30
+ class Option
31
+ def formatted_switches
32
+ [
33
+ switches.first.rjust(10),
34
+ switches.last.ljust(20)
35
+ ].join(", ").gsub(/ , /, ' ').gsub(/, /, ' ')
36
+ end
37
+ end
38
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ashwin Maroli
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-28 00:00:00.000000000 Z
11
+ date: 2017-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -16,28 +16,48 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.3'
19
+ version: '3.4'
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: '3.3'
26
+ version: '3.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: jekyll-data
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '1.12'
47
+ version: '1.14'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 1.14.3
34
51
  type: :development
35
52
  prerelease: false
36
53
  version_requirements: !ruby/object:Gem::Requirement
37
54
  requirements:
38
55
  - - "~>"
39
56
  - !ruby/object:Gem::Version
40
- version: '1.12'
57
+ version: '1.14'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 1.14.3
41
61
  - !ruby/object:Gem::Dependency
42
62
  name: rake
43
63
  requirement: !ruby/object:Gem::Requirement
@@ -53,56 +73,44 @@ dependencies:
53
73
  - !ruby/object:Gem::Version
54
74
  version: '10.0'
55
75
  - !ruby/object:Gem::Dependency
56
- name: minitest
76
+ name: cucumber
57
77
  requirement: !ruby/object:Gem::Requirement
58
78
  requirements:
59
79
  - - "~>"
60
80
  - !ruby/object:Gem::Version
61
- version: '5.0'
81
+ version: '2.1'
62
82
  type: :development
63
83
  prerelease: false
64
84
  version_requirements: !ruby/object:Gem::Requirement
65
85
  requirements:
66
86
  - - "~>"
67
87
  - !ruby/object:Gem::Version
68
- version: '5.0'
88
+ version: '2.1'
69
89
  description:
70
90
  email:
71
91
  - ashmaroli@gmail.com
72
- executables: []
92
+ executables:
93
+ - jekyll+
73
94
  extensions: []
74
95
  extra_rdoc_files: []
75
96
  files:
76
97
  - LICENSE.txt
77
98
  - README.md
99
+ - exe/jekyll+
78
100
  - lib/jekyll-plus.rb
79
101
  - lib/jekyll-plus/version.rb
80
- - lib/jekyll/commands/new.rb
81
- - lib/jekyll/templates/classic_template/Gemfile.erb
82
- - lib/jekyll/templates/classic_template/_config.yml.erb
83
- - lib/jekyll/templates/classic_template/theme_folders/_includes/disqus_comments.html
84
- - lib/jekyll/templates/classic_template/theme_folders/_includes/footer.html
85
- - lib/jekyll/templates/classic_template/theme_folders/_includes/google-analytics.html
86
- - lib/jekyll/templates/classic_template/theme_folders/_includes/head.html
87
- - lib/jekyll/templates/classic_template/theme_folders/_includes/header.html
88
- - lib/jekyll/templates/classic_template/theme_folders/_includes/icon-github.html
89
- - lib/jekyll/templates/classic_template/theme_folders/_includes/icon-github.svg
90
- - lib/jekyll/templates/classic_template/theme_folders/_includes/icon-twitter.html
91
- - lib/jekyll/templates/classic_template/theme_folders/_includes/icon-twitter.svg
92
- - lib/jekyll/templates/classic_template/theme_folders/_layouts/default.html
93
- - lib/jekyll/templates/classic_template/theme_folders/_layouts/home.html
94
- - lib/jekyll/templates/classic_template/theme_folders/_layouts/page.html
95
- - lib/jekyll/templates/classic_template/theme_folders/_layouts/post.html
96
- - lib/jekyll/templates/classic_template/theme_folders/_sass/_base.scss
97
- - lib/jekyll/templates/classic_template/theme_folders/_sass/_layout.scss
98
- - lib/jekyll/templates/classic_template/theme_folders/_sass/_syntax-highlighting.scss
99
- - lib/jekyll/templates/classic_template/theme_folders/assets/main.scss
100
- - lib/jekyll/templates/site_template/.gitignore
101
- - lib/jekyll/templates/site_template/Gemfile.erb
102
- - lib/jekyll/templates/site_template/_config.yml.erb
103
- - lib/jekyll/templates/site_template/_posts/0000-00-00-welcome-to-jekyll.md.erb
104
- - lib/jekyll/templates/site_template/about.md
105
- - lib/jekyll/templates/site_template/index.md
102
+ - lib/jekyll/commands/extract_theme.rb
103
+ - lib/jekyll/commands/new_site.rb
104
+ - lib/jekyll/site_template/.gitignore.erb
105
+ - lib/jekyll/site_template/Gemfile.erb
106
+ - lib/jekyll/site_template/_config.yml.erb
107
+ - lib/jekyll/site_template/_posts/0000-00-00-welcome-to-jekyll.md.erb
108
+ - lib/jekyll/site_template/about.md.erb
109
+ - lib/jekyll/site_template/index.html.erb
110
+ - lib/patches/idempotent_jekyll_config.rb
111
+ - lib/patches/jekyll_watcher.rb
112
+ - lib/patches/listen_windows_adapter.rb
113
+ - lib/patches/mercenary_presenter.rb
106
114
  homepage: https://github.com/ashmaroli/jekyll-plus
107
115
  licenses:
108
116
  - MIT
@@ -124,8 +132,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
132
  version: '0'
125
133
  requirements: []
126
134
  rubyforge_project:
127
- rubygems_version: 2.6.7
135
+ rubygems_version: 2.6.10
128
136
  signing_key:
129
137
  specification_version: 4
130
- summary: Additional switches for jekyll new command.
138
+ summary: A tool to simplify Jekyll experience with theme-gems.
131
139
  test_files: []
@@ -1,190 +0,0 @@
1
- require "erb"
2
-
3
- module Jekyll
4
- class Commands::New < Command
5
- class << self
6
- def init_with_program(prog)
7
- end
8
-
9
- def process(args, options = {})
10
- @verbose = options["verbose"]
11
-
12
- raise ArgumentError, "You must specify a path." if args.empty?
13
-
14
- # extract capitalized blog title from the argument(s) when a 'path'
15
- # to the new site has been provided.
16
- # e.g. jekyll new work/blogs/exploring ruby would install a blog
17
- # titled 'Exploring Ruby' at path ~/work/blogs/exploring ruby
18
- blog_title = extract_title args
19
- blog_path = File.expand_path(args.join(" "), Dir.pwd)
20
- FileUtils.mkdir_p blog_path
21
-
22
- if preserve_source_location?(blog_path, options)
23
- Jekyll.logger.abort_with "Conflict:",
24
- "#{blog_path} exists and is not empty."
25
- end
26
-
27
- create_site blog_title, blog_path, options
28
- end
29
-
30
- #
31
- # private methods
32
- #
33
-
34
- private
35
-
36
- # join the arguments given, with a whitespace; replace backslashes, if any
37
- # with a forward slash; split the string into an array again and select the
38
- # last entry.
39
- # Further split the entry along a single whitespace, and map to a new array
40
- # after capitalizing the split-entries. Join them again with a whitespace
41
- # to form the final title string.
42
- def extract_title(args)
43
- a = args.join(" ").tr("\\", "/").split("/").last
44
- a.split.map(&:capitalize).join(" ")
45
- end
46
-
47
- def initialized_post_name
48
- "_posts/#{Time.now.strftime("%Y-%m-%d")}-welcome-to-jekyll.md"
49
- end
50
-
51
- def initialize_git(path)
52
- Jekyll.logger.info "Initialising:", File.join(path, ".git") if @verbose
53
- Dir.chdir(path) { `git init` }
54
- end
55
-
56
- def user_name
57
- name ||= `git config user.name`.chomp
58
- name.empty? ? "Github User" : name
59
- end
60
-
61
- def user_email
62
- email ||= `git config user.email`.chomp
63
- email.empty? ? "your-email@domain.com" : email
64
- end
65
-
66
- def preserve_source_location?(path, options)
67
- !options["force"] && !Dir["#{path}/**/*"].empty?
68
- end
69
-
70
- def create_site(title, path, options)
71
- if options["blank"] && options["verbose"]
72
- create_blank_site path
73
- else
74
- create_sample_files path
75
- add_supporting_files title, path, options
76
- end
77
- after_install title, path, options
78
- end
79
-
80
- def create_blank_site(path)
81
- Dir.chdir(path) do
82
- FileUtils.mkdir(%w(_layouts _posts _drafts))
83
- FileUtils.touch("index.html")
84
- end
85
- end
86
-
87
- def create_sample_files(path)
88
- Jekyll.logger.info "" if @verbose
89
- initialize_git path
90
- FileUtils.mkdir_p(File.expand_path("_posts", path))
91
- source = site_template
92
-
93
- static_files = %w(index.md about.md .gitignore)
94
- static_files.each do |file|
95
- write_file(file, template(file, source), path)
96
- end
97
- write_file(initialized_post_name, template(scaffold_path, source), path)
98
- end
99
-
100
- # adds Gemfile and _config.yml
101
- # additionally creates (updated) SCAFFOLD DIRECTORIES of a Jekyll Theme at
102
- # blog_path when the `--classic` switch is used.
103
- def add_supporting_files(title, path, options)
104
- if options["classic"]
105
- source = classic_template
106
- Jekyll.logger.info "Creating:", "Classic directories and files" if @verbose
107
- FileUtils.cp_r "#{classic_directories}/.", path
108
- else
109
- source = site_template
110
- end
111
- create_config_file title, path, source
112
- write_file("Gemfile", template("Gemfile.erb", source), path)
113
- Jekyll.logger.info "" if @verbose
114
- end
115
-
116
- # create _config.yml pre-populated with blog-title, and author's name & email
117
- # using information from the user's .gitconfig
118
- def create_config_file(title, path, source)
119
- @blog_title = title
120
- @user_name = user_name
121
- @user_email = user_email
122
- config_template = File.expand_path("_config.yml.erb", source)
123
- config_copy = ERB.new(File.read(config_template)).result(binding)
124
-
125
- Jekyll.logger.info "Creating:", File.join(path, "_config.yml") if @verbose
126
- File.open(File.expand_path("_config.yml", path), "w") do |f|
127
- f.write(config_copy)
128
- end
129
- end
130
-
131
- def write_file(filename, contents, path)
132
- full_path = File.expand_path(filename, path)
133
- Jekyll.logger.info "Creating:", full_path if @verbose
134
- File.write(full_path, contents)
135
- end
136
-
137
- def template(filename, source)
138
- erb ||= ThemeBuilder::ERBRenderer.new(self)
139
- erb.render(File.read(File.expand_path(filename, source)))
140
- end
141
-
142
- def site_template
143
- File.expand_path("../templates/site_template", File.dirname(__FILE__))
144
- end
145
-
146
- def classic_template
147
- File.expand_path("../templates/classic_template", File.dirname(__FILE__))
148
- end
149
-
150
- def classic_directories
151
- File.join(classic_template, "theme_folders")
152
- end
153
-
154
- def scaffold_path
155
- "_posts/0000-00-00-welcome-to-jekyll.md.erb"
156
- end
157
-
158
- # After a new blog has been installed, print a success notification and then
159
- # automatically execute bundle install from within the new blog dir unless
160
- # the user opts to generate a classic Jekyll blog or a blank blog or skip
161
- # 'bundle install' using the `--skip-bundle` switch
162
- def after_install(title, path, options)
163
- if options["classic"]
164
- Jekyll.logger.info "New classic jekyll site installed in #{path.cyan}."
165
- elsif options["blank"]
166
- Jekyll.logger.info "New blank jekyll site installed in #{path.cyan}."
167
- else
168
- Jekyll.logger.info "New jekyll site #{title.cyan} installed in #{path.cyan}."
169
- end
170
-
171
- Jekyll.logger.info "Bundle install skipped." if options["skip-bundle"]
172
- unless options["classic"] || options["blank"] || options["skip-bundle"]
173
- bundle_install path
174
- end
175
- end
176
-
177
- def bundle_install(path)
178
- Jekyll::External.require_with_graceful_fail "bundler"
179
- Jekyll.logger.info "Running bundle install in #{path.cyan}..."
180
- Dir.chdir(path) do
181
- if ENV["CI"]
182
- system("bundle", "install", "--quiet")
183
- else
184
- system("bundle", "install")
185
- end
186
- end
187
- end
188
- end
189
- end
190
- end
@@ -1,37 +0,0 @@
1
- # Welcome to Jekyll!
2
- #
3
- # This config file is meant for settings that affect your whole blog, values
4
- # which you are expected to set up once and rarely edit after that. If you find
5
- # yourself editing this file very often, consider using Jekyll's data files
6
- # feature for the data you need to update frequently.
7
- #
8
- # For technical reasons, this file is *NOT* reloaded automatically when you use
9
- # 'bundle exec jekyll serve'. If you change this file, please restart the server process.
10
-
11
- # Site settings
12
- # These are used to personalize your new site. If you look in the HTML files,
13
- # you will see them accessed via {{ site.title }}, {{ site.email }}, and so on.
14
- # You can create any custom variable you would like, and they will be accessible
15
- # in the templates via {{ site.myvariable }}.
16
-
17
- title: your awesome title
18
- email: your-email@domain.com
19
- # the ">" below means to ignore newlines until "baseurl:"
20
- description: >
21
- Write an awesome description for your new site here. You can edit this
22
- line in _config.yml. It will appear in your document head meta (for
23
- Google search results) and in your feed.xml site description.
24
- baseurl: "" # the subpath of your site, e.g. /blog
25
- url: "" # the base hostname & protocol for your site, e.g. http://example.com
26
- twitter_username: jekyllrb
27
- github_username: jekyll
28
-
29
- # Build settings
30
- markdown: kramdown
31
- # uncomment (and edit) the line below when using a theme
32
- # theme: minima
33
- gems:
34
- - jekyll-feed
35
- exclude:
36
- - Gemfile
37
- - Gemfile.lock
@@ -1,20 +0,0 @@
1
- {% if page.comments != false and jekyll.environment == "production" %}
2
-
3
- <div id="disqus_thread"></div>
4
- <script>
5
- var disqus_config = function () {
6
- this.page.url = '{{ page.url | absolute_url }}';
7
- this.page.identifier = '{{ page.url | absolute_url }}';
8
- };
9
-
10
- (function() {
11
- var d = document, s = d.createElement('script');
12
-
13
- s.src = 'https://{{ site.disqus.shortname }}.disqus.com/embed.js';
14
-
15
- s.setAttribute('data-timestamp', +new Date());
16
- (d.head || d.body).appendChild(s);
17
- })();
18
- </script>
19
- <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
20
- {% endif %}