coral_core 0.1.4 → 0.1.5

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.
data/README.rdoc CHANGED
@@ -12,8 +12,8 @@ Note: This library is still very early in development!
12
12
 
13
13
  == Contributing to coral_core
14
14
 
15
- * Check out the latest master to make sure the feature hasn't been implemented
16
- or the bug hasn't been fixed yet.
15
+ * Check out the latest {major}.{minor} branch to make sure the feature hasn't
16
+ been implemented or the bug hasn't been fixed yet.
17
17
  * Check out the issue tracker to make sure someone already hasn't requested
18
18
  it and/or contributed it.
19
19
  * Fork the project.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
data/coral_core.gemspec CHANGED
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "coral_core"
8
- s.version = "0.1.4"
8
+ s.version = "0.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Adrian Webb"]
12
- s.date = "2013-02-08"
13
- s.description = "= coral_core\n\nThis library provides core data elements and utilities used in other Coral gems.\n\nThe Coral core library contains functionality that is utilized by other\nCoral gems by providing basic utilities like Git, Shell, Disk, and Data\nmanipulation libraries, a UI system, and a core data model that supports\nEvents, Commands, Repositories, and Memory (version controlled JSON \nobjects). This library is only used as a starting point for other systems.\n\nNote: This library is still very early in development!\n\n== Contributing to coral_core\n \n* Check out the latest master to make sure the feature hasn't been implemented \n or the bug hasn't been fixed yet.\n* Check out the issue tracker to make sure someone already hasn't requested \n it and/or contributed it.\n* Fork the project.\n* Start a feature/bugfix branch.\n* Commit and push until you are happy with your contribution.\n* Make sure to add tests for it. This is important so I don't break it in a \n future version unintentionally.\n* Please try not to mess with the Rakefile, version, or history. If you want \n to have your own version, or is otherwise necessary, that is fine, but \n please isolate to its own commit so I can cherry-pick around it.\n\n== Copyright\n\nLicensed under GPLv3. See LICENSE.txt for further details.\n\nCopyright (c) 2013 Adrian Webb <adrian.webb@coraltech.net>\nCoral Technology Group LLC"
12
+ s.date = "2013-02-09"
13
+ s.description = "= coral_core\n\nThis library provides core data elements and utilities used in other Coral gems.\n\nThe Coral core library contains functionality that is utilized by other\nCoral gems by providing basic utilities like Git, Shell, Disk, and Data\nmanipulation libraries, a UI system, and a core data model that supports\nEvents, Commands, Repositories, and Memory (version controlled JSON \nobjects). This library is only used as a starting point for other systems.\n\nNote: This library is still very early in development!\n\n== Contributing to coral_core\n \n* Check out the latest {major}.{minor} branch to make sure the feature hasn't \n been implemented or the bug hasn't been fixed yet.\n* Check out the issue tracker to make sure someone already hasn't requested \n it and/or contributed it.\n* Fork the project.\n* Start a feature/bugfix branch.\n* Commit and push until you are happy with your contribution.\n* Make sure to add tests for it. This is important so I don't break it in a \n future version unintentionally.\n* Please try not to mess with the Rakefile, version, or history. If you want \n to have your own version, or is otherwise necessary, that is fine, but \n please isolate to its own commit so I can cherry-pick around it.\n\n== Copyright\n\nLicensed under GPLv3. See LICENSE.txt for further details.\n\nCopyright (c) 2013 Adrian Webb <adrian.webb@coraltech.net>\nCoral Technology Group LLC"
14
14
  s.email = "adrian.webb@coraltech.net"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
@@ -8,27 +8,32 @@ class Disk < Core
8
8
 
9
9
  @@files = {}
10
10
 
11
+ @@separator = false
12
+ @@description = ''
13
+
11
14
  #-----------------------------------------------------------------------------
12
15
  # Utilities
13
16
 
14
17
  def self.open(file_name, options = {}, reset = false)
15
- mode = string(options[:mode])
16
- separator = ( options[:separator] ? options[:separator] : false )
17
- description = ( options[:description] ? options[:description] : '' )
18
+ mode = string(options[:mode])
19
+
20
+ @@separator = ( options[:separator] ? options[:separator] : false )
21
+ @@description = ( options[:description] ? options[:description] : '' )
18
22
 
19
23
  if @@files.has_key?(file_name) && ! reset
20
24
  reset = true if ! mode.empty? && mode != @@files[file_name][:mode]
21
25
  end
22
26
 
23
27
  if ! @@files.has_key?(file_name) || ! @@files[file_name][:file] || reset
24
- @@files[file_name][:file].close if @@files[file_name][:file]
25
- unless mode.empty?
28
+ @@files[file_name][:file].close if @@files[file_name] && @@files[file_name][:file]
29
+ unless mode.empty? || ( mode == 'r' && ! File.exists?(file_name) )
26
30
  @@files[file_name] = {
27
31
  :file => File.open(file_name, mode),
28
32
  :mode => mode,
29
33
  }
30
34
  end
31
35
  end
36
+ return nil unless @@files[file_name]
32
37
  return @@files[file_name][:file]
33
38
  end
34
39
 
@@ -62,8 +67,8 @@ class Disk < Core
62
67
  reset = ( options[:file_name] || options[:mode] )
63
68
  file = open(( options[:file_name] ? options[:file_name] : 'log.txt' ), options, reset)
64
69
  if file
65
- file.write("--------------------------------------\n") if separator
66
- file.write("#{description}\n") if description
70
+ file.write("--------------------------------------\n") if @@separator
71
+ file.write("#{@@description}\n") if @@description
67
72
  file.write("#{data}\n")
68
73
  end
69
74
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coral_core
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 4
10
- version: 0.1.4
9
+ - 5
10
+ version: 0.1.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Adrian Webb
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-02-08 00:00:00 Z
18
+ date: 2013-02-09 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: git
@@ -153,8 +153,8 @@ description: |-
153
153
 
154
154
  == Contributing to coral_core
155
155
 
156
- * Check out the latest master to make sure the feature hasn't been implemented
157
- or the bug hasn't been fixed yet.
156
+ * Check out the latest {major}.{minor} branch to make sure the feature hasn't
157
+ been implemented or the bug hasn't been fixed yet.
158
158
  * Check out the issue tracker to make sure someone already hasn't requested
159
159
  it and/or contributed it.
160
160
  * Fork the project.