easyfaa 0.90.0 → 1.0.0

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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +213 -7
  3. data/MIT-LICENSE +3 -1
  4. data/README.md +64 -20
  5. data/app/assets/fonts/easy/outfit-latin-ext.woff2 +0 -0
  6. data/app/assets/fonts/easy/outfit-latin.woff2 +0 -0
  7. data/app/assets/images/easy/favicon.ico +0 -0
  8. data/app/assets/images/easy/favicon.svg +11 -0
  9. data/app/assets/images/easy/sprite.svg +52 -0
  10. data/app/assets/javascripts/easy/add_rows.js +38 -0
  11. data/app/assets/javascripts/easy/flyer.js +100 -0
  12. data/app/assets/javascripts/easy/highlight.js +54 -0
  13. data/app/assets/javascripts/easy/konami.js +73 -0
  14. data/app/assets/javascripts/easy/modal.js +49 -0
  15. data/app/assets/javascripts/easy/pin_code.js +43 -0
  16. data/app/assets/javascripts/easy/report_sort.js +57 -0
  17. data/app/assets/javascripts/easy/rotating_placeholder.js +35 -0
  18. data/app/assets/javascripts/easy/step_foot.js +17 -0
  19. data/app/assets/javascripts/easy/switches.js +96 -0
  20. data/app/assets/javascripts/easy/switches_address.js +39 -0
  21. data/app/assets/javascripts/easy/tabs.js +35 -0
  22. data/app/assets/javascripts/easy/theme.js +41 -0
  23. data/app/assets/stylesheets/easy/base.css +42 -0
  24. data/app/assets/stylesheets/easy/components.css +533 -0
  25. data/app/assets/stylesheets/easy/layout.css +47 -0
  26. data/app/assets/stylesheets/easy/tokens.css +11 -0
  27. data/app/controllers/easyfaa/errors_controller.rb +41 -0
  28. data/app/helpers/easyfaa/easy_helper.rb +58 -0
  29. data/app/models/aircraft_avatar.rb +61 -0
  30. data/app/views/easy/_ad_card.html.erb +16 -0
  31. data/app/views/easy/_ad_list.html.erb +11 -0
  32. data/app/views/easy/_flyer.html.erb +10 -0
  33. data/app/views/easy/_logo.html.erb +15 -0
  34. data/app/views/easy/_modal.html.erb +17 -0
  35. data/app/views/easy/_part_tabs.html.erb +24 -0
  36. data/app/views/easy/_pin_code.html.erb +10 -0
  37. data/app/views/easy/_report_head.html.erb +28 -0
  38. data/app/views/easy/mailer/_button.html.erb +10 -0
  39. data/app/views/easy/mailer/_card.html.erb +23 -0
  40. data/app/views/easy/mailer/_code.html.erb +28 -0
  41. data/app/views/easy/mailer/_code.text.erb +19 -0
  42. data/app/views/easy/mailer/_frame.html.erb +35 -0
  43. data/app/views/easy/mailer/_text.html.erb +7 -0
  44. data/app/views/easyfaa/errors/show.html.erb +17 -0
  45. data/app/views/layouts/easy/site.html.erb +55 -0
  46. data/app/views/layouts/easyfaa/errors.html.erb +30 -0
  47. data/config/aircraft_avatars.yml +26 -0
  48. data/lib/easyfaa/engine.rb +26 -0
  49. data/lib/easyfaa/version.rb +3 -3
  50. data/lib/easyfaa.rb +16 -7
  51. metadata +99 -16
  52. data/exe/faa +0 -4
  53. data/lib/easyfaa/cli.rb +0 -65
@@ -0,0 +1,26 @@
1
+ # The single-engine airplane families easyFAA tells apart by make and model ("Cessna 172N",
2
+ # "Piper PA-18-150", "Van's RV-8"), tried in this order, the first pattern found in the name
3
+ # winning. A name no pattern finds is drawn high-wing, as the commonest. Case is ignored.
4
+ fixed-wing-drone:
5
+ - v-?bat|zipline|\buav\b|\buas\b|unmanned|drone
6
+ biplane:
7
+ - stearman|\bpt-?1[37]\b|\bn2s\b|pitts|\bs-?[12][abcs]?\b|waco|great lakes|starduster|skybolt|acro ?sport
8
+ - hatz|miniplane|christen|eagle ii|\bultimate\b|tiger moth|\bjungmann
9
+ ag-plane:
10
+ - air tractor|\bat-?[3-8]\d\d|thrush|\bs-?2r|ag-?cat|g-?164|\bpa-?25|pawnee|\bpa-?36|ag ?(wagon|truck|husky)|\b188\b
11
+ floatplane:
12
+ - \blake\b|\bla-?(4|250)|searey|sea rey|icon a5|seawind|\bg-?(21|44|73)\b|goose|widgeon|seabee|rc-?3\b|skimmer|catalina
13
+ low-wing-tailwheel:
14
+ - \brv-?[3468]\b(?!a)|\bat-?6\b|\bt-?6\b|\bsnj\b|harvard|\bp-?51\b|mustang|\bpt-?(19|22|26)\b|\bextra\b|\bea-?300
15
+ - edge 540|\bgiles\b|\blaser\b|\bcap ?(10|21|23)|\bsu-?(26|29|31)\b|\bt-?28\b
16
+ high-wing-tailwheel:
17
+ - \bj-?[2345]\b|\bpa-?(11|12|14|16|17|18|20)\b|cub|aeronca|champ|citabria|decathlon|scout|\b7[acegk]c|\b8kcab
18
+ - taylorcraft|\bbc-?12|cessna (a)?1(20|40|70|80|85|95)|\b(a)?185|maule|husky|\baviat\b|stinson|luscombe|kitfox|savage
19
+ - \bm-?[4-7]\b|helio|courier|\bdhc-?2\b|beaver|\bl-?(2|3|4|16|19)\b|bird ?dog|super ?cub|carbon ?cub|backcountry
20
+ low-wing-retractable:
21
+ - mooney|\bm20|(beech|raytheon|textron|hawker).*\b[a-v]?(33|35|36)[a-z]?\b|bonanza|debonair|\bpa-?(24|28r|30|32r|39|46)\b|comanche|arrow|saratoga
22
+ - lance|\bt-?34\b|meridian|malibu|mirage|navion|\bm-?18|\bb-?24r|sierra|swift|\bgc-?1|viking|\b17-?3\d|bellanca 14
23
+ low-wing:
24
+ - \bpa-?(28|32|38)\b|cherokee|warrior|archer|cadet|tomahawk|cirrus|\bsr-?2[02]|\bda-?(20|40)|diamond|katana
25
+ - \baa-?(1|5)|grumman|tiger|cheetah|traveler|musketeer|sundowner|\bbe-?23|\bc-?23\b|\brv-?\d+|ercoupe|aircoupe|\balon\b
26
+ - lancair|glasair|sonex|zenith|\bch-?[67]\d\d|tecnam|evektor|sportstar|\bsr-?20
@@ -0,0 +1,26 @@
1
+ # rails/engine alone raises NoMethodError: railtie.rb calls delegate_missing_to too early.
2
+ require 'rails'
3
+
4
+ module EasyFAA
5
+ # Hooks the gem into a host app: its error pages and its helpers. The easy design system's
6
+ # stylesheets, scripts, fonts and icons are under `app/assets`, which the host's asset
7
+ # pipeline reads as its own: `stylesheet_link_tag "easy/tokens"`.
8
+ class Engine < ::Rails::Engine
9
+ # The same page for 400, 404, 422 and 500 on every app (EasyFAA::ErrorsController), unless
10
+ # the host has already named an exceptions app of its own, and the page it shows while it
11
+ # is down at the path Heroku and a reader expect.
12
+ initializer 'easyfaa.errors' do |app|
13
+ app.config.exceptions_app ||= app.routes
14
+ app.routes.prepend do
15
+ %w[400 404 422 500].each do |status|
16
+ get status, to: 'easyfaa/errors#show', defaults: { status: status.to_i }
17
+ end
18
+ get 'down.html', to: 'easyfaa/errors#down', format: false
19
+ end
20
+ end
21
+
22
+ initializer 'easyfaa.helpers' do
23
+ ActiveSupport.on_load(:action_view) { include EasyFAA::EasyHelper }
24
+ end
25
+ end
26
+ end
@@ -1,4 +1,4 @@
1
- module Easyfaa
2
- # Version of the gem, read by the gemspec and printed by `faa --version`.
3
- VERSION = '0.90.0'.freeze
1
+ module EasyFAA
2
+ # Version of the gem, read by the gemspec and by hosts checking compatibility.
3
+ VERSION = '1.0.0'
4
4
  end
data/lib/easyfaa.rb CHANGED
@@ -1,9 +1,18 @@
1
- require 'easyfaa/version'
1
+ require 'active_support/core_ext/module/attribute_accessors'
2
+ require 'active_support/inflector'
2
3
 
