boltos 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
+ SHA1:
3
+ metadata.gz: 30f6242ba5fdacfb75d4f11f4b77d380f3a2c6e1
4
+ data.tar.gz: e2c3000c0e7adeb9ca0b5d99b57e3d965908e130
5
+ SHA512:
6
+ metadata.gz: 752bc4a180c9c4f6af27835dfea83d82a0789b7686e3e6e051e01cf9d8b9a6b3af6eada869f7efed6a608d54208e97ac5a6bc294fee33283bd0febcdbc41cd0d
7
+ data.tar.gz: be787c808e5cf3642f153dba0ca01adb20a4658f20f34b59aa8af3bee5c13a389184a6fc74105ae36c0627ed44a7ec8c5359679f5ad4f5ba42de9af91ed559f7
@@ -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
+ # rspec failure tracking
12
+ .rspec_status
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.3
5
+ before_install: gem install bundler -v 1.14.4
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at pat@freelancing-gods.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in boltos.gemspec
4
+ gemspec
@@ -0,0 +1,25 @@
1
+ # Boltos
2
+
3
+ A faster interface to [Voltos](https://voltos.io) bundle variables.
4
+
5
+ I'm sure the official interfaces will be faster soon enough, but this is just to keep me happy in the meantime.
6
+
7
+ ## Installation
8
+
9
+ The gem is named `boltos` - install it, bundle it, use it as a gem dependency.
10
+
11
+ ## Usage
12
+
13
+ ```ruby
14
+ # Use an existing bundle
15
+ bundle = Boltos::Bundle.new 'secrets'
16
+ bundle.set 'SECRET_KEY', 'SECRET_VALUE'
17
+ bundle.variables #=> {"SECRET_KEY" => "SECRET_VALUE"}
18
+
19
+ # Create a new bundle
20
+ bundle = Boltos::Bundle.create 'secrets'
21
+ ```
22
+
23
+ ## Contributing
24
+
25
+ Bug reports and pull requests are welcome on GitHub at https://github.com/limbrup/boltos. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "boltos"
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,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'boltos/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "boltos"
8
+ spec.version = Boltos::VERSION
9
+ spec.authors = ["Pat Allan"]
10
+ spec.email = ["pat@freelancing-gods.com"]
11
+
12
+ spec.summary = %q{Fast access to the Voltos API}
13
+ spec.homepage = "https://github.com/limbrup/boltos"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
+ f.match(%r{^(test|spec|features)/})
17
+ end
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_runtime_dependency "faraday", "~> 0.10.0"
23
+ end
@@ -0,0 +1,10 @@
1
+ require 'faraday'
2
+ require 'json'
3
+
4
+ module Boltos
5
+ #
6
+ end
7
+
8
+ require 'boltos/api'
9
+ require 'boltos/bundle'
10
+ require 'boltos/version'
@@ -0,0 +1,46 @@
1
+ class Boltos::API
2
+ DOMAIN = 'https://api.voltos.io'
3
+ VERSION = 'v1'
4
+ ENDPOINT = "#{DOMAIN}/#{VERSION}"
5
+
6
+ def get(path)
7
+ JSON.parse connection.get("#{VERSION}/#{path}").body
8
+ end
9
+
10
+ def put(path, params)
11
+ JSON.parse connection.put("#{VERSION}/#{path}", params).body
12
+ end
13
+
14
+ def post(path, params)
15
+ JSON.parse connection.post("#{VERSION}/#{path}", params).body
16
+ end
17
+
18
+ def create_bundle(name)
19
+ JSON.parse connection.post("#{VERSION}/bundles", {
20
+ :name => name,
21
+ :token_name => 'boltos'
22
+ }).body
23
+ end
24
+
25
+ private
26
+
27
+ def configuration
28
+ @configuration ||= JSON.parse(
29
+ File.read(File.expand_path('~/.voltos/config.json'))
30
+ )
31
+ end
32
+
33
+ def connection
34
+ @connection ||= Faraday.new(:url => DOMAIN) do |faraday|
35
+ faraday.request :url_encoded
36
+ faraday.adapter Faraday.default_adapter
37
+
38
+ faraday.headers['User-Agent'] = "boltos/#{Boltos::VERSION}"
39
+ faraday.headers['Authorization'] = "Token token=#{token}"
40
+ end
41
+ end
42
+
43
+ def token
44
+ configuration['auths']["#{ENDPOINT}"]['auth']
45
+ end
46
+ end
@@ -0,0 +1,27 @@
1
+ class Boltos::Bundle
2
+ attr_reader :name
3
+
4
+ def self.create(name, api = nil)
5
+ api ||= Boltos::API.new
6
+ response = api.create_bundle name
7
+
8
+ new name, api
9
+ end
10
+
11
+ def initialize(name, api = nil)
12
+ @name = name
13
+ @api = api || Boltos::API.new
14
+ end
15
+
16
+ def set(key, value)
17
+ api.put "/bundles/#{name}", "#{key}=#{value}"
18
+ end
19
+
20
+ def variables
21
+ @variables ||= api.get "/bundles/#{name}"
22
+ end
23
+
24
+ private
25
+
26
+ attr_reader :api
27
+ end
@@ -0,0 +1,3 @@
1
+ module Boltos
2
+ VERSION = '0.1.0'
3
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: boltos
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Pat Allan
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-02-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.10.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.10.0
27
+ description:
28
+ email:
29
+ - pat@freelancing-gods.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".gitignore"
35
+ - ".travis.yml"
36
+ - CODE_OF_CONDUCT.md
37
+ - Gemfile
38
+ - README.md
39
+ - Rakefile
40
+ - bin/console
41
+ - bin/setup
42
+ - boltos.gemspec
43
+ - lib/boltos.rb
44
+ - lib/boltos/api.rb
45
+ - lib/boltos/bundle.rb
46
+ - lib/boltos/version.rb
47
+ homepage: https://github.com/limbrup/boltos
48
+ licenses: []
49
+ metadata: {}
50
+ post_install_message:
51
+ rdoc_options: []
52
+ require_paths:
53
+ - lib
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubyforge_project:
66
+ rubygems_version: 2.5.2
67
+ signing_key:
68
+ specification_version: 4
69
+ summary: Fast access to the Voltos API
70
+ test_files: []