github-markup-preview 0.1.0 → 0.1.1
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.
- data/README.md.html +32 -0
 - data/bin/gm-preview +23 -9
 - data/lib/gm-preview.rb +4 -0
 - metadata +10 -8
 - data/.gitignore +0 -1
 - data/gm-preview.gemspec +0 -24
 
    
        data/README.md.html
    ADDED
    
    | 
         @@ -0,0 +1,32 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <html>
         
     | 
| 
      
 2 
     | 
    
         
            +
            <head>
         
     | 
| 
      
 3 
     | 
    
         
            +
            <link href='C:/h/p/ruby/lib/ruby/gems/1.9.1/gems/github-markup-preview-0.1.1/bin/../css/css1.css' media='screen' rel='stylesheet'
         
     | 
| 
      
 4 
     | 
    
         
            +
            type='text/css' />
         
     | 
| 
      
 5 
     | 
    
         
            +
            <link href='C:/h/p/ruby/lib/ruby/gems/1.9.1/gems/github-markup-preview-0.1.1/bin/../css/css2.css' media='screen' rel='stylesheet'
         
     | 
| 
      
 6 
     | 
    
         
            +
            type='text/css' />
         
     | 
| 
      
 7 
     | 
    
         
            +
            </head>
         
     | 
| 
      
 8 
     | 
    
         
            +
            <body>
         
     | 
| 
      
 9 
     | 
    
         
            +
            <div id='wrapper'>
         
     | 
| 
      
 10 
     | 
    
         
            +
            <div class='site hfeed' itemscope itemtype='http://schema.org/WebPage'>
         
     | 
| 
      
 11 
     | 
    
         
            +
            <div class='container hentry'>
         
     | 
| 
      
 12 
     | 
    
         
            +
            <div id='js-repo-pjax-container'>
         
     | 
| 
      
 13 
     | 
    
         
            +
            <div id='slider'>
         
     | 
| 
      
 14 
     | 
    
         
            +
            <div class='frames'>
         
     | 
| 
      
 15 
     | 
    
         
            +
            <div class='frame frame-center'>
         
     | 
| 
      
 16 
     | 
    
         
            +
            <div class='announce instapaper_body mdown' data-path='/' id='readme'>
         
     | 
| 
      
 17 
     | 
    
         
            +
              <span class='name'>
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
              </span>
         
     | 
| 
      
 20 
     | 
    
         
            +
              <article class='markdown-body entry-content' itemprop='mainContentOfPage'><h1 id='githubmarkuppreview'>github-markup-preview</h1>
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            <h2 id='description'>Description</h2>
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            <p>See <code>gm-preview.gemspec</code> for a description. Once installed, run <code>gm-preview -h</code> for usage guidelines.</p>
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            <p>WARNING: This gem is pretty new. Use with infinite caution.</p>
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            <h2 id='install'>Install</h2>
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            <pre><code>gem install github-markup-preview</code></pre>
         
     | 
| 
      
 31 
     | 
    
         
            +
            </article></div></div></div></div></div></div></div></div>
         
     | 
| 
      
 32 
     | 
    
         
            +
                </body></html>
         
     | 
    
        data/bin/gm-preview
    CHANGED
    
    | 
         @@ -21,21 +21,34 @@ $optparse = OptionParser.new do |opts| 
     | 
|
| 
       21 
21 
     | 
    
         
             
              opts.on('-h', '--help', 'Print help for this command.') do
         
     | 
| 
       22 
22 
     | 
    
         
             
                $options[:help] = true
         
     | 
| 
       23 
23 
     | 
    
         
             
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
              opts.on('-v', '--version', 'Display the current version.') do
         
     | 
| 
      
 25 
     | 
    
         
            +
                $options[:version] = true
         
     | 
| 
      
 26 
     | 
    
         
            +
                puts Gem.loaded_specs['github-markup-preview'].version.to_s
         
     | 
| 
      
 27 
     | 
    
         
            +
              end
         
     | 
| 
       24 
28 
     | 
    
         
             
            end
         
     | 
| 
       25 
29 
     | 
    
         
             
            $optparse.parse!
         
     | 
| 
       26 
     | 
    
         
            -
            $options[:help] ||=  
     | 
