nutella_framework 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.1.2 ruby lib
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.1.2"
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"
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/project.rb",
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<erubis>, [">= 2.7.0", "~> 2.7.0"])
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<erubis>, [">= 2.7.0", "~> 2.7.0"])
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<erubis>, [">= 2.7.0", "~> 2.7.0"])
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"])
@@ -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(:removeConfigFile)
8
+ Nutella.config.send(:remove_file)
9
9
  end
10
-
11
- should "set a key value" do
12
- assert_equal "value1", Nutella.config["key1"]="value1"
10
+
11
+
12
+ should 'set a key value' do
13
+ assert_equal 'value1', Nutella.config['key1']='value1'
13
14
  end
14
15
 
15
- should "return 'nil' if a key doesn't exist" do
16
- assert_nil Nutella.config["fakekey"]
16
+ should 'return \'nil\' if a key doesn\'t exist' do
17
+ assert_nil Nutella.config['fakekey']
17
18
  end
18
19
 
19
- should "return the value associated with a key whenever that key exists" do
20
- Nutella.config["key2"]="value2"
21
- assert_equal "value2", Nutella.config["key2"]
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 "retun true if a key exists" do
25
- Nutella.config["key3"]="value3"
26
- assert Nutella.config.has_key?("key3")
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 "retun false if a key doens't exist" do
30
- refute Nutella.config.has_key?("key4")
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 "access nested hashes" do
34
- Nutella.config["key5"]={"k55" => "v55"}
35
- assert_equal "v55", Nutella.config["key5"]["k55"]
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(:removeConfigFile)
41
+ Nutella.config.send(:remove_file)
40
42
  end
41
43
 
42
44
  end
43
-
44
-
45
+
45
46
  end
46
47
 
47
48
 
@@ -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.executeCommand "new", ["test_project"]
10
- Dir.chdir NUTELLA_HOME + "test_project"
9
+ Nutella.execute_command( 'new', ['test_project'] )
10
+ Dir.chdir "#{NUTELLA_HOME}test_project"
11
11
  end
12
-
13
- should "return true if the dir is a nutella project" do
14
- assert Nutella.currentProject.exist?
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 "return false if the dir is not a nutella project" do
18
+ should 'return false if the dir is not a nutella project' do
18
19
  Dir.chdir NUTELLA_HOME
19
- refute Nutella.currentProject.exist?
20
+ refute Nutella.current_project.exist?
20
21
  end
21
22
 
22
- should "return the correct version of nutella as read from the project configuration file" do
23
- assert_equal File.open(NUTELLA_HOME+"VERSION", "rb").read, Nutella.currentProject.config["nutella_version"]
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(NUTELLA_HOME + "test_project")
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
@@ -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(:removeRunListFile)
8
+ Nutella.runlist.send(:remove_file)
9
9
  end
10
10
 
11
- should "return true if the list is empty" do
11
+ should 'return true if the list is empty' do
12
12
  assert Nutella.runlist.empty?
13
13
  end
14
14
 
15
- should "return false if the list is not empty" do
16
- refute_nil Nutella.runlist.add? "run1"
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 "return empty array if the list is empty" do
21
- assert_empty Nutella.runlist.to_a
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 "return an array of runs in the list if not empty" do
25
- refute_nil Nutella.runlist.add? "run1"
26
- refute_nil Nutella.runlist.add? "run2"
27
- assert_equal ["run1", "run2"], Nutella.runlist.to_a
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 "return nil if trying to add the same element twice" do
31
- refute_nil Nutella.runlist.add? "run1"
32
- assert_nil Nutella.runlist.add? "run1"
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 "return properly when deleting an item" do
36
- refute_nil Nutella.runlist.add? "run1"
37
- refute_nil Nutella.runlist.delete? "run1"
38
- assert_nil Nutella.runlist.delete? "run1"
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(:removeRunListFile)
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.1.2
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-14 00:00:00.000000000 Z
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: erubis
134
+ name: nokogiri
135
135
  requirement: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - ">="
138
138
  - !ruby/object:Gem::Version
139
- version: 2.7.0
139
+ version: 1.6.3
140
140
  - - "~>"
141
141
  - !ruby/object:Gem::Version
142
- version: 2.7.0
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: 2.7.0
149
+ version: 1.6.3
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 2.7.0
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/project.rb
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
@@ -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
@@ -1,2 +0,0 @@
1
- # Rack config file used by thin when serving interfaces
2
- run Rack::Directory.new('.')
@@ -1,14 +0,0 @@
1
- <!doctype html>
2
- <html>
3
-
4
- <head>
5
- <meta charset="utf-8">
6
- <title> Welcome to RUNID</title>
7
- </head>
8
-
9
- <body>
10
- <p>We need a list of frontends</p>
11
-
12
- </body>
13
-
14
- </html>
@@ -1,9 +0,0 @@
1
- require 'sinatra'
2
- require 'erubis'
3
-
4
- #settings.root = "/Users/tebemis/Code/"
5
- # set :views, settings.root + '/templates'
6
-
7
- get '/' do
8
- erb :list
9
- end
@@ -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
-