qwandry 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,27 +1,18 @@
1
1
  require 'rake'
2
2
  require 'rake/testtask'
3
- require 'rake/rdoctask'
3
+ require 'rdoc/task'
4
+ require 'rubygems/package_task'
4
5
 
5
- begin
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
- rescue LoadError
24
- puts "Jeweler not available. Install it for jeweler-related tasks with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
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 binary `name` is present.
24
+ # Returns true if executable `name` is present.
25
25
  def present? name
26
- system("which #{name} > /dev/null")
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(Gem.dir, 'gems')
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
@@ -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 either set EDITOR or pass in an editor to use"
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
- # Launch the editor with its options and any paths that we have been passed
40
- system(*(editor_and_options + paths))
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
@@ -0,0 +1,6 @@
1
+ These files will let you customize Qwandry to your heart's desire.
2
+ Take a look at `init.rb`, there are examples for a variety of common
3
+ languages and package systems.
4
+
5
+ Qwandry will also run just fine without these files, so feel free to delete
6
+ them.
@@ -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
- - 4
10
- version: 0.1.4
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: 2011-01-06 00:00:00 -08:00
17
+ date: 2013-01-06 00:00:00 -08:00
19
18
  default_executable: qw
20
19
  dependencies: []
21
20
 
22
- description: " Open a gem or library's source directory with your default editor.\n"
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
@@ -1,4 +0,0 @@
1
- TODO
2
- ----
3
- Bugs and feature requests can be found on github:
4
- https://github.com/adamsanderson/qwandry/issues
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.1.4