dyndoc-ruby 0.9.12 → 0.9.14

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
  SHA1:
3
- metadata.gz: b521fb0e195336e4655811606b2db0dbfadf7304
4
- data.tar.gz: 39675c51acf5d462806dc98edf8342a345f78731
3
+ metadata.gz: 331c3c5c280c6a6df854b0404466d34252d47889
4
+ data.tar.gz: 58aa269ffdf01e6868e25613fa1d8a78000fc349
5
5
  SHA512:
6
- metadata.gz: 5cd340b92b6bde1373fa311495b4644e49b53e5ccc7ffc64769e53a6653a4daefa570539fdb9a295519906679072215f31199dc0817114bfda3e776225d94084
7
- data.tar.gz: 4ff34548e8446d36ed38a9d13a3de25d282a461db22bee7f52048373fb495a96148f123744cc385b106aa105737ff0999c171985a0231be50205a409dfd98676
6
+ metadata.gz: eaeb3aefee802d2b1a1a7f2e9e2e51d6b410a2716a3794fd8ba44f9fa3a006cf7d5fa4c1656a6b02a92159fb931b7a037d9744938ac69d8d99cbf15bf303cc1a
7
+ data.tar.gz: 55daab8dec69571791e481ea7ec95d1e4f91430690c1f9f45ac65adef0f30323165bef88b8a9820faae2b76edf34a5320602e301e2ba9ee80d51c500567c388e
data/bin/dyn-ctl CHANGED
@@ -27,6 +27,9 @@ when "start"
27
27
  when "stop"
28
28
  SRVS.each {|srv| `#{srv} stop`}
29
29
 
30
+ when "status"
31
+ SRVS.each {|srv| puts srv+(`#{srv} status`.empty? ? "stopped" : "running")}
32
+
30
33
  when "new"
31
34
 
32
35
  if RUBY_PLATFORM =~ /darwin/
@@ -248,8 +248,11 @@ module Dyndoc
248
248
  code = dyn_tags + code if dyn_tags
249
249
 
250
250
  ## add path for user
251
- code_path = "[#path]"+File.join(opts[:dyn_root],'users',opts[:user],"dynlib")
252
- code_path << "\n" << File.join(opts[:dyn_root],'users',opts[:user])
251
+ code_path = "[#path]"
252
+ if opts[:user]
253
+ code_path << "\n" << File.join(opts[:dyn_root],'users',opts[:user],"dynlib")
254
+ code_path << "\n" << File.join(opts[:dyn_root],'users',opts[:user])
255
+ end
253
256
  code_path << "\n" << File.join(sys_root,'public','users')
254
257
  code_path << "\n" << File.join(sys_root,'system','dynlib')
255
258
  code_path << "\n" << File.join(opts[:dyn_root],'dynlib')
@@ -265,7 +268,7 @@ module Dyndoc
265
268
  Dyndoc.process_html_file_from_dyn_file(code,html_file,dyn_file,dyn_layout,addr,dyndoc_start)
266
269
  else
267
270
  (opts[:current_tags] || html_files.keys[1..-1]).each do |doc_tag|
268
- html_file=File.join(html_root,["users",opts[:user]] || [],cfg_files[:urls][doc_tag])
271
+ html_file=File.join(html_root,(opts[:user] ? ["users",opts[:user]] : []),cfg_files[:urls][doc_tag])
269
272
  ##p [:html_multi,doc_tag,html_file] #,code.gsub(/__ALL_DOC_TAG__/,doc_tag)]
270
273
  Dyndoc.process_html_file_from_dyn_file(code.gsub(/__ALL_DOC_TAG__/,doc_tag),html_file,dyn_file,dyn_layout,addr,dyndoc_start)
271
274
  end
@@ -57,7 +57,7 @@ module Dyndoc
57
57
  opts = {
58
58
  dyn_root: dyn_root,
59
59
  html_root: pages_root,
60
- user: current_email
60
+ user: nil #current_email
61
61
  }
62
62
 
63
63
  puts "watching "+ dyn_root
@@ -67,24 +67,26 @@ module Dyndoc
67
67
  if [:changed,:new].include? event and File.extname(filename) == ".dyn"
68
68
  ##p [:filename_event,event,filename]
69
69
  if (lint_error=Dyndoc::Linter.check_file(filename)).empty?
70
- ## find dyn_file (relative path from root)
71
- dyn_file="/"+Pathname(filename).relative_path_from(Pathname(dyn_root)).to_s
72
- opts_doc=Dyndoc::FileWatcher.get_dyn_html_info(filename,dyn_file,opts[:user])
73
- opts.merge! opts_doc
74
- ##p [:html_files,html_files]
70
+ ## do not process preload, postload, lib and layout files
71
+ unless filename =~ /(?:_pre|_post|_lib|_layout)\.dyn$/
72
+ ## find dyn_file (relative path from root)
73
+ dyn_file="/"+Pathname(filename).relative_path_from(Pathname(dyn_root)).to_s
74
+ opts_doc=Dyndoc::FileWatcher.get_dyn_html_info(filename,dyn_file,opts[:user])
75
+ opts.merge! opts_doc
76
+ ##p [:html_files,html_files]
75
77
 
76
- html_file=opts[:html_files][opts[:current_doc_tag]] # No more default # || html_files[""]
77
- ##p [:opts,opts,:current_doc_tag,opts[:current_doc_tag]]
78
- Dyndoc.cli_convert_from_file(dyn_file[1..-1],html_file, opts)
79
- puts dyn_file[1..-1]+" processed!"
80
- if RUBY_PLATFORM =~ /darwin/
81
- options[:first] = html_file != old_html_file
82
- if html_file != old_html_file
83
- old_html_file = html_file
84
- url=File.join(base_url,html_file)
85
- cmd_to_open='tell application "Safari" to set URL of current tab of front window to "'+url+'"'
86
- `osascript -e '#{cmd_to_open}'`
87
- else
78
+ html_file=opts[:html_files][opts[:current_doc_tag]] # No more default # || html_files[""]
79
+ ##p [:opts,opts,:current_doc_tag,opts[:current_doc_tag]]
80
+ Dyndoc.cli_convert_from_file(dyn_file[1..-1],html_file, opts)
81
+ puts dyn_file[1..-1]+" processed!"
82
+ if RUBY_PLATFORM =~ /darwin/
83
+ options[:first] = html_file != old_html_file
84
+ if html_file != old_html_file
85
+ old_html_file = html_file
86
+ url=File.join(base_url,html_file)
87
+ cmd_to_open='tell application "Safari" to set URL of current tab of front window to "'+url+'"'
88
+ `osascript -e '#{cmd_to_open}'`
89
+ else
88
90
  %x{osascript<<ENDREFRESH
89
91
  tell app "Safari" to activate
90
92
  tell application "System Events"
@@ -92,6 +94,7 @@ tell application "System Events"
92
94
  end tell
93
95
  ENDREFRESH
94
96
  }
97
+ end
95
98
  end
96
99
  end
97
100
  else
@@ -25,69 +25,6 @@ class App < Roda
25
25
  :escape=>true,
26
26
  :check_paths=>true,
27
27
  :allowed_paths=>[File.expand_path("../views",__FILE__),$public_root]
28
- # plugin :csrf,
29
- # :skip => [
30
- # "POST:/edit/dyn",
31
- # "POST:/edit/save",
32
- # "POST:/edit/change-all-dyn-files",
33
- # "POST:/edit/add_delete_dyn_file",
34
- # "POST:/edit/add_delete_user",
35
- # "POST:/edit/add_user_dyn_file",
36
- # "POST:/edit/delete_user_dyn_file",
37
- # "POST:/edit/update_doc_tags_info"
38
- # ],
39
- # :skip_if => lambda{|req| req.env['CONTENT_TYPE'] =~ /application\/json/}
40
-
41
- # plugin :rodauth, :name=>:editor, :json=>true do
42
- # db DB
43
- # enable :login, :logout
44
- # account_password_hash_column :ph
45
- # session_key :user_id
46
- # login_label 'Email'
47
- # password_label 'Mot de passe'
48
- # login_redirect "/editor"
49
- # end
50
-
51
- # plugin :rodauth, :name=>:compte, :json=>true do
52
- # db DB
53
- # enable :change_login, :change_password, :close_account, :create_account,
54
- # :lockout, :login, :logout #, :remember, :reset_password,
55
- # #:verify_account,
56
- # #:otp, :recovery_codes, :sms_codes,
57
- # :password_complexity #,
58
- # #:disallow_password_reuse, :password_expiration, :password_grace_period,
59
- # #:account_expiration,
60
- # #:single_session,
61
- # #:jwt, :session_expiration,
62
- # #:verify_account_grace_period, :verify_change_login
63
- # create_account_link do
64
- # "<p><a href=\"/compte/create-account\">Créer un nouveau compte</a></p>"
65
- # end
66
- # login_redirect "/editor"
67
- # after_login do
68
- # puts session[:user_id]
69
- # end
70
- # logout_redirect "/editor"
71
- # create_account_redirect "/compte"
72
- # session_key :user_id
73
- # login_label "Email"
74
- # password_label "Mot de passe"
75
- # login_confirm_label "Confirme Email"
76
- # password_confirm_label "Confirme Mot de passe"
77
- # create_account_button "Création compte"
78
- # max_invalid_logins 2
79
- # #allow_password_change_after 60
80
- # #verify_account_grace_period 300
81
- # account_password_hash_column :ph
82
- # title_instance_variable :@page_title
83
- # delete_account_on_close? true
84
- # #only_json? false
85
- # #jwt_secret secret
86
- # # sms_send do |phone_number, message|
87
- # # MUTEX.synchronize{SMS[session_value] = "Would have sent the following SMS to #{phone_number}: #{message}"}
88
- # # end
89
- # end
90
-
91
28
 
92
29
  route do |r|
93
30
 
@@ -123,7 +60,8 @@ class App < Roda
123
60
  end
124
61
  end
125
62
 
126
- r.on "get" do
63
+ =begin
64
+ r.on "get" do ## useless because of static above???
127
65
  rsrc=r.remaining_path
128
66
  #p [:get,rsrc]
129
67
  static_root=File.join($public_root,"tools")
@@ -137,13 +75,18 @@ class App < Roda
137
75
  end
138
76
  "No resource #{rsrc} to serve!"
139
77
  end
78
+ =end
140
79
 
141
80
  r.get do
142
81
  page=r.remaining_path
143
82
  static_root=File.join($public_root,"pages")
144
83
  ##p [:page,File.join(static_root,"**",page+".html")]
145
- pattern=(page=~/[^\.]*\.(?:R|Rmd|css|js|html|html|rb|red|r|jpeg|jpg|png|gif)/) ? page : page+".html"
84
+ pattern=(page=~/[^\.]*\.(?:R|Rmd|css|js|htm|html|rb|red|r|jpeg|jpg|png|gif|pdf)/) ? page : page+".html"
146
85
  html_files=Dir[File.join(static_root,"**",pattern)]
86
+
87
+ ## try index.html in directory
88
+ html_files=Dir[File.join(static_root,"**",page,"index.html")] if html_files.empty?
89
+
147
90
  ##p html_files
148
91
  unless html_files.empty?
149
92
  html_file="pages/"+Pathname(html_files[0]).relative_path_from(Pathname(static_root)).to_s
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dyndoc-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.12
4
+ version: 0.9.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - RCqls
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-26 00:00:00.000000000 Z
11
+ date: 2016-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: R4rb