note 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in notes.gemspec
4
+ gemspec
data/README ADDED
File without changes
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
data/bin/note ADDED
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'note'
4
+ include Note
5
+
6
+ case ARGV.first
7
+ when "-c", "create"
8
+ create(ARGV.last)
9
+ when "-d", "delete"
10
+ delete(ARGV.last)
11
+ when "-l", "list"
12
+ list
13
+ when "-e", "execute"
14
+ execute(ARGV.last)
15
+ when "-h", "help"
16
+ help
17
+ else
18
+ if ARGV.count == 1
19
+ show ARGV.first
20
+ else
21
+ help
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ module Note
2
+ VERSION = "0.6.2"
3
+ end
data/lib/note.rb ADDED
@@ -0,0 +1,67 @@
1
+ require "note/version"
2
+
3
+ module Note
4
+ # Your code goes here...
5
+
6
+ def check_file
7
+ `touch #{notes}` unless File.exist? notes
8
+ end
9
+
10
+ def notes
11
+ "#{ENV['HOME']}/.notes"
12
+ end
13
+
14
+ def get_hash
15
+ check_file
16
+ eval(File.open(notes, 'r') { |f| f.read })
17
+ end
18
+
19
+ def save_hash(hash)
20
+ File.open(notes, "w").write(hash.to_s)
21
+ end
22
+
23
+ def create(key)
24
+ print "what value do you want to assign to this key? "
25
+ string = STDIN.gets.strip
26
+ hash = get_hash
27
+ hash = {} if hash == nil
28
+ hash[key] = string
29
+ save_hash hash
30
+ end
31
+
32
+ def delete(key)
33
+ hash = get_hash
34
+ hash.delete(key)
35
+ save_hash(hash)
36
+ end
37
+
38
+ def execute(key)
39
+ exec(get_hash[key])
40
+ end
41
+
42
+ def show(key)
43
+ if get_hash[key]
44
+ puts get_hash[key]
45
+ else
46
+ puts "Key does not exist."
47
+ end
48
+ end
49
+
50
+ def list
51
+ get_hash.each do |key, value|
52
+ puts key
53
+ end
54
+ end
55
+
56
+ def help
57
+ puts ""
58
+ puts "note -l Lists all note names"
59
+ puts "note -c <key> Create a new note"
60
+ puts "note -d <key> Delete a existing note"
61
+ puts "note -e <key> Try executing the key"
62
+ puts "note -h Display Help"
63
+ puts "note <key> Display the note for the given key"
64
+ puts ""
65
+ end
66
+
67
+ end
data/note.gemspec ADDED
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "note/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "note"
7
+ s.version = Note::VERSION
8
+ s.authors = ["Lyon", "Clay"]
9
+ s.email = ["lyon@delorum.com", "clay@delorum.com"]
10
+ s.homepage = "http://lyon.pagodabox.com"
11
+ s.summary = %q{console based Note system}
12
+ s.description = %q{Type note -h for options}
13
+
14
+ s.rubyforge_project = "note"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+ end
metadata ADDED
@@ -0,0 +1,56 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: note
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Lyon
9
+ - Clay
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2011-07-28 00:00:00.000000000Z
14
+ dependencies: []
15
+ description: Type note -h for options
16
+ email:
17
+ - lyon@delorum.com
18
+ - clay@delorum.com
19
+ executables:
20
+ - note
21
+ extensions: []
22
+ extra_rdoc_files: []
23
+ files:
24
+ - .gitignore
25
+ - Gemfile
26
+ - README
27
+ - Rakefile
28
+ - bin/note
29
+ - lib/note.rb
30
+ - lib/note/version.rb
31
+ - note.gemspec
32
+ homepage: http://lyon.pagodabox.com
33
+ licenses: []
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ! '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubyforge_project: note
52
+ rubygems_version: 1.8.5
53
+ signing_key:
54
+ specification_version: 3
55
+ summary: console based Note system
56
+ test_files: []