aqui 0.0.1

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: d04f21ddc9b10acfea60005040e69869af7e65e6
4
+ data.tar.gz: a736934f6c3e348002fad72f02f2c6cf25c9bec1
5
+ SHA512:
6
+ metadata.gz: cd0a4f8d2bc9e540bcac9a71c9cb760f8155d99ea2e3eb7d58666cd6f66388a4ea48b93101e567956cbea3a116bb36b43dcff12c1e522c4d876d63a4c311b6fa
7
+ data.tar.gz: a26c56ebf9d5e248a40b64863336717057c3f9e34e3fb585c97ccc4d8c8b90f19342943309b91500e19f4cd73b73d50c317653ceeabc51cf23747523f2a8abc6
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ Style/StringLiterals:
2
+ Enabled: false
3
+
4
+ Style/LambdaCall:
5
+ Enabled: false
6
+
7
+ Style/BlockComments:
8
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.1
4
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in aqui.gemspec
4
+ gemspec
5
+ gem 'rspec'
6
+ gem 'guard-rspec'
7
+ gem 'ruby_gntp'
8
+ gem 'guard-rubocop'
9
+ gem 'simplecov'
10
+ gem 'coveralls'
11
+ gem 'codeclimate-test-reporter'
data/Guardfile ADDED
@@ -0,0 +1,83 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec feature)
6
+
7
+ ## Uncomment to clear the screen before every task
8
+ # clearing :on
9
+
10
+ ## Guard internally checks for changes in the Guardfile and exits.
11
+ ## If you want Guard to automatically start up again, run guard in a
12
+ ## shell loop, e.g.:
13
+ ##
14
+ ## $ while bundle exec guard; do echo "Restarting Guard..."; done
15
+ ##
16
+ ## Note: if you are using the `directories` clause above and you are not
17
+ ## watching the project directory ('.'), the you will want to move the Guardfile
18
+ ## to a watched dir and symlink it back, e.g.
19
+ #
20
+ # $ mkdir config
21
+ # $ mv Guardfile config/
22
+ # $ ln -s config/Guardfile .
23
+ #
24
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
25
+
26
+ # Note: The cmd option is now required due to the increasing number of ways
27
+ # rspec may be run, below are examples of the most common uses.
28
+ # * bundler: 'bundle exec rspec'
29
+ # * bundler binstubs: 'bin/rspec'
30
+ # * spring: 'bin/rspec' (This will use spring if running and you have
31
+ # installed the spring binstubs per the docs)
32
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
33
+ # * 'just' rspec: 'rspec'
34
+
35
+ guard :rspec, cmd: "bundle exec rspec" do
36
+ require "guard/rspec/dsl"
37
+ dsl = Guard::RSpec::Dsl.new(self)
38
+
39
+ # Feel free to open issues for suggestions and improvements
40
+
41
+ # RSpec files
42
+ rspec = dsl.rspec
43
+ watch(rspec.spec_helper) { rspec.spec_dir }
44
+ watch(rspec.spec_support) { rspec.spec_dir }
45
+ watch(rspec.spec_files)
46
+
47
+ # Ruby files
48
+ ruby = dsl.ruby
49
+ dsl.watch_spec_files_for(ruby.lib_files)
50
+
51
+ # Rails files
52
+ rails = dsl.rails(view_extensions: %w(erb haml slim))
53
+ dsl.watch_spec_files_for(rails.app_files)
54
+ dsl.watch_spec_files_for(rails.views)
55
+
56
+ watch(rails.controllers) do |m|
57
+ [
58
+ rspec.spec.("routing/#{m[1]}_routing"),
59
+ rspec.spec.("controllers/#{m[1]}_controller"),
60
+ rspec.spec.("acceptance/#{m[1]}")
61
+ ]
62
+ end
63
+
64
+ # Rails config changes
65
+ watch(rails.spec_helper) { rspec.spec_dir }
66
+ watch(rails.routes) { "#{rspec.spec_dir}/routing" }
67
+ watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
68
+
69
+ # Capybara features specs
70
+ watch(rails.view_dirs) { |m| rspec.spec.("features/#{m[1]}") }
71
+
72
+ # Turnip features and steps
73
+ watch(%r{^spec/acceptance/(.+)\.feature$})
74
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
75
+ Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
76
+ end
77
+ watch(%r{^lib/aqui/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
78
+ end
79
+
80
+ guard :rubocop do
81
+ watch(/.+\.rb$/)
82
+ watch(/(?:.+\/)?\.rubocop\.yml$/) { |m| File.dirname(m[0]) }
83
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 hank
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,53 @@
1
+ # Aqui
2
+
3
+ [![Build Status](https://travis-ci.org/hstove/aqui.svg?branch=master)](https://travis-ci.org/hstove/aqui)
4
+ [![Code Climate](https://codeclimate.com/github/hstove/aqui.png)](https://codeclimate.com/github/hstove/aqui)
5
+ [![Coverage Status](https://coveralls.io/repos/hstove/aqui/badge.svg)](https://coveralls.io/r/hstove/aqui)
6
+
7
+ A gem for making sure some code is running.
8
+
9
+ Sometimes when coding, you run into a situation where you want to make sure
10
+ a bit of code is being executed by your application. You might end up
11
+ typing something like:
12
+
13
+ ~~~ruby
14
+ try_this
15
+ puts 'this is running'
16
+ try_another
17
+ puts 'blasfdd'
18
+ ~~~
19
+
20
+ This way, you can run your code and check your logs to see if the `put`
21
+ methods were called. If this short and simple effective method works for you,
22
+ then give `aqui` a shot next time. It looks like this:
23
+
24
+ ~~~ruby
25
+ try_this
26
+ aqui
27
+ try_another
28
+ aqui
29
+ ~~~
30
+
31
+ This time, the output is colorized and contains information about where the code is running:
32
+
33
+ ![screenshot](http://i.imgur.com/2AdA8YB.png)
34
+
35
+ ## Installation
36
+
37
+ ```ruby
38
+ gem 'aqui'
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ ```ruby
44
+ aqui
45
+ ```
46
+
47
+ ## Contributing
48
+
49
+ 1. Fork it ( https://github.com/[my-github-username]/aqui/fork )
50
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
51
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
52
+ 4. Push to the branch (`git push origin my-new-feature`)
53
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ desc "Run specs"
5
+ RSpec::Core::RakeTask.new do |t|
6
+ end
7
+
8
+ task default: :spec
data/aqui.gemspec ADDED
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'aqui/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "aqui"
8
+ spec.version = Aqui::VERSION
9
+ spec.authors = ["hank"]
10
+ spec.email = ["hstove@gmail.com"]
11
+ spec.summary = "Log \"I'm Here!\" in your code"
12
+ # spec.description = %q{TODO: Write a longer description. Optional.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(/^(test|spec|features)\//)
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency 'colorize'
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.7"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ end
@@ -0,0 +1,39 @@
1
+ module Aqui
2
+ # A class for providing the message of `aqui`
3
+ class Colorizer
4
+ def initialize(message, object)
5
+ @parser = Aqui::Parser.new(message)
6
+ @object = object
7
+ end
8
+
9
+ def file
10
+ @parser.file.colorize(:light_yellow)
11
+ end
12
+
13
+ def line_break
14
+ ':'.colorize(:light_green)
15
+ end
16
+
17
+ def line_number
18
+ @parser.line_number.colorize(:light_cyan)
19
+ end
20
+
21
+ def spacer
22
+ ' - '.colorize(:light_green)
23
+ end
24
+
25
+ def object_class
26
+ @object.class.to_s.colorize(:light_white)
27
+ end
28
+
29
+ def message
30
+ [
31
+ file,
32
+ line_break,
33
+ line_number,
34
+ spacer,
35
+ object_class
36
+ ].join('')
37
+ end
38
+ end
39
+ end
data/lib/aqui/ext.rb ADDED
@@ -0,0 +1,8 @@
1
+ # Extend the top-level `Object` class to provide the `aqui` method
2
+ class Object
3
+ def aqui
4
+ colorizer = Aqui::Colorizer.new(caller[0], self)
5
+ print colorizer.message
6
+ print "\n"
7
+ end
8
+ end
@@ -0,0 +1,21 @@
1
+ module Aqui
2
+ # A parser to get the useful parts of `caller`
3
+ class Parser
4
+ attr_accessor :caller_message
5
+ def initialize(caller_message)
6
+ @caller_message = caller_message
7
+ end
8
+
9
+ def parts
10
+ @parts ||= @caller_message[0..@caller_message.index(':in `')].split(':')
11
+ end
12
+
13
+ def file
14
+ parts[0].gsub(Dir.pwd + '/', '')
15
+ end
16
+
17
+ def line_number
18
+ parts[1]
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,4 @@
1
+ # Version File
2
+ module Aqui
3
+ VERSION = "0.0.1"
4
+ end
data/lib/aqui.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'aqui/version'
2
+ require 'aqui/parser'
3
+ require 'aqui/colorizer'
4
+ require 'aqui/ext'
5
+ require 'colorize'
data/script/console.rb ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "irb"
4
+ require "irb/completion"
5
+ require "bundler/setup"
6
+ Bundler.require
7
+
8
+ IRB.start
data/script/demo.rb ADDED
@@ -0,0 +1,13 @@
1
+ require "bundler/setup"
2
+ Bundler.require
3
+
4
+ class ClassName
5
+ def go
6
+ 1 + 2
7
+ aqui
8
+ 3 + 4
9
+ aqui
10
+ end
11
+ end
12
+
13
+ Model.new.go
data/spec/ext_spec.rb ADDED
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe Aqui do
4
+ describe Object do
5
+ it { expect { aqui }.to output(/#{self.class}/).to_stdout }
6
+ it { expect { aqui }.to output(/spec\/ext_spec.rb/).to_stdout }
7
+
8
+ # useful for debugging
9
+ # it { aqui }
10
+ end
11
+ end
@@ -0,0 +1,86 @@
1
+ require 'simplecov'
2
+ SimpleCov.start
3
+ require 'coveralls'
4
+ # require 'codeclimate-test-reporter'
5
+ require 'bundler'
6
+ Bundler.require(:default, :development)
7
+
8
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
9
+ SimpleCov::Formatter::HTMLFormatter,
10
+ Coveralls::SimpleCov::Formatter,
11
+ # CodeClimate::TestReporter::Formatter
12
+ ]
13
+ SimpleCov.start do
14
+ add_filter "/spec/"
15
+ end
16
+
17
+ # The `.rspec` file also contains a few flags that are not defaults but that
18
+ # users commonly want.
19
+ #
20
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
21
+ RSpec.configure do |config|
22
+ # rspec-expectations config goes here. You can use an alternate
23
+ # assertion/expectation library such as wrong or the stdlib/minitest
24
+ # assertions if you prefer.
25
+ config.expect_with :rspec do |expectations|
26
+ # This option will default to `true` in RSpec 4. It makes the `description`
27
+ # and `failure_message` of custom matchers include text for helper methods
28
+ # defined using `chain`, e.g.:
29
+ # be_bigger_than(2).and_smaller_than(4).description
30
+ # # => "be bigger than 2 and smaller than 4"
31
+ # ...rather than:
32
+ # # => "be bigger than 2"
33
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
34
+ end
35
+
36
+ # rspec-mocks config goes here. You can use an alternate test double
37
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
38
+ config.mock_with :rspec do |mocks|
39
+ # Prevents you from mocking or stubbing a method that does not exist on
40
+ # a real object. This is generally recommended, and will default to
41
+ # `true` in RSpec 4.
42
+ mocks.verify_partial_doubles = true
43
+ end
44
+
45
+ # The settings below are suggested to provide a good initial experience
46
+ # with RSpec, but feel free to customize to your heart's content.
47
+ =begin
48
+ # These two settings work together to allow you to limit a spec run
49
+ # to individual examples or groups you care about by tagging them with
50
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
51
+ # get run.
52
+ config.filter_run :focus
53
+ config.run_all_when_everything_filtered = true
54
+
55
+ # This setting enables warnings. It's recommended, but in some cases may
56
+ # be too noisy due to issues in dependencies.
57
+ config.warnings = true
58
+
59
+ # Many RSpec users commonly either run the entire suite or an individual
60
+ # file, and it's useful to allow more verbose output when running an
61
+ # individual spec file.
62
+ if config.files_to_run.one?
63
+ # Use the documentation formatter for detailed output,
64
+ # unless a formatter has already been configured
65
+ # (e.g. via a command-line flag).
66
+ config.default_formatter = 'doc'
67
+ end
68
+
69
+ # Print the 10 slowest examples and example groups at the
70
+ # end of the spec run, to help surface which specs are running
71
+ # particularly slow.
72
+ config.profile_examples = 10
73
+
74
+ # Run specs in random order to surface order dependencies. If you find an
75
+ # order dependency and want to debug it, you can fix the order by providing
76
+ # the seed, which is printed after each run.
77
+ # --seed 1234
78
+ config.order = :random
79
+
80
+ # Seed global randomization in this process using the `--seed` CLI option.
81
+ # Setting this allows you to use `--seed` to deterministically reproduce
82
+ # test failures related to randomization by passing the same `--seed` value
83
+ # as the one that triggered the failure.
84
+ Kernel.srand config.seed
85
+ =end
86
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aqui
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - hank
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: colorize
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description:
56
+ email:
57
+ - hstove@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - ".rubocop.yml"
65
+ - ".travis.yml"
66
+ - Gemfile
67
+ - Guardfile
68
+ - LICENSE.txt
69
+ - README.md
70
+ - Rakefile
71
+ - aqui.gemspec
72
+ - lib/aqui.rb
73
+ - lib/aqui/colorizer.rb
74
+ - lib/aqui/ext.rb
75
+ - lib/aqui/parser.rb
76
+ - lib/aqui/version.rb
77
+ - script/console.rb
78
+ - script/demo.rb
79
+ - spec/ext_spec.rb
80
+ - spec/spec_helper.rb
81
+ homepage: ''
82
+ licenses:
83
+ - MIT
84
+ metadata: {}
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubyforge_project:
101
+ rubygems_version: 2.4.1
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: Log "I'm Here!" in your code
105
+ test_files:
106
+ - spec/ext_spec.rb
107
+ - spec/spec_helper.rb