hyla 1.0.7.pre.8 → 1.0.7.pre.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MThiYzA4ZmM3OGExMDc3MTZhZTIwYzI2ZWM4YTZhZGJlMWQ0YzFmNQ==
4
+ ZTQ0MTcwYmY2MDdkOGE3YmVlNDk2NDdkMGQ3YTZiNjFiMmY0MjA0Nw==
5
5
  data.tar.gz: !binary |-
6
- ZTEwMzA4NTkzMmI5MDVjMWUzNGUwZTU5N2I4ZDM2MTgxODVkM2IxMw==
6
+ ZjU3YWJmNzA1YTA0ZDYwZjIxMjIwZTIxOWZjYmQ0MjExZjQ4NmMxYQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NzlkOWRhYzBlYjEyNzk0OGEzY2ZiMjYxYTczZjQzMjg5Y2I3MjRlZTFmODkw
10
- MzM0ZWJjOTc2OWIzOGIyNDZjMDA4YWJjNWIzNDg2ZWIyYzk3YzkyZTgzMWYx
11
- ZTY3YWE3OTUxNGM4OTc0N2M0M2ZmZmJkY2ZlZjA5YjhmY2Q2YjI=
9
+ YzY0ODE2NjIwNTE0NmZkZmVmZWU4MTdiZmUyMDY0MzdjODVlZmMwZGQ3Yjhk
10
+ MGI2ZjdlODIwZDQyN2E5NGU3OWQ0MzFmNDE3YWQ0YzNmY2Q1YjU3NWMzNzVh
11
+ Y2RkZjhjY2M0MmExZDI3NjQ4M2U2NjFhZjhjZGU3NTJhMGQzNzc=
12
12
  data.tar.gz: !binary |-
13
- M2Q5MTg0YzM3MmFjMThiMDJiOGIxZWFkMjY1NGNjNDY3YjY5M2NlZTIwOTc2
14
- MzUyZmJlMmY0ODU3NTFlZWU2NWJhNzNlYmYxZGYyMjA5M2RiODZkYzVlNzlm
15
- MjlkMDljYmJiOTI1ZTVhZTRiYjYyZWM4M2JhNGJkOWMxMzRmNzI=
13
+ NDRhODc4YTlkMDc5NWEyM2QwZjZmZGEyMDc2ZmQ1NTNjNzA0NGRlMmI3NjAy
14
+ MzkyZTQ2Y2RlNTA1ZmJjZTQwNmMxNGVlNzFhNGQ2ZTJjZjdiNDI1MmUxMmRh
15
+ Njg1MTRhMzI2NzZiN2YyZTIyOGFjOGEzZThhOTI2N2RhMWE2ZmE=
data/lib/hyla.rb CHANGED
@@ -56,15 +56,27 @@ module Hyla
56
56
  end
57
57
 
58
58
  def self.logger2
59
- log_cfg ||= $options[:log]
59
+ configs = $options[:config].split(",").map(&:strip) if $options[:config]
60
+ if !configs.nil? && !configs.empty?
61
+ @yaml_cfg = nil
62
+ configs.each do |config|
63
+ cfg = safe_load_file(config)
64
+ @yaml_cfg = cfg if @yaml_cfg.nil?
65
+ @yaml_cfg = @yaml_cfg.deep_merge(cfg)
66
+ end
67
+ else
68
+ # We will try to read the _config.yaml file if it exists within the project
69
+ cfg = safe_load_file(Configuration::YAML_CONFIG_FILE_NAME)
70
+ @yaml_cfg = cfg if !cfg.nil? && !cfg.empty?
71
+ end
72
+ hyla_cfg ||= @yaml_cfg if @yaml_cfg
60
73
 
61
- hyla_cfg = safe_load_file($options[:config]) if $options[:config]
62
-
63
- mode ||= hyla_cfg['mode']
64
- dirname ||= hyla_cfg['dirname']
65
- logname ||= hyla_cfg['logname']
66
- level ||= hyla_cfg['level']
67
- tracer ||= hyla_cfg['tracer']
74
+ log_cfg ||= $options[:log]
75
+ mode ||= hyla_cfg['mode'] if hyla_cfg
76
+ dirname ||= hyla_cfg['dirname'] if hyla_cfg
77
+ logname ||= hyla_cfg['logname'] if hyla_cfg
78
+ level ||= hyla_cfg['level'] if hyla_cfg
79
+ tracer ||= hyla_cfg['tracer'] if hyla_cfg
68
80
 
69
81
  $logger2 ||= Logger2.new(mode, log_cfg, dirname, logname, level, tracer)
70
82
  end
@@ -72,5 +84,7 @@ module Hyla
72
84
  def self.safe_load_file(filename)
73
85
  f = File.expand_path(filename, $cmd_directory)
74
86
  YAML.safe_load_file(f)
87
+ rescue SystemCallError
88
+ puts "No configuration file retrieved for the name : #{filename}"
75
89
  end
76
90
  end
data/lib/hyla/Logger2.rb CHANGED
@@ -9,23 +9,15 @@ module Hyla
9
9
 
10
10
  attr_reader :log, :levels
11
11
 
12
- def initialize(name, log_yml_file, dirname = nil, logname = nil, level = nil, tracer = nil)
12
+ def initialize(mode, log_yml_file, dirname = nil, logname = nil, level = nil, tracer = nil)
13
13
 
14
14
  #
15
15
  # Change logging level within the YAML config file
16
16
  # ! Log4r::YamlConfigurator does not allow to change key/val for the level but only for formatter/outputter
17
17
  #
18
- if level.nil?
19
- new_level = 'INFO'
20
- else
21
- new_level = level
22
- end
23
-
24
- if tracer.nil?
25
- new_tracer = 'false'
26
- else
27
- new_tracer = tracer
28
- end
18
+ if level.nil? then new_level = 'INFO' else new_level = level end
19
+ if tracer.nil? then new_tracer = 'false' else new_tracer = tracer end
20
+ if mode.nil? then new_mode = 'production' else new_mode = mode end
29
21
 
30
22
  log4r_hash = load_file(log_yml_file)
31
23
 
@@ -47,15 +39,11 @@ module Hyla
47
39
  cfg['DIRNAME'] = dirname
48
40
  end
49
41
 
50
- if logname.nil?
51
- cfg['LOGNAME'] = 'hyla.log'
52
- else
53
- cfg['LOGNAME'] = logname
54
- end
42
+ if logname.nil? then cfg['LOGNAME'] = 'hyla.log' else cfg['LOGNAME'] = logname end
55
43
 
56
44
  cfg.decode_yaml log4r_hash['log4r_config']
57
45
 
58
- @log = Log4r::Logger[name]
46
+ @log = Log4r::Logger[new_mode]
59
47
  end
60
48
 
61
49
  def levels
@@ -13,7 +13,6 @@ module Hyla
13
13
 
14
14
  # Asciidoctor
15
15
  'backend' => 'html5',
16
- 'eruby' => 'erb',
17
16
  'doctype' => 'article',
18
17
  'compact' => false,
19
18
  'to_dir' => '.',
@@ -154,30 +153,34 @@ module Hyla
154
153
  extracted_email_attributes = self.extract_attributes(override[:email_attributes]) if override[:email_attributes]
155
154
  override[:email_attributes] = extracted_email_attributes if extracted_email_attributes
156
155
 
157
- # Stringify keys of the hash that we receive from Hyla
156
+ # Stringify keys of the hash
158
157
  override = Configuration[override].stringify_keys
159
158
  Hyla::logger2.debug("OVERRIDE Keys: #{override.inspect}")
160
-
161
- # Clone DEFAULTS
159
+
160
+ # Config
162
161
  config = DEFAULTS
163
162
  Hyla::logger2.debug("DEFAULTS Keys: #{config.inspect}")
164
163
 
165
164
  #
166
- # Read the config file passed as parameter if it exists
167
- # otherwise read default _config.yaml file if it exists and
168
- # merge content with DEFAULT config
165
+ # Check if config parameter was passed and split content which is a list of files
166
+ # Read each config file and merge content with DEFAULTS
167
+ # Otherwise, check if there is a _config.yaml
169
168
  #
170
- alt_config = read_config_file(override['config']) if override['config']
171
- if !alt_config.nil?
172
- config = config.deep_merge(alt_config)
169
+ configs = override['config'].split(",").map(&:strip) if override['config']
170
+ if !configs.nil? && !configs.empty?
171
+ configs.each do |cfg_file|
172
+ cfg = read_config_file(cfg_file)
173
+ config = config.deep_merge(cfg)
174
+ end
173
175
  else
174
176
  new_config = read_config_file(YAML_CONFIG_FILE_NAME)
175
177
  Hyla::logger2.debug("OVERRIDE Keys: #{new_config.inspect}") if !new_config.nil?
176
- config = config.deep_merge(new_config) if !new_config.nil?
178
+ config = config.deep_merge(new_config) if !new_config.nil? && !new_config.empty?
177
179
  end
178
180
 
179
- # Merge DEFAULTS < _config.yaml or your_config.yaml file < override
181
+ # Merge files with parameters coming from the cmd line
180
182
  config = config.deep_merge(override)
183
+ Hyla::logger2.debug("DEFAULTS Keys: #{config.inspect}")
181
184
  # Convert String Keys to Symbols Keys
182
185
  config = Configuration[].transform_keys_to_symbols(config)
183
186
  Hyla::logger2.debug("Merged Keys: #{config.inspect}")
@@ -192,7 +195,8 @@ module Hyla
192
195
  Hyla::logger2.info("Config file to be parsed : #{f}")
193
196
  safe_load_file(f)
194
197
  rescue SystemCallError
195
- Hyla::logger2.error "No configuration file retrieved for the name : #{filename}"
198
+ Hyla::logger2.error "No configuration file retrieved for : #{filename}"
199
+ exit
196
200
  end
197
201
 
198
202
  #
@@ -250,7 +254,7 @@ module Hyla
250
254
  result
251
255
  }
252
256
  end
253
-
257
+
254
258
  ASSETS = '../../lib/resources/assets'
255
259
 
256
260
  FONTS = '../../lib/resources/assets/fonts'
@@ -270,26 +274,26 @@ module Hyla
270
274
  BACKENDS = '../../lib/resources/backends'
271
275
 
272
276
  COVER_TEMPLATE = '../../lib/resources/assets/cover/cover.slim'
273
-
277
+
274
278
  NEW_COVER_TEMPLATE = '../../lib/resources/assets/cover/new_cover.slim'
275
279
 
276
- ASSESSMENT_TXT = File.open(self.templates + '/course/assessment.txt','r').read
280
+ ASSESSMENT_TXT = File.open(self.templates + '/course/assessment.txt', 'r').read
277
281
 
278
- LABS_TXT = File.open(self.templates + '/course/labinstructions.txt','r').read
282
+ LABS_TXT = File.open(self.templates + '/course/labinstructions.txt', 'r').read
279
283
 
280
- INDEX = File.open(self.templates + '/course/index.txt','r').read
284
+ INDEX = File.open(self.templates + '/course/index.txt', 'r').read
281
285
 
282
- HEADER_INDEX = File.open(self.templates + '/course/header_index.txt','r').read
286
+ HEADER_INDEX = File.open(self.templates + '/course/header_index.txt', 'r').read
283
287
 
284
- FOOTER_TXT = File.open(self.templates + '/course/footer.txt','r').read
288
+ FOOTER_TXT = File.open(self.templates + '/course/footer.txt', 'r').read
285
289
 
286
- COVER_TXT = File.open(self.templates + '/course/cover.txt','r').read
290
+ COVER_TXT = File.open(self.templates + '/course/cover.txt', 'r').read
287
291
 
288
- OBJECTIVES_TXT = File.open(self.templates + '/course/objectives.txt','r').read
292
+ OBJECTIVES_TXT = File.open(self.templates + '/course/objectives.txt', 'r').read
289
293
 
290
- SUMMARY_TXT = File.open(self.templates + '/course/summary.txt','r').read
294
+ SUMMARY_TXT = File.open(self.templates + '/course/summary.txt', 'r').read
291
295
 
292
- AUDIO_TXT = File.open(self.templates + '/course/audio.txt','r').read
296
+ AUDIO_TXT = File.open(self.templates + '/course/audio.txt', 'r').read
293
297
 
294
298
  end # Class Configuration
295
299
  end # module Hyla
data/lib/hyla/project.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Hyla
2
- VERSION = '1.0.7.pre.8'
2
+ VERSION = '1.0.7.pre.9'
3
3
  DESCRIPTION = 'Asciidoctor Hyla - Command Line tool to create new project, watch modifications, generate content, publish or consult it live !'
4
4
  SUMMARY = 'Asciidoctor Hyla - builder/generator of HTML5, slideshow. Watch modifications, generate content, publish or consult it live !'
5
5
  end
@@ -1,11 +1,70 @@
1
- /* Selection audioblock under a section tag and move it before the title */
2
- var $sections = $('section');
3
- $sections.each(function () {
4
- var $this = $(this);
5
- var $audio = $this.find('.audioblock');
6
- var $audioHtml = $audio.html();
7
- if ($audioHtml != null) {
8
- $this.removeData($audioHtml);
9
- $audio.prependTo($this);
1
+ /**************************************************************/
2
+ /* Module GPE
3
+ /**************************************************************/
4
+ var GPE = {
5
+ prepareList: function () {
6
+ $('#expList').find('li:has(ul)')
7
+ .click(function (event) {
8
+ if (this == event.target) {
9
+ $(this).toggleClass('expanded');
10
+ $(this).children('ul').toggle('medium');
11
+ }
12
+ return false;
13
+ })
14
+ .addClass('collapsed')
15
+ .children('ul').hide();
16
+
17
+ //Create the button funtionality
18
+ $('#expandList')
19
+ .unbind('click')
20
+ .click(function () {
21
+ $('.collapsed').addClass('expanded');
22
+ $('.collapsed').children().show('medium');
23
+ })
24
+
25
+ $('#collapseList')
26
+ .unbind('click')
27
+ .click(function () {
28
+ $('.collapsed').removeClass('expanded');
29
+ $('.collapsed').children().hide('medium');
30
+ })
31
+ },
32
+
33
+ popuplink: function(audio_file) {
34
+ window.open(audio_file,
35
+ 'audio',
36
+ 'resizable=yes,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no,width=400,height=200');
37
+ return false
38
+ },
39
+
40
+ /* Selection audioblock under a section tag and move it before the title */
41
+ moveAudioBlock: function() {
42
+ $('section').each(function () {
43
+ var $this = $(this);
44
+ var $audio = $this.find('.audioblock');
45
+ var $audioHtml = $audio.html();
46
+ if ($audioHtml != null) {
47
+ $this.removeData($audioHtml);
48
+ $audio.prependTo($this);
49
+ }
50
+ });
10
51
  }
11
- });
52
+ };
53
+
54
+
55
+ /**************************************************************/
56
+ /* Functions to execute on loading of the document */
57
+ /**************************************************************/
58
+ $(document).ready(function () {
59
+
60
+ // Check expandable and collapsable lists
61
+ GPE.prepareList();
62
+
63
+ // Add click event for <a href where id=popuplink and audio-file
64
+ $("a[id][audio-file]").click(function () {
65
+ GPE.popuplink($(this).attr('audio-file'))
66
+ });
67
+
68
+ GPE.moveAudioBlock();
69
+
70
+ });
@@ -1 +1,3 @@
1
- var $sections=$('section');$sections.each(function(){var $this=$(this);var $audio=$this.find('.audioblock');var $audioHtml=$audio.html();if($audioHtml!=null){$this.removeData($audioHtml);$audio.prependTo($this);}});
1
+ var GPE={prepareList:function(){$('#expList').find('li:has(ul)').click(function(event){if(this==event.target){$(this).toggleClass('expanded');$(this).children('ul').toggle('medium');}
2
+ return false;}).addClass('collapsed').children('ul').hide();$('#expandList').unbind('click').click(function(){$('.collapsed').addClass('expanded');$('.collapsed').children().show('medium');})
3
+ $('#collapseList').unbind('click').click(function(){$('.collapsed').removeClass('expanded');$('.collapsed').children().hide('medium');})},popuplink:function(audio_file){window.open(audio_file,'audio','resizable=yes,status=no,location=no,toolbar=no,menubar=no,fullscreen=no,scrollbars=no,dependent=no,width=400,height=200');return false},moveAudioBlock:function(){$('section').each(function(){var $this=$(this);var $audio=$this.find('.audioblock');var $audioHtml=$audio.html();if($audioHtml!=null){$this.removeData($audioHtml);$audio.prependTo($this);}});}};$(document).ready(function(){GPE.prepareList();$("a[id][audio-file]").click(function(){GPE.popuplink($(this).attr('audio-file'))});GPE.moveAudioBlock();});
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyla
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7.pre.8
4
+ version: 1.0.7.pre.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Moulliard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-27 00:00:00.000000000 Z
11
+ date: 2015-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler