jekyll_and_hyde 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2010 Jingwen Owen Ou
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.markdown ADDED
@@ -0,0 +1,45 @@
1
+ # JekyllAndHyde
2
+
3
+ JekyllAndHyde is a HTML presentation generator that generates a basic [Jekyll][1] scaffold with [Slippy][2] hooking up.
4
+
5
+ # Jekyll
6
+
7
+ Jekyll is a blog aware static site generator that powers [GitHub Pages][3]. It takes a template directory (representing the raw form of a website), runs it through Textile or Markdown and Liquid converters, and spits out a complete, static website suitable for serving with Apache or your favorite web server. GitHub Pages is set up in a way that whenever you push markup files into its Git repository, Jekyll will automatically render them and generate a static website.
8
+
9
+ # Slippy
10
+
11
+ Slippy is HTML presentation library written with jQuery that takes a HTML file in and plays the presentation in any browser.
12
+
13
+ # Why?
14
+
15
+ Combining Jekyll and Slippy can provide a powerful yet simple solution to create presentations: you use the jekyll_and_hyde gem to generate a Jekyll scaffold with Slippy properly hooking up; you write your slides using Makrdown or Textile; then you publish your slides by pushing it to a Git repository.
16
+
17
+ # How?
18
+
19
+ ## Installation:
20
+
21
+ > gem install jekyll_and_hyde
22
+
23
+ ## Generation:
24
+
25
+ > jh new my_slides --github
26
+ > cd my_slides
27
+ > jh generate my-first-slide
28
+
29
+ The "--github" optional flag in "jh new" means setting up branching information for GitHub Pages.
30
+
31
+ ## Other tasks:
32
+
33
+ > jh github
34
+ > jh list [SEARCH]
35
+ > jh help [TASK]
36
+
37
+ The "github" task is to set up branching information for GitHub Pages. The "list" task is to list the available tasks by giving it an optional SEARCH terms. The "help" is to display the usage for a specific task.
38
+
39
+ # License
40
+
41
+ MIT License. Details see LICENSE.
42
+
43
+ [1]: https://github.com/mojombo/jekyll
44
+ [2]: https://github.com/Seldaek/slippy
45
+ [3]: http://pages.github.com/
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.email = ["owen@owenou.com"]
11
11
  s.homepage = "http://github.com/jingweno/jekyll_and_hyde"
12
12
  s.summary = %q{A simple HTML presentation generator based on jekyll and slippy.}
