nimbu 0.13.1 → 0.13.2

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
  SHA256:
3
- metadata.gz: fcaf454345adbb424c6f94c09a304e98d8a3a76cf76ca2d9df76a9f991f867c1
4
- data.tar.gz: 33ec694a0be3a929f9612629d43451389fee686a9789574356018da1ee536744
3
+ metadata.gz: acf58907df8ef86e997d2694f21ecc4239fa45e9530a4f3b108518939c218ed5
4
+ data.tar.gz: d4e92c37600d974a88f7add9d705981d3a44ac58c36d5294fedaf8839859bb6e
5
5
  SHA512:
6
- metadata.gz: fe4bb037e2ea41168414108bb662618f942fb5d4507591bfe2c317725199772244434b1a5c2536f551e1d98c1fab0fa0bfb03870045f016a3e3014330805e3bb
7
- data.tar.gz: a93d431f551918a465378f55b6a03e06389797bcfbad13dfedff952cc8679488707c6a19bcbb8126bf792810b63a0f7a18423ea7bf611815c297573a07e18ae7
6
+ metadata.gz: 53b91cb9662cf50224bf77273c4ddd44006bede74661cebeacb4327e3611df69fb7c765873d1f371cf8ffb2d262f83b5b91958bf113be6e6d8e9e357cbd9405c
7
+ data.tar.gz: c88ec2b024acdc576b5a3185d4b24c0200140d41d2b768a6c06bd4fb37f470792f0859bbc4529267e207df352f262ba79c7ed21f21adaa816e751021eb959ff1
data/lib/nimbu/auth.rb CHANGED
@@ -87,7 +87,7 @@ class Nimbu::Auth
87
87
  end
88
88
 
89
89
  def configuration_file
90
- "#{Dir.pwd}/nimbu.yml"
90
+ "#{Nimbu.cli_options[:dir] || Dir.pwd}/nimbu.yml"
91
91
  end
92
92
 
93
93
  def delete_configuration
@@ -17,6 +17,7 @@ class Nimbu::Command::Server < Nimbu::Command::Base
17
17
  # --webpack RES # comma separated list of webpack resources (relative to /javascripts)
18
18
  # --webpackurl URL # proxy requests for webpack resources to the given URL prefix (default: http://localhost:8080)
19
19
  # --nocookies # disable session refresh cookie check
20
+ # --dir DIR # root of your project (default: current directory)
20
21
  #
21
22
  def index
22
23
  require 'rubygems'
@@ -26,6 +27,9 @@ class Nimbu::Command::Server < Nimbu::Command::Base
26
27
  require 'filewatcher'
27
28
  require 'pathname'
28
29
  require 'lolcat'
30
+ require 'socket'
31
+
32
+ Nimbu.cli_options[:dir] = options[:dir] if options[:dir]
29
33
 
30
34
  # Check if config file is present?
31
35
  if !Nimbu::Auth.read_configuration
@@ -81,17 +85,6 @@ class Nimbu::Command::Server < Nimbu::Command::Base
81
85
  end
82
86
  end
83
87
 
84
- def bare
85
- puts "Starting server..."
86
- server_options = {
87
- :Port => options[:port] || 4567,
88
- :DocumentRoot => Dir.pwd
89
- }
90
- Rack::Handler::Thin.run Nimbu::Server::Base, server_options do |server|
91
- [:INT, :TERM].each { |sig| trap(sig) { server.respond_to?(:stop!) ? server.stop! : server.stop } }
92
- end
93
- end
94
-
95
88
  def haml
96
89
  require 'haml'
97
90
  puts "Starting..."
@@ -107,13 +100,36 @@ class Nimbu::Command::Server < Nimbu::Command::Base
107
100
 
108
101
  protected
109
102
 
103
+ def ipv6_supported?
104
+ begin
105
+ socket = Socket.new(Socket::AF_INET6, Socket::SOCK_STREAM)
106
+ socket.close
107
+ true
108
+ rescue Errno::EAFNOSUPPORT
109
+ false
110
+ end
111
+ end
112
+
113
+ def project_root
114
+ Nimbu.cli_options[:dir] || Dir.pwd
115
+ end
116
+
117
+ def default_host
118
+ if ipv6_supported?
119
+ "::"
120
+ else
121
+ "127.0.0.1"
122
+ end
123
+ end
124
+
110
125
  def run_on_windows!
111
126
  server_thread = Thread.new do
112
127
  Thread.current[:stdout] = StringIO.new
113
128
  puts "Starting server..."
114
129
  server_options = {
115
130
  :Port => options[:port] || 4567,
116
- :DocumentRoot => Dir.pwd
131
+ :DocumentRoot => project_root,
132
+ :Host => default_host
117
133
  }
118
134
  server_options.merge!({:Host => options[:host]}) if options[:host]
119
135
  Rack::Handler::Thin.run Nimbu::Server::Base, server_options do |server|
@@ -172,7 +188,8 @@ class Nimbu::Command::Server < Nimbu::Command::Base
172
188
  puts "Starting server..."
173
189
  server_options = {
174
190
  :Port => options[:port] || 4567,
175
- :DocumentRoot => Dir.pwd
191
+ :DocumentRoot => options[:dir] || Dir.pwd,
192
+ :Host => default_host,
176
193
  }
177
194
  server_options.merge!({:Host => options[:host]}) if options[:host]
178
195
  Rack::Handler::Thin.run Nimbu::Server::Base, **server_options do |server|
@@ -309,7 +326,7 @@ class HamlWatcher
309
326
 
310
327
  def watch
311
328
  refresh
312
- current_dir = File.join(Dir.pwd, 'haml/')
329
+ current_dir = File.join(Nimbu.cli_options[:dir] || Dir.pwd, 'haml/')
313
330
  puts ">>> Haml is polling for changes. Press Ctrl-C to Stop."
314
331
  Filewatcher.new('haml/**/*.haml', every: true).watch do |filename, event|
315
332
  begin
@@ -22,7 +22,7 @@ module Nimbu
22
22
 
23
23
  set :method_override, true
24
24
  set :static, true # set up static file routing
25
- set :public_folder, Dir.pwd # set up the static dir (with images/js/css inside)
25
+ set :public_folder, Nimbu.cli_options[:dir] || Dir.pwd # set up the static dir (with images/js/css inside)
26
26
 
27
27
  set :views, File.expand_path('../views', __FILE__) # set up the views dir
28
28
  set :haml, { format: :html5 } # if you use haml
@@ -229,8 +229,8 @@ module Nimbu
229
229
  end
230
230
 
231
231
  def load_files(type)
232
- glob = Dir["#{Dir.pwd}/#{type}/**/*.liquid","#{Dir.pwd}/#{type}/**/*.liquid.haml"]
233
- directory = "#{Dir.pwd}/#{type}/"
232
+ glob = Dir["#{project_root}/#{type}/**/*.liquid","#{project_root}/#{type}/**/*.liquid.haml"]
233
+ directory = "#{project_root}/#{type}/"
234
234
  glob.each do |file|
235
235
  name = file.gsub(/#{directory}/i,"")
236
236
  code = IO.read(file).force_encoding('UTF-8')
@@ -247,6 +247,10 @@ module Nimbu
247
247
  request.path =~ /^\/downloads\// && request.query_string =~ /key=/
248
248
  end
249
249
 
250
+ def project_root
251
+ Nimbu.cli_options[:dir] || Dir.pwd
252
+ end
253
+
250
254
  end
251
255
  end
252
256
  end
data/lib/nimbu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Nimbu
2
- VERSION = '0.13.1'.freeze
2
+ VERSION = '0.13.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nimbu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.1
4
+ version: 0.13.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zenjoy BVBA
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-14 00:00:00.000000000 Z
11
+ date: 2024-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: term-ansicolor
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 2.1.0
61
+ version: 2.2.3
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 2.1.0
68
+ version: 2.2.3
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sinatra-contrib
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -353,7 +353,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
353
353
  - !ruby/object:Gem::Version
354
354
  version: '0'
355
355
  requirements: []
356
- rubygems_version: 3.3.3
356
+ rubygems_version: 3.1.6
357
357
  signing_key:
358
358
  specification_version: 4
359
359
  summary: Client library and CLI to design websites on the Nimbu platform.