smartkiosk-common 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'pry'
4
+
5
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Boris Staal
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,25 @@
1
+ # Smartkiosk::Common
2
+
3
+ Common utils of Smartkiosk gems
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'smartkiosk-common'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install smartkiosk-common
18
+
19
+ ## Contributing
20
+
21
+ 1. Fork it
22
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
23
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
24
+ 4. Push to the branch (`git push origin my-new-feature`)
25
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'smartkiosk/common'
@@ -0,0 +1,9 @@
1
+ require "smartkiosk/common/version"
2
+ require "smartkiosk/common/patches"
3
+ require "smartkiosk/common/logging"
4
+
5
+ module Smartkiosk
6
+ module Common
7
+ # Your code goes here...
8
+ end
9
+ end
@@ -0,0 +1,40 @@
1
+ require 'logger'
2
+
3
+ module Smartkiosk
4
+ module Common
5
+ module Logging
6
+
7
+ def service=(service)
8
+ @service = service
9
+ end
10
+
11
+ def service
12
+ @service
13
+ end
14
+
15
+ def logger=(val)
16
+ @logger = (val ? val : Logger.new('/dev/null'))
17
+ end
18
+
19
+ def logger
20
+ @logger ||= init
21
+ end
22
+
23
+ def init
24
+ log = Logger.new(STDOUT)
25
+ log.level = Logger::DEBUG
26
+ log.formatter = proc do |severity, time, progname, msg|
27
+ Smartkiosk::Common::Logging.format @service, severity, time, progname, msg
28
+ end
29
+ log
30
+ end
31
+
32
+ def self.format(service, severity, time, progname, msg)
33
+ "#{service.ljust(10)} -- #{severity[0]}, " <<
34
+ "[#{time.utc.strftime '%Y-%m-%dT%H:%M:%S.%6N'} ##{::Process.pid}] " <<
35
+ "#{severity.rjust(5)} -- : #{msg}\n"
36
+ end
37
+
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,13 @@
1
+ module Smartkiosk
2
+ module Common
3
+ module Patches
4
+ def self.dante_should_log_with(logger)
5
+ Dante::Runner.class_eval do
6
+ define_method :log do |msg|
7
+ logger.info msg
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ module Smartkiosk
2
+ module Common
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'smartkiosk/common/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "smartkiosk-common"
8
+ gem.version = Smartkiosk::Common::VERSION
9
+ gem.authors = ["Boris Staal"]
10
+ gem.email = ["boris@roundlake.ru"]
11
+ gem.description = %q{Common utils of Smartkiosk gems}
12
+ gem.summary = gem.description
13
+ gem.homepage = "https://github.com/smartkiosk/smartkiosk-common"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+ end
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: smartkiosk-common
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Boris Staal
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-14 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Common utils of Smartkiosk gems
15
+ email:
16
+ - boris@roundlake.ru
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - Gemfile
23
+ - LICENSE.txt
24
+ - README.md
25
+ - Rakefile
26
+ - init.rb
27
+ - lib/smartkiosk/common.rb
28
+ - lib/smartkiosk/common/logging.rb
29
+ - lib/smartkiosk/common/patches.rb
30
+ - lib/smartkiosk/common/version.rb
31
+ - smartkiosk-common.gemspec
32
+ homepage: https://github.com/smartkiosk/smartkiosk-common
33
+ licenses: []
34
+ post_install_message:
35
+ rdoc_options: []
36
+ require_paths:
37
+ - lib
38
+ required_ruby_version: !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ required_rubygems_version: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ! '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubyforge_project:
52
+ rubygems_version: 1.8.15
53
+ signing_key:
54
+ specification_version: 3
55
+ summary: Common utils of Smartkiosk gems
56
+ test_files: []
57
+ has_rdoc: