nfg_ui 0.11.0 → 0.11.1

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: f61158331b40d623b2841200a49849f0afc8ac396b4e14d0c422d565e428276b
4
- data.tar.gz: 4e662c099cdcacb5aadbaa096fc8a31d0aab5c5a9b07283fd11dd87b3d56e652
3
+ metadata.gz: f0724b78919c0829c296004c09b2bae90a2b0492bc4d637c28a2a4dc5c5c4d7f
4
+ data.tar.gz: 9e8841a495673888802bb12df9bb9d3b92b32ad7042c6a2ee458f980c189c71b
5
5
  SHA512:
6
- metadata.gz: 610dc6560c3d1f3203efda9a84778921c89b75b1e4d4c347ef9057beca044f281fc6f23df9ec229988a26e3efdb2d679ef41c83c4e0a2cde18615e6cff00b3c6
7
- data.tar.gz: ff44548766c96889fcf7f0a81c5bc65d52930a269f4971a686c5952e75e7d1bae70b0b1d59e5d06650654f3b7db953206754e5cd19fde0f9c5f22f0ce2c5e971
6
+ metadata.gz: 40b97acfd1869140887b904f0c6a275f96290f67b6dd9f0b1ddba242fc9947f429e3efdc3b5c70805e93fc5aef55d139e99cb53fc52a1981adca6f18719e5e8d
7
+ data.tar.gz: d4dafdd6a2f3a401266526259ddb12a773b927557f4d12c06547a034516c3cffa669b5545421227fe3dd2a6c23bd89a1579dfe657c4afd0793d2626bb329b557
data/README.md CHANGED
@@ -88,6 +88,46 @@ Examples:
88
88
  = ui.nfg :icon, 'trash', class: 'mr-1', text: 'Delete Row'
89
89
  ```
90
90
 
91
+ ## Asset publishing
92
+
93
+ ### Depedency Installation
94
+
95
+ NFG UI assets are published for cross-site usage to a publicly-accessible AWS S3 bucket (`s3://nfg-ui/v#.##.#/`) using the AWS command-line interface:
96
+
97
+ 1. [Install the AWS command-line interface](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-mac.html#cliv2-mac-install-gui)
98
+ 2. Install AWS credentials provided by anyone on the team who has permissions to mint IAM users (such as Mike or Timothy). The credentials are sensitive and should be stored at `~/.aws/credentials`. See example below.
99
+ 3. (Optional but recommended) Install `~/.aws/config` per below to set a default region for S3 operations.
100
+
101
+ ```
102
+ # Example ~/.aws/credentials file
103
+
104
+ [default]
105
+ aws_access_key_id = ####################
106
+ aws_secret_access_key = ########################################
107
+
108
+ # Example ~/.aws/config
109
+ [default]
110
+ region = us-east-1
111
+ ```
112
+
113
+ 4. Use the following command to confirm successful installation:
114
+
115
+ ```
116
+ aws s3 ls --recursive s3://nfg-ui/
117
+ ```
118
+
119
+ ### Workflow
120
+
121
+ After `rake release` successfully completes, the `rake publish` task will run. This command wraps a separate `rake publish` task contained within the `/publisher` subdirectory.
122
+ `/publisher` contains a skeleton Rails app. The `rake publish` task contained within `/publisher` precompiles the assets that are part of the new `nfg_ui` release and uploads them to S3.
123
+
124
+ If necessary, `rake publish` can be invoked from within the `nfg_ui` parent directory, separately:
125
+
126
+ ```
127
+ rake publish # upload assets to S3; fails if files are already exist for the release
128
+ rake publish[override] # uploads assets to S3 without checking for existing files
129
+ ```
130
+
91
131
  #### Trait details
92
132
  Traits are designed to allow you to speedily build components, or pre-design complex components using meaningful symbols.
93
133
 
data/Rakefile CHANGED
@@ -15,9 +15,35 @@ RDoc::Task.new(:rdoc) do |rdoc|
15
15
  end
16
16
 
17
17
  APP_RAKEFILE = File.expand_path("spec/test_app/Rakefile", __dir__)
18
- load 'rails/tasks/engine.rake'
19
-
20
18
 
19
+ load 'rails/tasks/engine.rake'
21
20
  load 'rails/tasks/statistics.rake'
22
21
 
23
22
  require 'bundler/gem_tasks'
23
+
24
+ desc <<~DESC
25
+ Publish precompiled assets to s3://nfg-ui. This task is automatically invoked after successful "rake release" and normally it should not be called directly.
26
+ Requires installation of AWS CLI: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html
27
+ Please see additional instructions in README.md.
28
+ DESC
29
+ task :publish, %i[override_flag] do |_, override_flag: nil|
30
+ require 'fileutils'
31
+
32
+ version = Bundler.load_gemspec("#{__dir__}/nfg_ui.gemspec").version
33
+ puts "Compiling and publishing NFG UI v#{version} assets"
34
+
35
+ subtask_args = version.to_s
36
+ subtask_args << ",#{override_flag}" if override_flag
37
+
38
+ Dir.chdir("#{__dir__}/publisher") do
39
+ Bundler.with_clean_env do
40
+ sh "RAILS_ENV=production bundle exec rake publish[#{subtask_args}]" do |ok, _|
41
+ puts 'unable to publish assets' unless ok
42
+ end
43
+ end
44
+ end
45
+ end
46
+
47
+ Rake::Task['release'].enhance do
48
+ Rake::Task['publish'].invoke # runs :publish task after successful release
49
+ end
@@ -21,7 +21,7 @@ module NfgUi
21
21
  def render
22
22
  content_tag(as, html_options) do
23
23
  if image.present?
24
- image_tag image, alt: alt.presence
24
+ image_tag view_context.image_path(image), alt: alt.presence
25
25
  elsif body.present?
26
26
  content_tag(:span, (block_given? ? yield : body), class: body_css_class)
27
27
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NfgUi
4
- VERSION = '0.11.0'
4
+ VERSION = '0.11.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nfg_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Roehm
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-08-25 00:00:00.000000000 Z
12
+ date: 2020-09-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bootstrap