atom_shortcuts 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +47 -0
- data/LICENSE.txt +21 -0
- data/README.md +50 -0
- data/Rakefile +6 -0
- data/atom_shortcuts +4 -0
- data/atom_shortcuts.gemspec +40 -0
- data/bin/console +6 -0
- data/bin/setup +8 -0
- data/config/environment.rb +8 -0
- data/lib/atom_shortcuts/version.rb +3 -0
- data/lib/cli_interface.rb +175 -0
- data/lib/concerns/searchable.rb +43 -0
- data/lib/data_formatter.rb +44 -0
- data/lib/operating_system.rb +51 -0
- data/lib/scraper.rb +10 -0
- data/lib/shortcut.rb +37 -0
- data/notes.md +127 -0
- data/object_relationship_models.md +99 -0
- metadata +158 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fbb13726e85cde7d367dcd5701d9ea6018f91bd0fca3044d3c0fa32ac88346e3
|
4
|
+
data.tar.gz: 85b2aa555f9958c6086119f8a8e6953bf5094659fbe4b653ecddf21791597955
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2a31f7e03d895864458f1622798d247c1444174262d89e3959c35114a0a395f885fa50f79df8e372e617430b8805994338e5e14c72c972eccab3329db4962a2c
|
7
|
+
data.tar.gz: d6fac34d2ed1ee2b9587386f37247b459aba09c8585d14b2427a200a06c4096e008510a6dd58148cec90c66aa3a05325867d51cf3a92e58aeebf3b830fc79385
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at harleighabel@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
atom_shortcuts (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
coderay (1.1.2)
|
10
|
+
diff-lcs (1.3)
|
11
|
+
method_source (0.9.0)
|
12
|
+
mini_portile2 (2.4.0)
|
13
|
+
nokogiri (1.10.9)
|
14
|
+
mini_portile2 (~> 2.4.0)
|
15
|
+
pry (0.11.3)
|
16
|
+
coderay (~> 1.1.0)
|
17
|
+
method_source (~> 0.9.0)
|
18
|
+
rake (13.0.1)
|
19
|
+
require_all (1.5.0)
|
20
|
+
rspec (3.8.0)
|
21
|
+
rspec-core (~> 3.8.0)
|
22
|
+
rspec-expectations (~> 3.8.0)
|
23
|
+
rspec-mocks (~> 3.8.0)
|
24
|
+
rspec-core (3.8.0)
|
25
|
+
rspec-support (~> 3.8.0)
|
26
|
+
rspec-expectations (3.8.2)
|
27
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
28
|
+
rspec-support (~> 3.8.0)
|
29
|
+
rspec-mocks (3.8.0)
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
+
rspec-support (~> 3.8.0)
|
32
|
+
rspec-support (3.8.0)
|
33
|
+
|
34
|
+
PLATFORMS
|
35
|
+
ruby
|
36
|
+
|
37
|
+
DEPENDENCIES
|
38
|
+
atom_shortcuts!
|
39
|
+
bundler (~> 1.16)
|
40
|
+
nokogiri (~> 1.8)
|
41
|
+
pry (~> 0.11.3)
|
42
|
+
rake (~> 13.0)
|
43
|
+
require_all (~> 1.3, >= 1.3.3)
|
44
|
+
rspec (~> 3.0)
|
45
|
+
|
46
|
+
BUNDLED WITH
|
47
|
+
1.16.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 atxrenegade
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# Atom Shortcuts
|
2
|
+
|
3
|
+
Welcome to Atom Shortcuts!
|
4
|
+
|
5
|
+
This is a utility gem designed for as a quick reference to many of the atom shortcuts. Being familiar with shortcuts and important commands speeds up your workflow and increases your productivity as a programmer. This gem includes atom shortcuts for MacOS, Windows, and Linux operating systems. There is a search by name, and search by key sequence function, and users can select and individual shortcuts for a detailed view.
|
6
|
+
|
7
|
+
Harleigh/atxrenegade
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
To use this gem:
|
12
|
+
|
13
|
+
1. Download appication from the Github Repository or from RubyGems.com
|
14
|
+
2. Type 'bundle install' into command line.
|
15
|
+
3. To run executable type 'ruby atom_shortcuts' into command line.
|
16
|
+
|
17
|
+
|
18
|
+
This GEM upon execution will display a greeting and directions to proceed. Press the enter key to bring up the main menu. Here you can select your operating system or exit the program. Once you have selected your operating system you will have a choice to list all commands, search shortcuts by name, or search shortcuts by key sequence.
|
19
|
+
|
20
|
+
If you select LIST ALL, a full list of commands will be displayed. If you would like to view details for a specific shortcut type in the number press enter and you will bering up the detailed view for that shortcut. From here you can choose another shortcut by number, exit to the search menu, or back to the main menu to choose a different operating system.
|
21
|
+
|
22
|
+
If you select SEARCH BY NAME, you will be prompted to enter a name or search term to look for this shortcut. If a shortcut for this operating system matches your search term it will return the detailed view for that shortcut.
|
23
|
+
|
24
|
+
If you select SEARCH BY KEY, you will be prompted to enter a key sequence to look up. If a shortcut for this operating system matches your search term it will return the detailed view for that shortcut.
|
25
|
+
|
26
|
+
From the MAIN MENU and the SHORTCUT MENU you can EXIT by entering "x".
|
27
|
+
|
28
|
+
This application is easy to use and each stage will prompt you for the expected response.
|
29
|
+
|
30
|
+
## Development
|
31
|
+
|
32
|
+
After checking out the repo, run `bundle install` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
33
|
+
|
34
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
35
|
+
|
36
|
+
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/atxrenegade/flatiron_ruby_cli_portfolio. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
40
|
+
|
41
|
+
## License
|
42
|
+
|
43
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
44
|
+
|
45
|
+
## Code of Conduct
|
46
|
+
|
47
|
+
Everyone interacting in the Atom Shortcuts project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/atxrenegade/flatiron_ruby_cli_portfolio/blob/master/CODE_OF_CONDUCT.md).
|
48
|
+
|
49
|
+
## Acknowledgments
|
50
|
+
* Contributer(s): Nils Winkler - author of the Github page displaying the atom shortcuts scraped for this application. (https://github.com/nwinkler/atom-keyboard-shortcuts)
|
data/Rakefile
ADDED
data/atom_shortcuts
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "atom_shortcuts/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "atom_shortcuts"
|
8
|
+
spec.version = AtomShortcuts::VERSION
|
9
|
+
spec.authors = ["atxrenegade"]
|
10
|
+
spec.email = ["harleighabel@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "A Cli gem for quick reference to Atom Shortcuts"
|
13
|
+
spec.description = "A quick CLI reference to Atom shortcuts for Mac, Windows and Linux, with search function"
|
14
|
+
spec.homepage = "https://rubygems.org/gems/atom_shortcuts"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
#if spec.respond_to?(:metadata)
|
20
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
#else
|
22
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
# "public gem pushes."
|
24
|
+
#end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.bindir = "exe"
|
30
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
|
+
spec.require_paths = ["lib"]
|
32
|
+
|
33
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
34
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
35
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
36
|
+
spec.add_development_dependency "nokogiri", "~> 1.8"
|
37
|
+
spec.add_development_dependency 'pry', '~> 0.11.3'
|
38
|
+
spec.add_development_dependency 'require_all', '~> 1.3', '>= 1.3.3'
|
39
|
+
|
40
|
+
end
|
data/bin/console
ADDED
data/bin/setup
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
class CLIInterface
|
2
|
+
|
3
|
+
def call
|
4
|
+
Scraper.new.scrape_atom
|
5
|
+
welcome_greeting
|
6
|
+
end
|
7
|
+
|
8
|
+
def welcome_greeting
|
9
|
+
puts "\n\n\n****** Welcome To - Atom Shortcuts Quick Reference ******\n\n"
|
10
|
+
puts " This is a cli utility gem designed as a quick reference\n"
|
11
|
+
puts " to Atoms many shortcuts. With so many languages, commands,\n"
|
12
|
+
puts " shortcuts and tools to memorize, you can now access a quick\n"
|
13
|
+
puts " digital reference without having to interrupt your workflow.\n"
|
14
|
+
puts " Being familiar with important shortcuts and commands speeds\n"
|
15
|
+
puts " up your workflow and increases your productivity as a programmer.\n"
|
16
|
+
puts "\n\nPress the ENTER key to continue....."
|
17
|
+
|
18
|
+
any_key = gets
|
19
|
+
if any_key.include?("\n")
|
20
|
+
main_menu_display
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def main_menu_display
|
25
|
+
puts"\n*********************************\n"
|
26
|
+
puts "********** MAIN MENU **********\n"
|
27
|
+
puts "*********************************\n\n"
|
28
|
+
puts "Please Select Your Operating System\n"
|
29
|
+
puts "or type 'X' to exit."
|
30
|
+
|
31
|
+
puts "1. Mac OS\n"
|
32
|
+
puts "2. Windows\n"
|
33
|
+
puts "3. Linux\n"
|
34
|
+
puts "X. EXIT\n\n"
|
35
|
+
main_menu_input
|
36
|
+
end
|
37
|
+
|
38
|
+
def main_menu_input
|
39
|
+
@user_os = gets.strip.upcase
|
40
|
+
if @user_os == "X"
|
41
|
+
exit_method
|
42
|
+
elsif @user_os == "1" || @user_os =="2" || @user_os =="3"
|
43
|
+
set_os
|
44
|
+
submenu_display
|
45
|
+
else
|
46
|
+
CLIInterface.error
|
47
|
+
main_menu_display
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def submenu_display
|
52
|
+
puts "\nPlease select an option from the Menu Below:\n"
|
53
|
+
puts "To LIST ALL shortcuts for your operating system type 'L'"
|
54
|
+
puts "To search shortcuts by NAME type 'N'"
|
55
|
+
puts "To search shortcuts by KEY type 'K'"
|
56
|
+
puts "To return to MAIN MENU type 'MM'"
|
57
|
+
puts "To EXIT type 'X'"
|
58
|
+
puts "\nEnter your Selection:"
|
59
|
+
submenu_input
|
60
|
+
end
|
61
|
+
|
62
|
+
def submenu_input
|
63
|
+
@user_input = gets.strip.upcase
|
64
|
+
puts "\n"
|
65
|
+
if @user_input == "L"
|
66
|
+
list_shortcuts
|
67
|
+
details_menu_display
|
68
|
+
elsif @user_input == "X"
|
69
|
+
exit_method
|
70
|
+
elsif @user_input == "N"
|
71
|
+
search_by_os_and_name
|
72
|
+
elsif @user_input == "K"
|
73
|
+
search_by_os_and_key
|
74
|
+
elsif @user_input == "MM"
|
75
|
+
main_menu_display
|
76
|
+
else
|
77
|
+
CLIInterface.error
|
78
|
+
submenu_display
|
79
|
+
end
|
80
|
+
puts "\n"
|
81
|
+
submenu_display
|
82
|
+
end
|
83
|
+
|
84
|
+
def set_os
|
85
|
+
if @user_os == "1"
|
86
|
+
@os = OperatingSystem.find_by_name("Mac")
|
87
|
+
elsif
|
88
|
+
@user_os == "2"
|
89
|
+
@os = OperatingSystem.find_by_name("Windows")
|
90
|
+
else
|
91
|
+
@os = OperatingSystem.find_by_name("Linux")
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def list_shortcuts
|
96
|
+
puts "\n*************************************"
|
97
|
+
puts "\n ATOM SHORTCUTS FOR #{@os.name} OS"
|
98
|
+
puts "\n*************************************\n\n"
|
99
|
+
@os.sort_alphabetically
|
100
|
+
@os.shortcuts.each_with_index do |shortcut, index|
|
101
|
+
if (index)%10 == 0 && (index) != 0
|
102
|
+
puts "\n (Press Enter to Continue)\n\n"
|
103
|
+
gets
|
104
|
+
end
|
105
|
+
puts " #{index + 1}. #{shortcut.name}: #{shortcut.key_seq} \n"
|
106
|
+
end
|
107
|
+
puts "\n\n"
|
108
|
+
end
|
109
|
+
|
110
|
+
def search_by_os_and_name
|
111
|
+
puts "Enter the shortcut name you would like to search for: \n"
|
112
|
+
puts "(Use the format 'find in project')"
|
113
|
+
name = gets.strip.downcase
|
114
|
+
@os.search_by_name(name)
|
115
|
+
end
|
116
|
+
|
117
|
+
def search_by_os_and_key
|
118
|
+
puts "Enter the key you would like to search for: \n"
|
119
|
+
puts "(Use the format 'CTRL-K')\n"
|
120
|
+
key_to_find = gets.strip.upcase
|
121
|
+
@os.search_by_key(key_to_find)
|
122
|
+
end
|
123
|
+
|
124
|
+
def details_menu_display
|
125
|
+
puts "To view DETAILS of a specific shortcut enter the number below \n"
|
126
|
+
puts "To return to SEARCH MENU type 'SM'"
|
127
|
+
puts "To return to MAIN MENU type 'MM'\n"
|
128
|
+
puts "To EXIT type 'X'"
|
129
|
+
details_menu_input
|
130
|
+
end
|
131
|
+
|
132
|
+
def details_menu_input
|
133
|
+
details_input = gets.strip.upcase
|
134
|
+
if details_input == 'SM'
|
135
|
+
submenu_display
|
136
|
+
elsif details_input == 'MM'
|
137
|
+
main_menu_display
|
138
|
+
elsif details_input == 'X'
|
139
|
+
exit_method
|
140
|
+
elsif is_integer?(details_input)
|
141
|
+
@os.search_by_number(details_input)
|
142
|
+
else
|
143
|
+
CLIInterface.error
|
144
|
+
end
|
145
|
+
puts "\n"
|
146
|
+
details_menu_display
|
147
|
+
end
|
148
|
+
|
149
|
+
def is_integer?(details_input)
|
150
|
+
details_input.to_i.to_s == details_input
|
151
|
+
end
|
152
|
+
|
153
|
+
def exit_method
|
154
|
+
puts "\nThanks for using the Atom Shortcuts!"
|
155
|
+
puts "See you again soon!\n\n\n"
|
156
|
+
exit
|
157
|
+
end
|
158
|
+
|
159
|
+
def self.detail_view(key)
|
160
|
+
puts "\n\n Shortcut Key Sequence: #{key.key_seq}\n"
|
161
|
+
puts " Shortcut Name: #{key.name.capitalize}\n"
|
162
|
+
puts " Operating System: #{key.operating_system.name}\n"
|
163
|
+
puts " Shortcut Description: #{key.description.capitalize}\n\n"
|
164
|
+
end
|
165
|
+
|
166
|
+
def self.error
|
167
|
+
puts "Your response was not understood.\n"
|
168
|
+
puts "Please select a valid option.\n"
|
169
|
+
end
|
170
|
+
|
171
|
+
def self.not_found
|
172
|
+
puts "\nYour selection was not found or not understood.\n"
|
173
|
+
puts "Please try a different search term or adjust your format.\n"
|
174
|
+
end
|
175
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Searchable
|
2
|
+
module InstanceMethods
|
3
|
+
def search_by_number(number)
|
4
|
+
if number.to_i > shortcuts.count
|
5
|
+
CLIInterface.error
|
6
|
+
else
|
7
|
+
shortcuts.each_with_index do |key, index|
|
8
|
+
if (index + 1).to_s == number
|
9
|
+
CLIInterface.detail_view(key)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def search_by_name(name)
|
16
|
+
shortcuts.each do |key|
|
17
|
+
if key.name.include?(name)
|
18
|
+
@found_key = key
|
19
|
+
end
|
20
|
+
end
|
21
|
+
if @found_key.nil?
|
22
|
+
CLIInterface.not_found
|
23
|
+
else
|
24
|
+
CLIInterface.detail_view(@found_key)
|
25
|
+
end
|
26
|
+
@found_key = nil
|
27
|
+
end
|
28
|
+
|
29
|
+
def search_by_key(key_to_find)
|
30
|
+
shortcuts.each do |key|
|
31
|
+
if key.key_seq == key_to_find
|
32
|
+
@found_key = key
|
33
|
+
end
|
34
|
+
end
|
35
|
+
if @found_key.nil?
|
36
|
+
CLIInterface.not_found
|
37
|
+
else
|
38
|
+
CLIInterface.detail_view(@found_key)
|
39
|
+
end
|
40
|
+
@found_key = nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
class DataFormatter
|
2
|
+
def create_data_array_from_scraper(data)
|
3
|
+
#remove uneccessary data from array
|
4
|
+
shortcut_array = data.split("Block Travel").first.split("\n")
|
5
|
+
|
6
|
+
#remove blank strings
|
7
|
+
shortcut_array = shortcut_array.reject { |item| item.nil? || item == ''}
|
8
|
+
|
9
|
+
#find index number of first set of empty table values
|
10
|
+
insert_location = shortcut_array.index("ctrl-shift-o")
|
11
|
+
#insert n/a values into array
|
12
|
+
revised_array = shortcut_array.insert(insert_location + 1, "No key for this OS", "No key for this OS" )
|
13
|
+
|
14
|
+
#find second location of empty table values
|
15
|
+
insert_location = shortcut_array.index("alt-cmd-s")
|
16
|
+
#insert n/a values into array
|
17
|
+
revised_array = shortcut_array.insert(insert_location + 1, "No key for this OS", "No key for this OS")
|
18
|
+
|
19
|
+
#split array to sub arrays for object hashes
|
20
|
+
revised_array = revised_array.each_slice(5).to_a
|
21
|
+
create_shortcuts_array(revised_array)
|
22
|
+
end
|
23
|
+
|
24
|
+
#create object arrays for each shortcut for each operating system
|
25
|
+
def create_shortcuts_array(revised_array)
|
26
|
+
shortcuts_array = []
|
27
|
+
revised_array.each do |array|
|
28
|
+
array[0].downcase!
|
29
|
+
array[1].upcase!
|
30
|
+
array[2].upcase!
|
31
|
+
array[3].upcase!
|
32
|
+
array[4].downcase!
|
33
|
+
shortcuts_array << [array[0], array[1], array[4], "Mac"] << [array[0], array[2],array[4], "Windows"] << [array[0], array[3], array[4], "Linux"]
|
34
|
+
end
|
35
|
+
parse_attribute_array(shortcuts_array)
|
36
|
+
end
|
37
|
+
|
38
|
+
#parse array to create shortcut objects
|
39
|
+
def parse_attribute_array(shortcuts_array)
|
40
|
+
shortcuts_array.each do |shortcut_array|
|
41
|
+
Shortcut.create_from_attribute_array(shortcut_array)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
class OperatingSystem
|
2
|
+
@@all = []
|
3
|
+
include Searchable::InstanceMethods
|
4
|
+
|
5
|
+
attr_accessor :name, :shortcut
|
6
|
+
|
7
|
+
def initialize(name= nil)
|
8
|
+
@name = name
|
9
|
+
@shortcuts = []
|
10
|
+
end
|
11
|
+
|
12
|
+
def save
|
13
|
+
@@all << self
|
14
|
+
end
|
15
|
+
|
16
|
+
def shortcuts
|
17
|
+
@shortcuts
|
18
|
+
end
|
19
|
+
|
20
|
+
def add_shortcut(shortcut)
|
21
|
+
@shortcuts << shortcut
|
22
|
+
shortcut.operating_system = self
|
23
|
+
end
|
24
|
+
|
25
|
+
def sort_alphabetically
|
26
|
+
@shortcuts = shortcuts.collect.sort_by {|obj| obj.name}
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.find_by_name(name)
|
30
|
+
@@all.detect {|os| os.name == name}
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.find_or_create_operating_system(name)
|
34
|
+
os = OperatingSystem.all.detect {|os_object| name == os_object.name}
|
35
|
+
if os.nil?
|
36
|
+
create_operating_system(name)
|
37
|
+
else
|
38
|
+
os
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.create_operating_system(name)
|
43
|
+
os = OperatingSystem.new(name)
|
44
|
+
os.save
|
45
|
+
os
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.all
|
49
|
+
@@all
|
50
|
+
end
|
51
|
+
end
|
data/lib/scraper.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
class Scraper
|
2
|
+
|
3
|
+
ATOM_PATH = "https://github.com/nwinkler/atom-keyboard-shortcuts"
|
4
|
+
|
5
|
+
def scrape_atom
|
6
|
+
atom_doc = Nokogiri::HTML(open(ATOM_PATH))
|
7
|
+
shortcut_string = atom_doc.css("html body div div #js-repo-pjax-container div div #readme div article.markdown-body.entry-content table tbody").text
|
8
|
+
DataFormatter.new.create_data_array_from_scraper(shortcut_string)
|
9
|
+
end
|
10
|
+
end
|
data/lib/shortcut.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
class Shortcut
|
2
|
+
@@all = []
|
3
|
+
|
4
|
+
attr_accessor :name, :key_seq, :description, :operating_system
|
5
|
+
|
6
|
+
def initialize(name, key_seq, description, operating_system)
|
7
|
+
@name = name
|
8
|
+
@key_seq = key_seq
|
9
|
+
@description = description
|
10
|
+
@operating_system = operating_system
|
11
|
+
end
|
12
|
+
|
13
|
+
def operating_system=(operating_system)
|
14
|
+
@operating_system= operating_system
|
15
|
+
end
|
16
|
+
|
17
|
+
def save
|
18
|
+
@@all << self
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.create_from_attribute_array(attribute_array)
|
22
|
+
|
23
|
+
operating_system = OperatingSystem.find_or_create_operating_system(attribute_array[3])
|
24
|
+
name = attribute_array[0]
|
25
|
+
key_seq = attribute_array[1]
|
26
|
+
description = attribute_array[2]
|
27
|
+
|
28
|
+
shortcut = Shortcut.new(name, key_seq, description, operating_system)
|
29
|
+
|
30
|
+
shortcut.save
|
31
|
+
operating_system.add_shortcut(shortcut)
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.all
|
35
|
+
@@all
|
36
|
+
end
|
37
|
+
end
|
data/notes.md
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
BRAINSTORM for web_dev_cheatsheets which became atom_shortcuts
|
2
|
+
|
3
|
+
>./lazy_programmer
|
4
|
+
|
5
|
+
Welcome to the LAZY PROGRAMMER's Shortcuts and Cheatsheets CLI GEM!
|
6
|
+
|
7
|
+
Shortcuts and Cheatsheets is a cli utility gem designed for as a quick reference to a web developer’s most commonly used tools. Think of it as a Swiss army knife for web developers and web dev students. With so many languages, commands, shortcuts and tools to memorize, now you can access a quick digital reference without having shuffle through pages of cheatsheets, or drown in stack overflow posts.
|
8
|
+
|
9
|
+
Being familiar with shortcuts and important commands speeds up your workflow and increases your productivity as a programmer. This program does not to include an exhaustive list of all available commands but focuses on the most commonly used shortcuts and commands you will need as a developer.
|
10
|
+
|
11
|
+
*********************************
|
12
|
+
********** MAIN MENU **********
|
13
|
+
*********************************
|
14
|
+
|
15
|
+
1. Shortcut of the Day
|
16
|
+
2. Github commands
|
17
|
+
3. Atom shortcuts
|
18
|
+
4. Pry commands
|
19
|
+
5. Bash/Shell (CLI for linux and UNIX)
|
20
|
+
6. COMMAND (CLI for windows)
|
21
|
+
7. Mac OS keyboard shortcuts
|
22
|
+
8. Windows keyboard shortcuts
|
23
|
+
X. EXIT
|
24
|
+
|
25
|
+
Please select the number for the command you would
|
26
|
+
like to execute?
|
27
|
+
|
28
|
+
> 1
|
29
|
+
|
30
|
+
WELCOME TO SHORTCUTS!
|
31
|
+
This feature is designed to familiarize you with a
|
32
|
+
single randomly chosen shortcut. To make this the
|
33
|
+
most relevant to you can you tell me which operating
|
34
|
+
systems you are using?
|
35
|
+
|
36
|
+
1. Mac/linux
|
37
|
+
2. Windows
|
38
|
+
3. All of the Above
|
39
|
+
MM. Main Menu
|
40
|
+
X. EXIT
|
41
|
+
|
42
|
+
> 3
|
43
|
+
|
44
|
+
Perfect!
|
45
|
+
Your SHORTCUT OF THE DAY IS:
|
46
|
+
|
47
|
+
Atom SHORTCUT
|
48
|
+
|
49
|
+
FUNCTION: Move to the end of the line
|
50
|
+
KEY SEQUENCE: Cmd+Right or Ctrl+E
|
51
|
+
|
52
|
+
WOULD you like to EXIT or return to the main menu?
|
53
|
+
MM. MAIN MENU
|
54
|
+
X. EXIT
|
55
|
+
|
56
|
+
> MM
|
57
|
+
|
58
|
+
*********************************
|
59
|
+
********** MAIN MENU **********
|
60
|
+
*********************************
|
61
|
+
|
62
|
+
1. Shortcut of the Day
|
63
|
+
2. Github commands
|
64
|
+
3. Atom shortcuts
|
65
|
+
4. Pry commands
|
66
|
+
5. Bash/Shell (CLI for linux and UNIX)
|
67
|
+
6. COMMAND (CLI for windows)
|
68
|
+
7. Mac OS keyboard shortcuts
|
69
|
+
8. Windows keyboard shortcuts
|
70
|
+
X. EXIT
|
71
|
+
|
72
|
+
Please select the number for the command you would
|
73
|
+
like to execute?
|
74
|
+
|
75
|
+
>5
|
76
|
+
|
77
|
+
bash/shell COMMANDS
|
78
|
+
1. command name - keysequence - brief description.
|
79
|
+
Lorem ipsum blah, blah, blah.
|
80
|
+
2. command name - keysequence - brief description.
|
81
|
+
Lorem ipsum blah, blah, blah.
|
82
|
+
3. command name - keysequence - brief description.
|
83
|
+
Lorem ipsum blah, blah, blah.
|
84
|
+
4. command name - keysequence - brief description.
|
85
|
+
Lorem ipsum blah, blah, blah.
|
86
|
+
5. command name - keysequence - brief description.
|
87
|
+
Lorem ipsum blah, blah, blah.
|
88
|
+
6. command name - keysequence - brief description.
|
89
|
+
Lorem ipsum blah, blah, blah.
|
90
|
+
7. command name - keysequence - brief description.
|
91
|
+
Lorem ipsum blah, blah, blah.
|
92
|
+
8. command name - keysequence - brief description.
|
93
|
+
Lorem ipsum blah, blah, blah.
|
94
|
+
9. command name - keysequence - brief description.
|
95
|
+
Lorem ipsum blah, blah, blah.
|
96
|
+
10. command name - keysequence - brief description.
|
97
|
+
Lorem ipsum blah, blah, blah.
|
98
|
+
|
99
|
+
SELECT 1-10 to see detailed description of the command/shortcut,
|
100
|
+
M for More will display the next 10 commands/shortcuts from this category,
|
101
|
+
MM will return you to the Main MENU,
|
102
|
+
X to EXIT the program
|
103
|
+
|
104
|
+
Please input your selection?
|
105
|
+
>2
|
106
|
+
|
107
|
+
2. command name - keysequence - brief description.
|
108
|
+
Lorem ipsum blah, blah, blah.
|
109
|
+
|
110
|
+
Lorem ipsum dolor amet letterpress sartorial small batch chillwave. Plaid viral air plant, fingerstache portland copper mug you probably haven't heard of them leggings gastropub poke chia raclette. Schlitz offal kickstarter YOLO mixtape, tattooed artisan ennui pop-up cloud bread tumeric umami yuccie. Crucifix disrupt vegan, pug ethical air plant thundercats viral knausgaard neutra meh lomo. Subway tile man bun microdosing cronut. Readymade selvage tumeric iPhone literally, cornhole godard DIY brunch letterpress.
|
111
|
+
|
112
|
+
R will RETURN you to previous list of commands/shortcuts,
|
113
|
+
MM will return you to the MAIN MENU,
|
114
|
+
X to EXIT the program
|
115
|
+
|
116
|
+
Please input your selection?
|
117
|
+
> X
|
118
|
+
|
119
|
+
Thanks for using the LAZY PROGRAMMERS shortcuts and cheatsheets!
|
120
|
+
See you again soon!
|
121
|
+
|
122
|
+
>
|
123
|
+
|
124
|
+
//TO DO:
|
125
|
+
SEARCH
|
126
|
+
REVERSE-SEARCH
|
127
|
+
LIST-ALL
|
@@ -0,0 +1,99 @@
|
|
1
|
+
CLI ATOM SHORTCUTS - OBJECT RELATIONSHIPS
|
2
|
+
|
3
|
+
MODEL A
|
4
|
+
|
5
|
+
Shortcut
|
6
|
+
has many:
|
7
|
+
descriptions
|
8
|
+
MacOSkey
|
9
|
+
WindowsKey
|
10
|
+
LinuxKey
|
11
|
+
|
12
|
+
Description
|
13
|
+
belongs to:
|
14
|
+
a Shortcut
|
15
|
+
has many:
|
16
|
+
MacOSkeys through Shortcut
|
17
|
+
WindowsKeys through Shortcut
|
18
|
+
LinuxKeys through Shortcut
|
19
|
+
|
20
|
+
MacOSKey
|
21
|
+
belongs to:
|
22
|
+
a Shortcut
|
23
|
+
a Description through shortcut
|
24
|
+
|
25
|
+
WindowsKey
|
26
|
+
belongs to:
|
27
|
+
a Shortcut
|
28
|
+
a Description through shortcut
|
29
|
+
|
30
|
+
LinuxKey
|
31
|
+
belongs to:
|
32
|
+
a Shortcut
|
33
|
+
a Description through shortcut
|
34
|
+
|
35
|
+
|
36
|
+
MODEL B
|
37
|
+
|
38
|
+
Shortcut
|
39
|
+
Has one:
|
40
|
+
description
|
41
|
+
MacOSkey
|
42
|
+
WindowsKey
|
43
|
+
LinuxKey
|
44
|
+
|
45
|
+
Description
|
46
|
+
belongs to:
|
47
|
+
a Shortcut
|
48
|
+
has a
|
49
|
+
MacOSkey through shortcut
|
50
|
+
WindowsKeysthrough shortcut
|
51
|
+
LinuxKey through shortcut
|
52
|
+
|
53
|
+
MacOSKey
|
54
|
+
belongs to:
|
55
|
+
a Shortcut
|
56
|
+
a Description through shortcut
|
57
|
+
|
58
|
+
WindowsKey
|
59
|
+
belongs to:
|
60
|
+
a Shortcut
|
61
|
+
a Description through shortcut
|
62
|
+
|
63
|
+
|
64
|
+
LinuxKey
|
65
|
+
belongs to:
|
66
|
+
a Shortcut
|
67
|
+
a Description through shortcut
|
68
|
+
|
69
|
+
MODEL C *** (chosen structure)
|
70
|
+
|
71
|
+
Shortcut
|
72
|
+
has one:
|
73
|
+
description
|
74
|
+
MacOSkey
|
75
|
+
WindowsKey
|
76
|
+
LinuxKey
|
77
|
+
|
78
|
+
Description
|
79
|
+
belongs to:
|
80
|
+
a Shortcut
|
81
|
+
has one:
|
82
|
+
MacOSkey
|
83
|
+
WindowsKey
|
84
|
+
LinuxKey
|
85
|
+
|
86
|
+
MacOSKey
|
87
|
+
belongs to:
|
88
|
+
a Shortcut
|
89
|
+
a Description
|
90
|
+
|
91
|
+
WindowsKey
|
92
|
+
belongs to:
|
93
|
+
a Shortcut
|
94
|
+
a Description
|
95
|
+
|
96
|
+
LinuxKey
|
97
|
+
belongs to:
|
98
|
+
a Shortcut
|
99
|
+
a Description
|
metadata
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: atom_shortcuts
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- atxrenegade
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-03-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '13.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '13.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: nokogiri
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.8'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.8'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.11.3
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.11.3
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: require_all
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.3'
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 1.3.3
|
93
|
+
type: :development
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '1.3'
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 1.3.3
|
103
|
+
description: A quick CLI reference to Atom shortcuts for Mac, Windows and Linux, with
|
104
|
+
search function
|
105
|
+
email:
|
106
|
+
- harleighabel@gmail.com
|
107
|
+
executables: []
|
108
|
+
extensions: []
|
109
|
+
extra_rdoc_files: []
|
110
|
+
files:
|
111
|
+
- ".gitignore"
|
112
|
+
- ".rspec"
|
113
|
+
- ".travis.yml"
|
114
|
+
- CODE_OF_CONDUCT.md
|
115
|
+
- Gemfile
|
116
|
+
- Gemfile.lock
|
117
|
+
- LICENSE.txt
|
118
|
+
- README.md
|
119
|
+
- Rakefile
|
120
|
+
- atom_shortcuts
|
121
|
+
- atom_shortcuts.gemspec
|
122
|
+
- bin/console
|
123
|
+
- bin/setup
|
124
|
+
- config/environment.rb
|
125
|
+
- lib/atom_shortcuts/version.rb
|
126
|
+
- lib/cli_interface.rb
|
127
|
+
- lib/concerns/searchable.rb
|
128
|
+
- lib/data_formatter.rb
|
129
|
+
- lib/operating_system.rb
|
130
|
+
- lib/scraper.rb
|
131
|
+
- lib/shortcut.rb
|
132
|
+
- notes.md
|
133
|
+
- object_relationship_models.md
|
134
|
+
homepage: https://rubygems.org/gems/atom_shortcuts
|
135
|
+
licenses:
|
136
|
+
- MIT
|
137
|
+
metadata: {}
|
138
|
+
post_install_message:
|
139
|
+
rdoc_options: []
|
140
|
+
require_paths:
|
141
|
+
- lib
|
142
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - ">="
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
requirements: []
|
153
|
+
rubyforge_project:
|
154
|
+
rubygems_version: 2.7.8
|
155
|
+
signing_key:
|
156
|
+
specification_version: 4
|
157
|
+
summary: A Cli gem for quick reference to Atom Shortcuts
|
158
|
+
test_files: []
|