warp-dir 1.1.3 → 1.1.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85f7d0d955f09ea1659fe34174a10a36840d7ded
4
- data.tar.gz: 7ae441238d30b5795d4f309530338f09fa8ec4e4
3
+ metadata.gz: 1838ae6bcfd69ebc8bd9043ea689d4eba60839c6
4
+ data.tar.gz: f44b27945e973dfa316130dcd30d4af126b0fab5
5
5
  SHA512:
6
- metadata.gz: cc00a401aebc98c4135ef1a04456896d32baa3cb772d821b5674448cac040a43935a3b63db6428b64d2e2767600cd3fd454b8a94392b0e5ac1779723d67d086b
7
- data.tar.gz: f7cd6f85fdec69f52301d802eb5186cadcf7f566bb5f3c537c2b73b425a255a54b50803679d6a2d0484300872b28ecf62c5d4f51eb129fce4c23813818eeb9cd
6
+ metadata.gz: aafa1b87d2684660a1deb1427bb739436243e062c63d1ed586965c1d72cf5ccff995de6237a5dc4deb0a712093af4a17993ce909fb44a1b459fc0b605b82f3de
7
+ data.tar.gz: 426c0b4b70fb781853803a727afd238e360dcd3fdd5fc31bcf59437d56e50fbe4814ae18176bcbaed95178602962611fbb96682765ac4dae29b220f9f3164e20
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in warp-dir.gemspec
4
+ gemspec
data/Rakefile CHANGED
@@ -1,27 +1,35 @@
1
- task :default => [:rspec ]
2
1
  task :install do
3
- [
4
- %q(chmod -R o+r .),
2
+
3
+ [ %q(chmod -R o+r .),
5
4
  %q(rm -f *.gem),
6
5
  %q(rm -rf build),
7
- %q(gem uninstall -a --executables warp-dir 2> /dev/null; true),
6
+ %q(gem uninstall -quiet -a --executables warp-dir 2> /dev/null; true),
8
7
  %q(gem build warp-dir.gemspec)
9
8
  ].each do |command|
10
9
  sh command
11
10
  end
12
- sh <<-EOF
13
- export gem_file=$(ls -1 *.gem | tail -1)
14
- export gem_name=${gem_file//.gem/}
15
- if [ "$(which ruby)" == "/usr/bin/ruby" ]; then
16
- gem install $gem_file -n /usr/local/bin --no-ri --no-rdoc
17
- else
18
- gem install $gem_file --no-ri --no-rdoc
19
- fi
11
+
12
+ sh <<-EOF.gsub(%r{^\s+}m, '')
13
+ export gem_file=$(ls -1 *.gem | tail -1)
14
+ export gem_name=${gem_file//.gem/}
15
+ if [ "$(which ruby)" == "/usr/bin/ruby" ]; then
16
+ gem install $gem_file -n /usr/local/bin --no-ri --no-rdoc
17
+ else
18
+ gem install $gem_file --no-ri --no-rdoc
19
+ fi
20
20
  EOF
21
- exit 0
22
21
  end
23
22
 
24
23
  require 'bundler'
25
24
  require "bundler/gem_tasks"
26
25
  require 'rake/clean'
27
- require 'rspec/core/rake_task'
26
+
27
+ CLEAN.include %w(pkg coverage *.gem)
28
+
29
+ begin
30
+ require 'rspec/core/rake_task'
31
+ RSpec::Core::RakeTask.new(:spec)
32
+ rescue LoadError
33
+ end
34
+
35
+ task :default => [:spec]
@@ -32,3 +32,15 @@ wd_not_found() {
32
32
  printf " $ hash -r\n"
33
33
  printf " $ warp-dir install [ --dotfile ~/.bashrc ]\n"
34
34
  }
35
+
36
+ _wd() {
37
+ local WDWORDS cur
38
+
39
+ COMPREPLY=()
40
+ _get_comp_words_by_ref cur
41
+
42
+ WDWORDS=$(wd list --no-color | awk '{ print $1 }')
43
+ COMPREPLY=( $( compgen -W "$WDWORDS" -- "$cur" ) )
44
+ }
45
+
46
+ complete -F _wd wd
File without changes
@@ -0,0 +1,96 @@
1
+ unless Object.const_defined? :Colored
2
+ module Colored
3
+ extend self
4
+
5
+ COLORS = {
6
+ 'black' => 30,
7
+ 'red' => 31,
8
+ 'green' => 32,
9
+ 'yellow' => 33,
10
+ 'blue' => 34,
11
+ 'magenta' => 35,
12
+ 'cyan' => 36,
13
+ 'white' => 37
14
+ }
15
+
16
+ EXTRAS = {
17
+ 'clear' => 0,
18
+ 'bold' => 1,
19
+ 'underline' => 4,
20
+ 'reversed' => 7
21
+ }
22
+
23
+ COLORS.each do |color, value|
24
+ define_method(color) do
25
+ colorize(self, :foreground => color)
26
+ end
27
+
28
+ define_method("on_#{color}") do
29
+ colorize(self, :background => color)
30
+ end
31
+
32
+ COLORS.each do |highlight, value|
33
+ next if color == highlight
34
+ define_method("#{color}_on_#{highlight}") do
35
+ colorize(self, :foreground => color, :background => highlight)
36
+ end
37
+ end
38
+ end
39
+
40
+ EXTRAS.each do |extra, value|
41
+ next if extra == 'clear'
42
+ define_method(extra) do
43
+ colorize(self, :extra => extra)
44
+ end
45
+ end
46
+
47
+ define_method(:to_eol) do
48
+ tmp = sub(/^(\e\[[\[\e0-9;m]+m)/, "\\1\e[2K")
49
+ if tmp == self
50
+ return "\e[2K" << self
51
+ end
52
+ tmp
53
+ end
54
+
55
+ def colorize(string, options = {})
56
+ colored = [color(options[:foreground]), color("on_#{options[:background]}"), extra(options[:extra])].compact * ''
57
+ colored << string
58
+ colored << extra(:clear)
59
+ end
60
+
61
+ def colors
62
+ @@colors ||= COLORS.keys.sort
63
+ end
64
+
65
+ def extra(extra_name)
66
+ return '' if String.colors_disabled
67
+ extra_name = extra_name.to_s
68
+ "\e[#{EXTRAS[extra_name]}m" if EXTRAS[extra_name]
69
+ end
70
+
71
+ def color(color_name)
72
+ return '' if String.colors_disabled
73
+ background = color_name.to_s =~ /on_/
74
+ color_name = color_name.to_s.sub('on_', '')
75
+ return unless color_name && COLORS[color_name]
76
+ "\e[#{COLORS[color_name] + (background ? 10 : 0)}m"
77
+ end
78
+ end
79
+ end
80
+
81
+ String.send(:include, Colored)
82
+
83
+ class String
84
+ class << self
85
+ attr_accessor :colors_disabled
86
+
87
+ def enable_colors
88
+ self.colors_disabled = false
89
+ end
90
+ def disable_colors
91
+ self.colors_disabled = true
92
+ end
93
+ end
94
+ end
95
+
96
+
@@ -37,6 +37,8 @@ module Warp
37
37
  config.command = :help if (opts.help? || no_arguments)
38
38
  config.command = :warp if config.warp || config.command == 'warp'
39
39
 
40
+ String.disable_colors if config.no_color
41
+
40
42
  if config[:command]
41
43
  self.validated = true
42
44
  else
@@ -93,6 +95,7 @@ module Warp
93
95
  opts.string '-m', '--command', '<command> – command to run, ie. add, ls, list, rm, etc.'
94
96
  opts.string '-p', '--point', '<point-name> – name of the warp point'
95
97
  opts.string '-w', '--warp', '<warp-point> – warp to a given point'
98
+ opts.bool '--no-color',' - do not use ASCII color'
96
99
  opts.bool '-f', '--force', ' - force, ie. overwrite existing point when adding'
97
100
  opts.bool '-h', '--help', ' – show help'
98
101
  opts.bool '-v', '--verbose', ' – enable verbose mode'
@@ -3,6 +3,7 @@ require 'warp/dir/formatter'
3
3
 
4
4
  class Warp::Dir::Command::List < Warp::Dir::Command
5
5
  description %q(Print all stored warp points)
6
+ aliases :l
6
7
 
7
8
  def run(*args)
8
9
  formatted_list = ::Warp::Dir::Formatter.new(store).format_store
@@ -5,7 +5,7 @@ module Warp
5
5
  class LS < Warp::Dir::Command
6
6
  description %q(List directory contents of a Warp Point)
7
7
  needs_a_point? true
8
- aliases :dir
8
+ aliases :dir, :ll
9
9
 
10
10
  # @param [Object] args
11
11
  def run(opts, *flags)
@@ -8,7 +8,8 @@ module Warp
8
8
  warprc: ENV['HOME'] + '/.warprc',
9
9
  shell: false,
10
10
  force: false,
11
- debug: false
11
+ debug: false,
12
+ no_color: false
12
13
  }
13
14
 
14
15
  attr_accessor :variables
@@ -1,7 +1,7 @@
1
- require 'colored'
1
+ require_relative '../../colored'
2
2
  module Warp
3
3
  module Dir
4
- VERSION = '1.1.3'
4
+ VERSION = '1.1.4'
5
5
 
6
6
  @install_notice = <<-EOF
7
7
 
@@ -1,32 +1,32 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
2
+ lib = File.expand_path('../lib/', __FILE__)
3
+ $:.unshift lib unless $:.include?(lib)
4
4
  require 'warp/dir/version'
5
5
 
6
- Gem::Specification.new do |gem|
7
- gem.name = 'warp-dir'
8
- gem.license = 'MIT'
9
- gem.authors = ['Konstantin Gredeskoul']
10
- gem.email = ['kig@reinvent.one']
11
- gem.version = Warp::Dir::VERSION
6
+ Gem::Specification.new do |s|
7
+ s.name = 'warp-dir'
8
+ s.license = 'MIT'
9
+ s.authors = ['Konstantin Gredeskoul']
10
+ s.email = ['kig@reinvent.one']
11
+ s.version = Warp::Dir::VERSION
12
+ s.summary = %q{Warp-Dir (aka 'wd') replaces 'cd' and lets you instantly move between saved "warp points" and regular folders.}
13
+ s.description = %q{Warp-Dir is compatible (and inspired by) the popular 'wd' tool available as a ZSH module. This one is written in ruby and so it should work in any shell. Credits for the original zsh-only tool go to (https://github.com/mfaerevaag/wd).}
14
+ s.homepage = 'https://github.com/kigster/warp-dir'
15
+ s.files = `git ls-files`.split($\).reject{ |f| f.match(%r{^(doc|spec)/}) }
12
16
 
13
- gem.summary = %q{Warp-Dir (aka 'wd') is a command line tool that lets you bookmark any folders, and then 'wd' between any two points on file system in one command.}
14
- gem.description = %q{Warp-Dir is compatible (and inspired by) the popular 'wd' tool available as a ZSH module. This one is written in ruby and so it should work in any shell. Credits for the original zsh-only tool go to (https://github.com/mfaerevaag/wd).}
15
- gem.homepage = "https://github.com/kigster/warp-dir"
17
+ s.executables << 'warp-dir'
18
+ s.bindir = 'exe'
16
19
 
17
- gem.files = `git ls-files`.split($\).reject{ |f| f =~ /^doc\/|Gemfile/ }
18
- gem.executables << 'warp-dir'
20
+ s.post_install_message = ::Warp::Dir::INSTALL_NOTICE
21
+ s.require_paths = %w(lib)
19
22
 
20
- gem.post_install_message = ::Warp::Dir::INSTALL_NOTICE
23
+ s.required_ruby_version = '>= 2.0.0'
24
+ s.required_rubygems_version = '>= 1.3.6'
21
25
 
22
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
23
- gem.require_paths = %w(lib)
26
+ s.add_dependency('slop', '~> 4.2')
24
27
 
25
- gem.add_dependency('slop', '~> 4.2')
26
- gem.add_dependency('colored', '~> 1')
27
-
28
- gem.add_development_dependency 'codeclimate-test-reporter', '~> 0.5'
29
- gem.add_development_dependency 'bundler', '~> 1.11'
30
- gem.add_development_dependency 'rake', '~> 10.0'
31
- gem.add_development_dependency 'rspec', '~> 3.4'
28
+ s.add_development_dependency 'codeclimate-test-reporter', '~> 0.5'
29
+ s.add_development_dependency 'bundler', '~> 1.11'
30
+ s.add_development_dependency 'rake', '~> 10.0'
31
+ s.add_development_dependency 'rspec', '~> 3.4'
32
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: warp-dir
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Gredeskoul
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-09 00:00:00.000000000 Z
11
+ date: 2016-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slop
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.2'
27
- - !ruby/object:Gem::Dependency
28
- name: colored
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: codeclimate-test-reporter
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -115,6 +101,7 @@ files:
115
101
  - ".rspec"
116
102
  - ".rubocop.yml"
117
103
  - ".travis.yml"
104
+ - Gemfile
118
105
  - Guardfile
119
106
  - LICENSE
120
107
  - README.md
@@ -122,8 +109,9 @@ files:
122
109
  - Rakefile
123
110
  - bin/console
124
111
  - bin/setup
125
- - bin/warp-dir
126
112
  - bin/warp-dir.bash
113
+ - exe/warp-dir
114
+ - lib/colored.rb
127
115
  - lib/warp.rb
128
116
  - lib/warp/dir.rb
129
117
  - lib/warp/dir/app/cli.rb
@@ -146,20 +134,6 @@ files:
146
134
  - lib/warp/dir/serializer/dotfile.rb
147
135
  - lib/warp/dir/store.rb
148
136
  - lib/warp/dir/version.rb
149
- - spec/fixtures/warprc
150
- - spec/spec_helper.rb
151
- - spec/support/cli_expectations.rb
152
- - spec/warp/dir/app/cli_spec.rb
153
- - spec/warp/dir/app/response_spec.rb
154
- - spec/warp/dir/command_spec.rb
155
- - spec/warp/dir/commands/add_spec.rb
156
- - spec/warp/dir/commands/install_spec.rb
157
- - spec/warp/dir/commands/list_spec.rb
158
- - spec/warp/dir/config_spec.rb
159
- - spec/warp/dir/errors_spec.rb
160
- - spec/warp/dir/formatter_spec.rb
161
- - spec/warp/dir/point_spec.rb
162
- - spec/warp/dir/store_spec.rb
163
137
  - warp-dir.gemspec
164
138
  homepage: https://github.com/kigster/warp-dir
165
139
  licenses:
@@ -182,31 +156,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
182
156
  requirements:
183
157
  - - ">="
184
158
  - !ruby/object:Gem::Version
185
- version: '0'
159
+ version: 2.0.0
186
160
  required_rubygems_version: !ruby/object:Gem::Requirement
187
161
  requirements:
188
162
  - - ">="
189
163
  - !ruby/object:Gem::Version
190
- version: '0'
164
+ version: 1.3.6
191
165
  requirements: []
192
166
  rubyforge_project:
193
167
  rubygems_version: 2.5.1
194
168
  signing_key:
195
169
  specification_version: 4
196
- summary: Warp-Dir (aka 'wd') is a command line tool that lets you bookmark any folders,
197
- and then 'wd' between any two points on file system in one command.
198
- test_files:
199
- - spec/fixtures/warprc
200
- - spec/spec_helper.rb
201
- - spec/support/cli_expectations.rb
202
- - spec/warp/dir/app/cli_spec.rb
203
- - spec/warp/dir/app/response_spec.rb
204
- - spec/warp/dir/command_spec.rb
205
- - spec/warp/dir/commands/add_spec.rb
206
- - spec/warp/dir/commands/install_spec.rb
207
- - spec/warp/dir/commands/list_spec.rb
208
- - spec/warp/dir/config_spec.rb
209
- - spec/warp/dir/errors_spec.rb
210
- - spec/warp/dir/formatter_spec.rb
211
- - spec/warp/dir/point_spec.rb
212
- - spec/warp/dir/store_spec.rb
170
+ summary: Warp-Dir (aka 'wd') replaces 'cd' and lets you instantly move between saved
171
+ "warp points" and regular folders.
172
+ test_files: []
@@ -1,2 +0,0 @@
1
- tmp:/tmp
2
- log:/var/log
@@ -1,73 +0,0 @@
1
- require 'codeclimate-test-reporter'
2
- require 'warp/dir'
3
- require 'rspec/core'
4
-
5
- CodeClimate::TestReporter.start
6
-
7
- module Warp
8
- module Dir
9
- module App
10
- class Response
11
- class << self
12
- attr_accessor :exit_disabled
13
-
14
- def enable_exit!
15
- self.exit_disabled = false
16
- end
17
-
18
- def disable_exit!
19
- self.exit_disabled = true
20
- end
21
-
22
- def exit_disabled?
23
- self.exit_disabled
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end
30
-
31
- RSpec.configure do |config|
32
- config.before do
33
- Warp::Dir::App::Response.disable_exit!
34
- srand 117
35
- end
36
- end
37
-
38
- RSpec.shared_context :fake_serializer do
39
- let(:file) { @file ||= ::Tempfile.new('warp-dir') }
40
- let(:config) { Warp::Dir::Config.new(warprc: file.path) }
41
- let(:serializer) {
42
- @initialized_store ||= FakeSerializer ||= Class.new(Warp::Dir::Serializer::Base) do
43
- def persist!;
44
- end
45
-
46
- def restore!;
47
- end
48
- end
49
- }
50
-
51
- after do
52
- file.close
53
- file.unlink
54
- end
55
- end
56
-
57
- RSpec.shared_context :fixture_file do
58
- let(:fixture_file) { 'spec/fixtures/warprc'}
59
- let(:warprc_args) { " --config #{fixture_file}" }
60
- let(:config_path) { '/tmp/warprc' }
61
- let(:file) {
62
- FileUtils.cp(fixture_file, config_path)
63
- File.new(config_path)
64
- }
65
- let(:config) { Warp::Dir::Config.new(warprc: file.path) }
66
- end
67
-
68
- RSpec.shared_context :initialized_store do
69
- let(:store) { Warp::Dir::Store.new(config) }
70
- let(:wp_path) { ENV['HOME'] + '/workspace/tinker-mania' }
71
- let(:wp_name) { 'harro' }
72
- let(:point) { Warp::Dir::Point.new(wp_name, wp_path) }
73
- end