spectat 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.gitlab-ci.yml +6 -0
- data/.rspec +3 -0
- data/.rubocop.yml +7 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/README.md +35 -0
- data/Rakefile +8 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/spectat.rb +1 -0
- data/lib/spectat/fqdn.rb +61 -0
- data/lib/spectat/version.rb +3 -0
- data/spectat.gemspec +38 -0
- metadata +128 -0
checksums.yaml
ADDED
@@ -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
|
data/.gitignore
ADDED
data/.gitlab-ci.yml
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -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.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -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__)
|
data/bin/setup
ADDED
data/lib/spectat.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'spectat/version'
|
data/lib/spectat/fqdn.rb
ADDED
@@ -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
|
data/spectat.gemspec
ADDED
@@ -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: []
|