melog 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,10 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2012 Juha Kajava
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10
+
File without changes
data/bin/melog CHANGED
@@ -2,5 +2,6 @@
2
2
 
3
3
  require 'melog'
4
4
 
5
- puts "This is a simple command line logging tool."
6
- puts "Nothing more to see here yet."
5
+ args = ARGV.join(' ')
6
+
7
+ puts Melog.new(args).to_s
@@ -1,2 +1,12 @@
1
1
  class Melog
2
+ attr_accessor :time, :message
3
+
4
+ def initialize(message)
5
+ @time = Time.now
6
+ @message = message
7
+ end
8
+
9
+ def to_s
10
+ "[#{@time}] #{@message}"
11
+ end
2
12
  end
@@ -2,7 +2,29 @@ require 'spec_helper'
2
2
 
3
3
  describe Melog do
4
4
 
5
+ before :each do
6
+ @melog = Melog.new 'foo bar'
7
+ end
8
+
5
9
  it 'should be able to create an instance' do
6
- Melog.new.should_not be_nil
10
+ @melog.should_not be_nil
11
+ end
12
+
13
+ it 'should have changeable date stamp' do
14
+ @melog.time.should be_kind_of Time
15
+ @melog.time.should be_within(0.01).of Time.now
16
+
17
+ new_time = Time.now - 60
18
+ @melog.time = new_time
19
+ @melog.time.should be new_time
20
+ end
21
+
22
+ it 'should have a message' do
23
+ @melog.message.should == 'foo bar'
24
+ end
25
+
26
+ it 'should display time with message using to_s' do
27
+ time = @melog.time
28
+ @melog.to_s.should == "[#{time}] foo bar"
7
29
  end
8
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: melog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,9 +9,9 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-24 00:00:00.000000000 Z
12
+ date: 2012-06-25 00:00:00.000000000 Z
13
13
  dependencies: []
14
- description: Command line logging tool.
14
+ description: Command line logging tool. Prints a message with time-stamp.
15
15
  email: juhakaja@gmail.com
16
16
  executables:
17
17
  - melog
@@ -21,7 +21,8 @@ files:
21
21
  - lib/melog.rb
22
22
  - spec/spec_helper.rb
23
23
  - spec/melog_spec.rb
24
- - README
24
+ - README.md
25
+ - MIT-LICENSE.md
25
26
  - bin/melog
26
27
  homepage: http://rubygems.org/gems/melog
27
28
  licenses: []