Skip to content

Commit

Permalink
Merge branch 'main' of github.com:renuo/hotsheet
Browse files Browse the repository at this point in the history
  • Loading branch information
ignaciosy committed Oct 23, 2024
2 parents 84125eb + 4a9b8c8 commit 7572c6b
Show file tree
Hide file tree
Showing 24 changed files with 85 additions and 58 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ jobs:
with:
bundler-cache: true

- name: Setup Hotsheet
run: bin/setup

- name: Run linters
run: bundle exec rubocop -c .rubocop.yml
run: bin/fastcheck

- name: Run tests
run: RAILS_ENV=test bundle exec rspec
run: bin/check
4 changes: 1 addition & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@ inherit_gem:
renuocop: config/base.yml

AllCops:
SuggestExtensions: false
TargetRubyVersion: 3.1.4

Layout/LineLength:
Max: 120
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.3.5
1 change: 0 additions & 1 deletion .tool-versions

This file was deleted.

Empty file removed app/assets/images/hotsheet/.keep
Empty file.
3 changes: 3 additions & 0 deletions app/assets/javascripts/hotsheet/channels/consumer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { createConsumer } from "https://unpkg.com/@rails/[email protected]/app/assets/javascripts/actioncable.esm.js";

export default createConsumer();
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import consumer from "channels/consumer";

consumer.subscriptions.create({ channel: "InlineEditChannel" });
6 changes: 6 additions & 0 deletions app/channels/application_cable/channel.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true

module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end
6 changes: 6 additions & 0 deletions app/channels/application_cable/connection.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true

module ApplicationCable
class Connection < ActionCable::Connection::Base
end
end
9 changes: 9 additions & 0 deletions app/channels/inline_edit_channel.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

class InlineEditChannel < ApplicationCable::Channel
STREAM_NAME = "inline_edit"

def subscribed
stream_from(STREAM_NAME)
end
end
6 changes: 0 additions & 6 deletions app/helpers/hotsheet/application_helper.rb

This file was deleted.

6 changes: 0 additions & 6 deletions app/jobs/hotsheet/application_job.rb

This file was deleted.

4 changes: 2 additions & 2 deletions app/views/hotsheet/pages/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% if @model %>
<h1>--- <%= @model %> ---</h1>
<h1><%= @model %></h1>
<table class="model-table">
<tr>
<% @model.editable_attributes.each do |attribute| %>
Expand All @@ -18,6 +18,6 @@
<% end %>
</table>
<% else %>
<h1>--- Hotsheet ---</h1>
<h1>Hotsheet</h1>
<p>Welcome to the Hottest sheet around. Select a model from the sidebar to view the spreadsheet.</p>
<% end %>
5 changes: 5 additions & 0 deletions bin/check
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
set -eu

cd spec/dummy
bundle exec rspec --fail-fast=3 -f documentation
7 changes: 2 additions & 5 deletions bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

require "bundler/setup"
require "hotsheet"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

require "irb"
IRB.start(__FILE__)

IRB.start __FILE__
4 changes: 4 additions & 0 deletions bin/fastcheck
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
set -eu

bundle exec rubocop -c .rubocop.yml
15 changes: 6 additions & 9 deletions bin/rails
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#!/usr/bin/env ruby
# This command will automatically be run when you run "rails" with Rails gems
# installed from the root of your application.
# frozen_string_literal: true

ENGINE_ROOT = File.expand_path("..", __dir__)
ENGINE_PATH = File.expand_path("../lib/hotsheet/engine", __dir__)
APP_PATH = File.expand_path("../test/dummy/config/application", __dir__)

# Set up gems listed in the Gemfile.
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
ENV["BUNDLE_GEMFILE"] ||= File.expand_path "../Gemfile", __dir__
ENGINE_ROOT = File.expand_path "..", __dir__
ENGINE_PATH = File.expand_path "../lib/hotsheet/engine", __dir__
APP_PATH = File.expand_path "../spec/dummy/config/application", __dir__

require "bundler/setup" if File.exist? ENV["BUNDLE_GEMFILE"]
require "rails/all"
require "rails/engine/commands"
14 changes: 8 additions & 6 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
set -vx
#!/usr/bin/env sh
set -eu

bundle install
echo ---- Installing dependencies ----
bundle
cd spec/dummy
bundle

# Do any other automated setup that you need to do here
echo ---- Setting up database ----
bundle exec rails db:drop db:setup
3 changes: 2 additions & 1 deletion spec/dummy/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

source "https://rubygems.org"

gem "hotsheet", path: "../.."
gem "importmap-rails"
gem "puma"
gem "rails", github: "rails/rails", branch: "main"
gem "hotsheet", path: "../.."
gem "sqlite3"
gem "turbo-rails"

group :development, :test do
gem "better_errors"
Expand Down
1 change: 1 addition & 0 deletions spec/dummy/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ DEPENDENCIES
renuocop
rspec-rails
sqlite3
turbo-rails

BUNDLED WITH
2.5.22
4 changes: 2 additions & 2 deletions spec/dummy/config/initializers/hotsheet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

Hotsheet.configure do |config|
config.model :Author do |model|
model.included_attributes = %i[name birthdate gender updated_at]
model.included_attributes = %i[name birthdate gender created_at]
end

config.model :Post do |model|
model.excluded_attributes = %i[created_at updated_at]
model.excluded_attributes = %i[id author_id created_at updated_at]
end
end
File renamed without changes.
19 changes: 19 additions & 0 deletions spec/dummy/spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

ENV["RAILS_ENV"] = "test"

require "rspec/rails"
require_relative "config/environment"

ActiveRecord::Migration.maintain_test_schema!

RSpec.configure do |config|
Kernel.srand config.seed

config.disable_monkey_patching!
config.filter_rails_from_backtrace!
config.infer_spec_type_from_file_location!
config.mock_with(:rspec) { |mocks| mocks.verify_partial_doubles = true }
config.order = :random
config.run_all_when_everything_filtered = true
end
15 changes: 0 additions & 15 deletions spec/spec_helper.rb

This file was deleted.

0 comments on commit 7572c6b

Please sign in to comment.