crowbar 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ before_install: gem install bundler -v 1.10.6
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in crowbar.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Christopher Stingl
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.
@@ -0,0 +1,43 @@
1
+ # Crowbar
2
+
3
+ A set of console debugging gems packaged together for your Ruby 3/4 projects.
4
+
5
+ # Prerequisites
6
+
7
+ - A Rails >= 3.0 Application
8
+ - Ruby >= 1.9
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ ```ruby
15
+ gem 'crowbar'
16
+ ```
17
+
18
+ And then execute:
19
+
20
+ $ bundle
21
+
22
+ Or install it yourself as:
23
+
24
+ $ gem install crowbar
25
+
26
+ ## Usage
27
+
28
+ TODO: Write usage instructions here
29
+
30
+ ## Development
31
+
32
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. 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`. 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).
35
+
36
+ ## Contributing
37
+
38
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/crowbar. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
39
+
40
+
41
+ ## License
42
+
43
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -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
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "crowbar"
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
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,45 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'crowbar/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "crowbar"
8
+ s.version = Crowbar::VERSION
9
+ s.authors = ["Christopher Stingl"]
10
+ s.email = ["cs@wolves.io"]
11
+ s.summary = %q{Pry-based enhancements for Rails 3/4 debugging}
12
+ s.description = %q{Pry-based enhancements for both Rails 3 & 4 debugging. A compilation of opinionated pry packages to improve the debugging environment}
13
+ s.homepage = "https://github.com/wolves/crowbar"
14
+ s.license = "MIT"
15
+
16
+ s.required_ruby_version = '>= 1.9.3'
17
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
+ # delete this section to allow pushing this gem to any host.
19
+ # if s.respond_to?(:metadata)
20
+ # s.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
+ # else
22
+ # raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ # end
24
+
25
+ s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
+ s.bindir = "exe"
27
+ s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
+ s.require_paths = ["lib"]
29
+
30
+
31
+ s.add_development_dependency "rspec"
32
+ s.add_development_dependency "bundler", "~> 1.10"
33
+ s.add_development_dependency "rake", "~> 10.0"
34
+
35
+ s.add_runtime_dependency "pry", "~> 0.10.0"
36
+ s.add_runtime_dependency "pry-rails", "~> 0.3.4"
37
+ s.add_runtime_dependency "pry-doc", "~> 0.8.0"
38
+ s.add_runtime_dependency "pry-git", "~> 0.2.3"
39
+ s.add_runtime_dependency 'pry-remote', '>= 0.1.7'
40
+ s.add_runtime_dependency 'pry-stack_explorer', '~> 0.4.9'
41
+ s.add_runtime_dependency 'pry-debugger', '~> 0.2.3'
42
+ s.add_runtime_dependency 'hirb', '~> 0.7.3'
43
+ s.add_runtime_dependency 'awesome_print', '~> 1.6.0'
44
+ s.add_runtime_dependency 'railties', '>= 3.0', '< 5.0'
45
+ end
@@ -0,0 +1,30 @@
1
+ require "crowbar/version"
2
+ require "crowbar/railtie" if defined?(Rails)
3
+ require 'active_support'
4
+ require 'readline'
5
+
6
+ module Crowbar
7
+ # Color the prompt?
8
+ #
9
+ # A different setting than Pry.color since some may like colored output, but a
10
+ # plain prompt.
11
+ #
12
+ # Default: 'true' for GNU readline or rb-readline which correctly count line
13
+ # widths with color codes when using \001 and \002 hints. 'false' for
14
+ # libedit-based wrapper (standard on OS X unless ruby is explicitly compiled
15
+ # otherwise).
16
+ #
17
+ mattr_accessor :colored_prompt
18
+ self.colored_prompt = (Readline::VERSION !~ /EditLine/)
19
+
20
+ # Separator between application name and input in the prompt.
21
+ #
22
+ # Default: right angle quote, or '>' when using rb-readline which doesn't
23
+ # handle mixed encodings well.
24
+ #
25
+ mattr_accessor :prompt_separator
26
+ self.prompt_separator = defined?(RbReadline) ? '>' : "\u00BB"
27
+
28
+ ### Internal methods ###
29
+ mattr_accessor :_hirb_output
30
+ end
@@ -0,0 +1,18 @@
1
+ require 'hirb'
2
+ require 'pry'
3
+
4
+ class << Hirb::View
5
+ alias_method :enable_output_method_existing, :enable_output_method
6
+ alias_method :disable_output_method_existing, :disable_output_method
7
+
8
+ def enable_output_method
9
+ @output_method = true
10
+ Crowbar._hirb_output = true
11
+ enable_output_method_existing
12
+ end
13
+
14
+ def disable_output_method
15
+ Crowbar._hirb_output = false
16
+ disable_output_method_existing
17
+ end
18
+ end
@@ -0,0 +1,70 @@
1
+ require 'pry'
2
+ require 'pry-rails'
3
+ require 'pry-doc'
4
+ require 'pry-git'
5
+ require 'pry-remote'
6
+ require 'pry-stack_explorer'
7
+ require 'crowbar/hirb_ext'
8
+ require 'pry-debugger'
9
+
10
+ module Crowbar
11
+ class Railtie < Rails::Railtie
12
+ initializer 'crowbar.initialize' do |app|
13
+ silence_warnings do
14
+ # We're managing the loading of plugins. So don't let pry autoload them.
15
+ Pry.config.should_load_plugins = false
16
+
17
+ # Use awesome_print for output, but keep pry's pager. If Hirb is
18
+ # enabled, try printing with it first.
19
+ Pry.config.print = ->(output, value) do
20
+ return if Crowbar._hirb_output && Hirb::View.view_or_page_output(value)
21
+ pretty = value.ai(indent: 2)
22
+ Pry::Helpers::BaseHelpers.stagger_output("=> #{pretty}", output)
23
+ end
24
+
25
+ # Friendlier prompt - line number, app name, nesting levels look like
26
+ # directory paths.
27
+ #
28
+ # Heavy use of lazy lambdas so configuration (like Pry.color) can be
29
+ # changed later or even during console usage.
30
+ #
31
+ # Custom color helpers using hints \001 and \002 so that good readline
32
+ # libraries (GNU, rb-readline) correctly ignore color codes when
33
+ # calculating line length.
34
+
35
+ color = -> { Pry.color && Crowbar.colored_prompt }
36
+ red = ->(text) { color[] ? "\001\e[0;31m\002#{text}\001\e[0m\002" : text.to_s }
37
+ blue = ->(text) { color[] ? "\001\e[0;34m\002#{text}\001\e[0m\002" : text.to_s }
38
+ bold = ->(text) { color[] ? "\001\e[1m\002#{text}\001\e[0m\002" : text.to_s }
39
+
40
+ separator = -> { red.(Crowbar.prompt_separator) }
41
+ name = app.class.parent_name.underscore
42
+ colored_name = -> { blue.(name) }
43
+
44
+ line = ->(pry) { "[#{bold.(pry.input_array.size)}] " }
45
+ target_string = ->(object, level) do
46
+ level = 0 if level < 0
47
+ unless (string = Pry.view_clip(object)) == 'main'
48
+ "(#{'../' * level}#{string})"
49
+ else
50
+ ''
51
+ end
52
+ end
53
+
54
+ Pry.config.prompt = [
55
+ ->(object, level, pry) do # Main prompt
56
+ "#{line.(pry)}#{colored_name.()}#{target_string.(object, level)} #{separator.()} "
57
+ end,
58
+ ->(object, level, pry) do # Wait prompt in multiline input
59
+ spaces = ' ' * (
60
+ "[#{pry.input_array.size}] ".size + # Uncolored `line.(pry)`
61
+ name.size +
62
+ target_string.(object, level).size
63
+ )
64
+ "#{spaces} #{separator.()} "
65
+ end
66
+ ]
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,3 @@
1
+ module Crowbar
2
+ VERSION = "1.0.0"
3
+ end
metadata ADDED
@@ -0,0 +1,279 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: crowbar
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Christopher Stingl
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2015-07-31 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: bundler
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '1.10'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.10'
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '10.0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: pry
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 0.10.0
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 0.10.0
78
+ - !ruby/object:Gem::Dependency
79
+ name: pry-rails
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: 0.3.4
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 0.3.4
94
+ - !ruby/object:Gem::Dependency
95
+ name: pry-doc
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: 0.8.0
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 0.8.0
110
+ - !ruby/object:Gem::Dependency
111
+ name: pry-git
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 0.2.3
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 0.2.3
126
+ - !ruby/object:Gem::Dependency
127
+ name: pry-remote
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: 0.1.7
134
+ type: :runtime
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: 0.1.7
142
+ - !ruby/object:Gem::Dependency
143
+ name: pry-stack_explorer
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ~>
148
+ - !ruby/object:Gem::Version
149
+ version: 0.4.9
150
+ type: :runtime
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ~>
156
+ - !ruby/object:Gem::Version
157
+ version: 0.4.9
158
+ - !ruby/object:Gem::Dependency
159
+ name: pry-debugger
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ~>
164
+ - !ruby/object:Gem::Version
165
+ version: 0.2.3
166
+ type: :runtime
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ~>
172
+ - !ruby/object:Gem::Version
173
+ version: 0.2.3
174
+ - !ruby/object:Gem::Dependency
175
+ name: hirb
176
+ requirement: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ~>
180
+ - !ruby/object:Gem::Version
181
+ version: 0.7.3
182
+ type: :runtime
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ~>
188
+ - !ruby/object:Gem::Version
189
+ version: 0.7.3
190
+ - !ruby/object:Gem::Dependency
191
+ name: awesome_print
192
+ requirement: !ruby/object:Gem::Requirement
193
+ none: false
194
+ requirements:
195
+ - - ~>
196
+ - !ruby/object:Gem::Version
197
+ version: 1.6.0
198
+ type: :runtime
199
+ prerelease: false
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ~>
204
+ - !ruby/object:Gem::Version
205
+ version: 1.6.0
206
+ - !ruby/object:Gem::Dependency
207
+ name: railties
208
+ requirement: !ruby/object:Gem::Requirement
209
+ none: false
210
+ requirements:
211
+ - - ! '>='
212
+ - !ruby/object:Gem::Version
213
+ version: '3.0'
214
+ - - <
215
+ - !ruby/object:Gem::Version
216
+ version: '5.0'
217
+ type: :runtime
218
+ prerelease: false
219
+ version_requirements: !ruby/object:Gem::Requirement
220
+ none: false
221
+ requirements:
222
+ - - ! '>='
223
+ - !ruby/object:Gem::Version
224
+ version: '3.0'
225
+ - - <
226
+ - !ruby/object:Gem::Version
227
+ version: '5.0'
228
+ description: Pry-based enhancements for both Rails 3 & 4 debugging. A compilation
229
+ of opinionated pry packages to improve the debugging environment
230
+ email:
231
+ - cs@wolves.io
232
+ executables: []
233
+ extensions: []
234
+ extra_rdoc_files: []
235
+ files:
236
+ - .gitignore
237
+ - .travis.yml
238
+ - CODE_OF_CONDUCT.md
239
+ - Gemfile
240
+ - LICENSE.txt
241
+ - README.md
242
+ - Rakefile
243
+ - bin/console
244
+ - bin/setup
245
+ - crowbar.gemspec
246
+ - lib/crowbar.rb
247
+ - lib/crowbar/hirb_ext.rb
248
+ - lib/crowbar/railtie.rb
249
+ - lib/crowbar/version.rb
250
+ homepage: https://github.com/wolves/crowbar
251
+ licenses:
252
+ - MIT
253
+ post_install_message:
254
+ rdoc_options: []
255
+ require_paths:
256
+ - lib
257
+ required_ruby_version: !ruby/object:Gem::Requirement
258
+ none: false
259
+ requirements:
260
+ - - ! '>='
261
+ - !ruby/object:Gem::Version
262
+ version: 1.9.3
263
+ required_rubygems_version: !ruby/object:Gem::Requirement
264
+ none: false
265
+ requirements:
266
+ - - ! '>='
267
+ - !ruby/object:Gem::Version
268
+ version: '0'
269
+ segments:
270
+ - 0
271
+ hash: 2171736723669749146
272
+ requirements: []
273
+ rubyforge_project:
274
+ rubygems_version: 1.8.23.2
275
+ signing_key:
276
+ specification_version: 3
277
+ summary: Pry-based enhancements for Rails 3/4 debugging
278
+ test_files: []
279
+ has_rdoc: