cybertooth_rails 0.1.0.pre.alpha.6

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c4c9350cc03f00cc0378b9f18faf9f0f40ebac8e
4
+ data.tar.gz: bb244a3b3723892152378125298054d8b8d04164
5
+ SHA512:
6
+ metadata.gz: 438fb56d3a9c18e49097bce7d285bd8c6c4957bb3d8343f588657b3b7f7f3489b14e99f97fab1ef01e4a4a624ae17588d1a000f979b8f34e49e87751dff4110c
7
+ data.tar.gz: 8fa00625f21aada44b6c3e870cf9cd5d36d84d0aab887a3a89c4682585494c3d07c4c18c94b77b664e8db864bc14bcdd84a6982d25bd77c7962cb10e442cf431
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # ignore gems built by this project
12
+ *.gem
data/.rubocop.yml ADDED
@@ -0,0 +1,5 @@
1
+ # defaults found here: https://github.com/bbatsov/rubocop/blob/master/config/default.yml
2
+ # default enabled found here: https://github.com/bbatsov/rubocop/blob/master/config/enabled.yml
3
+
4
+ Metrics/LineLength:
5
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.1
5
+ before_install: gem install bundler -v 1.15.1
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cybertooth_rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Dan Nelson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # CybertoothRails
2
+
3
+ This gem provides some re-usable components for applications built by the Cybertooth software team.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'cybertooth_rails'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install cybertooth_rails
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Development
26
+
27
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the
28
+ tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
29
+
30
+ To install this gem onto your local machine, run `bundle exec rake install`.
31
+
32
+ To release a new version, update the version number in `version.rb`, and then
33
+ run `bundle exec rake release`, which will create a git tag for the version, push git commits and
34
+ tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
35
+
36
+ ## Contributing
37
+
38
+ Bug reports and pull requests are welcome on GitHub at https://github.com/cybertoothca/cybertooth_rails.
39
+
40
+ ## License
41
+
42
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << 'test'
6
+ t.libs << 'lib'
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task default: :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'cybertooth_rails'
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require 'irb'
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'cybertooth_rails/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'cybertooth_rails'
9
+ spec.version = CybertoothRails::VERSION
10
+ spec.authors = ['Dan Nelson']
11
+ spec.email = ['dan.nelson@cybertooth.io']
12
+
13
+ spec.summary = 'This is a summary.'
14
+ spec.description = 'This is a description.'
15
+ spec.homepage = 'https://github.com/cybertoothca/cybertooth_rails'
16
+ spec.license = 'MIT'
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
19
+ f.match(%r{^(test|spec|features)/})
20
+ end
21
+ spec.bindir = 'exe'
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ['lib']
24
+
25
+ spec.add_dependency 'rails', '~> 5.1'
26
+ spec.add_dependency 'aws-sdk', '~> 2.10'
27
+
28
+ spec.add_development_dependency 'bundler', '~> 1.15'
29
+ spec.add_development_dependency 'rake', '~> 10.0'
30
+ spec.add_development_dependency 'minitest', '~> 5.0'
31
+ spec.add_development_dependency 'rubocop', '0.49.1'
32
+ end
@@ -0,0 +1,8 @@
1
+ require 'cybertooth_rails/version'
2
+ require 'cybertooth_rails/not_authenticated_error'
3
+ require 'cybertooth_rails/ember_cli_rails'
4
+
5
+ # The namespace for Cybertooth customizations to Rails.
6
+ module CybertoothRails
7
+ # Your code goes here...
8
+ end
@@ -0,0 +1,10 @@
1
+ require 'cybertooth_rails/ember_cli_rails/local_file_deploy'
2
+ require 'cybertooth_rails/ember_cli_rails/http_deploy'
3
+ require 'cybertooth_rails/ember_cli_rails/s3_deploy'
4
+ require 'open-uri'
5
+
6
+ module CybertoothRails
7
+ # The dedicated namespace to several `ember-cli-rails` deployment strategies.
8
+ module EmberCliRails
9
+ end
10
+ end
@@ -0,0 +1,41 @@
1
+ module CybertoothRails
2
+ module EmberCliRails
3
+ # Using `ember-cli-rails` gem you can serve your Ember application(s) pre-compiled `index.html`.
4
+ # This class's `index_html` method will return the Single Page Application's (SPA) html file;
5
+ # in this case it will be a file pulled from a prescribed URL.
6
+ #
7
+ # Notice that this is a production-like deploy mechanism; you'd never use this in development or test.
8
+ #
9
+ # Configure the URL coordinates to your Single Page Application (SPA) index.html file inside
10
+ # your Rails `config/secrets.yml` file.
11
+ #
12
+ # spa_http_index_html_path: 'http://example.com/my-spa.html'
13
+ #
14
+ # Now you need to make sure that this class (`CybertoothRails::EmberCliRails::HttpDeploy`) is configured
15
+ # inside your `config/initializers/ember.rb` Here is an example (see the production declaration):
16
+ #
17
+ # ```
18
+ # EmberCli.configure do |c|
19
+ # c.app :ui, deploy: {
20
+ # development: CybertoothRails::EmberCliRails::LocalFileDeploy,
21
+ # production: CybertoothRails::EmberCliRails::HttpDeploy,
22
+ # test: CybertoothRails::EmberCliRails::LocalFileDeploy
23
+ # }
24
+ # end
25
+ # ```
26
+ #
27
+ # Lastly, make sure your Ember application is mounted inside your `config/routes.rb` file:
28
+ #
29
+ # ```
30
+ # mount_ember_app :ui, to: '/'
31
+ # ```
32
+ #
33
+ # The following redis example gave me the idea to use this technique.
34
+ # @see https://github.com/seanpdoyle/ember-cli-rails-deploy-redis/blob/master/lib/ember_cli/deploy/redis.rb
35
+ class HttpDeploy < LocalFileDeploy
36
+ def index_html
37
+ open(Rails.application.secrets.spa_http_index_html_path).read
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,54 @@
1
+ module CybertoothRails
2
+ module EmberCliRails
3
+ # Using `ember-cli-rails` gem you can serve your Ember application(s) pre-compiled `index.html`.
4
+ # This class's `index_html` method will return the Single Page Application's (SPA) html file;
5
+ # in this case it will return a static html file from inside your Rails application.
6
+ #
7
+ # Notice that this is not for production environments. Use it in your test and development
8
+ # environments only.
9
+ #
10
+ # Configure the `Rails.root` relative path to your Single Page Application (SPA) index.html file inside
11
+ # your Rails `config/secrets.yml` file.
12
+ #
13
+ # spa_local_index_html_path: 'public/_index.html'
14
+ #
15
+ # Now you need to make sure that this class (`CybertoothRails::EmberCliRails::LocalFileDeploy`) is configured
16
+ # inside your `config/initializers/ember.rb` Here is an example (see the development & test declarations):
17
+ #
18
+ # ```
19
+ # EmberCli.configure do |c|
20
+ # c.app :ui, deploy: {
21
+ # development: CybertoothRails::EmberCliRails::LocalFileDeploy,
22
+ # production: CybertoothRails::EmberCliRails::S3Deploy,
23
+ # test: CybertoothRails::EmberCliRails::LocalFileDeploy
24
+ # }
25
+ # end
26
+ # ```
27
+ #
28
+ # Lastly, make sure your Ember application is mounted inside your `config/routes.rb` file:
29
+ #
30
+ # ```
31
+ # mount_ember_app :ui, to: '/'
32
+ # ```
33
+ #
34
+ # The following redis example gave me the idea to use this technique.
35
+ # @see https://github.com/seanpdoyle/ember-cli-rails-deploy-redis/blob/master/lib/ember_cli/deploy/redis.rb
36
+ class LocalFileDeploy
37
+ def initialize(app)
38
+ @app = app
39
+ end
40
+
41
+ def index_html
42
+ open(Rails.root.join(Rails.application.secrets.spa_local_index_html_path)).read
43
+ end
44
+
45
+ def mountable?
46
+ false
47
+ end
48
+
49
+ def to_rack
50
+ raise NotImplementedError
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,56 @@
1
+ require 'aws-sdk'
2
+
3
+ module CybertoothRails
4
+ module EmberCliRails
5
+ # Using `ember-cli-rails` gem you can serve your Ember application(s) pre-compiled `index.html`.
6
+ # This class's `index_html` method will return the Single Page Application's (SPA) html file;
7
+ # in this case it will be a file pulled from a prescribed AWS S3 container.
8
+ #
9
+ # Notice that this is a production-like deploy mechanism; you'd never use this in development or test.
10
+ #
11
+ # Configure the S3 coordinates to your Single Page Application (SPA) index.html file inside
12
+ # your Rails `config/secrets.yml` file. Obviously sensitive secrets should be passed in as
13
+ # environment variables. Here is the list of keys you should set inside your `config/secrets.yml`:
14
+ #
15
+ # spa_s3_bucket_name: 'some-bucket-name'
16
+ # spa_s3_region : 'your-region'
17
+ # spa_s3_object_key: 'key-of-s3-object'
18
+ # spa_s3_key: 'user-access-key'
19
+ # spa_s3_secret: 'user-access-key-secret'
20
+ #
21
+ # Now you need to make sure that this class (`CybertoothRails::EmberCliRails::S3Deploy`) is configured
22
+ # inside your `config/initializers/ember.rb` Here is an example (see the production declaration):
23
+ #
24
+ # ```
25
+ # EmberCli.configure do |c|
26
+ # c.app :ui, deploy: {
27
+ # development: CybertoothRails::EmberCliRails::LocalFileDeploy,
28
+ # production: CybertoothRails::EmberCliRails::S3Deploy,
29
+ # test: CybertoothRails::EmberCliRails::LocalFileDeploy
30
+ # }
31
+ # end
32
+ # ```
33
+ #
34
+ # Lastly, make sure your Ember application is mounted inside your `config/routes.rb` file:
35
+ #
36
+ # ```
37
+ # mount_ember_app :ui, to: '/'
38
+ # ```
39
+ #
40
+ # The following redis example gave me the idea to use this technique.
41
+ # @see https://github.com/seanpdoyle/ember-cli-rails-deploy-redis/blob/master/lib/ember_cli/deploy/redis.rb
42
+ class S3Deploy < LocalFileDeploy
43
+ def index_html
44
+ client = Aws::S3::Client.new(
45
+ access_key_id: Rails.application.secrets.spa_s3_key,
46
+ region: Rails.application.secrets.spa_s3_region,
47
+ secret_access_key: Rails.application.secrets.spa_s3_secret
48
+ )
49
+ resource = Aws::S3::Resource.new(client: client)
50
+ resource
51
+ .bucket(Rails.application.secrets.spa_s3_bucket_name)
52
+ .object(Rails.application.secrets.spa_s3_object_key).get.body.read
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,11 @@
1
+ module CybertoothRails
2
+ # This error class will typically be raised when:
3
+ # 1. A user fails to authenticate
4
+ # 2. A request is missing an expected JWT
5
+ # 3. A request's JWT cannot be decoded
6
+ class NotAuthenticatedError < StandardError
7
+ def initialize
8
+ super('Not Authenticated')
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module CybertoothRails
2
+ VERSION = '0.1.0-alpha.6'.freeze
3
+ end
metadata ADDED
@@ -0,0 +1,145 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cybertooth_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0.pre.alpha.6
5
+ platform: ruby
6
+ authors:
7
+ - Dan Nelson
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-07-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '5.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '5.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: aws-sdk
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.10'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.10'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.15'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.15'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '5.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '5.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 0.49.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 0.49.1
97
+ description: This is a description.
98
+ email:
99
+ - dan.nelson@cybertooth.io
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rubocop.yml"
106
+ - ".travis.yml"
107
+ - Gemfile
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - bin/console
112
+ - bin/setup
113
+ - cybertooth_rails.gemspec
114
+ - lib/cybertooth_rails.rb
115
+ - lib/cybertooth_rails/ember_cli_rails.rb
116
+ - lib/cybertooth_rails/ember_cli_rails/http_deploy.rb
117
+ - lib/cybertooth_rails/ember_cli_rails/local_file_deploy.rb
118
+ - lib/cybertooth_rails/ember_cli_rails/s3_deploy.rb
119
+ - lib/cybertooth_rails/not_authenticated_error.rb
120
+ - lib/cybertooth_rails/version.rb
121
+ homepage: https://github.com/cybertoothca/cybertooth_rails
122
+ licenses:
123
+ - MIT
124
+ metadata: {}
125
+ post_install_message:
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">"
137
+ - !ruby/object:Gem::Version
138
+ version: 1.3.1
139
+ requirements: []
140
+ rubyforge_project:
141
+ rubygems_version: 2.6.12
142
+ signing_key:
143
+ specification_version: 4
144
+ summary: This is a summary.
145
+ test_files: []