ecic 0.2.2 → 0.3.0

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
  SHA256:
3
- metadata.gz: fcfde91d7468d6f43a09146f41ab142722a396dc5e099ae831b8ec984063954b
4
- data.tar.gz: 115eeab40eed6862c9885a768a1e8d5aa5d8847d673cb1259dfaa1234ab3541e
3
+ metadata.gz: 2a216371da32fdac9361a74bec2731d155686754f57b0d36a8568eb5c48caf1d
4
+ data.tar.gz: 90920997e9a82cdeb267d83b18fe3a685198ffa0aa2be1c1898775d84f2a6267
5
5
  SHA512:
6
- metadata.gz: 78240fcec48ed9dd041659193b9c0076a53012ef11c324a6479f86fd402263a7e8be31aa245798869a18984b4e0299195c33dd02cd208c3af91d0154e7adc278
7
- data.tar.gz: 8b62a7ee844493fa626ca981dc909ff31ab6243089036f990e6b7cf094209e7b6543796a146956b732aba0aa2ddc3fbf5b031398836c3024374806e6060e0d40
6
+ metadata.gz: 6e121298d8fbb508c1ea7215e7aa346162b34bc75778612835018fd6104267c8ac270c5c3cd6c74e55c437a2641aa19e93768c469ca0b0084e15e0886dbe0caa
7
+ data.tar.gz: 034ca0e7b15f88814183258af18f825f1f0b2b916857dc6876cf4f6de3b206e0789561e1cf1bd81b45c8e49b1fe774b9a36e9c97c68998de7c36d85bcb47a112
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ecic (0.2.2)
4
+ ecic (0.3.0)
5
5
  activesupport (~> 5.2)
6
6
  colorize (~> 0.8)
7
7
  rake (~> 12.3)
data/lib/ecic.rb CHANGED
@@ -25,5 +25,6 @@ module Ecic
25
25
  autoload :Completer, "ecic/completer"
26
26
  autoload :ProjectGenerator, "ecic/project_generator"
27
27
  autoload :LibraryGenerator, "ecic/library_generator"
28
+ autoload :Library, "ecic/library"
28
29
  autoload :Project, "ecic/project"
29
30
  end
data/lib/ecic/cli.rb CHANGED
@@ -76,6 +76,20 @@ module Ecic
76
76
  def version
77
77
  say "#{VERSION}"
78
78
  end
79
+
80
+ #--------------------------------------------------------------------------
81
+ # LIBRARIES command:
82
+ #--------------------------------------------------------------------------
83
+ desc 'libraries', 'Display list of libraries in your project'
84
+ def libraries
85
+ root_dir = Project::root
86
+ shell.error "You must be within an ECIC project before calling this command" if root_dir.nil?
87
+ library_cfg_file = Project::library_cfg_file(root_dir)
88
+ project = Project.new
89
+ project.load_libraries(library_cfg_file)
90
+ say project.libraries { |lib| "#{lib.to_s}" }.join("\n")
91
+ end
92
+
79
93
  end
80
94
  end
81
95
 
@@ -0,0 +1,18 @@
1
+ module Ecic
2
+
3
+ class Library
4
+
5
+ def initialize(name=nil)
6
+ @name = name
7
+ end
8
+
9
+ def create(name)
10
+ @name = name
11
+ end
12
+
13
+ def to_s
14
+ @name
15
+ end
16
+
17
+ end
18
+ end
@@ -18,7 +18,7 @@ module Ecic
18
18
  libraries_file = File.expand_path("#{destination_root}/src/config/libraries.rb")
19
19
  empty_directory 'src/config' unless File.exist?(File.dirname(libraries_file))
20
20
  create_file libraries_file unless File.exist?(libraries_file)
21
- append_to_file 'src/config/libraries.rb', "add library #{@library_name}\n"
21
+ append_to_file 'src/config/libraries.rb', "\nlibrary.create('#{@library_name}')"
22
22
  end
23
23
 
24
24
  end
data/lib/ecic/project.rb CHANGED
@@ -2,9 +2,20 @@ module Ecic
2
2
 
3
3
  class Project
4
4
 
5
+ attr_accessor :libraries
6
+
5
7
  require 'pathname'
8
+
9
+ def initialize
10
+ @libraries = []
11
+ end
6
12
 
7
13
  SCRIPT_ECIC = File.join('src', 'config', 'ecic.rb')
14
+ LIBRARIES_CFG_SCRIPT = File.join('src', 'config', 'libraries.rb')
15
+
16
+ def self.library_cfg_file(root = Project::root)
17
+ File.join(root, LIBRARIES_CFG_SCRIPT)
18
+ end
8
19
 
9
20
  #Function that returns the root directory of a ECIC project
10
21
  def self.root(path = Pathname.new(Dir.pwd))
@@ -15,6 +26,26 @@ module Ecic
15
26
  end
16
27
  return root(path.parent)
17
28
  end
29
+
30
+ def load_libraries(lib_file)
31
+ if File.exists?(lib_file)
32
+ puts "Reading #{lib_file}"
33
+ eval File.read(lib_file)
34
+ else
35
+ raise "Could not read library definitions from #{lib_file}"
36
+ end
37
+
38
+ end
39
+
40
+ def add_libray(name)
41
+ @libraries << Library.new(name)
42
+ end
43
+
44
+ def library
45
+ new_lib = Library.new()
46
+ libraries << new_lib
47
+ new_lib
48
+ end
18
49
 
19
50
  end
20
51
  end
data/lib/ecic/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ecic
2
- VERSION = "0.2.2"
2
+ VERSION = "0.3.0"
3
3
  end
data/notes.txt CHANGED
@@ -4,3 +4,7 @@ add design chip, :env => ['asic_rtl', 'asic_gate', 'fpga_rtl']
4
4
  add design [basic_vhdl, chip], :except => {:env => ['asic']}
5
5
  #add design chip_tb, :path => '/some/absolute/path'
6
6
  #add testbench chip_tb, :path => '/some/absolute/path'
7
+ #Libraries can be added in libraries.rb with two different syntaxes, eg.:
8
+ library.create('lib_x')
9
+ and
10
+ libraries << Library.new('lib_z')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Torben Fox Jacobsen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-09 00:00:00.000000000 Z
11
+ date: 2018-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -142,6 +142,7 @@ files:
142
142
  - lib/ecic/completion.rb
143
143
  - lib/ecic/generate.rb
144
144
  - lib/ecic/help.rb
145
+ - lib/ecic/library.rb
145
146
  - lib/ecic/library_generator.rb
146
147
  - lib/ecic/project.rb
147
148
  - lib/ecic/project_generator.rb