lazyme 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +5 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +12 -0
- data/Rakefile +6 -0
- data/bin/lazyme +8 -0
- data/lazyme.gemspec +18 -0
- data/lib/lazyme.rb +36 -0
- data/lib/lazyme/version.rb +3 -0
- metadata +54 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c10f4ede7be3f915b135ed794958859832f56d02
|
4
|
+
data.tar.gz: 1bf95937bc2ca061d15bc1b8cd615a12c8fcceb1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1f910020d4f8a9483bb34c7dea761d4d7e910190dee87369292d857b292d68faae94a3daba62d10f083226a8715f587732881610890a5c1c93a15987fe5be2f3
|
7
|
+
data.tar.gz: 570cdf86c3b0be0290e45038e67b2a11ce83c4b51490ed25adda973a05135ce79dafe509be125d432e502716dc795ca6f1dda7928ffe2eb8024ef8564f525298
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 pawurb
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# Lazyme [![Gem Version](https://badge.fury.io/rb/lazyme.svg)](http://badge.fury.io/rb/lazyme)
|
2
|
+
|
3
|
+
Lazyme a simple gem that helps you optimise your laziness. You can display your most used shell commands so that you can change them into aliases and evetually type less.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
```bash
|
7
|
+
gem install lazyme
|
8
|
+
```
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
```
|
12
|
+
|
data/Rakefile
ADDED
data/bin/lazyme
ADDED
data/lazyme.gemspec
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'lazyme/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "lazyme"
|
8
|
+
gem.version = Lazyme::VERSION
|
9
|
+
gem.authors = ["pawurb"]
|
10
|
+
gem.email = ["p.urbanek89@gmail.com"]
|
11
|
+
gem.summary = %q{ Lazyme a simple gem that helps you optimise your laziness }
|
12
|
+
gem.description = %q{ Display your most used shell commands count }
|
13
|
+
gem.homepage = "http://github.com/pawurb/lazyme"
|
14
|
+
gem.files = `git ls-files`.split("\n")
|
15
|
+
gem.executables = ['lazyme']
|
16
|
+
gem.require_paths = ["lib"]
|
17
|
+
gem.license = "MIT"
|
18
|
+
end
|
data/lib/lazyme.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'lazyme/version'
|
2
|
+
require 'pp'
|
3
|
+
|
4
|
+
module Lazyme
|
5
|
+
class Main
|
6
|
+
def call
|
7
|
+
file = File.open(history_file_path)
|
8
|
+
data = file.read.force_encoding('BINARY').
|
9
|
+
|
10
|
+
encode("UTF-8", invalid: :replace, undef: :replace).
|
11
|
+
split("\n").map do |line|
|
12
|
+
line.split(';').last
|
13
|
+
end
|
14
|
+
|
15
|
+
count = Hash.new(0)
|
16
|
+
|
17
|
+
data.each do |item|
|
18
|
+
if item
|
19
|
+
count[item] = count[item] + 1
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
pp Hash[count.sort_by {|_, v| v }]
|
24
|
+
end
|
25
|
+
|
26
|
+
def history_file_path
|
27
|
+
if File.exist?(File.expand_path('~/.zsh_history'))
|
28
|
+
File.expand_path('~/.zsh_history')
|
29
|
+
elsif File.exist?(File.expand_path('~/.bash_history'))
|
30
|
+
File.expand_path('~/.bash_history')
|
31
|
+
else
|
32
|
+
raise "Missing both zsh and bash history files"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lazyme
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- pawurb
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-08-28 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: " Display your most used shell commands count "
|
14
|
+
email:
|
15
|
+
- p.urbanek89@gmail.com
|
16
|
+
executables:
|
17
|
+
- lazyme
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- ".gitignore"
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE.txt
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- bin/lazyme
|
27
|
+
- lazyme.gemspec
|
28
|
+
- lib/lazyme.rb
|
29
|
+
- lib/lazyme/version.rb
|
30
|
+
homepage: http://github.com/pawurb/lazyme
|
31
|
+
licenses:
|
32
|
+
- MIT
|
33
|
+
metadata: {}
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options: []
|
36
|
+
require_paths:
|
37
|
+
- lib
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
requirements: []
|
49
|
+
rubyforge_project:
|
50
|
+
rubygems_version: 2.6.8
|
51
|
+
signing_key:
|
52
|
+
specification_version: 4
|
53
|
+
summary: Lazyme a simple gem that helps you optimise your laziness
|
54
|
+
test_files: []
|