| 
      
 30 
     | 
    
         
            +
            $options[:help] ||= $options.size == 0
         
     | 
| 
       27 
31 
     | 
    
         | 
| 
       28 
32 
     | 
    
         
             
            if $options[:help]
         
     | 
| 
       29 
33 
     | 
    
         | 
| 
       30 
34 
     | 
    
         
             
              puts "USAGE: gm-preview [-c][-r][-w][-h][<directory>]
         
     | 
| 
       31 
     | 
    
         
            -
             
     | 
| 
       32 
     | 
    
         
            -
            <directory>  
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            Compiles markdown files (.md) under <directory> to html. The output file name is \
         
     | 
| 
      
 37 
     | 
    
         
            +
            formed by appending .html to the input file name, yielding a file name with \
         
     | 
| 
      
 38 
     | 
    
         
            +
            .md.html extension. This allows for the -d flag to distinguish between compiled \
         
     | 
| 
      
 39 
     | 
    
         
            +
            markdown files and other html files.
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            <directory> defaults to the current directory.  At least one of '-w', '-r' or \
         
     | 
| 
      
 42 
     | 
    
         
            +
            '-d' options needs to be supplied.\n\n"
         
     | 
| 
       34 
43 
     | 
    
         | 
| 
       35 
44 
     | 
    
         
             
              puts $optparse.summarize
         
     | 
| 
       36 
45 
     | 
    
         | 
| 
       37 
     | 
    
         
            -
              puts "\ 
     | 
| 
      
 46 
     | 
    
         
            +
              puts "\nUsing -d with -c causes all output files to be deleted then \
         
     | 
| 
      
 47 
     | 
    
         
            +
            regenerated."
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
              puts "\nWith '-w', when changes are detected, the markdown files are \
         
     | 
| 
       38 
50 
     | 
    
         
             
            (re)compiled to html. Addition and removal of markdown files are not detected.
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
       39 
52 
     | 
    
         
             
            '-w' requires you to have the 'watchr' gem installed."
         
     | 
| 
       40 
53 
     | 
    
         | 
| 
       41 
54 
     | 
    
         
             
              exit 0
         
     | 
| 
         @@ -61,8 +74,7 @@ type='text/css' /> 
     | 
|
| 
       61 
74 
     | 
    
         
             
            <div class='frame frame-center'>
         
     | 
| 
       62 
75 
     | 
    
         
             
            <div class='announce instapaper_body mdown' data-path='/' id='readme'>
         
     | 
| 
       63 
76 
     | 
    
         
             
              <span class='name'>
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
                Preview
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
       66 
78 
     | 
    
         
             
              </span>
         
     | 
| 
       67 
79 
     | 
    
         
             
              <article class='markdown-body entry-content' itemprop='mainContentOfPage'>"
         
     | 
| 
       68 
80 
     | 
    
         | 
| 
         @@ -71,7 +83,7 @@ $html_post="</article></div></div></div></div></div></div></div></div> 
     | 
|
| 
       71 
83 
     | 
    
         | 
| 
       72 
84 
     | 
    
         
             
            def rebuild(md_file)
         
     | 
| 
       73 
85 
     | 
    
         
             
                html_file = "#{md_file}.html"
         
     | 
| 
       74 
     | 
    
         
            -
                puts "rebuild #{ 
     | 
| 
      
 86 
     | 
    
         
            +
                puts "rebuild #{html_file}"
         
     | 
| 
       75 
87 
     | 
    
         
             
                File.open(html_file, "w") {|f| f.write($html_pre) }
         
     | 
| 
       76 
88 
     | 
    
         
             
                system "github-markup #{md_file} >> #{html_file}"
         
     | 
| 
       77 
89 
     | 
    
         
             
                File.open(html_file, "a") {|f| f.write($html_post) }
         
     | 
| 
         @@ -112,4 +124,6 @@ if $options[:compile] 
     | 
|
| 
       112 
124 
     | 
    
         
             
              end
         
     | 
| 
       113 
125 
     | 
    
         
             
            end
         
     | 
| 
       114 
126 
     | 
    
         | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
      
 127 
     | 
    
         
            +
            if $options[:watch]
         
     | 
| 
      
 128 
     | 
    
         
            +
              watchr($pattern_w, $dir) do |m| rebuild m[0] end
         
     | 