3
- # What the FAA publishes about an aircraft or an Airworthiness Directive, read in a terminal.
4
- module Easyfaa
5
- # Where the FAA's data is served, unless EASYFAA_URL says otherwise.
6
- URL = 'https://data.easyfaa.com'.freeze
7
- end
4
+ # FAA in capitals: Rails camelizes the gem's folders (easyfaa/) by this, to load and route them.
5
+ ActiveSupport::Inflector.inflections(:en) { it.acronym 'EasyFAA' }
6
+
7
+ require_relative 'easyfaa/version'
8
+ require_relative 'easyfaa/engine'
8
9
 
9
- require 'easyfaa/cli'
10
+ # easyFAA's front end: the easy design system every app's pages are drawn with (its layout,
11
+ # stylesheets, scripts, fonts, icons and partials), the error pages every app shows, and the
12
+ # marks the apps are known by inside the house.
13
+ module EasyFAA
14
+ # The site an error page names, in its title, its one link and the maintenance message, as
15
+ # `[name, url]` for the request: an app that is not easyFAA's own names itself,
16
+ # `EasyFAA.site = ->(request) { ['easyAnnual', 'https://easyannual.com/'] }`.
17
+ mattr_accessor :site, default: ->(_request) { ['easyFAA', 'https://easyfaa.com/'] }
18
+ end
metadata CHANGED
@@ -1,36 +1,119 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easyfaa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.90.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - claudiob
8
- bindir: exe
8
+ bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
- dependencies: []
12
- description: "`faa -n 170ad` prints what the FAA registry keeps about an N-number,
13
- and `faa -ad 2020-12-12` what the FAA published about an Airworthiness Directive."
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: actionpack
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '8.1'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '8.1'
26
+ - !ruby/object:Gem::Dependency
27
+ name: actionview
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '8.1'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '8.1'
40
+ - !ruby/object:Gem::Dependency
41
+ name: railties
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '8.1'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '8.1'
54
+ description: 'The easy design system every easyFAA page is drawn with: its layout,
55
+ stylesheets, scripts, fonts, icons and partials, and the error pages every app shows.'
14
56
  email:
15
- - claudiob@users.noreply.github.com
16
- executables:
17
- - faa
57
+ - info@easyfaa.com
58
+ executables: []
18
59
  extensions: []
19
60
  extra_rdoc_files: []
20
61
  files:
21
62
  - CHANGELOG.md
22
63
  - MIT-LICENSE
23
64
  - README.md
24
- - exe/faa
65
+ - app/assets/fonts/easy/outfit-latin-ext.woff2
66
+ - app/assets/fonts/easy/outfit-latin.woff2
67
+ - app/assets/images/easy/favicon.ico
68
+ - app/assets/images/easy/favicon.svg
69
+ - app/assets/images/easy/sprite.svg
70
+ - app/assets/javascripts/easy/add_rows.js
71
+ - app/assets/javascripts/easy/flyer.js
72
+ - app/assets/javascripts/easy/highlight.js
73
+ - app/assets/javascripts/easy/konami.js
74
+ - app/assets/javascripts/easy/modal.js
75
+ - app/assets/javascripts/easy/pin_code.js
76
+ - app/assets/javascripts/easy/report_sort.js
77
+ - app/assets/javascripts/easy/rotating_placeholder.js
78
+ - app/assets/javascripts/easy/step_foot.js
79
+ - app/assets/javascripts/easy/switches.js
80
+ - app/assets/javascripts/easy/switches_address.js
81
+ - app/assets/javascripts/easy/tabs.js
82
+ - app/assets/javascripts/easy/theme.js
83
+ - app/assets/stylesheets/easy/base.css
84
+ - app/assets/stylesheets/easy/components.css
85
+ - app/assets/stylesheets/easy/layout.css
86
+ - app/assets/stylesheets/easy/tokens.css
87
+ - app/controllers/easyfaa/errors_controller.rb
88
+ - app/helpers/easyfaa/easy_helper.rb
89
+ - app/models/aircraft_avatar.rb
90
+ - app/views/easy/_ad_card.html.erb
91
+ - app/views/easy/_ad_list.html.erb
92
+ - app/views/easy/_flyer.html.erb
93
+ - app/views/easy/_logo.html.erb
94
+ - app/views/easy/_modal.html.erb
95
+ - app/views/easy/_part_tabs.html.erb
96
+ - app/views/easy/_pin_code.html.erb
97
+ - app/views/easy/_report_head.html.erb
98
+ - app/views/easy/mailer/_button.html.erb
99
+ - app/views/easy/mailer/_card.html.erb
100
+ - app/views/easy/mailer/_code.html.erb
101
+ - app/views/easy/mailer/_code.text.erb
102
+ - app/views/easy/mailer/_frame.html.erb
103
+ - app/views/easy/mailer/_text.html.erb
104
+ - app/views/easyfaa/errors/show.html.erb
105
+ - app/views/layouts/easy/site.html.erb
106
+ - app/views/layouts/easyfaa/errors.html.erb
107
+ - config/aircraft_avatars.yml
25
108
  - lib/easyfaa.rb
