bullet_train 1.4.7 → 1.4.9

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: b37d49a851243ce6ee4762eb3939db28bbe9566fc7897f3dde6f46639d41cf6b
4
- data.tar.gz: 54e743ef8e8859657bd43e0294c96d7c9f9b91eae5b08f49e7f3c5350d189ca4
3
+ metadata.gz: 433bfb9d02ab90a900aa78aa7918b9b33a644738756ca001d75571e889faa111
4
+ data.tar.gz: 4a0fb6994451fb11ac8bd268bb2df790e994ff7b1a4e9ac3ca6f9c71e3187808
5
5
  SHA512:
6
- metadata.gz: 7a694f756dcb9f8defd2f3a731ac981328f22e793937b68b5117600c83f880d60e9fb092714de7da50da03cf9167e11ad4c25ada0776062b165e6976b087a7ea
7
- data.tar.gz: 38ebed0df0636b49bda73a1d5d11a2f5edf2db7e01a4e9a16882a7efbc4bdee1fbc139bcb4cd7a1f4533ea5d5b55d3f299ac892d35b6f80288186f77d44e65dd
6
+ metadata.gz: 18bf21a0212e080b886d045a25cce43f6a05f60844c2bc97f73bd062190d9d01968fcf0e8946c9a98f2a3784958685e90ff321edf471b583be7dcf0a0c3d7683
7
+ data.tar.gz: aea9776250358a2436400ed63c4ee89bc80b1bb31537dcb082f249fd6ae3522bddcc008a6d275c6a046514a351a209ba8a49741fd66b7fcbbe9c755171969d1e
@@ -111,17 +111,14 @@ module Account::Teams::ControllerBase
111
111
  # # DELETE /teams/1
112
112
  # # DELETE /teams/1.json
113
113
  def destroy
114
- if current_user.teams.size == 1
115
- respond_to do |format|
116
- format.html { redirect_to edit_account_team_url(@team), alert: t("account.teams.notifications.cannot_delete_last_team") }
117
- format.json { head :no_content }
118
- end
119
- else
114
+ respond_to do |format|
115
+ raise RemovingLastTeamException if current_user.one_team?
120
116
  @team.destroy
121
- respond_to do |format|
122
- format.html { redirect_to account_teams_url, notice: t("account.teams.notifications.destroyed") }
123
- format.json { head :no_content }
124
- end
117
+ format.html { redirect_to account_teams_url, notice: t("account.teams.notifications.destroyed") }
118
+ format.json { head :no_content }
119
+ rescue RemovingLastTeamException => _
120
+ format.html { redirect_to edit_account_team_url(@team), alert: t("account.teams.notifications.cannot_delete_last_team") }
121
+ format.json { head :no_content }
125
122
  end
126
123
  end
127
124
 
@@ -7,6 +7,10 @@ module Teams::Base
7
7
  has_many :scaffolding_absolutely_abstract_creative_concepts, class_name: "Scaffolding::AbsolutelyAbstract::CreativeConcept", dependent: :destroy, enable_cable_ready_updates: true
8
8
  end
9
9
 
10
+ # added_by_id is a foreign_key to other Memberships on the same team,
11
+ # so we nullify this to remove the constraint to delete the team.
12
+ before_destroy { Membership.where(team: self).update_all(added_by_id: nil) }
13
+
10
14
  # memberships and invitations
11
15
  has_many :memberships, dependent: :destroy
12
16
  has_many :users, through: :memberships
@@ -54,6 +54,28 @@ module BulletTrain
54
54
  end
55
55
  end
56
56
  `cat #{source_file[:absolute_path]} >> #{source_file[:project_path]}`.strip
57
+
58
+ # Look for showcase preview.
59
+ file_name = source_file[:absolute_path].split("/").last
60
+ showcase_partials = Dir.glob(`bundle show bullet_train-themes-light`.chomp + "/app/views/showcase/**/*.html.erb")
61
+ has_showcase_partial = false
62
+ showcase_partial = nil
63
+ showcase_partials.each do |partial|
64
+ has_showcase_preview = partial.match?(/#{file_name}$/)
65
+ if has_showcase_preview
66
+ showcase_partial = partial
67
+ break
68
+ end
69
+ end
70
+
71
+ if has_showcase_partial
72
+ puts "Ejecting showcase preview for #{source_file[:relative_path]}"
73
+ partial_relative_path = showcase_preview.scan(/(?=app\/views\/showcase).*/).last
74
+ directory = partial_relative_path.split("/")[0..-2].join("/")
75
+ FileUtils.mkdir_p(directory)
76
+ FileUtils.touch(partial_relative_path)
77
+ `cp #{showcase_preview} #{partial_relative_path}`
78
+ end
57
79
  end
58
80
 
59
81
  # Just in case they try to open the file, open it from the new location.
@@ -1,3 +1,3 @@
1
1
  module BulletTrain
2
- VERSION = "1.4.7"
2
+ VERSION = "1.4.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bullet_train
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.7
4
+ version: 1.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Culver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-21 00:00:00.000000000 Z
11
+ date: 2023-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: standard