dyndoc-ruby 1.0.6 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19d45fc111a01b00353776a681cbc64567f275ee
4
- data.tar.gz: 5666b03f5ff1769e5a248201ebfb4fa15620dd1a
3
+ metadata.gz: b6c1b12fb52379a242ee6666bd58e6fb95514984
4
+ data.tar.gz: 4050a6b56fbc8484c07508d6bb31821e2a5d1772
5
5
  SHA512:
6
- metadata.gz: 8cd73d30108e28fb03253ef3438a0c9bd25207691bb43e562659ad5c862afc49cd17b7fb30514344c352d1715672eae08c7d87cc6a33edd4c124ed925134e139
7
- data.tar.gz: 923eab3685183944f69c1742e92e163226951d56f10ecf1e28de91fd406ec932b1a05582ddf64988fbae13e3b39ea8bd8ea88616cb20e16dcb35c311a214be15
6
+ metadata.gz: 035bf836dc73dbe0f1e882b0e32ce36e2dabda2ef8cd26f37c537cacda59a0aebdbac5f558e149b389652bfe63ff407b07b13a598943fb317514b029117a2b42
7
+ data.tar.gz: ea85e2ab5a4cc666172371de528bead712591873dcfafd751a91d6a31b5852d20df89b9dfb8e2eadd3b029af7825cc54f871a6e4da694b7304a2851b6ffe7b95
@@ -39,7 +39,7 @@ when "browser"
39
39
  require 'dyndoc-html-servers'
40
40
  if browser
41
41
  browser=browser.downcase
42
- Dyndoc::Browser.set browser if ["firefox","safari","chrome"].include? browser
42
+ Dyndoc::Browser.set browser if ["firefox","safari","chrome","midori"].include? browser
43
43
  else
44
44
  puts "Current browser is #{Dyndoc::Browser.get}"
45
45
  end
@@ -9,7 +9,7 @@ module Dyndoc
9
9
 
10
10
  @@cfg=nil
11
11
 
12
- @@default_browser=(RUBY_PLATFORM =~ /darwin/ ? "safari" : "firefox")
12
+ @@default_browser=(RUBY_PLATFORM =~ /darwin/ ? "safari" : (RUBY_PLATFORM =~ /linux/ ? "midori" : "firefox"))
13
13
 
14
14
  def Browser.set(browser)
15
15
  Browser.cfg["browser"]=browser
@@ -38,20 +38,24 @@ module Dyndoc
38
38
  end
39
39
 
40
40
  def Browser.name
41
- mode=(Browser.cfg["browser"] || :safari).to_sym
42
- case mode
43
- when :chrome
44
- "Google Chrome"
45
- when :canary
46
- "Google Chrome Canary"
47
- when :firefox
48
- "Firefox"
49
- when :firefox_nightly
50
- "FirefoxNightly"
51
- when :firefox_developer
52
- "FirefoxDeveloperEdition"
53
- when :safari
54
- "Safari"
41
+ mode=Browser.get.to_sym
42
+ if RUBY_PLATFORM =~ /darwin/
43
+ case mode
44
+ when :chrome
45
+ "Google Chrome"
46
+ when :canary
47
+ "Google Chrome Canary"
48
+ when :firefox
49
+ "Firefox"
50
+ when :firefox_nightly
51
+ "FirefoxNightly"
52
+ when :firefox_developer
53
+ "FirefoxDeveloperEdition"
54
+ when :safari
55
+ "Safari"
56
+ end
57
+ elsif RUBY_PLATFORM =~ /linux/
58
+ mode.to_s
55
59
  end
56
60
  end
57
61
 
@@ -129,6 +133,8 @@ module Dyndoc
129
133
  if RUBY_PLATFORM =~ /darwin/
130
134
  Browser.set_browser_reload unless File.exists? @@browser_reload_osa
131
135
  `osascript #{@@browser_reload_osa}`
136
+ elsif RUBY_PLATFORM =~ /linux/ and File.exists? "/usr/bin/xdotool"
137
+ `export DISPLAY=':0.0';/usr/bin/xdotool search --sync --onlyvisible #{Browser.name} key F5 windowactivate`
132
138
  end
133
139
  end
134
140
 
@@ -152,68 +158,12 @@ module Dyndoc
152
158
  f << code
153
159
  end
154
160
  `osascript #{@@browser_load_osa}`
161
+ elsif RUBY_PLATFORM =~ /linux/
162
+ system("xdg-open #{url} &")
155
163
  end
156
164
  end
157
165
  end
158
166
  end
159
- =begin
160
- Commands = {
161
- darwin: {
162
- firefox: MacFirefoxCmd,
163
- firefoxNightly: MacFirefoxNightlyCmd,
164
- firefoxDeveloperEdition: MacFirefoxDeveloperEditionCmd,
165
- chrome: MacChromeCmd,
166
- chromeCanary: MacChromeCanaryCmd,
167
- safari: MacSafariCmd
168
- },
169
- linux: {
170
- firefox: [
171
- 'search',
172
- '--sync',
173
- '--onlyvisible',
174
- '--class',
175
- 'firefox',
176
- 'key',
177
- 'F5',
178
- 'windowactivate'
179
- ],
180
- chrome: [
181
- 'search',
182
- '--sync',
183
- '--onlyvisible',
184
- '--class',
185
- 'chrome',
186
- 'key',
187
- 'F5',
188
- 'windowactivate'
189
- ]
190
- }
191
- }
192
-
193
- RunMacCmd = (cmd) ->
194
- new BufferedProcess({
195
- command: 'osascript'
196
- args: ['-e', BrowserCmd]
197
- stderr: (data) ->
198
- OpenPanel(type: 'alert', message: data.toString())
199
- })
200
-
201
- RunLinuxCmd = (BrowserArgs) ->
202
- new BufferedProcess({
203
- command: 'xdotool'
204
- args: BrowserArgs
205
- stderr: (data) ->
206
- OpenPanel(type: 'alert', message: data.toString())
207
- })
208
-
209
- RunCmd = (browser) ->
210
- if OS.platform() == 'darwin'
211
- RunMacCmd(Commands['darwin'][browser])
212
- else if OS.platform() == 'linux' and browser isnt 'safari'
213
- RunLinuxCmd(Commands['linux'][browser])
214
- else
215
- OpenPanel(type: 'alert', message: 'Unsupported platform')
216
- =end
217
167
 
218
168
  module Dyndoc
219
169
  module HtmlServers
@@ -342,24 +292,13 @@ module Dyndoc
342
292
  html_file = $1+".html"
343
293
  end
344
294
  puts dyn_file[1..-1]+" processed => "+html_file+" created!"
345
- if RUBY_PLATFORM =~ /darwin/
346
- options[:first] = html_file != old_html_file
347
- if html_file != old_html_file
348
- old_html_file = html_file
349
- url=File.join(base_url,html_file)
350
- # cmd_to_open='tell application "Safari" to set URL of current tab of front window to "'+url+'"'
351
- # `osascript -e '#{cmd_to_open}'`
352
- Dyndoc::Browser.load(url)
353
- else
354
- Dyndoc::Browser.reload
355
- # %x{osascript<<ENDREFRESH
356
- # tell app "Safari" to activate
357
- # tell application "System Events"
358
- # keystroke "r" using {command down}
359
- # end tell
360
- # ENDREFRESH
361
- # }
362
- end
295
+ options[:first] = html_file != old_html_file
296
+ if html_file != old_html_file
297
+ old_html_file = html_file
298
+ url=File.join(base_url,html_file)
299
+ Dyndoc::Browser.load(url)
300
+ else
301
+ Dyndoc::Browser.reload
363
302
  end
364
303
  end
365
304
  end
@@ -0,0 +1,13 @@
1
+ ## Install dyndoc services
2
+
3
+ * change user account prefixed to `conf` if necessary
4
+
5
+ * then install the services
6
+
7
+ ```
8
+ sudo cp *.service /etc/systemd/system/
9
+ sudo systemctl enable dyn-srv
10
+ sudo systemctl enable dyn-html
11
+ sudo systemctl enable dyn-http
12
+ sudo systemctl start dyn-http
13
+ ```
@@ -1,8 +1,9 @@
1
1
  [Unit]
2
- Description=Syncthing - Open Source Continuous File Synchronization
2
+ Description=Dyndoc Html service
3
3
  Wants=dyn-srv.service
4
4
 
5
5
  [Service]
6
+ User=conf
6
7
  ExecStart=/usr/local/bin/dyn-html run
7
8
  Restart=on-failure
8
9
  SuccessExitStatus=3 4
@@ -1,8 +1,9 @@
1
1
  [Unit]
2
- Description=Syncthing - Open Source Continuous File Synchronization
2
+ Description=Dyndoc Http service
3
3
  Wants=dyn-html.service
4
4
 
5
5
  [Service]
6
+ User=conf
6
7
  ExecStart=/usr/local/bin/dyn-http run
7
8
  Restart=on-failure
8
9
  SuccessExitStatus=3 4
@@ -1,7 +1,8 @@
1
1
  [Unit]
2
- Description=Syncthing - Open Source Continuous File Synchronization
2
+ Description=Dyndoc Server service
3
3
 
4
4
  [Service]
5
+ User=conf
5
6
  ExecStart=/usr/local/bin/dyn-srv run
6
7
  Restart=on-failure
7
8
  SuccessExitStatus=3 4
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: 1.0.6
4
+ version: 1.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - RCqls
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-08 00:00:00.000000000 Z
11
+ date: 2017-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: R4rb
@@ -176,6 +176,7 @@ files:
176
176
  - share/etc/dyn-cli/layout/default.dyn
177
177
  - share/etc/dyndoc_library_path
178
178
  - share/etc/helpers
179
+ - share/etc/systemd/README.md
179
180
  - share/etc/systemd/dyn-html.service
180
181
  - share/etc/systemd/dyn-http.service
181
182
  - share/etc/systemd/dyn-srv.service