nutella_framework 0.1.2 → 0.2.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 +4 -4
- data/Gemfile +4 -3
- data/VERSION +1 -1
- data/actors/main_interface/main_interface_bot.rb +148 -0
- data/actors/main_interface/public/index.html +47 -0
- data/actors/main_interface/startup +5 -0
- data/actors/main_interface/views/index.erb +45 -0
- data/actors/main_interface/views/not_found_404.erb +37 -0
- data/lib/cli/nutella_cli.rb +24 -15
- data/lib/config/config.rb +5 -67
- data/lib/config/current_project.rb +58 -0
- data/lib/config/persisted_hash.rb +114 -0
- data/lib/config/runlist.rb +19 -83
- data/lib/core/command.rb +2 -2
- data/lib/core/commands/broker.rb +23 -24
- data/lib/core/commands/checkup.rb +36 -37
- data/lib/core/commands/help.rb +3 -3
- data/lib/core/commands/install.rb +3 -4
- data/lib/core/commands/new.rb +26 -28
- data/lib/core/commands/runs.rb +22 -31
- data/lib/core/commands/start.rb +134 -121
- data/lib/core/commands/stop.rb +62 -48
- data/lib/core/nutella_core.rb +23 -12
- data/lib/core/run_command.rb +44 -0
- data/lib/core/tmux.rb +20 -18
- data/lib/logging/nutella_logging.rb +5 -5
- data/lib/nutella_framework.rb +8 -6
- data/nutella_framework.gemspec +15 -12
- data/test/config/test_config.rb +23 -22
- data/test/config/test_project.rb +13 -12
- data/test/config/test_runlist.rb +30 -22
- metadata +15 -12
- data/lib/config/project.rb +0 -53
- data/lib/extra/config.ru +0 -2
- data/lib/extra/interfaces_list.erubis +0 -14
- data/lib/extra/main_interface.rb +0 -9
- data/test/test_nutella_framework.rb +0 -31
data/nutella_framework.gemspec
CHANGED
@@ -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.
|
5
|
+
# stub: nutella_framework 0.2.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "nutella_framework"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.2.0"
|
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 = "2014-11-
|
14
|
+
s.date = "2014-11-26"
|
15
15
|
s.description = "Nutella is a framework to build and run \"Internet of Things\"-like learning applications"
|
16
16
|
s.email = "tebemis@gmail.com"
|
17
17
|
s.executables = ["nutella"]
|
@@ -27,10 +27,16 @@ Gem::Specification.new do |s|
|
|
27
27
|
"README.md",
|
28
28
|
"Rakefile",
|
29
29
|
"VERSION",
|
30
|
+
"actors/main_interface/main_interface_bot.rb",
|
31
|
+
"actors/main_interface/public/index.html",
|
32
|
+
"actors/main_interface/startup",
|
33
|
+
"actors/main_interface/views/index.erb",
|
34
|
+
"actors/main_interface/views/not_found_404.erb",
|
30
35
|
"bin/nutella",
|
31
36
|
"lib/cli/nutella_cli.rb",
|
32
37
|
"lib/config/config.rb",
|
33
|
-
"lib/config/
|
38
|
+
"lib/config/current_project.rb",
|
39
|
+
"lib/config/persisted_hash.rb",
|
34
40
|
"lib/config/runlist.rb",
|
35
41
|
"lib/core/command.rb",
|
36
42
|
"lib/core/commands/broker.rb",
|
@@ -42,10 +48,8 @@ Gem::Specification.new do |s|
|
|
42
48
|
"lib/core/commands/start.rb",
|
43
49
|
"lib/core/commands/stop.rb",
|
44
50
|
"lib/core/nutella_core.rb",
|
51
|
+
"lib/core/run_command.rb",
|
45
52
|
"lib/core/tmux.rb",
|
46
|
-
"lib/extra/config.ru",
|
47
|
-
"lib/extra/interfaces_list.erubis",
|
48
|
-
"lib/extra/main_interface.rb",
|
49
53
|
"lib/logging/nutella_logger-remote.rb",
|
50
54
|
"lib/logging/nutella_logger.rb",
|
51
55
|
"lib/logging/nutella_logging.rb",
|
@@ -55,8 +59,7 @@ Gem::Specification.new do |s|
|
|
55
59
|
"test/config/test_project.rb",
|
56
60
|
"test/config/test_runlist.rb",
|
57
61
|
"test/helper.rb",
|
58
|
-
"test/logging/test_logging.rb"
|
59
|
-
"test/test_nutella_framework.rb"
|
62
|
+
"test/logging/test_logging.rb"
|
60
63
|
]
|
61
64
|
s.homepage = "https://github.com/nutella-framework/nutella_framework"
|
62
65
|
s.licenses = ["MIT"]
|
@@ -73,7 +76,7 @@ Gem::Specification.new do |s|
|
|
73
76
|
s.add_runtime_dependency(%q<git>, [">= 1.2.8", "~> 1.2"])
|
74
77
|
s.add_runtime_dependency(%q<thin>, [">= 1.6.3", "~> 1.6.3"])
|
75
78
|
s.add_runtime_dependency(%q<sinatra>, [">= 1.4.5", "~> 1.4.5"])
|
76
|
-
s.add_runtime_dependency(%q<
|
79
|
+
s.add_runtime_dependency(%q<nokogiri>, [">= 1.6.3", "~> 1.6.3"])
|
77
80
|
s.add_development_dependency(%q<shoulda>, [">= 3", "~> 3"])
|
78
81
|
s.add_development_dependency(%q<yard>, [">= 0.8.7", "~> 0.8"])
|
79
82
|
s.add_development_dependency(%q<rdoc>, [">= 4.0", "~> 4.0"])
|
@@ -87,7 +90,7 @@ Gem::Specification.new do |s|
|
|
87
90
|
s.add_dependency(%q<git>, [">= 1.2.8", "~> 1.2"])
|
88
91
|
s.add_dependency(%q<thin>, [">= 1.6.3", "~> 1.6.3"])
|
89
92
|
s.add_dependency(%q<sinatra>, [">= 1.4.5", "~> 1.4.5"])
|
90
|
-
s.add_dependency(%q<
|
93
|
+
s.add_dependency(%q<nokogiri>, [">= 1.6.3", "~> 1.6.3"])
|
91
94
|
s.add_dependency(%q<shoulda>, [">= 3", "~> 3"])
|
92
95
|
s.add_dependency(%q<yard>, [">= 0.8.7", "~> 0.8"])
|
93
96
|
s.add_dependency(%q<rdoc>, [">= 4.0", "~> 4.0"])
|
@@ -102,7 +105,7 @@ Gem::Specification.new do |s|
|
|
102
105
|
s.add_dependency(%q<git>, [">= 1.2.8", "~> 1.2"])
|
103
106
|
s.add_dependency(%q<thin>, [">= 1.6.3", "~> 1.6.3"])
|
104
107
|
s.add_dependency(%q<sinatra>, [">= 1.4.5", "~> 1.4.5"])
|
105
|
-
s.add_dependency(%q<
|
108
|
+
s.add_dependency(%q<nokogiri>, [">= 1.6.3", "~> 1.6.3"])
|
106
109
|
s.add_dependency(%q<shoulda>, [">= 3", "~> 3"])
|
107
110
|
s.add_dependency(%q<yard>, [">= 0.8.7", "~> 0.8"])
|
108
111
|
s.add_dependency(%q<rdoc>, [">= 4.0", "~> 4.0"])
|
data/test/config/test_config.rb
CHANGED
@@ -3,45 +3,46 @@ require 'helper'
|
|
3
3
|
module Nutella
|
4
4
|
|
5
5
|
class TestNutellaConfig < MiniTest::Test
|
6
|
-
|
6
|
+
|
7
7
|
def setup
|
8
|
-
Nutella.config.send(:
|
8
|
+
Nutella.config.send(:remove_file)
|
9
9
|
end
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
|
11
|
+
|
12
|
+
should 'set a key value' do
|
13
|
+
assert_equal 'value1', Nutella.config['key1']='value1'
|
13
14
|
end
|
14
15
|
|
15
|
-
should
|
16
|
-
assert_nil Nutella.config[
|
16
|
+
should 'return \'nil\' if a key doesn\'t exist' do
|
17
|
+
assert_nil Nutella.config['fakekey']
|
17
18
|
end
|
18
19
|
|
19
|
-
should
|
20
|
-
Nutella.config[
|
21
|
-
assert_equal
|
20
|
+
should 'return the value associated with a key whenever that key exists' do
|
21
|
+
Nutella.config['key2']='value2'
|
22
|
+
assert_equal 'value2', Nutella.config['key2']
|
22
23
|
end
|
23
24
|
|
24
|
-
should
|
25
|
-
Nutella.config[
|
26
|
-
assert Nutella.config.has_key?(
|
25
|
+
should 'retun true if a key exists' do
|
26
|
+
Nutella.config['key3']='value3'
|
27
|
+
assert Nutella.config.has_key?('key3')
|
27
28
|
end
|
28
29
|
|
29
|
-
should
|
30
|
-
refute Nutella.config.has_key?(
|
30
|
+
should 'retun false if a key doens\'t exist' do
|
31
|
+
refute Nutella.config.has_key?('key4')
|
31
32
|
end
|
32
33
|
|
33
|
-
should
|
34
|
-
Nutella.config[
|
35
|
-
assert_equal
|
34
|
+
should 'access nested hashes' do
|
35
|
+
Nutella.config['key5']={'k55' => 'v55'}
|
36
|
+
assert_equal 'v55', Nutella.config['key5']['k55']
|
36
37
|
end
|
37
|
-
|
38
|
+
|
39
|
+
|
38
40
|
def teardown
|
39
|
-
Nutella.config.send(:
|
41
|
+
Nutella.config.send(:remove_file)
|
40
42
|
end
|
41
43
|
|
42
44
|
end
|
43
|
-
|
44
|
-
|
45
|
+
|
45
46
|
end
|
46
47
|
|
47
48
|
|
data/test/config/test_project.rb
CHANGED
@@ -3,31 +3,32 @@ require 'helper'
|
|
3
3
|
module Nutella
|
4
4
|
|
5
5
|
class TestProject < MiniTest::Test
|
6
|
-
|
6
|
+
|
7
7
|
def setup
|
8
8
|
Dir.chdir NUTELLA_HOME
|
9
|
-
Nutella.
|
10
|
-
Dir.chdir NUTELLA_HOME
|
9
|
+
Nutella.execute_command( 'new', ['test_project'] )
|
10
|
+
Dir.chdir "#{NUTELLA_HOME}test_project"
|
11
11
|
end
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
|
13
|
+
|
14
|
+
should 'return true if the dir is a nutella project' do
|
15
|
+
assert Nutella.current_project.exist?
|
15
16
|
end
|
16
17
|
|
17
|
-
should
|
18
|
+
should 'return false if the dir is not a nutella project' do
|
18
19
|
Dir.chdir NUTELLA_HOME
|
19
|
-
refute Nutella.
|
20
|
+
refute Nutella.current_project.exist?
|
20
21
|
end
|
21
22
|
|
22
|
-
should
|
23
|
-
assert_equal File.open(NUTELLA_HOME
|
23
|
+
should 'return the correct version of nutella as read from the project configuration file' do
|
24
|
+
assert_equal File.open("#{NUTELLA_HOME}VERSION", "rb").read, Nutella.current_project.config['nutella_version']
|
24
25
|
end
|
25
26
|
|
26
27
|
|
27
28
|
def teardown
|
28
|
-
FileUtils.rm_rf
|
29
|
+
FileUtils.rm_rf "#{NUTELLA_HOME}test_project"
|
29
30
|
Dir.chdir NUTELLA_HOME
|
30
31
|
end
|
31
|
-
|
32
|
+
|
32
33
|
end
|
33
34
|
end
|
data/test/config/test_runlist.rb
CHANGED
@@ -3,44 +3,52 @@ require 'helper'
|
|
3
3
|
module Nutella
|
4
4
|
|
5
5
|
class TestRunList < MiniTest::Test
|
6
|
-
|
6
|
+
|
7
7
|
def setup
|
8
|
-
Nutella.runlist.send(:
|
8
|
+
Nutella.runlist.send(:remove_file)
|
9
9
|
end
|
10
10
|
|
11
|
-
should
|
11
|
+
should 'return true if the list is empty' do
|
12
12
|
assert Nutella.runlist.empty?
|
13
13
|
end
|
14
14
|
|
15
|
-
should
|
16
|
-
refute_nil Nutella.runlist.add?
|
15
|
+
should 'return false if the list is not empty' do
|
16
|
+
refute_nil Nutella.runlist.add?( 'run1', '/path/to/my/run1')
|
17
17
|
refute Nutella.runlist.empty?
|
18
18
|
end
|
19
19
|
|
20
|
-
should
|
21
|
-
assert_empty Nutella.runlist.
|
20
|
+
should 'return empty array if the list is empty' do
|
21
|
+
assert_empty Nutella.runlist.runs_by_project
|
22
22
|
end
|
23
23
|
|
24
|
-
should
|
25
|
-
refute_nil Nutella.runlist.add?
|
26
|
-
refute_nil Nutella.runlist.add?
|
27
|
-
assert_equal
|
24
|
+
should 'return an array of runs in the list if not empty' do
|
25
|
+
refute_nil Nutella.runlist.add?( 'run1', '/path/to/my/run1' )
|
26
|
+
refute_nil Nutella.runlist.add?( 'run2', '/path/to/my/run2' )
|
27
|
+
assert_equal %w{run1 run2}, Nutella.runlist.runs_by_project
|
28
28
|
end
|
29
|
-
|
30
|
-
should
|
31
|
-
|
32
|
-
|
29
|
+
|
30
|
+
should 'return false if trying to add the same element twice' do
|
31
|
+
assert Nutella.runlist.add?( 'run1', '/path/to/my/run1' )
|
32
|
+
refute Nutella.runlist.add?( 'run1', '/path/to/my/run1' )
|
33
33
|
end
|
34
|
-
|
35
|
-
should
|
36
|
-
|
37
|
-
|
38
|
-
|
34
|
+
|
35
|
+
should 'return properly when deleting an item' do
|
36
|
+
assert Nutella.runlist.add?( 'run1', '/path/to/my/run1' )
|
37
|
+
assert Nutella.runlist.delete? 'run1'
|
38
|
+
refute Nutella.runlist.delete? 'run1'
|
39
|
+
end
|
40
|
+
|
41
|
+
should 'properly indicate if an item is in the list' do
|
42
|
+
refute Nutella.runlist.include? 'run1'
|
43
|
+
assert Nutella.runlist.add?( 'run1', '/path/to/my/run1' )
|
44
|
+
assert Nutella.runlist.include? 'run1'
|
45
|
+
assert Nutella.runlist.delete? 'run1'
|
46
|
+
refute Nutella.runlist.include? 'run1'
|
39
47
|
end
|
40
48
|
|
41
49
|
def teardown
|
42
|
-
Nutella.runlist.send(:
|
50
|
+
Nutella.runlist.send(:remove_file)
|
43
51
|
end
|
44
|
-
|
52
|
+
|
45
53
|
end
|
46
54
|
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
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Gnoli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ansi
|
@@ -131,25 +131,25 @@ dependencies:
|
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: 1.4.5
|
133
133
|
- !ruby/object:Gem::Dependency
|
134
|
-
name:
|
134
|
+
name: nokogiri
|
135
135
|
requirement: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
137
|
- - ">="
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version:
|
139
|
+
version: 1.6.3
|
140
140
|
- - "~>"
|
141
141
|
- !ruby/object:Gem::Version
|
142
|
-
version:
|
142
|
+
version: 1.6.3
|
143
143
|
type: :runtime
|
144
144
|
prerelease: false
|
145
145
|
version_requirements: !ruby/object:Gem::Requirement
|
146
146
|
requirements:
|
147
147
|
- - ">="
|
148
148
|
- !ruby/object:Gem::Version
|
149
|
-
version:
|
149
|
+
version: 1.6.3
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
152
|
+
version: 1.6.3
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: shoulda
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -287,10 +287,16 @@ files:
|
|
287
287
|
- README.md
|
288
288
|
- Rakefile
|
289
289
|
- VERSION
|
290
|
+
- actors/main_interface/main_interface_bot.rb
|
291
|
+
- actors/main_interface/public/index.html
|
292
|
+
- actors/main_interface/startup
|
293
|
+
- actors/main_interface/views/index.erb
|
294
|
+
- actors/main_interface/views/not_found_404.erb
|
290
295
|
- bin/nutella
|
291
296
|
- lib/cli/nutella_cli.rb
|
292
297
|
- lib/config/config.rb
|
293
|
-
- lib/config/
|
298
|
+
- lib/config/current_project.rb
|
299
|
+
- lib/config/persisted_hash.rb
|
294
300
|
- lib/config/runlist.rb
|
295
301
|
- lib/core/command.rb
|
296
302
|
- lib/core/commands/broker.rb
|
@@ -302,10 +308,8 @@ files:
|
|
302
308
|
- lib/core/commands/start.rb
|
303
309
|
- lib/core/commands/stop.rb
|
304
310
|
- lib/core/nutella_core.rb
|
311
|
+
- lib/core/run_command.rb
|
305
312
|
- lib/core/tmux.rb
|
306
|
-
- lib/extra/config.ru
|
307
|
-
- lib/extra/interfaces_list.erubis
|
308
|
-
- lib/extra/main_interface.rb
|
309
313
|
- lib/logging/nutella_logger-remote.rb
|
310
314
|
- lib/logging/nutella_logger.rb
|
311
315
|
- lib/logging/nutella_logging.rb
|
@@ -316,7 +320,6 @@ files:
|
|
316
320
|
- test/config/test_runlist.rb
|
317
321
|
- test/helper.rb
|
318
322
|
- test/logging/test_logging.rb
|
319
|
-
- test/test_nutella_framework.rb
|
320
323
|
homepage: https://github.com/nutella-framework/nutella_framework
|
321
324
|
licenses:
|
322
325
|
- MIT
|
data/lib/config/project.rb
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
# handles current project files
|
2
|
-
|
3
|
-
require 'singleton'
|
4
|
-
require 'json'
|
5
|
-
|
6
|
-
module Nutella
|
7
|
-
|
8
|
-
class Project
|
9
|
-
|
10
|
-
include Singleton
|
11
|
-
|
12
|
-
# Check that the current directory is actually a nutella project
|
13
|
-
def exist?
|
14
|
-
@prj_dir = Dir.pwd
|
15
|
-
if File.exist?("#{@prj_dir}/conf/project.json")
|
16
|
-
conf = JSON.parse( IO.read("#{@prj_dir}/conf/project.json") )
|
17
|
-
if conf["nutella_version"].nil?
|
18
|
-
console.warn "The current directory is not a Nutella project"
|
19
|
-
return false
|
20
|
-
end
|
21
|
-
else
|
22
|
-
console.warn "The current directory is not a Nutella project"
|
23
|
-
return false
|
24
|
-
end
|
25
|
-
return true
|
26
|
-
end
|
27
|
-
|
28
|
-
# Returns the value for an entry in the project configuration file
|
29
|
-
def config
|
30
|
-
@prj_dir = Dir.pwd
|
31
|
-
if File.exist? "#{@prj_dir}/conf/project.json"
|
32
|
-
return ConfigHash.new "#{@prj_dir}/conf/project.json"
|
33
|
-
else
|
34
|
-
console.error "The current directory is not a Nutella project! Impossible to get project configuration file"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
# Returns current project directory
|
39
|
-
def dir
|
40
|
-
Dir.pwd
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
def Nutella.currentProject
|
47
|
-
Project.instance
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
|
53
|
-
|
data/lib/extra/config.ru
DELETED
data/lib/extra/main_interface.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
module Nutella
|
4
|
-
class TestNutellaFramework < MiniTest::Test
|
5
|
-
|
6
|
-
def setup
|
7
|
-
Nutella.init
|
8
|
-
end
|
9
|
-
|
10
|
-
# The test works but it takes to long to run it all the time
|
11
|
-
# should "install remote interface template correctly" do
|
12
|
-
# Dir.chdir NUTELLA_HOME
|
13
|
-
# prj_dir = "#{Dir.pwd}/test_prj"
|
14
|
-
# # create new project and cs into it
|
15
|
-
# Nutella.executeCommand "new", ["test_prj"]
|
16
|
-
# Dir.chdir prj_dir
|
17
|
-
# Nutella.executeCommand "install", ["basic-web-interface"]
|
18
|
-
# # Cleanup
|
19
|
-
# Dir.chdir NUTELLA_HOME
|
20
|
-
# FileUtils.rm_rf prj_dir
|
21
|
-
# end
|
22
|
-
|
23
|
-
|
24
|
-
def teardown
|
25
|
-
Nutella.config.send(:removeConfigFile)
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
|