spectat 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6d67e7571faa0a25b6c1aea54e47d927d282f72c951425ddd90d9deff26e3e4c
4
+ data.tar.gz: 48f9923e33ba2734a3a318a221428d16afd7ca4d5eea3de8eab16090098c7596
5
+ SHA512:
6
+ metadata.gz: e1044aebcccda8c83ca8178b048077de7cd2ce247f63a61c1ebb170376b8dd939bd536da58cd87ec967e389ff92427a81c6157f67dbe3a38f3e4e6ceae1e3cde
7
+ data.tar.gz: 52fef71c65dcf12a5fc048e75e8e88a45067f730cd50597c9e1df214ed8e4613aed16feb5733f3d7cc6fc4382dbdbcf231dce9c64ade180f88534eacd004f116
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
@@ -0,0 +1,6 @@
1
+ test:
2
+ image: ruby:2.5
3
+ script:
4
+ - bundle install
5
+ - bundle exec rake
6
+ - bundle exec rake build
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,7 @@
1
+ Metrics/LineLength:
2
+ Max: 110
3
+ Metrics/BlockLength:
4
+ Exclude:
5
+ - spec/**/*.rb
6
+ Metrics/MethodLength:
7
+ Max: 15
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.5.1
5
+ before_install: gem install bundler -v 1.16.1
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in spectat.gemspec
6
+ gemspec
@@ -0,0 +1,35 @@
1
+ # Spectat
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/spectat`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'spectat'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install spectat
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/spectat.
@@ -0,0 +1,8 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+ RuboCop::RakeTask.new :lint
7
+
8
+ task default: %i[lint spec]
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'spectat'
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__)
@@ -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 @@
1
+ require 'spectat/version'
@@ -0,0 +1,61 @@
1
+ require 'domain_name'
2
+
3
+ module Spectat
4
+ # Helper class, used to specify opinionated Spectat config
5
+ class Fqdn
6
+ attr_reader :fqdn
7
+ attr_reader :review_apps_fqdn
8
+
9
+ SITE_ROOT ||= '/srv/www'.freeze
10
+
11
+ def initialize(fqdn, env_str)
12
+ @fqdn = Spectat::Fqdn.fqdn(fqdn, env_str)
13
+ @review_apps_fqdn = Spectat::Fqdn.review_apps_fqdn(fqdn)
14
+ end
15
+
16
+ def slugify
17
+ @fqdn.downcase.strip.gsub(/\W/, '-')
18
+ end
19
+
20
+ def site_dir
21
+ "#{SITE_ROOT}/#{@fqdn}"
22
+ end
23
+
24
+ def user
25
+ slugify[0, 32]
26
+ end
27
+
28
+ def database_name
29
+ @fqdn.downcase.strip.gsub(/\W/, '_')
30
+ end
31
+
32
+ def self.fqdn(fqdn, env_str)
33
+ domain_name = DomainName(fqdn)
34
+ raise 'FQDN already contains `staging.`' if fqdn =~ /staging\.#{domain_name.domain}/
35
+
36
+ # we keep the trailing `.`
37
+ subdomain = fqdn.gsub(domain_name.domain, '')
38
+
39
+ case env_str
40
+ when 'production'
41
+ fqdn
42
+ else
43
+ if fqdn =~ /review\.#{domain_name.domain}/
44
+ fqdn
45
+ else
46
+ "#{subdomain}staging.#{domain_name.domain}"
47
+ end
48
+ end
49
+ end
50
+
51
+ def self.safe_key_name(key_name)
52
+ key_name.downcase.gsub(/\W/, '_')
53
+ end
54
+
55
+ def self.review_apps_fqdn(fqdn)
56
+ domain_name = DomainName(fqdn)
57
+ subdomain = fqdn.gsub(domain_name.domain, '')
58
+ "#{subdomain}review.#{domain_name.domain}".freeze
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,3 @@
1
+ module Spectat
2
+ VERSION = '0.1.0'.freeze
3
+ end
@@ -0,0 +1,38 @@
1
+
2
+ lib = File.expand_path('lib', __dir__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'spectat/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'spectat'
8
+ spec.version = Spectat::VERSION
9
+ spec.authors = ['Jamie Tanna']
10
+ spec.email = ['rubygems@jamietanna.co.uk']
11
+
12
+ spec.summary = 'Opiononated configuration for Spectat Designs infrastructure'
13
+ spec.description = 'Opiononated configuration for Spectat Designs infrastructure'
14
+ spec.homepage = 'https://gitlab.com/spectat/gems/spectat-gem'
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
20
+ else
21
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
22
+ 'public gem pushes.'
23
+ end
24
+
25
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
26
+ f.match(%r{^(test|spec|features)/})
27
+ end
28
+ spec.bindir = 'exe'
29
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ['lib']
31
+
32
+ spec.add_development_dependency 'bundler', '~> 1.16'
33
+ spec.add_development_dependency 'rake', '~> 10.0'
34
+ spec.add_development_dependency 'rspec', '~> 3.0'
35
+ spec.add_development_dependency 'rubocop', '~> 0.55.0'
36
+
37
+ spec.add_runtime_dependency 'domain_name', '0.5.20170404'
38
+ end
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spectat
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jamie Tanna
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-05-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.55.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.55.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: domain_name
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 0.5.20170404
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 0.5.20170404
83
+ description: Opiononated configuration for Spectat Designs infrastructure
84
+ email:
85
+ - rubygems@jamietanna.co.uk
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".gitlab-ci.yml"
92
+ - ".rspec"
93
+ - ".rubocop.yml"
94
+ - ".travis.yml"
95
+ - Gemfile
96
+ - README.md
97
+ - Rakefile
98
+ - bin/console
99
+ - bin/setup
100
+ - lib/spectat.rb
101
+ - lib/spectat/fqdn.rb
102
+ - lib/spectat/version.rb
103
+ - spectat.gemspec
104
+ homepage: https://gitlab.com/spectat/gems/spectat-gem
105
+ licenses: []
106
+ metadata:
107
+ allowed_push_host: https://rubygems.org
108
+ post_install_message:
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ requirements: []
123
+ rubyforge_project:
124
+ rubygems_version: 2.7.6
125
+ signing_key:
126
+ specification_version: 4
127
+ summary: Opiononated configuration for Spectat Designs infrastructure
128
+ test_files: []