mark 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,13 +5,13 @@ begin
5
5
  rescue LoadError
6
6
  end
7
7
 
8
+ require 'yaml'
9
+
8
10
  $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
9
11
 
12
+ require 'mark/storage'
10
13
  require 'mark/label'
11
14
  require 'mark/jump'
12
15
  require 'mark/error'
16
+ require 'mark/version'
13
17
  require 'mark/main'
14
-
15
- module Mark
16
- VERSION = '0.0.1'
17
- end
@@ -1,7 +1,11 @@
1
1
  # coding: utf-8
2
2
 
3
3
  module Mark
4
- def self.jump(label, *argv)
5
- puts "Jumping to #{label}"
4
+ class << self
5
+ def jump(label, *argv)
6
+ target = @marks[label]
7
+
8
+ puts "cd #{target}"
9
+ end
6
10
  end
7
11
  end
@@ -1,7 +1,11 @@
1
1
  # coding: utf-8
2
2
 
3
3
  module Mark
4
- def self.label(label, *argv)
5
- puts "Saving #{label}"
4
+ class << self
5
+ CWD = Dir.pwd
6
+
7
+ def label(label, *argv)
8
+ @marks[label] = argv.first || CWD
9
+ end
6
10
  end
7
11
  end
@@ -2,6 +2,8 @@
2
2
 
3
3
  module Mark
4
4
  def self.process(command, *argv)
5
+ self.load
6
+
5
7
  case command
6
8
  when 'label'
7
9
  self.label(*argv)
@@ -10,5 +12,7 @@ module Mark
10
12
  else
11
13
  self.error!(command, *argv)
12
14
  end
15
+
16
+ self.save
13
17
  end
14
18
  end
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+
3
+ module Mark
4
+ class << self
5
+ STORAGE_UNIT = "#{ENV['HOME']}/.mark"
6
+
7
+ attr_accessor :marks
8
+
9
+ def load
10
+ return @marks = [] unless File.exist?(STORAGE_UNIT)
11
+
12
+ f = File.open(STORAGE_UNIT)
13
+ @marks = YAML.load(f.read)
14
+ end
15
+
16
+ def save
17
+ f = File.open(STORAGE_UNIT, 'w')
18
+
19
+ YAML.dump(@marks ||= [], f)
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,5 @@
1
+ # coding: utf-8
2
+
3
+ module Mark
4
+ VERSION = '0.0.2'
5
+ end
@@ -1,3 +1,6 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+ require 'mark/version'
3
+
1
4
  ## This is the rakegem gemspec template. Make sure you read and understand
2
5
  ## all of the comments. Some sections require modification, and others can
3
6
  ## be deleted if you don't need them. Once you understand the contents of
@@ -13,7 +16,7 @@ Gem::Specification.new do |s|
13
16
  ## If your rubyforge_project name is different, then edit it and comment out
14
17
  ## the sub! line in the Rakefile
15
18
  s.name = 'mark'
16
- s.version = '0.0.1'
19
+ s.version = Mark::VERSION
17
20
  s.date = '2013-09-23'
18
21
  s.rubyforge_project = 'boom'
19
22
 
@@ -64,7 +67,9 @@ Gem::Specification.new do |s|
64
67
  lib/mark/main.rb
65
68
  lib/mark/label.rb
66
69
  lib/mark/jump.rb
70
+ lib/mark/storage.rb
67
71
  lib/mark/error.rb
72
+ lib/mark/version.rb
68
73
  bin/mark
69
74
  mark.gemspec
70
75
  ]
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mark
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Jordan Scales
@@ -10,9 +11,8 @@ bindir: bin
10
11
  cert_chain: []
11
12
  date: 2013-09-23 00:00:00.000000000 Z
12
13
  dependencies: []
13
- description: |-
14
- cd ../../projects/blah gets old quick. Mark allows you to
15
- mark directories with a shortcut and jump between them with ease.
14
+ description: ! "cd ../../projects/blah gets old quick. Mark allows you to\n mark
15
+ directories with a shortcut and jump between them with ease."
16
16
  email: scalesjordan@gmail.com
17
17
  executables:
18
18
  - mark
@@ -25,31 +25,35 @@ files:
25
25
  - lib/mark/main.rb
26
26
  - lib/mark/label.rb
27
27
  - lib/mark/jump.rb
28
+ - lib/mark/storage.rb
28
29
  - lib/mark/error.rb
30
+ - lib/mark/version.rb
29
31
  - bin/mark
30
32
  - mark.gemspec
31
33
  homepage: https://github.com/jdan/mark
32
34
  licenses: []
33
- metadata: {}
34
35
  post_install_message:
35
36
  rdoc_options:
36
37
  - --charset=UTF-8
37
38
  require_paths:
38
39
  - lib
39
40
  required_ruby_version: !ruby/object:Gem::Requirement
41
+ none: false
40
42
  requirements:
41
- - - '>='
43
+ - - ! '>='
42
44
  - !ruby/object:Gem::Version
43
45
  version: '0'
44
46
  required_rubygems_version: !ruby/object:Gem::Requirement
47
+ none: false
45
48
  requirements:
46
- - - '>='
49
+ - - ! '>='
47
50
  - !ruby/object:Gem::Version
48
51
  version: '0'
49
52
  requirements: []
50
53
  rubyforge_project: boom
51
- rubygems_version: 2.0.6
54
+ rubygems_version: 1.8.23
52
55
  signing_key:
53
56
  specification_version: 2
54
57
  summary: mark lets you easily mark directories and jump between them
55
58
  test_files: []
59
+ has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: be67614e58e9837a50800bcb9ae1c10d94a8be7c
4
- data.tar.gz: 72f4e7b746ebf7efdd6442b04f4e1b09f71c8f45
5
- SHA512:
6
- metadata.gz: 0e6d9fdc243372a822c921b719f302b813ff2685f471b6f896eb33b5b3b24cde164da7b951d94662f46533a468c24351a25b2bca0f5e569d85089da9c5f73463
7
- data.tar.gz: 11ffe859159ffb304b615a047148ab132aaf7fde4953b313a36569ac90e12e2d0c53650ae6569667dcc0d122abc304a383810fa6bc28983b10e29e24690c0bd3