| 
      
 129 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/gm-preview.rb
    ADDED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: github-markup-preview
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.1
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date:  
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2013-01-13 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: github-markup
         
     | 
| 
         @@ -52,12 +52,14 @@ executables: 
     | 
|
| 
       52 
52 
     | 
    
         
             
            extensions: []
         
     | 
| 
       53 
53 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       54 
54 
     | 
    
         
             
            files:
         
     | 
| 
       55 
     | 
    
         
            -
            -  
     | 
| 
       56 
     | 
    
         
            -
            -  
     | 
| 
       57 
     | 
    
         
            -
            -  
     | 
| 
       58 
     | 
    
         
            -
            -  
     | 
| 
       59 
     | 
    
         
            -
            -  
     | 
| 
       60 
     | 
    
         
            -
            -  
     | 
| 
      
 55 
     | 
    
         
            +
            - ./bin/gm-preview
         
     | 
| 
      
 56 
     | 
    
         
            +
            - ./css/css1.css
         
     | 
| 
      
 57 
     | 
    
         
            +
            - ./css/css2.css
         
     | 
| 
      
 58 
     | 
    
         
            +
            - ./lib/gm-preview.rb
         
     | 
| 
      
 59 
     | 
    
         
            +
            - ./README.md
         
     | 
| 
      
 60 
     | 
    
         
            +
            - ./README.md.html
         
     | 
| 
      
 61 
     | 
    
         
            +
            - !binary |-
         
     | 
| 
      
 62 
     | 
    
         
            +
              YmluL2dtLXByZXZpZXc=
         
     | 
| 
       61 
63 
     | 
    
         
             
            homepage: http://github.com/norswap/github-markup-preview
         
     | 
| 
       62 
64 
     | 
    
         
             
            licenses:
         
     | 
| 
       63 
65 
     | 
    
         
             
            - BSD 3-clauses
         
     | 
    
        data/.gitignore
    DELETED
    
    | 
         @@ -1 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            *.gem
         
     | 
    
        data/gm-preview.gemspec
    DELETED
    
    | 
         @@ -1,24 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            $summary =
         
     | 
| 
       2 
     | 
    
         
            -
                "Preview your markdown files as html using the github look and feel."
         
     | 
| 
       3 
     | 
    
         
            -
            $description =
         
     | 
| 
       4 
     | 
    
         
            -
                "Uses the 'github-markup' gem to compiler your markdown files to html. " \
         
     | 
| 
       5 
     | 
    
         
            -
                "html is then formatted the same way as it is on github. Includes " \
         
     | 
| 
       6 
     | 
    
         
            -
                "options to compile all files under a directory, to watch for changes " \
         
     | 
| 
       7 
     | 
    
         
            -
                "and to delete generated files."
         
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
            Gem::Specification.new do |s|
         
     | 
| 
       10 
     | 
    
         
            -
              s.name                = "github-markup-preview"
         
     | 
| 
       11 
     | 
    
         
            -
              s.version             = "0.1.0"
         
     | 
| 
       12 
     | 
    
         
            -
              s.summary             = $summary
         
     | 
| 
       13 
     | 
    
         
            -
              s.description         = $description
         
     | 
| 
       14 
     | 
    
         
            -
              s.author              = "Nicolas 'Norswap' Laurent"
         
     | 
| 
       15 
     | 
    
         
            -
              s.email               = "norswap@gmail.com"
         
     | 
| 
       16 
     | 
    
         
            -
              s.homepage            = "http://github.com/norswap/github-markup-preview"
         
     | 
| 
       17 
     | 
    
         
            -
              s.bindir              = "bin"
         
     | 
| 
       18 
     | 
    
         
            -
              s.executables         = "gm-preview"
         
     | 
| 
       19 
     | 
    
         
            -
              s.files               = `git ls-files`.strip.split("\n")
         
     | 
| 
       20 
     | 
    
         
            -
              s.license             = "BSD 3-clauses"
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
              s.add_runtime_dependency "github-markup"
         
     | 
| 
       23 
     | 
    
         
            -
              s.add_runtime_dependency "watchr"
         
     | 
| 
       24 
     | 
    
         
            -
            end
         
     |