26
- - lib/easyfaa/cli.rb
109
+ - lib/easyfaa/engine.rb
27
110
  - lib/easyfaa/version.rb
28
- homepage: https://github.com/easyfaa/faa
111
+ homepage: https://easyfaa.com/design
29
112
  licenses:
30
113
  - MIT
31
114
  metadata:
32
- source_code_uri: https://github.com/easyfaa/faa
33
- changelog_uri: https://github.com/easyfaa/faa/blob/main/CHANGELOG.md
115
+ source_code_uri: https://github.com/easyfaa/easyfaa/tree/main/design
116
+ changelog_uri: https://github.com/easyfaa/easyfaa/blob/main/design/CHANGELOG.md
34
117
  documentation_uri: https://rubydoc.info/gems/easyfaa
35
118
  rdoc_options: []
36
119
  require_paths:
@@ -39,14 +122,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
39
122
  requirements:
40
123
  - - ">="
41
124
  - !ruby/object:Gem::Version
42
- version: '3.1'
125
+ version: '3.4'
43
126
  required_rubygems_version: !ruby/object:Gem::Requirement
44
127
  requirements:
45
128
  - - ">="
46
129
  - !ruby/object:Gem::Version
47
130
  version: '0'
48
131
  requirements: []
49
- rubygems_version: 4.0.3
132
+ rubygems_version: 4.0.20
50
133
  specification_version: 4
51
- summary: 'The faa command: what the FAA publishes about an aircraft or an AD.'
134
+ summary: The front end every easyFAA app shares.
52
135
  test_files: []
data/exe/faa DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'easyfaa'
3
-
4
- exit Easyfaa::CLI.new(ARGV).run
data/lib/easyfaa/cli.rb DELETED
@@ -1,65 +0,0 @@
1
- require 'net/http'
2
-
3
- module Easyfaa
4
- # The `faa` command: what the FAA publishes about an N-number (`faa -n 170ad`) or an AD
5
- # (`faa -ad 2020-12-12`), as text, or as JSON with `--json`.
6
- class CLI
7
- # Each option, and the page it asks for.
8
- PAGES = { '-n' => 'N', '-ad' => 'AD' }.freeze
9
-
10
- # What `faa --help` prints.
11
- USAGE = <<~TEXT.freeze
12
- Usage: faa -n N-NUMBER [--json] what the FAA registry keeps about an aircraft
13
- faa -ad AD-NUMBER [--json] what the FAA published about an Airworthiness Directive
14
- faa --version
15
-
16
- Reads EASYFAA_URL, where the data is served (#{URL} unless set).
17
- TEXT
18
-
19
- # @param args [Array<String>] command-line arguments.
20
- # @param out [IO] where the answer is printed.
21
- # @param err [IO] where a problem is printed.
22
- def initialize(args, out: $stdout, err: $stderr)
23
- @args = args
24
- @out = out
25
- @err = err
26
- end
27
-
28
- # Prints what was asked for.
29
- # @return [Integer] exit status: 0 when it was found, 1 otherwise.
30
- def run
31
- option, number, format = @args
32
- if %w[-v --version].include?(option) then answer "faa #{VERSION}"
33
- elsif PAGES.key?(option) && number then fetch PAGES[option], number, format
34
- else answer USAGE, status: option.nil? || %w[-h --help].include?(option) ? 0 : 1
35
- end
36
- end
37
-
38
- private
39
-
40
- def fetch(page, number, format)
41
- extension = format == '--json' ? 'json' : 'txt'
42
- response = Net::HTTP.get_response URI("#{url}/#{page}/#{escape number}.#{extension}")
43
- case response
44
- when Net::HTTPSuccess then answer response.body
45
- when Net::HTTPNotFound then problem "The FAA publishes nothing under #{number}."
46
- when Net::HTTPTooManyRequests then problem 'Too many requests: try again in a minute.'
47
- else problem "#{url} answered #{response.code}."
48
- end
49
- end
50
-
51
- def escape(number) = URI.encode_www_form_component(number)
52
-
53
- def url = ENV.fetch('EASYFAA_URL', URL).chomp('/')
54
-
55
- def answer(text, status: 0)
56
- @out.puts text
57
- status
58
- end
59
-
60
- def problem(text)
61
- @err.puts text
62
- 1
63
- end
64
- end
65
- end