mdpresent 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +49 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +30 -0
- data/Rakefile +1 -0
- data/bin/mdpresent +5 -0
- data/lib/config.rb +12 -0
- data/lib/en.yml +42 -0
- data/lib/mdpresent.rb +24 -0
- data/lib/mdpresent/cli.rb +77 -0
- data/lib/mdpresent/command.rb +46 -0
- data/lib/mdpresent/github.rb +60 -0
- data/lib/mdpresent/heroku.rb +64 -0
- data/lib/mdpresent/home_page_generator.rb +52 -0
- data/lib/mdpresent/logger.rb +10 -0
- data/lib/mdpresent/scm.rb +54 -0
- data/lib/mdpresent/templates/index.erubis +38 -0
- data/lib/mdpresent/templates/index.html +35 -0
- data/lib/mdpresent/templates/index.php +1 -0
- data/lib/mdpresent/templates/md_files/demo.md +107 -0
- data/lib/mdpresent/templates/styles.css +136 -0
- data/lib/mdpresent/templates/www/mdpfile +5 -0
- data/lib/mdpresent/version.rb +3 -0
- data/mdpresent.gemspec +30 -0
- metadata +195 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3b2b7b0d035023a8589418d7184b9dd5b0b71344
|
4
|
+
data.tar.gz: ca9751caba661e50f104c6a666ee18a9d49c1723
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9b75ac636d778c9315dc711ba762f910735e4d07e11b3f19bd450fa741217dde6d2603c207690455feb200d3f67729839eb8d13ac034509eb2d250da21278ae2
|
7
|
+
data.tar.gz: 88778293a14a60653153b44a2932dfe08fa75259824f43ae6ecad7ed0eba23d8c87c742b503807b50b268ffd71f6016588f1667fda5589f83a56f1a38cee8da3
|
data/.gitignore
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
/.config
|
19
|
+
/coverage/
|
20
|
+
/InstalledFiles
|
21
|
+
/pkg/
|
22
|
+
/spec/reports/
|
23
|
+
/test/tmp/
|
24
|
+
/test/version_tmp/
|
25
|
+
/tmp/
|
26
|
+
|
27
|
+
## Specific to RubyMotion:
|
28
|
+
.dat*
|
29
|
+
.repl_history
|
30
|
+
build/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalisation:
|
39
|
+
/.bundle/
|
40
|
+
/lib/bundler/man/
|
41
|
+
|
42
|
+
# for a library or gem, you might want to ignore these files since the code is
|
43
|
+
# intended to run in multiple environments; otherwise, check them in:
|
44
|
+
# Gemfile.lock
|
45
|
+
# .ruby-version
|
46
|
+
# .ruby-gemset
|
47
|
+
|
48
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
49
|
+
.rvmrc
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Ankit Goyal
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Mdpresent
|
2
|
+
|
3
|
+
Wrapper over mdpress for easy deployment
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'mdpresent'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install mdpresent
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
30
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/mdpresent
ADDED
data/lib/config.rb
ADDED
data/lib/en.yml
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
en:
|
3
|
+
platform_not_supported: platform %{platform} not supported yet.
|
4
|
+
install_heroku_toolbelt: heroku toolbelt not found. please install from https://toolbelt.heroku.com/
|
5
|
+
commands:
|
6
|
+
heroku:
|
7
|
+
login: heroku login
|
8
|
+
create: heroku create
|
9
|
+
deploy: git push heroku master
|
10
|
+
open: heroku open
|
11
|
+
bundle_install: bundle install
|
12
|
+
git:
|
13
|
+
status: git status
|
14
|
+
init: git init
|
15
|
+
which: which git
|
16
|
+
heroku_remote: git remote | grep heroku
|
17
|
+
origin_remote: git remote | grep origin
|
18
|
+
initial_add: git add index.erubis www md_files index.php index.html styles.css
|
19
|
+
initial_commit: git commit -m 'initial commit %{date_time}'
|
20
|
+
gh_pages_remote: git branch | grep gh-pages
|
21
|
+
checkout_master: git checkout master
|
22
|
+
mdpress:
|
23
|
+
mdpress: mdpress %{args}
|
24
|
+
gen: mdpress %{file}
|
25
|
+
watch: mdpress -a %{file}
|
26
|
+
style: mdpress -s %{style} %{file}
|
27
|
+
list: mdpress -l
|
28
|
+
github:
|
29
|
+
create_gh_pages: git checkout -b gh-pages
|
30
|
+
add_remote: git remote add origin http://github.com/%{user_name}/%{repo_name}
|
31
|
+
switch_to_gh_page: git checkout gh-pages
|
32
|
+
merge_master: git merge master
|
33
|
+
switch_to_master: git checkout master
|
34
|
+
push_gh_pages_to_github: git push origin gh-pages
|
35
|
+
errors:
|
36
|
+
git_init_failed: git init failed!\nPlease make sure `git init` succeeds before continuing
|
37
|
+
git_witch_failed: git is not installed. Please install `git` before continuing
|
38
|
+
heroku_deploy_failed: heroku deploy failed. You could manually try running `git push heroku master` \n\n\nPlease file a bug report with stack trace at http://github.com/goyalankit/mdpresent
|
39
|
+
heroku_open_failed: heroku open failed. You could manually try running `heroku open` \n\n\nPlease file a bug report with stack trace at http://github.com/goyalankit/mdpresent
|
40
|
+
heroku_login_failed: login to heroku failed. please try again.
|
41
|
+
heroku_create_failed: heroku create failed. please try again.
|
42
|
+
|
data/lib/mdpresent.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require "mdpresent/version"
|
2
|
+
require "mdpresent/command"
|
3
|
+
require "mdpresent/heroku"
|
4
|
+
require "mdpresent/scm"
|
5
|
+
require "mdpresent/logger"
|
6
|
+
require "mdpresent/home_page_generator"
|
7
|
+
require "mdpresent/github"
|
8
|
+
require "config"
|
9
|
+
|
10
|
+
module Mdpresent
|
11
|
+
|
12
|
+
# globals
|
13
|
+
PLATFORMS = [ "heroku", "github" ]
|
14
|
+
|
15
|
+
def self.platform
|
16
|
+
return :heroku if Git.heroku_remote_present?
|
17
|
+
return :github if Git.gh_pages_branch_present?
|
18
|
+
end
|
19
|
+
|
20
|
+
# get the root of gem
|
21
|
+
def self.root
|
22
|
+
File.expand_path '../..', __FILE__
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
|
2
|
+
require 'thor'
|
3
|
+
require 'mdpresent'
|
4
|
+
module Mdpresent
|
5
|
+
class CLI < Thor
|
6
|
+
|
7
|
+
desc "new", "create a new project for presentations"
|
8
|
+
def new dir_name
|
9
|
+
begin
|
10
|
+
# create directory if it doesn't exist already
|
11
|
+
FileUtils.mkdir_p(dir_name) unless File.directory?(dir_name)
|
12
|
+
|
13
|
+
# copy the template files to user directory
|
14
|
+
FileUtils.cp_r(Dir.glob("#{Mdpresent.root}/lib/mdpresent/templates/*") , dir_name)
|
15
|
+
rescue
|
16
|
+
puts $!, $@
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
desc "setup heroku", "setup the platform. Currently only \"heroku\" is supported"
|
21
|
+
def setup platform
|
22
|
+
abort I18n.t :platform_not_supported, { platform: platform } unless PLATFORMS.include?(platform.downcase)
|
23
|
+
case platform.downcase
|
24
|
+
when "heroku"
|
25
|
+
Heroku.setup
|
26
|
+
when "github"
|
27
|
+
Github.setup
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
desc "generate file", "generate file from markdown"
|
32
|
+
def generate file
|
33
|
+
Command.generate_presentation file, {action: :default}
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "update_home", "update the home page with new presentations"
|
37
|
+
def update_home
|
38
|
+
home_page_generator = HomePageGenerator.new
|
39
|
+
home_page_generator.generate
|
40
|
+
end
|
41
|
+
|
42
|
+
desc "open", "open app in browser"
|
43
|
+
def open
|
44
|
+
case Mdpresent.platform
|
45
|
+
when :heroku
|
46
|
+
Heroku.open
|
47
|
+
when :github
|
48
|
+
Github.open
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
desc "deploy", "deploy app to production"
|
53
|
+
def deploy
|
54
|
+
case Mdpresent.platform
|
55
|
+
when :heroku
|
56
|
+
Heroku.deploy
|
57
|
+
when :github
|
58
|
+
Github.deploy
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
desc "watch", "auto-update the presentation files"
|
63
|
+
def watch file
|
64
|
+
Command.generate_presentation file, {action: :watch}
|
65
|
+
end
|
66
|
+
|
67
|
+
desc "style", "apply style to your presentation"
|
68
|
+
def style style, file
|
69
|
+
Command.generate_presentation file, {action: :style, style: style}
|
70
|
+
end
|
71
|
+
|
72
|
+
desc "list", "list all the stylesheets"
|
73
|
+
def list
|
74
|
+
Command.execute I18n.t("commands.mdpress.list")
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Mdpresent
|
2
|
+
class Command
|
3
|
+
|
4
|
+
require "shellwords"
|
5
|
+
|
6
|
+
class << self
|
7
|
+
def path cmd
|
8
|
+
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
9
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
10
|
+
exts.each { |ext|
|
11
|
+
exe = File.join(path, "#{cmd}#{ext}")
|
12
|
+
return exe if File.executable? exe
|
13
|
+
}
|
14
|
+
end
|
15
|
+
return nil
|
16
|
+
end
|
17
|
+
|
18
|
+
def generate_presentation file, options
|
19
|
+
# get the absolute path of mdfile provided by user.
|
20
|
+
file_with_path = File.expand_path(file)
|
21
|
+
|
22
|
+
# use git to get the project root
|
23
|
+
project_root = `git rev-parse --show-toplevel`.strip
|
24
|
+
|
25
|
+
# run mdpress generate command inside the www dir.
|
26
|
+
# since this is where we want to keep all the generated code.
|
27
|
+
Dir.chdir "#{project_root}/www"
|
28
|
+
puts "Generating presentation files..."
|
29
|
+
case options[:action]
|
30
|
+
when :default
|
31
|
+
execute I18n.t "commands.mdpress.gen", { file: file_with_path }
|
32
|
+
when :style
|
33
|
+
execute I18n.t("commands.mdpress.style", {style: options[:style], file: file_with_path})
|
34
|
+
when :watch
|
35
|
+
execute I18n.t("commands.mdpress.watch", {file: file_with_path})
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def execute cmd
|
40
|
+
Logger.log("[command.execution] executing #{cmd}")
|
41
|
+
system cmd
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Mdpresent
|
2
|
+
class Github
|
3
|
+
require 'launchy'
|
4
|
+
attr_accessor :github
|
5
|
+
|
6
|
+
class << self
|
7
|
+
def setup
|
8
|
+
Git.setup_git
|
9
|
+
# setup the repo if not already set
|
10
|
+
setup_repo unless Git.origin_remote_present?
|
11
|
+
|
12
|
+
success = make_initial_commit
|
13
|
+
|
14
|
+
abort "Aborting..git add was unsucessful" unless success
|
15
|
+
|
16
|
+
create_gh_pages_branch unless Git.gh_pages_branch_present?
|
17
|
+
|
18
|
+
Command.execute I18n.t("commands.git.checkout_master")
|
19
|
+
end
|
20
|
+
|
21
|
+
def make_initial_commit
|
22
|
+
success = true
|
23
|
+
success &&= Command.execute I18n.t("commands.git.initial_add")
|
24
|
+
success &&= Command.execute I18n.t("commands.git.initial_commit", date_time: Time.now)
|
25
|
+
end
|
26
|
+
|
27
|
+
def create_gh_pages_branch
|
28
|
+
Command.execute I18n.t("commands.github.create_gh_pages")
|
29
|
+
end
|
30
|
+
|
31
|
+
def setup_repo
|
32
|
+
|
33
|
+
print "Enter your github username: "
|
34
|
+
user_name = $stdin.gets
|
35
|
+
print "Enter the repo name: "
|
36
|
+
repo_name = $stdin.gets
|
37
|
+
|
38
|
+
# add remote to git
|
39
|
+
unless user_name.nil? || user_name.empty? || repo_name.nil? || repo_name.empty?
|
40
|
+
success = Git.git_add_remote(user_name, repo_name)
|
41
|
+
fail("unable to add git remote") unless success
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def deploy
|
46
|
+
Command.execute I18n.t("commands.github.switch_to_gh_page")
|
47
|
+
Command.execute I18n.t("commands.github.merge_master")
|
48
|
+
Command.execute I18n.t("commands.github.switch_to_master")
|
49
|
+
Command.execute I18n.t("commands.github.push_gh_pages_to_github")
|
50
|
+
end
|
51
|
+
|
52
|
+
def open
|
53
|
+
url = `git config --get remote.origin.url`
|
54
|
+
user_name, repo_name = url.strip.match(/http:\/\/github.com\/(.*)\/(.*)/).captures
|
55
|
+
Launchy.open("http://#{user_name}.github.com/#{repo_name}")
|
56
|
+
end
|
57
|
+
end # end of self
|
58
|
+
end # end of class
|
59
|
+
end # end of module
|
60
|
+
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module Mdpresent
|
2
|
+
class Heroku
|
3
|
+
|
4
|
+
attr_accessor :heroku
|
5
|
+
|
6
|
+
class << self
|
7
|
+
|
8
|
+
# check that heroku toolbelt is installed
|
9
|
+
# heroku login - authenticate with heroku
|
10
|
+
# heroku create - create new app and add remote to .git/config
|
11
|
+
def setup
|
12
|
+
Logger.log("starting the setup...")
|
13
|
+
@heroku = Command.path("heroku")
|
14
|
+
abort I18n.t :install_heroku_toolbelt unless @heroku
|
15
|
+
|
16
|
+
puts "[S] Found heroku toolbelt..."
|
17
|
+
|
18
|
+
# login to heroku
|
19
|
+
login
|
20
|
+
|
21
|
+
# create heroku app
|
22
|
+
create
|
23
|
+
end
|
24
|
+
|
25
|
+
def login
|
26
|
+
|
27
|
+
# check if heroku remote is already present.
|
28
|
+
# return, since heroku create has already been run
|
29
|
+
if Git.heroku_remote_present?
|
30
|
+
Logger.log("Heroku remote already present. Exiting.")
|
31
|
+
puts "Heroku already setup."
|
32
|
+
exit 1
|
33
|
+
end
|
34
|
+
|
35
|
+
success = Command.execute I18n.t("commands.heroku.login")
|
36
|
+
abort I18n.t("errors.heroku_login_failed") unless success
|
37
|
+
end
|
38
|
+
|
39
|
+
def create
|
40
|
+
|
41
|
+
# check if git is installed.
|
42
|
+
# initialize the repo if not already
|
43
|
+
Git.setup_git
|
44
|
+
|
45
|
+
puts "Creating new heroku app..."
|
46
|
+
success = Command.execute I18n.t("commands.heroku.create")
|
47
|
+
success &&= Command.execute I18n.t("commands.git.initial_add")
|
48
|
+
success &&= Command.execute I18n.t("commands.git.initial_commit", date_time: Time.now)
|
49
|
+
abort I18n.t("errors.heroku_create_failed") unless success
|
50
|
+
end
|
51
|
+
|
52
|
+
def deploy
|
53
|
+
success = Command.execute I18n.t("commands.heroku.deploy")
|
54
|
+
abort I18n.t("errors.heroku_deploy_failed") unless success
|
55
|
+
end
|
56
|
+
|
57
|
+
def open
|
58
|
+
success = Command.execute I18n.t("commands.heroku.open")
|
59
|
+
abort I18n.t("errors.heroku_open_failed") unless success
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'erubis'
|
2
|
+
require 'parseconfig'
|
3
|
+
|
4
|
+
module Mdpresent
|
5
|
+
class HomePageGenerator
|
6
|
+
def generate
|
7
|
+
puts "Generating home page..."
|
8
|
+
# file with template variables
|
9
|
+
home_page_input = File.read('index.erubis')
|
10
|
+
|
11
|
+
# create eruby object
|
12
|
+
home_page_eruby = Erubis::Eruby.new(home_page_input)
|
13
|
+
|
14
|
+
link_desc_map = get_link_description_map
|
15
|
+
|
16
|
+
# generate home.html page
|
17
|
+
File.write('index.html', home_page_eruby.result(:link_desc => link_desc_map))
|
18
|
+
end
|
19
|
+
|
20
|
+
def get_link_description_map
|
21
|
+
project_root = `git rev-parse --show-toplevel`.strip
|
22
|
+
|
23
|
+
# get the directory names from www directory
|
24
|
+
Dir.chdir("#{project_root}/www")
|
25
|
+
presentation_dirs = Dir.glob("*").select {|f| File.directory? f}
|
26
|
+
custom_desc = get_custom_description
|
27
|
+
|
28
|
+
# go back to home directory
|
29
|
+
Dir.chdir("#{project_root}")
|
30
|
+
|
31
|
+
link_desc = {}
|
32
|
+
presentation_dirs.each do |dir_name|
|
33
|
+
if custom_desc.keys.include?(dir_name)
|
34
|
+
link_desc["./www/#{dir_name}"] = custom_desc[dir_name]
|
35
|
+
else
|
36
|
+
link_desc["./www/#{dir_name}"] = dir_name
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
link_desc
|
41
|
+
end
|
42
|
+
|
43
|
+
def get_custom_description
|
44
|
+
if File.exists?('mdpfile')
|
45
|
+
config = ParseConfig.new('mdpfile')
|
46
|
+
return config.params
|
47
|
+
else
|
48
|
+
return {}
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module Mdpresent
|
2
|
+
class Git
|
3
|
+
|
4
|
+
class << self
|
5
|
+
def git_installed?
|
6
|
+
Logger.log("Checking if git is installed...")
|
7
|
+
success = Command.execute I18n.t("commands.git.which")
|
8
|
+
|
9
|
+
fail I18n.t("errors.git_which_failed") unless success
|
10
|
+
end
|
11
|
+
|
12
|
+
def is_git_repo?
|
13
|
+
Logger.log("Checking if already a git repo")
|
14
|
+
Command.execute I18n.t("commands.git.status")
|
15
|
+
end
|
16
|
+
|
17
|
+
def git_init
|
18
|
+
Logger.log("Initializing git repo now...")
|
19
|
+
success = Command.execute I18n.t("commands.git.init")
|
20
|
+
|
21
|
+
fail I18n.t("errors.git_init_failed") unless success
|
22
|
+
end
|
23
|
+
|
24
|
+
def setup_git
|
25
|
+
Logger.log("Setting up git...")
|
26
|
+
# check if git is installed
|
27
|
+
git_installed?
|
28
|
+
|
29
|
+
# initialize the repo if not already
|
30
|
+
git_init unless is_git_repo?
|
31
|
+
end
|
32
|
+
|
33
|
+
def heroku_remote_present?
|
34
|
+
Command.execute I18n.t("commands.git.heroku_remote")
|
35
|
+
end
|
36
|
+
|
37
|
+
def origin_remote_present?
|
38
|
+
puts "Checking if remote present..."
|
39
|
+
Command.execute I18n.t("commands.git.origin_remote")
|
40
|
+
end
|
41
|
+
|
42
|
+
def git_add_remote user_name, repo_name
|
43
|
+
puts "Adding remote..."
|
44
|
+
Command.execute I18n.t("commands.github.add_remote", {user_name: user_name.strip, repo_name: repo_name.strip})
|
45
|
+
end
|
46
|
+
|
47
|
+
def gh_pages_branch_present?
|
48
|
+
puts "Adding branch for github pages.."
|
49
|
+
Command.execute I18n.t("commands.git.gh_pages_remote")
|
50
|
+
end
|
51
|
+
end # end of class << self
|
52
|
+
|
53
|
+
end # end of class Git
|
54
|
+
end # end of Module
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<title>Slides | ankitgoyal.me</title>
|
6
|
+
<!-- The stylesheet -->
|
7
|
+
<link rel="stylesheet" href="styles.css" />
|
8
|
+
<!--[if lt IE 9]>
|
9
|
+
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
10
|
+
<![endif]-->
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<div class="container">
|
14
|
+
<caption> This page showcaseis my awesome slides! </caption>
|
15
|
+
|
16
|
+
|
17
|
+
<ul>
|
18
|
+
<% link_desc.each do |lnk, desc| %>
|
19
|
+
<li><a href="<%= lnk %>"><%= desc%></a></li>
|
20
|
+
<% end %>
|
21
|
+
<%# here is ignored because starting with '#' %>
|
22
|
+
</ul>
|
23
|
+
<!--<ol>-->
|
24
|
+
<!--<li><a href="llvm-instruction-selection/main/index.html">LLVM instruction selection presentation</a></li>-->
|
25
|
+
<!--<li><a href="llvm-pragmas/main/index.html">LLVM pragmas</a></li>-->
|
26
|
+
<!--</ol>-->
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<footer>
|
30
|
+
<!--Copyright © 2014 <b>Ankit Goyal</b>-->
|
31
|
+
<b>Credits:</b> <br/>
|
32
|
+
Slides made using <a href="https://github.com/egonSchiele/mdpress">mdpress</a><br/>
|
33
|
+
Deployed on <a href="http://heroku.com/">heroku</a><br/><br/>
|
34
|
+
<a href="http://goyalankit.com/"><i>Copyright © 2014 <b>Ankit Goyal</b></i></a>
|
35
|
+
|
36
|
+
</footer>
|
37
|
+
</body>
|
38
|
+
</html>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<title>Slides | ankitgoyal.me</title>
|
6
|
+
<!-- The stylesheet -->
|
7
|
+
<link rel="stylesheet" href="styles.css" />
|
8
|
+
<!--[if lt IE 9]>
|
9
|
+
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
10
|
+
<![endif]-->
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
<div class="container">
|
14
|
+
<caption> This page showcases my awesome slides! </caption>
|
15
|
+
|
16
|
+
|
17
|
+
<ul>
|
18
|
+
</ul>
|
19
|
+
<!--<ol>-->
|
20
|
+
<!--<li><a href="llvm-instruction-selection/main/index.html">LLVM instruction selection presentation</a></li>-->
|
21
|
+
<!--<li><a href="llvm-pragmas/main/index.html">LLVM pragmas</a></li>-->
|
22
|
+
<!--</ol>-->
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<footer>
|
26
|
+
<!--Copyright © 2014 <b>Ankit Goyal</b>-->
|
27
|
+
<b>Credits:</b> <br/>
|
28
|
+
Deployed using <a href="https://github.com/goyalankit">mdpresent</a><br/>
|
29
|
+
Slides made using <a href="https://github.com/egonSchiele/mdpress">mdpress</a><br/>
|
30
|
+
Deployed on <a href="http://heroku.com/">heroku</a><br/><br/>
|
31
|
+
<a href="http://goyalankit.com/"><i>Copyright © 2014 <b>Ankit Goyal</b></i></a>
|
32
|
+
|
33
|
+
</footer>
|
34
|
+
</body>
|
35
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<?php include_once("index.html"); ?>
|
@@ -0,0 +1,107 @@
|
|
1
|
+
---
|
2
|
+
author: Ankit Goyal
|
3
|
+
title: introduction to mdpresent tool
|
4
|
+
---
|
5
|
+
# Mdpresent
|
6
|
+
## a quick presentation deployment tool
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
## Concept
|
11
|
+
> write in **markdown**, deploy on **heroku** or **github**, show the
|
12
|
+
> whole **world**!
|
13
|
+
|
14
|
+
---
|
15
|
+
|
16
|
+
## Getting started
|
17
|
+
|
18
|
+
> Install the mdpresent ruby gem
|
19
|
+
|
20
|
+
gem install mdpresent
|
21
|
+
|
22
|
+
---
|
23
|
+
|
24
|
+
## How to setup github pages
|
25
|
+
|
26
|
+
---
|
27
|
+
|
28
|
+
* Create a new repo at github.com
|
29
|
+
* Create a new mdpresent project
|
30
|
+
|
31
|
+
```
|
32
|
+
mdpresent new slides
|
33
|
+
```
|
34
|
+
|
35
|
+
* Setup the github pages
|
36
|
+
|
37
|
+
```
|
38
|
+
mdpresent setup github
|
39
|
+
```
|
40
|
+
|
41
|
+
* Enter your username and reponame (that you created in step 1)
|
42
|
+
* You are all set!
|
43
|
+
|
44
|
+
---
|
45
|
+
|
46
|
+
## Creating and deploying a presentation
|
47
|
+
|
48
|
+
---
|
49
|
+
|
50
|
+
* Create a new presentation file in md\_files folder
|
51
|
+
|
52
|
+
```
|
53
|
+
cd md_files
|
54
|
+
touch presentation.md
|
55
|
+
```
|
56
|
+
|
57
|
+
* Write those insightful ideas in presentation.md
|
58
|
+
* At any time, generate your presentation.
|
59
|
+
|
60
|
+
```
|
61
|
+
mdpresent gen md_files/presentation.md
|
62
|
+
```
|
63
|
+
* Add all the files in www/presentation and presentation.md to git*
|
64
|
+
|
65
|
+
```
|
66
|
+
git add www md_files
|
67
|
+
git commit -am 'presentation on mdpresent'
|
68
|
+
```
|
69
|
+
|
70
|
+
|
71
|
+
---
|
72
|
+
|
73
|
+
* deploy your presentation
|
74
|
+
|
75
|
+
```
|
76
|
+
mdpresent deploy
|
77
|
+
```
|
78
|
+
|
79
|
+
* Generate homepage
|
80
|
+
|
81
|
+
```
|
82
|
+
mdpresent update_home
|
83
|
+
```
|
84
|
+
|
85
|
+
* Open the public url
|
86
|
+
|
87
|
+
```
|
88
|
+
mdpresent open
|
89
|
+
```
|
90
|
+
|
91
|
+
---
|
92
|
+
|
93
|
+
> You can very easily deploy on heroku platform too..
|
94
|
+
|
95
|
+
Visit http://github.com/goyalankit/mdpresent
|
96
|
+
|
97
|
+
---
|
98
|
+
|
99
|
+
## Credits
|
100
|
+
|
101
|
+
> Thanks to **@egonSchiele** for writing **mdpress** gem to generate presentations.
|
102
|
+
|
103
|
+
---
|
104
|
+
|
105
|
+
# Thanks!
|
106
|
+
|
107
|
+
|
@@ -0,0 +1,136 @@
|
|
1
|
+
/*-------------------------
|
2
|
+
Simple reset
|
3
|
+
--------------------------*/
|
4
|
+
|
5
|
+
|
6
|
+
*{
|
7
|
+
margin:0;
|
8
|
+
padding:0;
|
9
|
+
}
|
10
|
+
|
11
|
+
|
12
|
+
/*-------------------------
|
13
|
+
General Styles
|
14
|
+
--------------------------*/
|
15
|
+
|
16
|
+
|
17
|
+
html{
|
18
|
+
/* This image will be displayed fullscreen */
|
19
|
+
/*background:url('background.jpg') no-repeat center center;*/
|
20
|
+
|
21
|
+
/* Ensure the html element always takes up the full height of the browser window */
|
22
|
+
min-height:100%;
|
23
|
+
|
24
|
+
/* The Magic */
|
25
|
+
background-size:cover;
|
26
|
+
}
|
27
|
+
|
28
|
+
body{
|
29
|
+
/* Workaround for some mobile browsers */
|
30
|
+
min-height:100%;
|
31
|
+
font:14px/1.3 'Segoe UI',Arial, sans-serif;
|
32
|
+
}
|
33
|
+
|
34
|
+
a, a:visited {
|
35
|
+
outline:none;
|
36
|
+
color:#1c4f64;
|
37
|
+
}
|
38
|
+
|
39
|
+
a:hover{
|
40
|
+
text-decoration:none;
|
41
|
+
}
|
42
|
+
|
43
|
+
section, footer, header{
|
44
|
+
display: block;
|
45
|
+
}
|
46
|
+
|
47
|
+
.container {
|
48
|
+
color: 000;
|
49
|
+
font-family: Courier;
|
50
|
+
/*font-family: Verdana, sans-serif;*/
|
51
|
+
font-size: 20px;
|
52
|
+
margin: 55px;
|
53
|
+
margin-left: 12%;
|
54
|
+
}
|
55
|
+
|
56
|
+
ol {
|
57
|
+
margin-top: 50px;
|
58
|
+
margin-left: 30px;
|
59
|
+
}
|
60
|
+
|
61
|
+
.container li a {
|
62
|
+
margin-top: 20px;
|
63
|
+
left: 60px;
|
64
|
+
font-size: 14px;
|
65
|
+
color: #000;
|
66
|
+
/*text-decoration: none;*/
|
67
|
+
}
|
68
|
+
|
69
|
+
.container li a:hover {
|
70
|
+
color: #666;
|
71
|
+
}
|
72
|
+
|
73
|
+
footer{
|
74
|
+
position: absolute;
|
75
|
+
margin-top: 10%;
|
76
|
+
margin-left: 11%;
|
77
|
+
font-family: Courier;
|
78
|
+
}
|
79
|
+
|
80
|
+
footer a{
|
81
|
+
|
82
|
+
text-decoration: none;
|
83
|
+
}
|
84
|
+
|
85
|
+
/*----------------------------
|
86
|
+
The Footer
|
87
|
+
-----------------------------*/
|
88
|
+
|
89
|
+
/*
|
90
|
+
footer{
|
91
|
+
background-color: #111111;
|
92
|
+
bottom: 0;
|
93
|
+
box-shadow: 0 -1px 2px rgba(0,0,0,0.4);
|
94
|
+
height: 45px;
|
95
|
+
left: 0;
|
96
|
+
position: fixed;
|
97
|
+
width: 100%;
|
98
|
+
z-index: 100000;
|
99
|
+
}
|
100
|
+
|
101
|
+
footer h2{
|
102
|
+
color: #EEEEEE;
|
103
|
+
font-size: 14px;
|
104
|
+
font-weight: normal;
|
105
|
+
left: 50%;
|
106
|
+
margin-left: -400px;
|
107
|
+
padding: 13px 0 0;
|
108
|
+
position: absolute;
|
109
|
+
width: 540px;
|
110
|
+
}
|
111
|
+
|
112
|
+
footer h2 i{
|
113
|
+
font-style:normal;
|
114
|
+
color:#888;
|
115
|
+
}
|
116
|
+
|
117
|
+
footer a.tzine,a.tzine:visited{
|
118
|
+
color: #999999;
|
119
|
+
font-size: 12px;
|
120
|
+
left: 50%;
|
121
|
+
margin: 16px 0 0 110px;
|
122
|
+
position: absolute;
|
123
|
+
text-decoration: none;
|
124
|
+
top: 0;
|
125
|
+
}
|
126
|
+
|
127
|
+
footer a i{
|
128
|
+
color:#ccc;
|
129
|
+
font-style: normal;
|
130
|
+
}
|
131
|
+
|
132
|
+
footer a i b{
|
133
|
+
color:#c92020;
|
134
|
+
font-weight: normal;
|
135
|
+
}
|
136
|
+
*/
|
data/mdpresent.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mdpresent/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "mdpresent"
|
8
|
+
spec.version = Mdpresent::VERSION
|
9
|
+
spec.authors = ["Ankit Goyal"]
|
10
|
+
spec.email = ["ankit3goyal@gmail.com"]
|
11
|
+
spec.description = %q{publish quick presentations from markdown files}
|
12
|
+
spec.summary = %q{wrapper over mdpress to publish quick markdown files}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_dependency "thor"
|
24
|
+
spec.add_dependency "i18n"
|
25
|
+
spec.add_dependency "erubis"
|
26
|
+
spec.add_dependency "parseconfig"
|
27
|
+
spec.add_dependency "mdpress"
|
28
|
+
spec.add_dependency "launchy"
|
29
|
+
spec.add_development_dependency "pry"
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,195 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mdpresent
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ankit Goyal
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: i18n
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: erubis
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: parseconfig
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: mdpress
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: launchy
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pry
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: publish quick presentations from markdown files
|
140
|
+
email:
|
141
|
+
- ankit3goyal@gmail.com
|
142
|
+
executables:
|
143
|
+
- mdpresent
|
144
|
+
extensions: []
|
145
|
+
extra_rdoc_files: []
|
146
|
+
files:
|
147
|
+
- ".gitignore"
|
148
|
+
- Gemfile
|
149
|
+
- LICENSE
|
150
|
+
- README.md
|
151
|
+
- Rakefile
|
152
|
+
- bin/mdpresent
|
153
|
+
- lib/config.rb
|
154
|
+
- lib/en.yml
|
155
|
+
- lib/mdpresent.rb
|
156
|
+
- lib/mdpresent/cli.rb
|
157
|
+
- lib/mdpresent/command.rb
|
158
|
+
- lib/mdpresent/github.rb
|
159
|
+
- lib/mdpresent/heroku.rb
|
160
|
+
- lib/mdpresent/home_page_generator.rb
|
161
|
+
- lib/mdpresent/logger.rb
|
162
|
+
- lib/mdpresent/scm.rb
|
163
|
+
- lib/mdpresent/templates/index.erubis
|
164
|
+
- lib/mdpresent/templates/index.html
|
165
|
+
- lib/mdpresent/templates/index.php
|
166
|
+
- lib/mdpresent/templates/md_files/demo.md
|
167
|
+
- lib/mdpresent/templates/styles.css
|
168
|
+
- lib/mdpresent/templates/www/mdpfile
|
169
|
+
- lib/mdpresent/version.rb
|
170
|
+
- mdpresent.gemspec
|
171
|
+
homepage: ''
|
172
|
+
licenses:
|
173
|
+
- MIT
|
174
|
+
metadata: {}
|
175
|
+
post_install_message:
|
176
|
+
rdoc_options: []
|
177
|
+
require_paths:
|
178
|
+
- lib
|
179
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - ">="
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '0'
|
184
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - ">="
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: '0'
|
189
|
+
requirements: []
|
190
|
+
rubyforge_project:
|
191
|
+
rubygems_version: 2.2.2
|
192
|
+
signing_key:
|
193
|
+
specification_version: 4
|
194
|
+
summary: wrapper over mdpress to publish quick markdown files
|
195
|
+
test_files: []
|