Skip to content

Commit 213cb1d

Browse files
authored
Merge pull request #1234 from basecamp/flavorjones/package-in-ruby-gem
Create a ruby gem package "action_text-trix"
2 parents 5f8d56d + 8994151 commit 213cb1d

File tree

14 files changed

+14357
-3
lines changed

14 files changed

+14357
-3
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"semi": ["error", "never"],
2626
"sort-imports": ["error", { "ignoreDeclarationSort": true }]
2727
},
28-
"ignorePatterns": ["dist/**/*.js", "**/vendor/**/*.js"],
28+
"ignorePatterns": ["dist/**/*.js", "**/vendor/**/*.js", "action_text-trix/**/*.js"],
2929
"globals": {
3030
"after": true,
3131
"getComposition": true,

action_text-trix/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Gemfile.lock
2+
pkg

action_text-trix/Gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source "https://rubygems.org"
2+
3+
# Specify your gem's dependencies in trix.gemspec.
4+
gemspec

action_text-trix/LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 37signals, LLC
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

action_text-trix/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Building the Trix Ruby gem
2+
3+
1. `cd action_text-trix`
4+
2. `bundle exec rake sync` (updates files which must be committed to git)
5+
3. `bundle exec rake build`
6+
4. `gem push pkg/*.gem`

action_text-trix/Rakefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
require "bundler/gem_tasks"
2+
require "rake/clean"
3+
4+
task :sync do
5+
require "json"
6+
7+
FileUtils.cp File.expand_path("../LICENSE", __dir__), __dir__, verbose: true
8+
FileUtils.cp File.expand_path("../dist/trix.umd.js", __dir__), File.expand_path("app/assets/javascripts/trix.js", __dir__), verbose: true
9+
FileUtils.cp File.expand_path("../dist/trix.css", __dir__), File.expand_path("app/assets/stylesheets/trix.css", __dir__), verbose: true
10+
11+
package_json = JSON.load(File.read(File.join(__dir__, "../package.json")))
12+
version = package_json["version"]
13+
File.write(File.join(__dir__, "lib", "action_text", "trix", "version.rb"), <<~RUBY)
14+
module Trix
15+
VERSION = "#{version}"
16+
end
17+
RUBY
18+
puts "Updated gem version to #{version}"
19+
end
20+
21+
CLEAN.add "pkg"
22+
CLOBBER.add "app/assets/javascripts/trix.js", "app/assets/stylesheets/trix.css"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
require_relative "lib/action_text/trix/version"
2+
3+
Gem::Specification.new do |spec|
4+
spec.name = "action_text-trix"
5+
spec.version = Trix::VERSION
6+
spec.authors = "37signals, LLC"
7+
spec.summary = "A rich text editor for everyday writing"
8+
spec.license = "MIT"
9+
10+
spec.homepage = "https://github.com/basecamp/trix"
11+
spec.metadata["homepage_uri"] = spec.homepage
12+
spec.metadata["source_code_uri"] = spec.homepage
13+
spec.metadata["changelog_uri"] = "#{spec.homepage}/releases"
14+
15+
spec.files = [
16+
"LICENSE",
17+
"app/assets/javascripts/trix.js",
18+
"app/assets/stylesheets/trix.css",
19+
"lib/action_text/trix.rb",
20+
"lib/action_text/trix/engine.rb",
21+
"lib/action_text/trix/version.rb"
22+
]
23+
24+
spec.add_dependency "railties"
25+
end
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
trix.js linguist-vendored -whitespace

0 commit comments

Comments
 (0)