Skip to content

Commit

Permalink
#1169 simple layout works
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jan 5, 2024
1 parent 9cce08e commit db14b70
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 14 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,19 @@ body="important" and (author=yegor256 or #hello+ or $bye+ or
(posted<2023-12-14 and title=~"something" and body=~"Hello"))
```

## How to Test

In order to test it locally, run:

```
$ bundle update
$ bundle exec rake
```

In order to run it locally as a web service on your localhost, run:

```
$ bundle exec rake run
```

You should be able to see it at `http://localhost:4567`.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ task(:config) do
end

task(run: %i[pgsql liquibase]) do
`rerun -b "RACK_ENV=test rackup"`
`rerun -b "RACK_ENV=test ruby netbout.rb"`
end

task(:copyright) do
Expand Down
2 changes: 1 addition & 1 deletion front/front_login.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

require_relative 'objects/version'
require_relative '../objects/version'

before '/*' do
@locals = {
Expand Down
3 changes: 1 addition & 2 deletions front/front_telegram.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

require 'telebot'
require_relative '../objects/urror'
require_relative '../objects/daemon'

get '/telegram' do
id = params[:id].to_i
Expand Down Expand Up @@ -107,7 +106,7 @@ def reply(msg, login)
end

if settings.config['telegram']
Nb::Daemon.new.start do
Thread.new do
Telebot::Bot.new(settings.config['telegram']['token']).run do |_, message|
chat = message.chat.id
if telechats.exists?(chat)
Expand Down
12 changes: 8 additions & 4 deletions netbout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@
},
'sentry' => ''
}
config = YAML.safe_load(File.open(File.join(File.dirname(__FILE__), 'config.yml'))) unless ENV['RACK_ENV'] == 'test'
unless ENV['RACK_ENV'] == 'test'
cfg = File.join(File.dirname(__FILE__), 'config.yml')
raise "The #{cfg} file must exist or you should set RACK_ENV to 'test' " unless File.exist?(cfg)
config = YAML.safe_load(File.open())
end
if ENV['RACK_ENV'] != 'test'
Raven.configure do |c|
c.dsn = config['sentry']
Expand All @@ -66,9 +70,9 @@
end
set :bind, '0.0.0.0'
set :server, :thin
set :show_exceptions, false
set :raise_errors, false
set :dump_errors, false
set :show_exceptions, true
set :raise_errors, true
set :dump_errors, true
set :config, config
set :logging, true
set :log, Loog::REGULAR
Expand Down
2 changes: 1 addition & 1 deletion objects/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

require_relative 'objects/nb'
require_relative 'nb'

module Nb
VERSION = '0.0.0'
Expand Down
7 changes: 7 additions & 0 deletions public/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 8 additions & 5 deletions views/layout.haml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
%meta{name: 'keywords', content: 'risks, risk management, risk quality, risk quantity'}
%meta{name: 'description', content: 'Private Talks Made Easy'}
%link{href: 'https://cdn.jsdelivr.net/gh/yegor256/tacit@gh-pages/tacit-css.min.css', rel: 'stylesheet'}
%link{rel: 'shortcut icon', href: iri.cut('/logo-64.png')}
%link{href: 'https://cdn.jsdelivr.net/gh/yegor256/drops@gh-pages/drops-css.min.css', rel: 'stylesheet'}
%link{rel: 'shortcut icon', href: iri.cut('/icon.svg')}
%script{src: 'https://code.jquery.com/jquery-3.3.1.min.js'}
:css
.logo { width: 64px; height: 64px; }
.logo { width: 128px; height: 128px; }
article { border: none; }
footer nav ul, header nav ul { text-align: left; margin-bottom: 1px; }
%body
%section
%header
%header.small
%nav
%ul
%li
Expand Down Expand Up @@ -41,8 +44,8 @@
%ul
%li
&copy;
='2009&ndash;' + '-2024'
%a{href: 'https://www.zerocracy.com'} Zerocracy
="2009&ndash;#{Time.now.year}"
%a{href: 'https://www.netbout.com'} Netbout
%li
%a{href: iri.cut('/terms')} Terms of Use
%nav
Expand Down

0 comments on commit db14b70

Please sign in to comment.