tappow 0.1.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
+ SHA1:
3
+ metadata.gz: 1059759d71beb3110ad89598a328ebcbe65cafcd
4
+ data.tar.gz: 9b742c203c11949c707fa66f4945d06e010956de
5
+ SHA512:
6
+ metadata.gz: 65d30ae4589bd74c5879ec0e8fa9bff6e7bd78f2e58e3f2196bf5f207a4e0cb1ce98856c3a5953b0b64637f8a2b71288ece5a9d785287817ec27f47fb5c941fd
7
+ data.tar.gz: a152e3dded33a530fcf4590fdebd06cb550891de0609621339b15338b49f8634f16d5624399ff98317d7b9d9ec1c8cbb52f4de6d8bc3bd5fa6817b88c073cc79
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ sudo: false
3
+ rvm:
4
+ - 2.0
5
+ - 2.1
6
+ - 2.2
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in tappow.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # Tappow = tapp + pow
2
+ [![Build Status](https://travis-ci.org/joker1007/tappow.svg?branch=master)](https://travis-ci.org/joker1007/tappow)
3
+
4
+ When use Pow for development, it is difficult to see stdout output.
5
+
6
+ tappow add tapp printers that use logger interface, and add `Object#tappow` method.
7
+ `Object#tappow` can have different default printer with tapp's one
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'tappow'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install tappow
24
+
25
+ ## Usage
26
+
27
+ ex.
28
+ ```ruby
29
+ Tappow.logger = Rails.logger
30
+ Tappow.log_level = :info # default :debug
31
+ Tappow.default_printer = :logger_awesome # default :logger_pretty
32
+ ```
33
+
34
+ ```ruby
35
+ "foo".tappow
36
+ ```
37
+
38
+ ### printer
39
+ | key | desc |
40
+ | ---- | ---- |
41
+ | :logger_pretty | output pretty_inspect |
42
+ | :logger_awesome | output awesome_inspect |
43
+ | :logger_string | output to_s |
44
+
45
+ ## Development
46
+
47
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
48
+
49
+ 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` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
50
+
51
+ ## Contributing
52
+
53
+ 1. Fork it ( https://github.com/joker1007/tappow/fork )
54
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
55
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
56
+ 4. Push to the branch (`git push origin my-new-feature`)
57
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "tappow"
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
data/bin/setup ADDED
@@ -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
data/lib/tappow.rb ADDED
@@ -0,0 +1,26 @@
1
+ require 'tappow/printer'
2
+ require 'tappow/tapp_extension'
3
+ require 'tappow/object_extension'
4
+
5
+ require 'logger'
6
+ require 'tapp'
7
+
8
+ module Tappow
9
+ class << self
10
+ attr_writer :logger, :log_level, :default_printer
11
+ def logger
12
+ @logger ||= Logger.new($stdout)
13
+ end
14
+
15
+ def log_level
16
+ @log_level ||= :debug
17
+ end
18
+
19
+ def default_printer
20
+ @default_printer ||= :logger_pretty
21
+ end
22
+ end
23
+ end
24
+
25
+ Tapp::Printer.singleton_class.__send__ :prepend, Tappow::TappExtension
26
+ Object.__send__ :include, Tappow::ObjectExtension
@@ -0,0 +1,7 @@
1
+ module Tappow
2
+ module ObjectExtension
3
+ def tappow(printer = Tappow.default_printer, &block)
4
+ tapp printer, &block
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module Tappow
2
+ module Printer
3
+ autoload :LoggerAwesome, 'tappow/printer/logger_awesome'
4
+ autoload :LoggerPretty, 'tappow/printer/logger_pretty'
5
+ autoload :LoggerString, 'tappow/printer/logger_string'
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ require 'tapp/printer'
2
+ require 'ap'
3
+
4
+ module Tappow::Printer
5
+ class LoggerAwesome < Tapp::Printer::Base
6
+ def print(*args)
7
+ Tappow.logger.send(Tappow.log_level, args[0].awesome_inspect)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'tapp/printer'
2
+ require 'pp'
3
+
4
+ module Tappow::Printer
5
+ class LoggerPretty < Tapp::Printer::Base
6
+ def print(*args)
7
+ Tappow.logger.send(Tappow.log_level, args[0].pretty_inspect)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ require 'tapp/printer'
2
+
3
+ module Tappow::Printer
4
+ class LoggerString < Tapp::Printer::Base
5
+ def print(*args)
6
+ Tappow.logger.send(Tappow.log_level, args[0].to_s)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,16 @@
1
+ module Tappow
2
+ module TappExtension
3
+ def instance(name)
4
+ case name
5
+ when :logger_pretty
6
+ Tappow::Printer::LoggerPretty.instance
7
+ when :logger_awesome
8
+ Tappow::Printer::LoggerAwesome.instance
9
+ when :logger_string
10
+ Tappow::Printer::LoggerString.instance
11
+ else
12
+ super
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ module Tappow
2
+ VERSION = "0.1.0"
3
+ end
data/tappow.gemspec ADDED
@@ -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 'tappow/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "tappow"
8
+ spec.version = Tappow::VERSION
9
+ spec.authors = ["joker1007"]
10
+ spec.email = ["kakyoin.hierophant@gmail.com"]
11
+
12
+ spec.summary = %q{tapp with pow}
13
+ spec.description = %q{tapp with pow}
14
+ spec.homepage = "https://github.com/joker1007/tappow"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency "tapp"
22
+
23
+ spec.add_development_dependency "bundler", ">= 1.7"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "rspec"
26
+ spec.add_development_dependency "awesome_print"
27
+ end
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tappow
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - joker1007
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: tapp
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
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
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: awesome_print
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: tapp with pow
84
+ email:
85
+ - kakyoin.hierophant@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - ".travis.yml"
93
+ - Gemfile
94
+ - README.md
95
+ - Rakefile
96
+ - bin/console
97
+ - bin/setup
98
+ - lib/tappow.rb
99
+ - lib/tappow/object_extension.rb
100
+ - lib/tappow/printer.rb
101
+ - lib/tappow/printer/logger_awesome.rb
102
+ - lib/tappow/printer/logger_pretty.rb
103
+ - lib/tappow/printer/logger_string.rb
104
+ - lib/tappow/tapp_extension.rb
105
+ - lib/tappow/version.rb
106
+ - tappow.gemspec
107
+ homepage: https://github.com/joker1007/tappow
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
128
+ signing_key:
129
+ specification_version: 4
130
+ summary: tapp with pow
131
+ test_files: []