qwandry 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/TODO +5 -1
- data/VERSION +1 -1
- data/bin/qw +4 -4
- data/lib/qwandry/launcher.rb +16 -4
- data/lib/qwandry.rb +22 -0
- metadata +4 -4
data/TODO
CHANGED
@@ -4,4 +4,8 @@ TODO, or perhaps not...
|
|
4
4
|
- Allow better customization of repositories
|
5
5
|
- Customize collection phase (see LibraryRepository)
|
6
6
|
- Customize naming phase
|
7
|
-
-
|
7
|
+
- If the user is using rvm, add the ruby src directory to the search path, maybe merge it with the normal ruby
|
8
|
+
- Examples: opening digest could get you both the ruby and the C sources.
|
9
|
+
- For editors that don't support multi opening collections of files (ie: ./digest.rb and ./digest/) we could trick them by adding symlinks in a temp dir.
|
10
|
+
- Could be an option... might be a terrible idea :)
|
11
|
+
- Instead of requiring users to find and configure other languages, small scripts for perl, python, etc. could introspect on their load paths.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/bin/qw
CHANGED
@@ -34,14 +34,14 @@ opts = OptionParser.new do |opts|
|
|
34
34
|
end
|
35
35
|
|
36
36
|
opts.on("--customize", "Create and edit files for customizing Qwandry") do
|
37
|
-
dir =
|
37
|
+
dir = Qwandry.config_dir
|
38
38
|
if !dir
|
39
|
-
puts "
|
39
|
+
puts "HOME directory must be defined."
|
40
40
|
exit(1)
|
41
41
|
else
|
42
|
-
FileUtils.
|
42
|
+
FileUtils.mkdir_p(dir, :verbose=>true) unless File.exist?(dir)
|
43
43
|
Dir[File.dirname(__FILE__) + '/../templates/*'].each do |path|
|
44
|
-
FileUtils.cp(path, dir, :verbose=>true
|
44
|
+
FileUtils.cp(path, dir, :verbose=>true) unless File.exist?(path)
|
45
45
|
end
|
46
46
|
@qwandry.launch dir
|
47
47
|
end
|
data/lib/qwandry/launcher.rb
CHANGED
@@ -70,7 +70,11 @@ module Qwandry
|
|
70
70
|
end
|
71
71
|
|
72
72
|
paths = package.is_a?(String) ? [package] : package.paths
|
73
|
-
|
73
|
+
# Editors may have options, 'mate -w' for instance
|
74
|
+
editor_and_options = editor.strip.split(/\s+/)
|
75
|
+
|
76
|
+
# Launch the editor with its options and any paths that we have been passed
|
77
|
+
system(*(editor_and_options + paths))
|
74
78
|
end
|
75
79
|
|
76
80
|
private
|
@@ -95,9 +99,17 @@ module Qwandry
|
|
95
99
|
end
|
96
100
|
|
97
101
|
def custom_configuration!
|
98
|
-
|
99
|
-
|
100
|
-
|
102
|
+
if config_dir = Qwandry.config_dir
|
103
|
+
custom_path = File.join(config_dir, 'init.rb')
|
104
|
+
if File.exist?(custom_path)
|
105
|
+
begin
|
106
|
+
eval IO.read(custom_path), nil, custom_path, 1
|
107
|
+
rescue Exception=>ex
|
108
|
+
STDERR.puts "Warning: error in custom file: #{custom_path.inspect}"
|
109
|
+
STDERR.puts "Exception: #{ex.message}"
|
110
|
+
STDERR.puts ex.backtrace
|
111
|
+
end
|
112
|
+
end
|
101
113
|
end
|
102
114
|
end
|
103
115
|
|
data/lib/qwandry.rb
CHANGED
@@ -21,4 +21,26 @@ module Qwandry
|
|
21
21
|
autoload :FlatRepository, "qwandry/flat_repository"
|
22
22
|
autoload :LibraryRepository, "qwandry/library_repository"
|
23
23
|
autoload :Package, "qwandry/package"
|
24
|
+
end
|
25
|
+
|
26
|
+
# If defined, Qwandry will use XDG_CONFIG_HOME as the xdg spec. If not it
|
27
|
+
# will check for an existing `~/.qwandry`. Finally it will fall back to
|
28
|
+
# `~/.config/qwandry`.
|
29
|
+
#
|
30
|
+
# Returns either the path the +config_dir+ or +nil+ if HOME is not defined.
|
31
|
+
#
|
32
|
+
# XDG Spec:
|
33
|
+
# http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
34
|
+
#
|
35
|
+
def Qwandry.config_dir
|
36
|
+
subdir = '/.qwandry/'
|
37
|
+
if ENV['XDG_CONFIG_HOME']
|
38
|
+
File.join(ENV['XDG_CONFIG_HOME'], subdir)
|
39
|
+
elsif File.exist? File.join(ENV['HOME'], subdir)
|
40
|
+
File.join(ENV['HOME'], subdir)
|
41
|
+
elsif ENV['HOME']
|
42
|
+
File.join(ENV['HOME'],'.config', subdir)
|
43
|
+
else
|
44
|
+
nil
|
45
|
+
end
|
24
46
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qwandry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Adam Sanderson
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-12-
|
18
|
+
date: 2010-12-11 00:00:00 -08:00
|
19
19
|
default_executable: qw
|
20
20
|
dependencies: []
|
21
21
|
|