nutella_framework 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ee0147d7ad4b06c602ad742ad464804686a73af
4
- data.tar.gz: 5255b9ac953ca5d4a2608943ed6d7fab61cebaaf
3
+ metadata.gz: ac187479daa0e0d14c536168f984cd938ab4186b
4
+ data.tar.gz: cb4b9e47db857035b8d19cfa3a1fbf112760cd50
5
5
  SHA512:
6
- metadata.gz: e93582f785ccdebe69dd852033edd700935bc957a29844633d07d7001459d928e0b20b1d72f9740e67941a68c3fca1ab67f871ac2c9b3a1c8288fe540fe593f6
7
- data.tar.gz: 23ac44867911110658384dce2379c8a3336868ce39e7f8cec1d07ff07ed04fb3a2790c22186d218f6cfe39e1e36ccf41c301a95953e340c174f957e21b6fa969
6
+ metadata.gz: d5432a739db7b22af3e5a5ff212c226a5e5b8054355521e21593404fd4b72f4c99a001fcdc2c965e34abbf56e6f9454384e0b685e522055272ea57737bc8a2e9
7
+ data.tar.gz: db9906aa9ae78f264f3a72e93b15b1321f054ea77fd77e801691f8c2a4dfdfe38ccf0de0f531cbf69dea9a42a75e2fe5542e5b13328a80a441143f2b62be08a1
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ gem 'sinatra', '~>1.4.5', '>=1.4.5'
7
7
  gem 'thin', '~>1.6.3', '>=1.6.3'
8
8
  gem 'nokogiri', '~>1.6.3', '>=1.6.3'
9
9
  gem 'slop', '~>4.0.0', '>=4.0.0'
10
- gem 'nutella_lib','~>0.4.1', '>=0.4.1'
10
+ gem 'nutella_lib','~>0.4.3', '>=0.4.3'
11
11
 
12
12
 
13
13
  group :development do
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: nutella_framework 0.4.1 ruby lib
5
+ # stub: nutella_framework 0.4.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "nutella_framework"
9
- s.version = "0.4.1"
9
+ s.version = "0.4.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Alessandro Gnoli"]
14
- s.date = "2015-03-16"
14
+ s.date = "2015-03-26"
15
15
  s.description = "utella is a framework to create and run RoomApps"
16
16
  s.email = "tebemis@gmail.com"
17
17
  s.executables = ["nutella"]
@@ -68,6 +68,7 @@ Gem::Specification.new do |s|
68
68
  "nutella_framework.gemspec",
69
69
  "nutella_lib/framework_core.rb",
70
70
  "nutella_lib/framework_net.rb",
71
+ "nutella_lib/framework_persistence.rb",
71
72
  "test/commands/test_cmd_cli_params_parsing.rb",
72
73
  "test/commands/test_command_template.rb",
73
74
  "test/config/test_current_app_utils.rb",
@@ -93,7 +94,7 @@ Gem::Specification.new do |s|
93
94
  s.add_runtime_dependency(%q<thin>, [">= 1.6.3", "~> 1.6.3"])
94
95
  s.add_runtime_dependency(%q<nokogiri>, [">= 1.6.3", "~> 1.6.3"])
95
96
  s.add_runtime_dependency(%q<slop>, [">= 4.0.0", "~> 4.0.0"])
96
- s.add_runtime_dependency(%q<nutella_lib>, [">= 0.4.1", "~> 0.4.1"])
97
+ s.add_runtime_dependency(%q<nutella_lib>, [">= 0.4.3", "~> 0.4.3"])
97
98
  s.add_development_dependency(%q<shoulda>, [">= 3", "~> 3"])
98
99
  s.add_development_dependency(%q<yard>, [">= 0.8.7", "~> 0.8"])
99
100
  s.add_development_dependency(%q<rdoc>, [">= 4.0", "~> 4.0"])
@@ -108,7 +109,7 @@ Gem::Specification.new do |s|
108
109
  s.add_dependency(%q<thin>, [">= 1.6.3", "~> 1.6.3"])
109
110
  s.add_dependency(%q<nokogiri>, [">= 1.6.3", "~> 1.6.3"])
110
111
  s.add_dependency(%q<slop>, [">= 4.0.0", "~> 4.0.0"])
111
- s.add_dependency(%q<nutella_lib>, [">= 0.4.1", "~> 0.4.1"])
112
+ s.add_dependency(%q<nutella_lib>, [">= 0.4.3", "~> 0.4.3"])
112
113
  s.add_dependency(%q<shoulda>, [">= 3", "~> 3"])
113
114
  s.add_dependency(%q<yard>, [">= 0.8.7", "~> 0.8"])
114
115
  s.add_dependency(%q<rdoc>, [">= 4.0", "~> 4.0"])
@@ -124,7 +125,7 @@ Gem::Specification.new do |s|
124
125
  s.add_dependency(%q<thin>, [">= 1.6.3", "~> 1.6.3"])
125
126
  s.add_dependency(%q<nokogiri>, [">= 1.6.3", "~> 1.6.3"])
126
127
  s.add_dependency(%q<slop>, [">= 4.0.0", "~> 4.0.0"])
127
- s.add_dependency(%q<nutella_lib>, [">= 0.4.1", "~> 0.4.1"])
128
+ s.add_dependency(%q<nutella_lib>, [">= 0.4.3", "~> 0.4.3"])
128
129
  s.add_dependency(%q<shoulda>, [">= 3", "~> 3"])
129
130
  s.add_dependency(%q<yard>, [">= 0.8.7", "~> 0.8"])
130
131
  s.add_dependency(%q<rdoc>, [">= 4.0", "~> 4.0"])
@@ -31,6 +31,7 @@ module Nutella
31
31
  # Accessors for sub-modules
32
32
  def self.net; Nutella::Framework::Net; end
33
33
  def self.log; Nutella::Framework::Log; end
34
+ def self.persist; Nutella::Framework::Persist; end
34
35
 
35
36
 
36
37
  # Utility functions
@@ -0,0 +1,55 @@
1
+ require 'util/mongo_persisted_collection'
2
+ require 'util/json_file_persisted_collection'
3
+ require 'util/mongo_persisted_hash'
4
+ require 'util/json_file_persisted_hash'
5
+ require 'fileutils'
6
+
7
+
8
+ module Nutella
9
+
10
+ module Framework
11
+
12
+ # Implements basic persistence for framework-level components
13
+ module Persist
14
+
15
+ # This method returns a MongoDB-backed store (i.e. persistence)
16
+ # for a collection (i.e. an Array)
17
+ # @param [String] name the name of the store
18
+ # @return [MongoPersistedCollection] a MongoDB-backed collection store
19
+ def self.get_mongo_collection_store( name )
20
+ MongoPersistedCollection.new Nutella.mongo_host, 'nutella', name
21
+ end
22
+
23
+ # This method returns a MongoDB-backed store (i.e. persistence)
24
+ # for a single object (i.e. an Hash)
25
+ # @param [String] name the name of the store
26
+ # @return [MongoPersistedHash] a MongoDB-backed Hash store
27
+ def self.get_mongo_object_store( name )
28
+ MongoPersistedHash.new Nutella.mongo_host, 'nutella', 'fr_persisted_hashes', name
29
+ end
30
+
31
+ # This method returns a JSON-file-backed store (i.e. persistence)
32
+ # for a collection (i.e. an Array)
33
+ # @param [String] name the name of the store
34
+ # @return [JSONFilePersistedCollection] a JSON-file-backed collection store
35
+ def self.get_json_collection_store( name )
36
+ dir_path = "#{ENV['HOME']}/.nutella/data/#{Nutella.component_id}"
37
+ file_path = "#{dir_path}/#{name}.json"
38
+ FileUtils.mkdir_p dir_path
39
+ JSONFilePersistedCollection.new file_path
40
+ end
41
+
42
+ # This method returns a JSON-file-backed store (i.e. persistence)
43
+ # for a single object (i.e. an Hash)
44
+ # @param [String] name the name of the store
45
+ # @return [JSONFilePersistedHash] a JSON-file-backed Hash store
46
+ def self.get_json_object_store( name )
47
+ dir_path = "#{ENV['HOME']}/.nutella/data/#{Nutella.component_id}"
48
+ file_path = "#{dir_path}/#{name}.json"
49
+ FileUtils.mkdir_p dir_path
50
+ JSONFilePersistedHash.new file_path
51
+ end
52
+ end
53
+ end
54
+
55
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nutella_framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Gnoli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-16 00:00:00.000000000 Z
11
+ date: 2015-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: semantic
@@ -156,20 +156,20 @@ dependencies:
156
156
  requirements:
157
157
  - - ">="
158
158
  - !ruby/object:Gem::Version
159
- version: 0.4.1
159
+ version: 0.4.3
160
160
  - - "~>"
161
161
  - !ruby/object:Gem::Version
162
- version: 0.4.1
162
+ version: 0.4.3
163
163
  type: :runtime
164
164
  prerelease: false
165
165
  version_requirements: !ruby/object:Gem::Requirement
166
166
  requirements:
167
167
  - - ">="
168
168
  - !ruby/object:Gem::Version
169
- version: 0.4.1
169
+ version: 0.4.3
170
170
  - - "~>"
171
171
  - !ruby/object:Gem::Version
172
- version: 0.4.1
172
+ version: 0.4.3
173
173
  - !ruby/object:Gem::Dependency
174
174
  name: shoulda
175
175
  requirement: !ruby/object:Gem::Requirement
@@ -347,6 +347,7 @@ files:
347
347
  - nutella_framework.gemspec
348
348
  - nutella_lib/framework_core.rb
349
349
  - nutella_lib/framework_net.rb
350
+ - nutella_lib/framework_persistence.rb
350
351
  - test/commands/test_cmd_cli_params_parsing.rb
351
352
  - test/commands/test_command_template.rb
352
353
  - test/config/test_current_app_utils.rb