13
- s.description = %q{jekyll_and_hyde is a simple HTML presentation generator based on jekyll(https://github.com/mojombo/jekyll) and slippy(https://github.com/Seldaek/slippy).}
13
+ s.description = %q{JekyllAndHyde is a HTML presentation generator that generates a basic Jekyll scaffold with Slippy hooking up.}
14
14
 
15
15
  s.rubyforge_project = "jekyll_and_hyde"
16
16
 
@@ -1,12 +1,9 @@
1
1
  module JekyllAndHyde
2
2
  module Actions
3
- def inside_app_path(config = {}, &block)
4
- inside app_path, config, &block
5
- end
6
-
7
3
  def run_command(command, config={})
8
4
  result = run(command, config)
9
5
  raise Error, "Errors occured when running command \"#{command}\"." unless result
6
+ result
10
7
  end
11
8
 
12
9
  def say_status(status, message, log_status=true)
@@ -16,5 +13,10 @@ module JekyllAndHyde
16
13
  def set_color(string, color, bold=false)
17
14
  self.shell.set_color(string, color, bold)
18
15
  end
16
+
17
+ def validate_installation
18
+ self.class.source_root(destination_root)
19
+ find_in_source_paths("_config.yml")
20
+ end
19
21
  end
20
22
  end
@@ -0,0 +1,10 @@
1
+ module JekyllAndHyde
2
+ class GroupTask < Thor::Group
3
+ include Thor::Actions
4
+ include JekyllAndHyde::Actions
5
+
6
+ def self.self_task
7
+ Thor::DynamicTask.new(self.namespace.split(':').last, class_options)
8
+ end
9
+ end
10
+ end
@@ -37,7 +37,7 @@ class JekyllAndHyde::Runner < Thor
37
37
 
38
38
  def start_task(klass, task, args)
39
39
  if klass.nil?
40
- say "Don't know how to build task '#{JekyllAndHyde.trim_namespace(task)}'."
40
+ say "Don't know how to run task '#{JekyllAndHyde.trim_namespace(task)}'."
41
41
  else
42
42
  klass.start(args, :shell => self.shell)
43
43
  end
@@ -50,11 +50,11 @@ class JekyllAndHyde::Runner < Thor
50
50
  # Display information about the given klasses. If with_module is given,
51
51
  # it shows a table with information extracted from the yaml file.
52
52
  def display_klasses(klasses=Thor::Base.subclasses)
53
- klasses -= JekyllAndHyde::Group.ancestors
53
+ klasses -= JekyllAndHyde::GroupTask.ancestors
54
54
  raise Error, "No JekyllAndHyde tasks available" if klasses.empty?
55
55
 
56
56
  list = Hash.new { |h, k| h[k] = [] }
57
- groups = klasses.select { |k| k.ancestors.include?(Thor::Group) }
57
+ groups = klasses.select { |k| k.ancestors.include?(JekyllAndHyde::GroupTask) }
58
58
 
59
59
  # Get classes which inherit from Thor
60
60
  (klasses - groups).each { |k| list[k.namespace.split(":").first] += k.printable_tasks(false) }
@@ -1,14 +1,13 @@
1
1
  module JekyllAndHyde
2
- class Generate < JekyllAndHyde::Group
2
+ class Generate < JekyllAndHyde::GroupTask
3
3
  argument :title, :type => :string, :required => true, :desc => "The title of the slide."
4
4
  class_option :format, :type => :string, :default => 'markdown', :desc => 'The format of the slide. It supports markdown and textile.'
5
5
  desc "Generate a slide using the defined template."
6
6
 
7
7
  SUPPORT_FORMATS = %W{markdown md textile}
8
8
 
9
- def validate_current_folder
10
- self.class.source_root(destination_root)
11
- find_in_source_paths("_config.yml")
9
+ def validate_current_installation
10
+ validate_installation
12
11
  end
13
12
 
14
13
  def create_slide
@@ -0,0 +1,30 @@
1
+ module JekyllAndHyde
2
+ class Github < JekyllAndHyde::GroupTask
3
+ desc "Create branching information for GitHub Project Pages, details in http://pages.github.com/."
4
+
5
+ def validate_current_installation
6
+ validate_installation
7
+ end
8
+
9
+ def check_uncommited_files
10
+ output = run_command 'git status', :capture => true
11
+ raise Error, "There are uncommited changes. Please commit them first." unless output.include?("nothing to commit")
12
+ end
13
+
14
+ def create_github_page_branch
15
+ run_command 'git checkout -b gh-pages'
16
+ run_command 'git branch -d master'
17
+ say_status :create, 'branch "gh-pages" for GitHub project page, details in http://pages.github.com/.'
18
+ say
19
+ end
20
+
21
+ def print_next_steps
22
+ next_step_string = "Next steps:"
23
+ say set_color(next_step_string, :blue, true)
24
+ say "-" * next_step_string.size
25
+ say 'git remote add origin git@github.com:your_github_username/your_git_repo.git'
26
+ say 'git push origin gh-pages'
27
+ say
28
+ end
29
+ end
30
+ end
@@ -1,5 +1,5 @@
1
1
  module JekyllAndHyde
2
- class New < JekyllAndHyde::Group
2
+ class New < JekyllAndHyde::GroupTask
3
3
  JEKYLL_AND_HYDE_TEMPLATE_GIT_REPO = 'git://github.com/jingweno/jekyll_and_hyde_template.git'
4
4
  SLIPPY_GIT_REPO = 'git://github.com/jingweno/slippy.git'
5
5
 
@@ -40,29 +40,22 @@ module JekyllAndHyde
40
40
  def create_git_hub_page
41
41
  if options.github?
42
42
  inside_app_path do
43
- create_github_page_branch()
44
- say
45
- print_next_steps()
46
- say
43
+ # Commit all changes
44
+ run_command 'git commit -am "Template files generated by jekyll_and_hyde."'
45
+ invoke_github_task
47
46
  end
48
47
  end
49
48
  end
50
49
 
51
50
  private
52
51
 
53
- def create_github_page_branch
54
- run_command 'git commit -am "Template files generated by jekyll_and_hyde."'
55
- run_command 'git checkout -b gh-pages'
56
- run_command 'git branch -d master'
57
- say_status :create, 'branch "gh-pages" for GitHub project page, details in http://pages.github.com/.'
52
+ def inside_app_path(config = {}, &block)
53
+ inside app_path, config, &block
58
54
  end
59
55
 
60
- def print_next_steps
61
- next_step_string = "Next steps:"
62
- say set_color(next_step_string, :blue, true)
63
- say "-" * next_step_string.size
64
- say 'git remote add origin git@github.com:your_github_username/your_git_repo.git'
65
- say 'git push origin gh-pages'
56
+ def invoke_github_task
57
+ klass = JekyllAndHyde::Util.find_class_and_task_by_namespace("github").first
58
+ klass.start([], :shell => self.shell)
66
59
  end
67
60
  end
68
61
  end
@@ -1,3 +1,3 @@
1
1
  module JekyllAndHyde
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -11,7 +11,8 @@ require 'jekyll_and_hyde/thor_ext'
11
11
  require 'jekyll_and_hyde/actions'
12
12
  require 'jekyll_and_hyde/error'
13
13
  require 'jekyll_and_hyde/util'
14
- require 'jekyll_and_hyde/group'
14
+ require 'jekyll_and_hyde/group_task'
15
15
  require 'jekyll_and_hyde/tasks/new'
16
16
  require 'jekyll_and_hyde/tasks/generate'
17
+ require 'jekyll_and_hyde/tasks/github'
17
18
  require 'jekyll_and_hyde/runner'
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
+ - 1
7
8
  - 0
8
- - 0
9
- version: 1.0.0
9
+ version: 1.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jingwen Owen Ou
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-26 00:00:00 -08:00
17
+ date: 2011-01-28 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -69,7 +69,7 @@ dependencies:
69
69
  version: "0"
70
70
  type: :development
71
71
  version_requirements: *id004
72
- description: jekyll_and_hyde is a simple HTML presentation generator based on jekyll(https://github.com/mojombo/jekyll) and slippy(https://github.com/Seldaek/slippy).
72
+ description: JekyllAndHyde is a HTML presentation generator that generates a basic Jekyll scaffold with Slippy hooking up.
73
73
  email:
74
74
  - owen@owenou.com
75
75
  executables:
@@ -82,6 +82,8 @@ files:
82
82
  - .gitignore
83
83
  - .rspec
84
84
  - Gemfile
85
+ - LICENSE
86
+ - README.markdown
85
87
  - Rakefile
86
88
  - bin/jh
87
89
  - features/presenter_creates_a_skeletal_installation.feature
@@ -93,10 +95,11 @@ files:
93
95
  - lib/jekyll_and_hyde/actions.rb
94
96
  - lib/jekyll_and_hyde/core_ext/string.rb
95
97
  - lib/jekyll_and_hyde/error.rb
96
- - lib/jekyll_and_hyde/group.rb
98
+ - lib/jekyll_and_hyde/group_task.rb
97
99
  - lib/jekyll_and_hyde/namespace.rb
98
100
  - lib/jekyll_and_hyde/runner.rb
99
101
  - lib/jekyll_and_hyde/tasks/generate.rb
102
+ - lib/jekyll_and_hyde/tasks/github.rb
100
103
  - lib/jekyll_and_hyde/tasks/new.rb
101
104
  - lib/jekyll_and_hyde/thor_ext.rb
102
105
  - lib/jekyll_and_hyde/util.rb
@@ -1,7 +0,0 @@
1
- module JekyllAndHyde
2
- class Group < Thor::Group
3
- include JekyllAndHyde::ThorExt
4
- include Thor::Actions
5
- include JekyllAndHyde::Actions
6
- end
7
- end