qwandry 0.1.4 → 0.1.5
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/Rakefile +11 -20
- data/bin/qw +10 -0
- data/lib/qwandry/configuration.rb +4 -2
- data/lib/qwandry/configuration/default.rb +2 -2
- data/lib/qwandry/launcher.rb +6 -4
- data/templates/README +6 -0
- data/templates/init.rb +34 -0
- metadata +10 -14
- data/TODO +0 -4
- data/VERSION +0 -1
data/Rakefile
CHANGED
@@ -1,27 +1,18 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rake/testtask'
|
3
|
-
require '
|
3
|
+
require 'rdoc/task'
|
4
|
+
require 'rubygems/package_task'
|
4
5
|
|
5
|
-
|
6
|
-
require 'jeweler'
|
7
|
-
Jeweler::Tasks.new do |s|
|
8
|
-
s.name = "qwandry"
|
9
|
-
s.summary = "Qwandry lets you quickly edit ruby gems and libraries"
|
10
|
-
s.description = <<-DESC
|
11
|
-
Open a gem or library's source directory with your default editor.
|
12
|
-
DESC
|
13
|
-
s.email = "netghost@gmail.com"
|
14
|
-
s.homepage = "http://github.com/adamsanderson/qwandry"
|
15
|
-
s.authors = ["Adam Sanderson"]
|
16
|
-
s.has_rdoc = false
|
17
|
-
s.files = FileList["[A-Z]*", "{bin,lib,test}/**/*"]
|
18
|
-
|
19
|
-
# Testing
|
20
|
-
s.test_files = FileList["test/**/*_test.rb"]
|
21
|
-
end
|
6
|
+
spec = eval(File.read('qwandry.gemspec'))
|
22
7
|
|
23
|
-
|
24
|
-
|
8
|
+
Gem::PackageTask.new(spec) do |p|
|
9
|
+
p.gem_spec = spec
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "Install the current Qwandry gem"
|
13
|
+
task "install" => [:gem] do
|
14
|
+
path = File.join("pkg", spec.full_name)
|
15
|
+
system 'gem', 'install', path
|
25
16
|
end
|
26
17
|
|
27
18
|
Rake::TestTask.new do |t|
|
data/bin/qw
CHANGED
@@ -43,6 +43,16 @@ opts = OptionParser.new do |opts|
|
|
43
43
|
exit(0)
|
44
44
|
end
|
45
45
|
|
46
|
+
opts.on("--version", "Print version") do
|
47
|
+
spec = Gem.loaded_specs['qwandry']
|
48
|
+
if spec
|
49
|
+
puts spec.full_name
|
50
|
+
else
|
51
|
+
puts 'qwandry-dev'
|
52
|
+
end
|
53
|
+
exit
|
54
|
+
end
|
55
|
+
|
46
56
|
opts.on_tail("-h", "--help", "Show this message") do
|
47
57
|
puts opts
|
48
58
|
exit
|
@@ -21,9 +21,11 @@ module Qwandry
|
|
21
21
|
register(name, &block) if present? binary
|
22
22
|
end
|
23
23
|
|
24
|
-
# Returns true if
|
24
|
+
# Returns true if executable `name` is present.
|
25
25
|
def present? name
|
26
|
-
|
26
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).any? do |pathDir|
|
27
|
+
File.executable?(File.join pathDir, name.to_s)
|
28
|
+
end
|
27
29
|
end
|
28
30
|
|
29
31
|
# Sets the default configuration to launch, if no `configurations` are passed
|
@@ -12,7 +12,7 @@ register_if_present :gem do
|
|
12
12
|
require 'rubygems' unless defined? Gem
|
13
13
|
|
14
14
|
# Add rubygems path:
|
15
|
-
add File.join(
|
15
|
+
add Gem.path.map { |p| File.join(p, 'gems') }
|
16
16
|
end
|
17
17
|
|
18
18
|
# Register a perl configuration:
|
@@ -72,4 +72,4 @@ end
|
|
72
72
|
|
73
73
|
# Qwandry is a ruby app after all, so activate ruby and gem by default. Other defaults can be set
|
74
74
|
# with a custom init.rb
|
75
|
-
default :ruby, :gem
|
75
|
+
default :ruby, :gem
|
data/lib/qwandry/launcher.rb
CHANGED
@@ -25,10 +25,10 @@ module Qwandry
|
|
25
25
|
# Launches a Package or path represented by a String. Unless `editor` will
|
26
26
|
# check against the environment by default.
|
27
27
|
def launch(package, editor=nil)
|
28
|
-
editor ||= @editor || ENV['VISUAL'] || ENV['EDITOR']
|
28
|
+
editor ||= @editor || ENV['QWANDRY_EDITOR'] || ENV['VISUAL'] || ENV['EDITOR']
|
29
29
|
|
30
30
|
if (!editor) || (editor =~ /^\s*$/) # if the editor is not set, or is blank, exit with a message:
|
31
|
-
puts "Please
|
31
|
+
puts "Please set QWANDRY_EDITOR, VISUAL or EDITOR, or pass in an editor to use"
|
32
32
|
exit 1
|
33
33
|
end
|
34
34
|
|
@@ -36,8 +36,10 @@ module Qwandry
|
|
36
36
|
# Editors may have options, 'mate -w' for instance
|
37
37
|
editor_and_options = editor.strip.split(/\s+/)
|
38
38
|
|
39
|
-
|
40
|
-
|
39
|
+
Dir.chdir(File.dirname paths.first) do
|
40
|
+
# Launch the editor with its options and any paths that we have been passed
|
41
|
+
system(*(editor_and_options + paths))
|
42
|
+
end
|
41
43
|
end
|
42
44
|
|
43
45
|
private
|
data/templates/README
ADDED
data/templates/init.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# ~/.qwandry/init.rb
|
2
|
+
#
|
3
|
+
# This file lets you configure where and how Qwandry looks for packages to open.
|
4
|
+
#
|
5
|
+
# To learn more about Qwandry, take a look at the source with qwandry!
|
6
|
+
# qw qwandry
|
7
|
+
#
|
8
|
+
# You can uncomment the indented code to try it out.
|
9
|
+
# If you get confused, just delete this file and run the customize command again.
|
10
|
+
#
|
11
|
+
# == Adding Personal Projects
|
12
|
+
#
|
13
|
+
# If you keep all your projects in the home directory under projects,
|
14
|
+
# you can tell Qwandry to search there.
|
15
|
+
#
|
16
|
+
# register 'projects' do
|
17
|
+
# add '~/Projects/personal'
|
18
|
+
# add '~/Projects/work'
|
19
|
+
# add '~/Experiments'
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# This will tell Qwandry that you want to create a `projects` configuration
|
23
|
+
#
|
24
|
+
# For more advanced examples, try `qw qwandry` and take a look at
|
25
|
+
# `configuration/default.rb`.
|
26
|
+
|
27
|
+
# == Setting Defaults
|
28
|
+
# To make `projects` a default search path, activate `projects`:
|
29
|
+
#
|
30
|
+
# default :projects
|
31
|
+
#
|
32
|
+
# You can also set multiple configurations to be the default:
|
33
|
+
#
|
34
|
+
# default :python, :projects
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qwandry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 19
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
8
7
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
8
|
+
- 5
|
9
|
+
version: 0.1.5
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Adam Sanderson
|
@@ -15,11 +14,11 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date:
|
17
|
+
date: 2013-01-06 00:00:00 -08:00
|
19
18
|
default_executable: qw
|
20
19
|
dependencies: []
|
21
20
|
|
22
|
-
description:
|
21
|
+
description: Open a gem or library's source directory with your default editor.
|
23
22
|
email: netghost@gmail.com
|
24
23
|
executables:
|
25
24
|
- qw
|
@@ -27,22 +26,21 @@ extensions: []
|
|
27
26
|
|
28
27
|
extra_rdoc_files:
|
29
28
|
- README.markdown
|
30
|
-
- TODO
|
31
29
|
files:
|
32
|
-
- README.markdown
|
33
|
-
- Rakefile
|
34
|
-
- TODO
|
35
|
-
- VERSION
|
36
30
|
- bin/qw
|
37
|
-
- lib/qwandry.rb
|
38
|
-
- lib/qwandry/configuration.rb
|
39
31
|
- lib/qwandry/configuration/default.rb
|
40
32
|
- lib/qwandry/configuration/probe_node.js
|
33
|
+
- lib/qwandry/configuration.rb
|
41
34
|
- lib/qwandry/flat_repository.rb
|
42
35
|
- lib/qwandry/launcher.rb
|
43
36
|
- lib/qwandry/library_repository.rb
|
44
37
|
- lib/qwandry/package.rb
|
45
38
|
- lib/qwandry/repository.rb
|
39
|
+
- lib/qwandry.rb
|
40
|
+
- templates/init.rb
|
41
|
+
- templates/README
|
42
|
+
- Rakefile
|
43
|
+
- README.markdown
|
46
44
|
has_rdoc: true
|
47
45
|
homepage: http://github.com/adamsanderson/qwandry
|
48
46
|
licenses: []
|
@@ -57,7 +55,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
57
55
|
requirements:
|
58
56
|
- - ">="
|
59
57
|
- !ruby/object:Gem::Version
|
60
|
-
hash: 3
|
61
58
|
segments:
|
62
59
|
- 0
|
63
60
|
version: "0"
|
@@ -66,7 +63,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
63
|
requirements:
|
67
64
|
- - ">="
|
68
65
|
- !ruby/object:Gem::Version
|
69
|
-
hash: 3
|
70
66
|
segments:
|
71
67
|
- 0
|
72
68
|
version: "0"
|
data/TODO
DELETED
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.1.4
|