refs 0.0.2 → 0.0.3
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 +1 -0
- data/Gemfile.lock +6 -0
- data/bin/refs +3 -0
- data/lib/refs/refs.rb +28 -0
- data/lib/refs.rb +2 -1
- data/refs.gemspec +1 -0
- metadata +13 -2
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
configuration (1.2.0)
|
5
|
+
launchy (0.4.0)
|
6
|
+
configuration (>= 0.0.5)
|
7
|
+
rake (>= 0.8.1)
|
4
8
|
maruku (0.6.0)
|
5
9
|
syntax (>= 1.0.0)
|
10
|
+
rake (0.8.7)
|
6
11
|
syntax (1.0.0)
|
7
12
|
trollop (1.16.2)
|
8
13
|
|
@@ -10,5 +15,6 @@ PLATFORMS
|
|
10
15
|
ruby
|
11
16
|
|
12
17
|
DEPENDENCIES
|
18
|
+
launchy
|
13
19
|
maruku
|
14
20
|
trollop
|
data/bin/refs
CHANGED
@@ -22,6 +22,7 @@ Where [options] are:
|
|
22
22
|
EOS
|
23
23
|
opt :delete, "Delete a reference."
|
24
24
|
opt :list, "List references."
|
25
|
+
opt :edit, "Edit the reference if it already exists. If this option isn't provided and the reference is accessed and it exists, it will be converted from Markdown to HTML and opened in the default web browser."
|
25
26
|
end
|
26
27
|
|
27
28
|
ref = ARGV.shift
|
@@ -30,6 +31,8 @@ if opts[:list] == true
|
|
30
31
|
Refs::list
|
31
32
|
elsif opts[:delete] == true
|
32
33
|
Refs::delete_ref(ref)
|
34
|
+
elsif opts[:edit] == true
|
35
|
+
Refs::edit_ref(ref)
|
33
36
|
else
|
34
37
|
Refs::access_ref(ref)
|
35
38
|
end
|
data/lib/refs/refs.rb
CHANGED
@@ -5,12 +5,40 @@ module Refs
|
|
5
5
|
if !Dir.exists?(REF_DIR)
|
6
6
|
Dir.mkdir(REF_DIR)
|
7
7
|
end
|
8
|
+
Dir.chdir(REF_DIR)
|
9
|
+
|
10
|
+
the_ref = ref.dup
|
11
|
+
the_ref.strip!
|
12
|
+
|
13
|
+
if File.exists?("#{the_ref}.md")
|
14
|
+
file_content = ""
|
15
|
+
File.open("#{the_ref}.md", 'r') do |f|
|
16
|
+
f.each_line do |line|
|
17
|
+
file_content << line
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
doc = Maruku.new(file_content)
|
22
|
+
html_contents = doc.to_html_document
|
23
|
+
|
24
|
+
File.open("#{the_ref}.html", 'w') do |f|
|
25
|
+
f.write html_contents
|
26
|
+
Launchy::Browser.run(File.absolute_path(f))
|
27
|
+
end
|
28
|
+
else
|
29
|
+
system("#{ENV['EDITOR']} \"#{the_ref}.md\"")
|
30
|
+
exit 0
|
31
|
+
end
|
8
32
|
end
|
9
33
|
|
10
34
|
def list
|
11
35
|
|
12
36
|
end
|
13
37
|
|
38
|
+
def edit_ref(ref)
|
39
|
+
|
40
|
+
end
|
41
|
+
|
14
42
|
def delete_ref(ref)
|
15
43
|
|
16
44
|
end
|
data/lib/refs.rb
CHANGED
data/refs.gemspec
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: refs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Mark Szymanski
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-04-01 00:00:00 -05:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -35,6 +35,17 @@ dependencies:
|
|
35
35
|
version: "0"
|
36
36
|
type: :runtime
|
37
37
|
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: launchy
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id003
|
38
49
|
description:
|
39
50
|
email: mrman208@me.com
|
40
51
|
executables:
|