lazy_navigator 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c24d8de358db52d4b3bfc190c4c70abbbb53d95abcf0b45bb9c329445fc0f873
4
+ data.tar.gz: '09dc70376929d43e36c43b50c80d7c54f9ca9f4373f339eed647582d33fa7402'
5
+ SHA512:
6
+ metadata.gz: e4c34605f8dab910af12a1f82f5470a1c7ea28f623ca31d3fe7ddea5ce07a95903ddd1144708df146114085823c2432ba449b1fb8345172843c801fbd5476832
7
+ data.tar.gz: 11b55c0585b680ee7707d47e637003d889c1d7cac5a501774baf40a5e1bc5ee04f6e63cab78eb716fb98eb3bcf58bb316f69531fea6be135400995e98257d72f
@@ -0,0 +1,47 @@
1
+ # Ruby CircleCI 2.0 configuration file
2
+ #
3
+ # Check https://circleci.com/docs/2.0/language-ruby/ for more details
4
+ #
5
+ version: 2
6
+ jobs:
7
+ build:
8
+ docker:
9
+ - image: circleci/ruby:2.5.1-node-browsers
10
+
11
+ working_directory: ~/repo
12
+
13
+ steps:
14
+ - checkout
15
+
16
+ # Download and cache dependencies
17
+ - restore_cache:
18
+ keys:
19
+ - v1-dependencies-{{ checksum "Gemfile.lock" }}
20
+ # fallback to using the latest cache if no exact match is found
21
+ - v1-dependencies-
22
+
23
+ - run:
24
+ name: install dependencies
25
+ command: |
26
+ bundle install --jobs=4 --retry=3 --path vendor/bundle
27
+ - save_cache:
28
+ paths:
29
+ - ./vendor/bundle
30
+ key: v1-dependencies-{{ checksum "Gemfile.lock" }}
31
+
32
+ - run:
33
+ name: run tests
34
+ command: |
35
+ mkdir /tmp/test-results
36
+ TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"
37
+
38
+ bundle exec rspec --format progress \
39
+ --out /tmp/test-results/rspec.xml \
40
+ --format progress \
41
+ $TEST_FILES
42
+ # collect reports
43
+ - store_test_results:
44
+ path: /tmp/test-results
45
+ - store_artifacts:
46
+ path: /tmp/test-results
47
+ destination: test-results
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /*.gem
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.1
7
+ before_install: gem install bundler -v 1.17.3
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in lazy_navigator.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,61 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ lazy_navigator (1.5.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.0)
10
+ diff-lcs (1.3)
11
+ docile (1.3.1)
12
+ jaro_winkler (1.5.1)
13
+ json (2.1.0)
14
+ parallel (1.12.1)
15
+ parser (2.5.3.0)
16
+ ast (~> 2.4.0)
17
+ powerpack (0.1.2)
18
+ rainbow (3.0.0)
19
+ rake (10.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
+ rubocop (0.61.1)
34
+ jaro_winkler (~> 1.5.1)
35
+ parallel (~> 1.10)
36
+ parser (>= 2.5, != 2.5.1.1)
37
+ powerpack (~> 0.1)
38
+ rainbow (>= 2.2.2, < 4.0)
39
+ ruby-progressbar (~> 1.7)
40
+ unicode-display_width (~> 1.4.0)
41
+ ruby-progressbar (1.10.0)
42
+ simplecov (0.16.1)
43
+ docile (~> 1.1)
44
+ json (>= 1.8, < 3)
45
+ simplecov-html (~> 0.10.0)
46
+ simplecov-html (0.10.2)
47
+ unicode-display_width (1.4.1)
48
+
49
+ PLATFORMS
50
+ ruby
51
+
52
+ DEPENDENCIES
53
+ bundler (~> 1.17)
54
+ lazy_navigator!
55
+ rake (~> 10.0)
56
+ rspec (~> 3.0)
57
+ rubocop
58
+ simplecov
59
+
60
+ BUNDLED WITH
61
+ 1.17.3
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 IgorShkidchenko
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,31 @@
1
+ [![CircleCI](https://circleci.com/gh/IgorShkidchenko/lazy_navigator/tree/master.svg?style=svg)](https://circleci.com/gh/IgorShkidchenko/lazy_navigator/tree/master) [![Maintainability](https://api.codeclimate.com/v1/badges/25e47f7e18c7de8dffbb/maintainability)](https://codeclimate.com/github/IgorShkidchenko/lazy_navigator/maintainability)
2
+ # LazyNavigator
3
+ ###### Gem that generates bash script which opens terminal and your IDE in last project folder(which you point out in constant), and if you want executes some additional bash commands
4
+
5
+ ## Installation
6
+ ``` $ gem install lazy_navigator ```
7
+
8
+ ##### create scripts files by runnig this commands in your terminal:
9
+ ```~$ cd ~```
10
+
11
+ ```~$ irb```
12
+
13
+ ```> require 'lazy_navigator'```
14
+
15
+ ```> LazyNavigator::Generator.g```
16
+
17
+ ```> exit ```
18
+
19
+ ##### then edit constants in generated lazy_navigator/last_project.rb file
20
+ PATH_TO_LAST_PROJECT = 'your last project path'
21
+
22
+ IDE = your ide name in bash
23
+ ## Usage
24
+
25
+ in your home folder run
26
+
27
+ ```~$ ./l```
28
+ ##### also you can pass argument command: in lead method which execute bash command in opening terminal
29
+ for example: .lead(path: PATH_TO_LAST_PROJECT, command: 'echo hello world')
30
+ ## License
31
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/autoload.rb ADDED
@@ -0,0 +1,3 @@
1
+ require_relative './lib/colorize/colorize'
2
+ require_relative './lib/entities/generator'
3
+ require_relative './lib/entities/opener'
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'lazy_navigator'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,35 @@
1
+ lib = File.expand_path('lib', __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'lazy_navigator/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'lazy_navigator'
7
+ spec.version = LazyNavigator::VERSION
8
+ spec.authors = ['IgorShkidchenko']
9
+ spec.email = ['igorshkidchenko@gmail.com']
10
+
11
+ spec.summary = 'gem for opening last project'
12
+ spec.description = 'gem for opening last project'
13
+ spec.homepage = 'https://github.com/IgorShkidchenko/lazy_navigator'
14
+ spec.license = 'MIT'
15
+
16
+ if spec.respond_to?(:metadata)
17
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
18
+ else
19
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
20
+ 'public gem pushes.'
21
+ end
22
+
23
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ end
26
+ spec.bindir = 'exe'
27
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ['lib']
29
+
30
+ spec.add_development_dependency 'bundler', '~> 1.17'
31
+ spec.add_development_dependency 'rake', '~> 10.0'
32
+ spec.add_development_dependency 'rspec', '~> 3.0'
33
+ spec.add_development_dependency 'rubocop'
34
+ spec.add_development_dependency 'simplecov'
35
+ end
@@ -0,0 +1,25 @@
1
+ class String
2
+ def green
3
+ "\e[32m#{self}\e[0m"
4
+ end
5
+
6
+ def magenta
7
+ "\e[35m#{self}\e[0m"
8
+ end
9
+
10
+ def cyan
11
+ "\e[36m#{self}\e[0m"
12
+ end
13
+
14
+ def bold
15
+ "\e[1m#{self}\e[22m"
16
+ end
17
+
18
+ def italic
19
+ "\e[3m#{self}\e[23m"
20
+ end
21
+
22
+ def blink
23
+ "\e[5m#{self}\e[25m"
24
+ end
25
+ end
@@ -0,0 +1,42 @@
1
+ module LazyNavigator
2
+ class Generator
3
+
4
+ SUCCESS_BASH_MSG = 'bash script generated'.freeze
5
+ SUCCESS_RUBY_MSG = 'ruby script generated'.freeze
6
+ BASH_SCRIPT_NAME = 'l'.freeze
7
+ RUBY_SCRIPT_NAME = 'last_project.rb'.freeze
8
+ TEXT_FOR_BASH = "#!/bin/bash\nruby lazy_navigator/last_project.rb\nkill -9 $PPID".freeze
9
+ TEXT_FOR_RUBY = "require 'lazy_navigator'\n\nPATH_TO_LAST_PROJECT = 'RubyGarage/codebreaker <-- change me'
10
+ \n#IDE = your ide name in bash, for example VSC = code
11
+ \nLazyNavigator::Opener.lead(path: PATH_TO_LAST_PROJECT, ide: nil)".freeze
12
+
13
+ class << self
14
+ def generate_script(folder = 'lazy_navigator')
15
+ puts SUCCESS_BASH_MSG.green if generate_bash
16
+ puts SUCCESS_RUBY_MSG.green if generate_ruby(folder)
17
+ end
18
+
19
+ alias g generate_script
20
+
21
+ private
22
+
23
+ def generate_bash
24
+ File.new(BASH_SCRIPT_NAME, 'w')
25
+ File.open(BASH_SCRIPT_NAME, 'w').write(TEXT_FOR_BASH)
26
+ add_script_command
27
+ end
28
+
29
+ def generate_ruby(folder)
30
+ Dir.mkdir(folder)
31
+ Dir.chdir(folder) do
32
+ File.new(RUBY_SCRIPT_NAME, 'w')
33
+ File.open(RUBY_SCRIPT_NAME, 'w').write(TEXT_FOR_RUBY)
34
+ end
35
+ end
36
+
37
+ def add_script_command
38
+ system "chmod +x #{BASH_SCRIPT_NAME}"
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,29 @@
1
+ module LazyNavigator
2
+ class Opener
3
+ STANDART_MSG = 'echo let the rspec to be with you'.freeze
4
+ WEATHER = 'curl https://wttr.in?0'.freeze
5
+ ACCEPT = 'y'.freeze
6
+
7
+ class << self
8
+ def lead(path:, ide: nil, command: STANDART_MSG)
9
+ ask_question
10
+ return unless yes?
11
+
12
+ Dir.chdir(path) do
13
+ system "gnome-terminal -- sh -c '#{command};#{WEATHER}; bash'"
14
+ system ide if ide
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ def yes?
21
+ gets.chomp.downcase == ACCEPT
22
+ end
23
+
24
+ def ask_question
25
+ puts ('continue last project? '.cyan + "#{'y'.green}/#{'n'.magenta}".blink.bold).italic
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,2 @@
1
+ require_relative 'lazy_navigator/version'
2
+ require_relative '../autoload'
@@ -0,0 +1,3 @@
1
+ module LazyNavigator
2
+ VERSION = '1.5.0'.freeze
3
+ end
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lazy_navigator
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.5.0
5
+ platform: ruby
6
+ authors:
7
+ - IgorShkidchenko
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-12-29 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.17'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.17'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.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: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: gem for opening last project
84
+ email:
85
+ - igorshkidchenko@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".circleci/config.yml"
91
+ - ".gitignore"
92
+ - ".rspec"
93
+ - ".travis.yml"
94
+ - Gemfile
95
+ - Gemfile.lock
96
+ - LICENSE.txt
97
+ - README.md
98
+ - Rakefile
99
+ - autoload.rb
100
+ - bin/console
101
+ - bin/setup
102
+ - lazy_navigator.gemspec
103
+ - lib/colorize/colorize.rb
104
+ - lib/entities/generator.rb
105
+ - lib/entities/opener.rb
106
+ - lib/lazy_navigator.rb
107
+ - lib/lazy_navigator/version.rb
108
+ homepage: https://github.com/IgorShkidchenko/lazy_navigator
109
+ licenses:
110
+ - MIT
111
+ metadata:
112
+ allowed_push_host: https://rubygems.org
113
+ post_install_message:
114
+ rdoc_options: []
115
+ require_paths:
116
+ - lib
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ requirements: []
128
+ rubygems_version: 3.0.1
129
+ signing_key:
130
+ specification_version: 4
131
+ summary: gem for opening last project
132
+ test_files: []