raudi 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/Guardfile +11 -0
- data/Rakefile +1 -0
- data/examples/actions.raudi +1 -0
- data/examples/config.rb +3 -0
- data/examples/result.c +10 -0
- data/lib/raudi/action_processor.rb +33 -0
- data/lib/raudi/avr_controller.rb +23 -0
- data/lib/raudi.rb +25 -0
- data/raudi.gemspec +27 -0
- data/spec/raudi_spec.rb +9 -0
- metadata +103 -0
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm 1.9.3@raudi --create
|
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'rspec', :version => 2, :cli=>"--colour --format=Fuubar", :all_after_pass => false do
|
5
|
+
|
6
|
+
watch(%r{^spec/.+_spec\.rb$})
|
7
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
8
|
+
watch('spec/spec_helper.rb') { "spec" }
|
9
|
+
|
10
|
+
end
|
11
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1 @@
|
|
1
|
+
//
|
data/examples/config.rb
ADDED
data/examples/result.c
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
module ActionProcessor
|
2
|
+
|
3
|
+
class << self
|
4
|
+
|
5
|
+
def generate_source(actions_file)
|
6
|
+
raise %q{Controller isn't specified in config.rb file} unless Raudi.controller
|
7
|
+
define_actions(actions_file)
|
8
|
+
output = ''
|
9
|
+
output << append_libs(Raudi.controller.libs)
|
10
|
+
output << block_delimiter
|
11
|
+
output << main_block
|
12
|
+
end
|
13
|
+
|
14
|
+
def append_libs(libs)
|
15
|
+
libs.map do |lib_name|
|
16
|
+
lib_name = lib_name.to_s
|
17
|
+
lib_name << '.h' unless lib_name =~ /\.h$/
|
18
|
+
"#include <#{lib_name}>"
|
19
|
+
end.join("\n")
|
20
|
+
end
|
21
|
+
|
22
|
+
def block_delimiter
|
23
|
+
"\n"
|
24
|
+
end
|
25
|
+
|
26
|
+
def define_actions(actions_file)
|
27
|
+
File.open(actions_file) do |file|
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class AvrController
|
2
|
+
|
3
|
+
class << self
|
4
|
+
|
5
|
+
def define(model_name)
|
6
|
+
Raudi.controller = new(model_name)
|
7
|
+
yield(Raudi.controller) if block_given?
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_accessor :libs
|
13
|
+
|
14
|
+
def initialize(model_name)
|
15
|
+
@model_name = model_name
|
16
|
+
@libs = ['avr/io']
|
17
|
+
end
|
18
|
+
|
19
|
+
def add_lib(lib_name)
|
20
|
+
@libs << lib_name
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
data/lib/raudi.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'raudi/action_processor'
|
2
|
+
require 'raudi/avr_controller'
|
3
|
+
|
4
|
+
module Raudi
|
5
|
+
|
6
|
+
class << self
|
7
|
+
|
8
|
+
attr_accessor :controller
|
9
|
+
|
10
|
+
def version
|
11
|
+
"0.0.1"
|
12
|
+
end
|
13
|
+
|
14
|
+
def generate(config_file, actions_file)
|
15
|
+
absolute_config_path = File.expand_path(config_file)
|
16
|
+
absolute_actions_path = File.expand_path(actions_file)
|
17
|
+
raise 'Create configuration file config.rb before' unless File.exists?(absolute_config_path)
|
18
|
+
raise 'Create actions file actions.raudi before' unless File.exists?(absolute_actions_path)
|
19
|
+
load(absolute_config_path)
|
20
|
+
ActionProcessor.generate_source(absolute_config_path)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
data/raudi.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "raudi"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "raudi"
|
7
|
+
s.version = Raudi.version
|
8
|
+
s.authors = ["Sergey Pchelincev"]
|
9
|
+
s.email = ["jalkoby91@gmail.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Raudi is adapter for programming avr controller without pain}
|
12
|
+
s.description = %q{Raudi is adapter for programming avr controller without pain}
|
13
|
+
|
14
|
+
s.rubyforge_project = "raudi"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
s.add_development_dependency "rspec", '>= 2.5'
|
23
|
+
s.add_development_dependency 'guard-rspec'
|
24
|
+
s.add_development_dependency 'fuubar'
|
25
|
+
s.add_development_dependency 'ruby_gntp'
|
26
|
+
|
27
|
+
end
|
data/spec/raudi_spec.rb
ADDED
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: raudi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Sergey Pchelincev
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-09 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: &70350185137180 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.5'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70350185137180
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: guard-rspec
|
27
|
+
requirement: &70350185136760 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70350185136760
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: fuubar
|
38
|
+
requirement: &70350185136300 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70350185136300
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: ruby_gntp
|
49
|
+
requirement: &70350185135880 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70350185135880
|
58
|
+
description: Raudi is adapter for programming avr controller without pain
|
59
|
+
email:
|
60
|
+
- jalkoby91@gmail.com
|
61
|
+
executables: []
|
62
|
+
extensions: []
|
63
|
+
extra_rdoc_files: []
|
64
|
+
files:
|
65
|
+
- .gitignore
|
66
|
+
- .rvmrc
|
67
|
+
- Gemfile
|
68
|
+
- Guardfile
|
69
|
+
- Rakefile
|
70
|
+
- examples/actions.raudi
|
71
|
+
- examples/config.rb
|
72
|
+
- examples/result.c
|
73
|
+
- lib/raudi.rb
|
74
|
+
- lib/raudi/action_processor.rb
|
75
|
+
- lib/raudi/avr_controller.rb
|
76
|
+
- raudi.gemspec
|
77
|
+
- spec/raudi_spec.rb
|
78
|
+
homepage: ''
|
79
|
+
licenses: []
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
requirements: []
|
97
|
+
rubyforge_project: raudi
|
98
|
+
rubygems_version: 1.8.10
|
99
|
+
signing_key:
|
100
|
+
specification_version: 3
|
101
|
+
summary: Raudi is adapter for programming avr controller without pain
|
102
|
+
test_files:
|
103
|
+
- spec/raudi_spec.rb
|