ghpreview 0.0.5 → 0.0.7

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/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in github-preview.gemspec
4
+ gem 'rake'
4
5
  gemspec
data/README.md CHANGED
@@ -33,6 +33,12 @@ option:
33
33
  $ ghpreview -w README.md
34
34
  ```
35
35
 
36
+ To use an alternate browser (Mac only), use the `-a` (or `--application`) option:
37
+
38
+ ```bash
39
+ $ ghpreview -a Safari.app README.md
40
+ ```
41
+
36
42
  ## Why is this better than X?
37
43
 
38
44
  There are several tools available for previewing Markdown files, and many that
@@ -1,17 +1,35 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ trap("INT") { exit }
3
4
  require 'optparse'
4
5
  require 'ghpreview'
5
6
 
6
7
  options = {}
7
8
 
8
- OptionParser.new do |opts|
9
+ optparse = OptionParser.new do |opts|
9
10
  opts.banner = "Usage: ghpreview [options] FILE"
10
11
  opts.separator ""
11
12
 
12
13
  opts.on("-w", "--watch", "Watch for changes") do |w|
13
14
  options[:watch] = w
14
15
  end
15
- end.parse!
16
+
17
+ opts.on("-a", "--application APP", "Alternate browser") do |a|
18
+ options[:application] = a
19
+ end
20
+ end
21
+
22
+ def valid_file? filename
23
+ filename and File.exist?(filename) and File.file?(filename)
24
+ end
25
+
26
+ begin
27
+ optparse.parse!
28
+ unless valid_file? ARGV[0]
29
+ puts "Missing markdown file."
30
+ puts optparse
31
+ exit
32
+ end
33
+ end
16
34
 
17
35
  GHPreview::Previewer.new(ARGV[0], options)
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
19
19
 
20
20
  gem.add_dependency 'listen'
21
21
  gem.add_dependency 'rb-fsevent'
22
- gem.add_dependency 'html-pipeline', '0.0.4'
22
+ gem.add_dependency 'html-pipeline', '0.0.6'
23
23
  gem.add_dependency 'httpclient'
24
- gem.add_dependency 'github-linguist', '2.3.4'
24
+ gem.add_dependency 'github-linguist', '2.1'
25
25
  end
@@ -16,6 +16,7 @@ module GHPreview
16
16
  @http = HTTPClient.new
17
17
  generate_template_with_fingerprinted_stylesheet_links
18
18
 
19
+ @application = options[:application]
19
20
  options[:watch] ? listen : open
20
21
  end
21
22
 
@@ -39,7 +40,7 @@ module GHPreview
39
40
  if RUBY_PLATFORM =~ /linux/
40
41
  command = 'xdg-open'
41
42
  else
42
- command = 'open'
43
+ command = @application ? "open -a #{@application}" : 'open'
43
44
  end
44
45
  `#{command} #{HTML_FILEPATH}`
45
46
  end
@@ -1,3 +1,3 @@
1
1
  module GHPreview
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ghpreview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
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: 2012-12-20 00:00:00.000000000 Z
12
+ date: 2013-04-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: listen
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - '='
52
52
  - !ruby/object:Gem::Version
53
- version: 0.0.4
53
+ version: 0.0.6
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.0.4
61
+ version: 0.0.6
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: httpclient
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -82,7 +82,7 @@ dependencies:
82
82
  requirements:
83
83
  - - '='
84
84
  - !ruby/object:Gem::Version
85
- version: 2.3.4
85
+ version: '2.1'
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -90,7 +90,7 @@ dependencies:
90
90
  requirements:
91
91
  - - '='
92
92
  - !ruby/object:Gem::Version
93
- version: 2.3.4
93
+ version: '2.1'
94
94
  description: Command line utility for previewing Markdown files with Github styling
95
95
  email:
96
96
  - adam@adamlogic.com
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  version: '0'
131
131
  requirements: []
132
132
  rubyforge_project:
133
- rubygems_version: 1.8.24
133
+ rubygems_version: 1.8.23
134
134
  signing_key:
135
135
  specification_version: 3
136
136
  summary: Command line utility for previewing Markdown files with Github styling