lnjs-rails 1.0.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: 2e5bfa62ad82df16a9cf36bfbff255fda035f785
4
+ data.tar.gz: 273828578e8456e6029eb16c6737873f97391240
5
+ SHA512:
6
+ metadata.gz: cbab75fed174d10f73a6a274ab4bb5bd71ccfcbd5f53540cbd5c63a3ad0b5e2f5774be486bbe5680768d2284af1d2033161c1d57ab1422da38b844a3a7531e46
7
+ data.tar.gz: 5cba6a2d7b410908e460ba20480c6498db70c5c83b5e7b9f09a60e5a2d819e2b5491d3e9e3a474969194f6344eb3b889b47c2bebb8ffe8aa7317973a6d4a0fec
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/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in lnjs-rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 David Reghay
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,42 @@
1
+ # lnjs-rails
2
+ ### excruciatingly lightweight logging for your RoR app's JS
3
+
4
+ ln.js is a teensy tool I made for nicely formatted level-cognizant logging in JavaScript. Lover of RoR that I am, I gemified it for easy inclusion in rails apps!
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'lnjs-rails'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install lnjs-rails
21
+
22
+ ## Usage
23
+
24
+ Simply require ln.js from your application.js
25
+
26
+ ```javascript
27
+ //= require ln
28
+ ```
29
+
30
+ After this it's easy peasy to instantiate a logger and start logging away like a code-flinging woodsman of sorts! For example:
31
+
32
+ ```javascript
33
+ var logger = new Logger('debug');
34
+ logger.log('If I knew a woodchuck who could chuck wood, would you, Chuck, chuck me a smattering of wood?');
35
+ ```
36
+
37
+ It's really just that simple.
38
+
39
+ ## License
40
+
41
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
42
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "lnjs/rails"
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,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/lib/lnjs-rails.rb ADDED
@@ -0,0 +1,8 @@
1
+ require "lnjs-rails/version"
2
+
3
+ module Lnjs
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ module Lnjs
2
+ module Rails
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'lnjs-rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "lnjs-rails"
8
+ spec.version = Lnjs::Rails::VERSION
9
+ spec.authors = ["David Reghay"]
10
+ spec.email = ["david.reghay@gmail.com"]
11
+
12
+ spec.summary = %q{A gemified version of ln.js, an extremely lightweight, natural logging tool.}
13
+ spec.homepage = "https://github.com/davidreghay/lnjs-rails"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.require_paths = ["lib"]
18
+
19
+ spec.add_development_dependency "bundler", "~> 1.11"
20
+ spec.add_development_dependency "rake", "~> 10.0"
21
+ spec.add_development_dependency "railties", "~> 3.1"
22
+ end
@@ -0,0 +1,44 @@
1
+ // Copyright (C) 2015, 2016, David Reghay
2
+
3
+ // don't step on others' toes!
4
+ if(typeof Logger === 'undefined') {
5
+ var Logger = function(level) {
6
+ //private
7
+ var self = this;
8
+ var _level = typeof level !== 'undefined' ? level : 'all';
9
+ var levels = ['error', 'warn', 'info', 'debug', 'log'];
10
+ var priority = {
11
+ off: -1,
12
+ all : 10
13
+ };
14
+ var timestamp = function() {
15
+ var time = new Date();
16
+ var year = time.getFullYear();
17
+ var month = time.getMonth() + 1;
18
+ var date = time.getDate();
19
+ var hour = time.getHours();
20
+ var min = time.getMinutes();
21
+ var sec = time.getSeconds();
22
+ var mill = time.getMilliseconds();
23
+ return ("" + month + '-' + date + '-' + year + ' ' + hour + ':' + min + '.' + sec + ',' + mill);
24
+ };
25
+ //public
26
+ this.getLevel = function() {
27
+ return _level;
28
+ };
29
+ this.setLevel = function(l) {
30
+ if(typeof priority[l] !== 'undefined') _level = l;
31
+ };
32
+ this.e = Math.E;
33
+ levels.forEach(function(l, i) {
34
+ self[l] = function(data) {
35
+ if(typeof console !== 'undefined' && priority[l] <= priority[_level]) {
36
+ var caller = self[l].caller !== null ? '[' + self[l].caller.name + ']' : '[Main]';
37
+ if(caller.length === 2) caller = '[anonymous_function]';
38
+ console[l](timestamp() + ' ' + caller + ' ' + l.toUpperCase() + ' - ' + data);
39
+ }
40
+ };
41
+ priority[l] = i;
42
+ });
43
+ };
44
+ }
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lnjs-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - David Reghay
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-21 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: railties
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.1'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.1'
55
+ description:
56
+ email:
57
+ - david.reghay@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - bin/console
68
+ - bin/setup
69
+ - lib/lnjs-rails.rb
70
+ - lib/lnjs-rails/version.rb
71
+ - lnjs-rails.gemspec
72
+ - vendor/assets/javascripts/ln.js
73
+ homepage: https://github.com/davidreghay/lnjs-rails
74
+ licenses:
75
+ - MIT
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.5.1
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: A gemified version of ln.js, an extremely lightweight, natural logging tool.
97
+ test_files: []