Skip to content

Commit

Permalink
Merge pull request #263 from robertcheramy/update-weblibs
Browse files Browse the repository at this point in the history
Update weblibs, dependencies & webui
  • Loading branch information
robertcheramy authored Jun 17, 2024
2 parents 4addf32 + 17de97a commit 18e69e2
Show file tree
Hide file tree
Showing 66 changed files with 53,596 additions and 2,499 deletions.
8 changes: 1 addition & 7 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,15 @@ updates:
schedule:
interval: "daily"
open-pull-requests-limit: 10
labels:
- dependencies
- package-ecosystem: "bundler"
target-branch: "master"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10
labels:
- dependencies
- package-ecosystem: "docker"
- package-ecosystem: "npm"
target-branch: "master"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10
labels:
- dependencies
2 changes: 1 addition & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['3.0', '3.1', '3.2']
ruby-version: ['3.1', '3.2', '3.3']

steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,6 @@ Gemfile.lock

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

# npm files
/node_modules/
5 changes: 4 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require:
# Do not attempt to police vendored code, and exclude special cases
AllCops:
NewCops: enable
TargetRubyVersion: 2.7
TargetRubyVersion: 3.1
Exclude:
- 'vendor/**/*'

Expand Down Expand Up @@ -60,6 +60,9 @@ Style/HashTransformKeys:
Style/HashTransformValues:
Enabled: true

Style/HashSyntax:
EnforcedShorthandSyntax: either

Style/RescueModifier:
Enabled: false

14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
## [Unreleased]

### Added
- Created CHANGELOG.md (@robertchreamy)
- CHANGELOG.md created (@robertchreamy)
- First minitest: get / (@robertchreamy)
- docs/development.md created (@robertchreamy)
- weblibs are maintained with npm (@robertchreamy)

### Changed
- gem dependencies updated (@robertchreamy)
- support for ruby 3.0 dropped (@robertchreamy)
- #215: weblibs (jQuery, bootstrap, datatables.net) updated (@robertchreamy)
- the web design follows where possible bootstrap without specific css (@robertchreamy)
- deprecating the RANCID migration page (@robertchreamy)

### Fixed
- #232: escape_once not supported in haml 6.0 (@robertchreamy)
- #253: deprecated sass dependency dropped (@robertchreamy)
- rubocop warnings fixed (@robertchreamy)
- #234: removed link to not working live demo (@robertchreamy)
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@

Web userinterface and RESTful API for Oxidized.

This is not useful independently, see https://github.com/ytti/oxidized for install instructions
This is not useful independently, see https://github.com/ytti/oxidized for install instructions.

If you wonder how to run oxidized-web from git for development, have a look at
[docs/development.md](docs/development.md).

## License and Copyright

Expand Down
44 changes: 44 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,48 @@ task :chmod do
dirs.sort.uniq.each { |dir| File.chmod(0o0755, dir) }
end

desc 'Copy web packages from npm into public'
task :weblibs do
weblibs = []
fonts = []

# jQuery
weblibs << 'node_modules/jquery/dist/jquery.js'

# Bootstrap
weblibs << 'node_modules/bootstrap/dist/js/bootstrap.js'
weblibs << 'node_modules/bootstrap/dist/js/bootstrap.js.map'
weblibs << 'node_modules/bootstrap/dist/css/bootstrap.css'
weblibs << 'node_modules/bootstrap/dist/css/bootstrap.css.map'
weblibs << 'node_modules/bootstrap/dist/js/bootstrap.bundle.js'
weblibs << 'node_modules/bootstrap/dist/js/bootstrap.bundle.js.map'

# Bootstrap-icons
weblibs << 'node_modules/bootstrap-icons/font/bootstrap-icons.css'
fonts << 'node_modules/bootstrap-icons/font/fonts/bootstrap-icons.woff'
fonts << 'node_modules/bootstrap-icons/font/fonts/bootstrap-icons.woff2'

# Datatables
weblibs << 'node_modules/datatables.net/js/dataTables.js'

# Datatables + Bootstrap
weblibs << 'node_modules/datatables.net-bs5/js/dataTables.bootstrap5.js'
weblibs << 'node_modules/datatables.net-bs5/css/dataTables.bootstrap5.css'

# Datatables Buttons + Bootstrap
weblibs << 'node_modules/datatables.net-buttons-bs5/js/buttons.bootstrap5.js'
weblibs << 'node_modules/datatables.net-buttons-bs5/css/buttons.bootstrap5.css'
# colVis
weblibs << 'node_modules/datatables.net-buttons/js/dataTables.buttons.js'
weblibs << 'node_modules/datatables.net-buttons/js/buttons.colVis.js'

weblibs.each do |w|
cp(w, 'lib/oxidized/web/public/weblibs')
end

fonts.each do |f|
cp(f, 'lib/oxidized/web/public/weblibs/fonts')
end
end

task default: :test
64 changes: 64 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# How to run / develop oxidized-web from git
## Using the latest oxidized package
When you develop oxidized-web, it is quite simple to run it from git. As it depends on oxidized,
oxidized will be included in `bundle install`, and you just have to run `bundle exec oxidized`.
You need bundler, if not installed yet. On debian-based systems, you can run `sudo apt install ruby-bundler` to install it.

All steps in one to copy & pase:
```shell
git clone [email protected]:ytti/oxidized-web.git
cd oxidized-web
bundle config set --local path 'vendor/bundle'
bundle install
bundle exec oxidized
```

Changes to haml templates are reloaded on the fly. For changes to the ruby
scripts, you have to stop an restart `bundle exec oxidized`.

## Paralell development between oxidized and oxidized-web
You may need to make some changes in oxidized **and** oxidized-web. For this,
git clone oxidized and oxidized-web in a common root directory, add the direct
dependency to ../oxidized-web in oxidized and run oxidized from the oxidized
repo:

```shell
git clone [email protected]:ytti/oxidized-web.git
git clone [email protected]:ytti/oxidized.git
cd oxidized
bundle config set --local path 'vendor/bundle'
echo "gem 'oxidized-web', path: '../oxidized-web'" >> Gemfile
bundle install
bundle exec bin/oxidized
```

Be careful when commiting your work in oxidized *NOT* to include the changes to
Gemfile, as this is a local change for development. I (@robertcheramy) didn't
find a better way to do this, better ideas are welcome :-)

If your changes to oxidized **AND** oxidzed-web are dependent from another, make
sure you document this in the respectives CHANGELOG.md, so that everyone is
informed at the next release.

# Update the weblibs
The weblibs are beeing downloaded and maintained by `npm`.

Run `npm install` to download the weblibs. They will be stored under
`node_modules`.
The file `package-lock.json` (wich is tracked in git) ensures that every
developer gets the same versions.

Run `npm outdated` to get a list of new releases:

```shell
oxidized-web$ npm outdated
Package Current Wanted Latest Location Depended by
datatables.net-bs5 2.0.7 2.0.8 2.0.8 node_modules/datatables.net-bs5 oxidized-web
```

Run `npm update` to get the latest releases. They still are not used
oxidzed-web. Run `rake weblibs` to sync `node_modules` with
`lib/oxidized/web/public/weblibs`.

Test, and commit the changes to the weblibs **and** package-lock.json. Don't
forget to document your changes in CHANGELOG.md.
5 changes: 0 additions & 5 deletions lib/oxidized/web/public/css/bootstrap.min.css

This file was deleted.

1 change: 0 additions & 1 deletion lib/oxidized/web/public/css/buttons.bootstrap.min.css

This file was deleted.

Loading

0 comments on commit 18e69e2

Please sign in to comment.