rash-shell 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 95a0a3c2fcfd4205946cc8e5f0b93ba16ff9344d
4
+ data.tar.gz: f9a6a46ad801fe4800871f9962d48153cedf9395
5
+ SHA512:
6
+ metadata.gz: e27d8cbd5662afb99febc1f8bab4d4a7087d6a0cf4a8210f06fb2d6a093fed877139a979fb926550ae7264d8e13c492977cedf06721e6621479f23494ed114c9
7
+ data.tar.gz: 0865744fcbfea2ea9b560f125f629be6ab957e902a7ef7d9ffe58379cb6ccaa40a50a31dc13e295371d89e44ffd0df7fe9e1eb666e0508a1db9bb566cd19d871
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /_yardoc/
2
+ /.bundle/
3
+ /.yardoc
4
+ /coverage/
5
+ /doc/
6
+ /Gemfile.lock
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,78 @@
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
9
+ experience, nationality, personal appearance, race, religion, or sexual identity
10
+ and 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
+
28
+ * Trolling, insulting/derogatory comments, and personal or political attacks
29
+
30
+ * Public or private harassment
31
+
32
+ * Publishing others' private information, such as a physical or electronic
33
+ address, without explicit permission
34
+
35
+ * Other conduct which could reasonably be considered inappropriate in a
36
+ professional setting
37
+
38
+ ## Our Responsibilities
39
+
40
+ Project maintainers are responsible for clarifying the standards of acceptable
41
+ behavior and are expected to take appropriate and fair corrective action in
42
+ response to any instances of unacceptable behavior.
43
+
44
+ Project maintainers have the right and responsibility to remove, edit, or
45
+ reject comments, commits, code, wiki edits, issues, and other contributions
46
+ that are not aligned to this Code of Conduct, or to ban temporarily or
47
+ permanently any contributor for other behaviors that they deem inappropriate,
48
+ threatening, offensive, or harmful.
49
+
50
+ ## Scope
51
+
52
+ This Code of Conduct applies both within project spaces and in public spaces
53
+ when an individual is representing the project or its community. Examples of
54
+ representing a project or community include using an official project e-mail
55
+ address, posting via an official social media account, or acting as an appointed
56
+ representative at an online or offline event. Representation of a project may be
57
+ further defined and clarified by project maintainers.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported by contacting the project team at jean@mertz.fm. All complaints will be
63
+ reviewed and investigated and will result in a response that is deemed necessary
64
+ and appropriate to the circumstances. The project team is obligated to maintain
65
+ confidentiality with regard to the reporter of an incident. Further details of
66
+ specific enforcement policies may be posted separately.
67
+
68
+ Project maintainers who do not follow or enforce the Code of Conduct in good
69
+ faith may face temporary or permanent repercussions as determined by other
70
+ members of the project's leadership.
71
+
72
+ ## Attribution
73
+
74
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
75
+ version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
76
+
77
+ [homepage]: http://contributor-covenant.org
78
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Jean Mertz
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,40 @@
1
+ # Rash::Shell
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rash/shell`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'rash-shell'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install rash-shell
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Run `bundle exec rash-shell` to use the gem in this directory, ignoring other installed copies of this gem.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rash-shell. 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.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << 'test'
6
+ t.libs << 'lib'
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task default: :test
data/bin/rash ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rack'
4
+ require 'pry'
5
+ require 'rash/shell'
6
+
7
+ ENV['RACK_ENV'] ||= 'development'
8
+ Rack::Builder.parse_file('config.ru')
9
+
10
+ if ARGV.empty?
11
+ Pry.start
12
+ else
13
+ Pry.prompt = Pry::NO_PROMPT
14
+ Pry.hooks.delete_hook(:before_session, :welcome)
15
+
16
+ puts
17
+ cmd = ARGV.join(' ').concat("\n exit")
18
+ Pry::CLI.parse_options(['--exec', cmd])
19
+ end
@@ -0,0 +1,3 @@
1
+ Pry::Commands.create_command 'h' do
2
+ description 'Show application specific help (if any are defined): h ARG'
3
+ end
@@ -0,0 +1,12 @@
1
+ Pry::Commands.create_command 'no-prompt' do
2
+ description 'Show/hide REPL command prompt prefix'
3
+
4
+ def process
5
+ case _pry_.prompt
6
+ when Pry::NO_PROMPT
7
+ _pry_.pop_prompt
8
+ else
9
+ _pry_.push_prompt Pry::NO_PROMPT
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,2 @@
1
+ require 'rash/shell/pry/commands/h'
2
+ require 'rash/shell/pry/commands/no_prompt'
@@ -0,0 +1,13 @@
1
+ Pry.hooks.add_hook(:before_session, :welcome) do |output|
2
+ output.print "#{Pry::Helpers::Text.yellow(Pry.config.prompt_name)} shell " \
3
+ "started in #{Rash::Shell.environment_with_color} environment. "
4
+
5
+ output.print "Happy Hackin'" unless ENV['RACK_ENV'] == 'production'
6
+ output.puts "\n\n"
7
+ end
8
+
9
+ Pry.config.color = true
10
+ Pry.config.theme = 'railscasts'
11
+ Pry.config.pager = false
12
+ Pry.config.history.file = '.pry_history'
13
+ Pry.config.prompt_name = "\e[38;5;222m#{ENV['APP_NAME'] || File.basename(Dir.pwd)}\033[0m"
@@ -0,0 +1,15 @@
1
+ Pry.prompt = [
2
+ proc do |target_self, _, pry|
3
+ target = target_self.to_s == 'main' ? '' : " (#{target_self.to_s.split('::').last})"
4
+ env = Rash::Shell.environment_with_color
5
+
6
+ "#{pry.config.prompt_name} [#{env}]#{target} % "
7
+ end,
8
+
9
+ proc do |target_self, _, pry|
10
+ target = target_self.to_s == 'main' ? '' : " (#{target_self.to_s.split('::').last})"
11
+ env = Rash::Shell.environment_with_color
12
+
13
+ "#{pry.config.prompt_name} [#{env}]#{target} * "
14
+ end
15
+ ]
@@ -0,0 +1,5 @@
1
+ require 'pry'
2
+
3
+ require 'rash/shell/pry/commands'
4
+ require 'rash/shell/pry/config'
5
+ require 'rash/shell/pry/prompt'
@@ -0,0 +1,5 @@
1
+ module Rash
2
+ module Shell
3
+ VERSION = '0.1.0'.freeze
4
+ end
5
+ end
data/lib/rash/shell.rb ADDED
@@ -0,0 +1,21 @@
1
+ require 'rash/shell/pry'
2
+ require 'rash/shell/version'
3
+
4
+ module Rash
5
+ # :no-doc:
6
+ module Shell
7
+ module_function
8
+
9
+ def environment
10
+ ENV['RACK_ENV'] || 'development'
11
+ end
12
+
13
+ def environment_color
14
+ environment == 'production' ? "\e[38;5;124m" : "\e[38;5;107m"
15
+ end
16
+
17
+ def environment_with_color
18
+ "#{environment_color}#{environment}\033[0m"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rash/shell/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'rash-shell'
8
+ spec.version = Rash::Shell::VERSION
9
+ spec.authors = ['Jean Mertz']
10
+ spec.email = ['jean@mertz.fm']
11
+
12
+ spec.summary = 'Write a short summary, because Rubygems requires one.'
13
+ spec.description = 'Write a longer description or delete this line.'
14
+ spec.homepage = 'https://github.com/JeanMertz/rash-shell'
15
+ spec.license = 'MIT'
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = 'bin'
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.11'
22
+ spec.add_development_dependency 'rake', '~> 10.0'
23
+ spec.add_development_dependency 'minitest', '~> 5.0'
24
+
25
+ spec.add_dependency 'pry'
26
+ spec.add_dependency 'pry-theme'
27
+ end
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rash-shell
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jean Mertz
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-03-19 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.11'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.11'
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: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
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: pry-theme
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Write a longer description or delete this line.
84
+ email:
85
+ - jean@mertz.fm
86
+ executables:
87
+ - rash
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".gitignore"
92
+ - CODE_OF_CONDUCT.md
93
+ - Gemfile
94
+ - LICENSE.txt
95
+ - README.md
96
+ - Rakefile
97
+ - bin/rash
98
+ - lib/rash/shell.rb
99
+ - lib/rash/shell/pry.rb
100
+ - lib/rash/shell/pry/commands.rb
101
+ - lib/rash/shell/pry/commands/h.rb
102
+ - lib/rash/shell/pry/commands/no_prompt.rb
103
+ - lib/rash/shell/pry/config.rb
104
+ - lib/rash/shell/pry/prompt.rb
105
+ - lib/rash/shell/version.rb
106
+ - rash-shell.gemspec
107
+ homepage: https://github.com/JeanMertz/rash-shell
108
+ licenses:
109
+ - MIT
110
+ metadata: {}
111
+ post_install_message:
112
+ rdoc_options: []
113
+ require_paths:
114
+ - lib
115
+ required_ruby_version: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ required_rubygems_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ requirements: []
126
+ rubyforge_project:
127
+ rubygems_version: 2.4.5.1
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: Write a short summary, because Rubygems requires one.
131
+ test_files: []
132
+ has_rdoc: