Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d0b234bf3d | |||
| 981fe05c15 | |||
| 918550465b | |||
| 963d4f1738 | |||
| d809732280 | |||
| c4e38a11b7 | |||
| 7abe215bc2 | |||
| 0f269430bc | |||
| 20528f72df | |||
| ad9af9bb3d | |||
| 133308141b |
@@ -0,0 +1,15 @@
|
||||
version: 2.1
|
||||
|
||||
# Define the jobs we want to run for this project
|
||||
jobs:
|
||||
build:
|
||||
docker:
|
||||
- image: cimg/base:2023.03
|
||||
steps:
|
||||
- run: echo "so long and thanks for all the fish"
|
||||
|
||||
# Orchestrate our job run sequence
|
||||
workflows:
|
||||
build_and_test:
|
||||
jobs:
|
||||
- build
|
||||
@@ -5,7 +5,7 @@ name: Build and deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["dui3/alpha", "deploy/*"] # Continuous delivery on every long-lived branch
|
||||
branches: ["main"] # Continuous delivery on every long-lived branch
|
||||
tags: ["v3.*"] # Manual delivery on every 3.x tag
|
||||
|
||||
jobs:
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
||||
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
||||
|
||||
name: Ruby
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
ruby-version: ['2.7']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Ruby
|
||||
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
||||
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
||||
# uses: ruby/setup-ruby@v1
|
||||
uses: ruby/setup-ruby@0a29871fe2b0200a17a4497bae54fe5df0d973aa # v1.115.3
|
||||
with:
|
||||
ruby-version: ${{ matrix.ruby-version }}
|
||||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
||||
- name: Run tests
|
||||
run: bundle exec rake
|
||||
@@ -24,6 +24,27 @@ module SpeckleConnector3
|
||||
rows.map { |row| JSON.parse(row[1]) }
|
||||
end
|
||||
|
||||
def self.remove_account(account_id)
|
||||
db_path = SPECKLE_ACCOUNTS_DB_PATH
|
||||
unless File.exist?(db_path)
|
||||
raise(
|
||||
IOError,
|
||||
"No Accounts db found. Please read the guide for different options for adding your account:\n
|
||||
https://speckle.guide/user/manager.html#adding-accounts"
|
||||
)
|
||||
end
|
||||
db = Sqlite3::Database.new(db_path)
|
||||
|
||||
begin
|
||||
db.exec("DELETE FROM objects WHERE hash = '#{account_id}'")
|
||||
puts "Account with hash #{account_id} has been removed."
|
||||
rescue StandardError => e
|
||||
puts "An error occurred: #{e}"
|
||||
ensure
|
||||
db.close
|
||||
end
|
||||
end
|
||||
|
||||
def self.get_account_by_id(id)
|
||||
accounts = load_accounts
|
||||
accounts.select { |acc| acc['id'] == id }[0]
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative 'action'
|
||||
require_relative '../accounts/accounts'
|
||||
require_relative 'load_saved_streams'
|
||||
require_relative '../action'
|
||||
require_relative '../../accounts/accounts'
|
||||
require_relative '../load_saved_streams'
|
||||
|
||||
module SpeckleConnector3
|
||||
module Actions
|
||||
@@ -0,0 +1,20 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../action'
|
||||
require_relative '../../accounts/accounts'
|
||||
require_relative '../load_saved_streams'
|
||||
|
||||
module SpeckleConnector3
|
||||
module Actions
|
||||
# Action to remove account from database.
|
||||
class RemoveAccount < Action
|
||||
# @param state [States::State] the current state of the {App::SpeckleConnectorApp}
|
||||
# @return [States::State] the new updated state object
|
||||
def self.update_state(state, resolve_id, account_id)
|
||||
SpeckleConnector3::Accounts.remove_account(account_id)
|
||||
js_script = "accountsBinding.receiveResponse('#{resolve_id}')"
|
||||
state.with_add_queue_js_command('removeAccount', js_script)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,34 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../action'
|
||||
require_relative '../../cards/send_card'
|
||||
require_relative '../../cards/receive_card'
|
||||
require_relative '../../filters/send/everything_filter'
|
||||
require_relative '../../filters/send/selection_filter'
|
||||
require_relative '../../filters/send_filters'
|
||||
require_relative '../../sketchup_model/dictionary/model_card_dictionary_handler'
|
||||
|
||||
module SpeckleConnector3
|
||||
module Actions
|
||||
# Action to remove cards.
|
||||
class RemoveModels < Action
|
||||
# @param state [States::State] the current state of the {App::SpeckleConnectorApp}
|
||||
# @return [States::State] the new updated state object
|
||||
def self.update_state(state, resolve_id, data)
|
||||
data.each do |model_card|
|
||||
SketchupModel::Dictionary::ModelCardDictionaryHandler.remove_card_dict(state.sketchup_state.sketchup_model, model_card)
|
||||
new_speckle_state = if model_card['typeDiscriminator'] == 'ReceiverModelCard'
|
||||
state.speckle_state.without_receive_card(model_card['id'])
|
||||
else
|
||||
state.speckle_state.without_send_card(model_card['id'])
|
||||
end
|
||||
state = state.with_speckle_state(new_speckle_state)
|
||||
end
|
||||
|
||||
# Resolve promise
|
||||
js_script = "baseBinding.receiveResponse('#{resolve_id}')"
|
||||
state.with_add_queue_js_command('removeModels', js_script)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -22,7 +22,7 @@ module SpeckleConnector3
|
||||
SPECKLE_DUI3 = 'speckle_dui3'
|
||||
|
||||
def dialog_title
|
||||
"Speckle (Beta) for SketchUp"
|
||||
"Speckle for SketchUp"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -65,10 +65,10 @@ module SpeckleConnector3
|
||||
|
||||
def self.initialize_dui3_speckle_command(app)
|
||||
cmd = MenuCommandHandler.sketchup_command(
|
||||
InitializeDUI3Speckle.new(app, nil), 'Initialize Speckle (Beta)'
|
||||
InitializeDUI3Speckle.new(app, nil), 'Initialize Speckle'
|
||||
)
|
||||
cmd.tooltip = 'Speckle (Beta) for SketchUp'
|
||||
cmd.status_bar_text = 'Opens the Speckle Connector (Beta)'
|
||||
cmd.tooltip = 'Speckle for SketchUp'
|
||||
cmd.status_bar_text = 'Opens the Speckle Connector'
|
||||
cmd.small_icon = '../../img/s2logo_dui3.png'
|
||||
cmd.large_icon = '../../img/s2logo_dui3.png'
|
||||
cmd
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative 'binding'
|
||||
require_relative '../../actions/get_accounts'
|
||||
require_relative '../../actions/account_actions/get_accounts'
|
||||
require_relative '../../actions/account_actions/remove_account'
|
||||
|
||||
module SpeckleConnector3
|
||||
module Ui
|
||||
@@ -11,7 +12,8 @@ module SpeckleConnector3
|
||||
class AccountsBinding < Binding
|
||||
def commands
|
||||
@commands ||= {
|
||||
getAccounts: Commands::ActionCommand.new(@app, self, Actions::GetAccounts)
|
||||
getAccounts: Commands::ActionCommand.new(@app, self, Actions::GetAccounts),
|
||||
removeAccount: Commands::ActionCommand.new(@app, self, Actions::RemoveAccount)
|
||||
}.freeze
|
||||
end
|
||||
end
|
||||
|
||||
@@ -11,6 +11,7 @@ require_relative '../../actions/base_actions/add_model'
|
||||
require_relative '../../actions/base_actions/highlight_model'
|
||||
require_relative '../../actions/base_actions/highlight_objects'
|
||||
require_relative '../../actions/base_actions/remove_model'
|
||||
require_relative '../../actions/base_actions/remove_models'
|
||||
require_relative '../../actions/base_actions/get_send_filters'
|
||||
require_relative '../../actions/base_actions/update_send_filter'
|
||||
require_relative '../../actions/base_actions/get_document_state'
|
||||
@@ -27,6 +28,7 @@ module SpeckleConnector3
|
||||
highlightModel: Commands::ActionCommand.new(@app, self, Actions::HighlightModel),
|
||||
highlightObjects: Commands::ActionCommand.new(@app, self, Actions::HighlightObjects),
|
||||
removeModel: Commands::ActionCommand.new(@app, self, Actions::RemoveModel),
|
||||
removeModels: Commands::ActionCommand.new(@app, self, Actions::RemoveModels),
|
||||
# Since we send exact model card with updateModel, I can use directly AddModel action, it will replace
|
||||
updateModel: Commands::ActionCommand.new(@app, self, Actions::AddModel),
|
||||
getSourceApplicationName: Commands::ActionCommand.new(@app, self, Actions::GetSourceAppName),
|
||||
|
||||
@@ -5,7 +5,7 @@ module SpeckleConnector3
|
||||
# An interface to Sketchup user interface. This object controls the menu `Extensions->Speckle` in Sketchup's menu,
|
||||
# the Speckle toolbar and sending message to the user via Sketchup.
|
||||
class SketchupUi
|
||||
MENU_TITLE = 'Speckle Beta'
|
||||
MENU_TITLE = 'Speckle'
|
||||
BEFORE_NEVER_SHOWN = -1
|
||||
|
||||
# @return [Sketchup::Menu] the menu of the Speckle
|
||||
|
||||
Reference in New Issue
Block a user