Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@
quick.sh
*~
*.swp
.bundle/

# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
Gemfile.lock
.ruby-version
.ruby-gemset
28 changes: 28 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Metrics/ClassLength:
Description: 'Avoid classes longer than 100 lines of code.'
Max: 165

Metrics/LineLength:
Description: 'Limit lines to 80 characters.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
Enabled: true
Max: 250
Exclude:
- site-cookbooks/b_kibana/spec/configure_service_spec.rb

Metrics/MethodLength:
Description: 'Avoid methods longer than 10 lines of code.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
Enabled: true
Max: 15

Style/Documentation:
Description: 'Document classes and non-namespace modules.'
Enabled: false

Style/FileName:
Description: 'Use snake_case for source file names.'
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
Enabled: true
Exclude:
- lib/aws-cache.rb
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
language: ruby
rvm:
- 1.9.3
cache:
- bundler
script: bundle exec rspec spec
- 2.0.0
- 2.2.3
sudo: false
cache: bundler
script: bundle exec rake
deploy:
provider: rubygems
api_key:
Expand Down
13 changes: 1 addition & 12 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
source 'https://rubygems.org'
gem 'aws-sdk'
gem 'redis'

group :development do
gem 'awesome_print'
gem 'travis'
end

group :test do
gem 'rspec'
gem 'rspec-given'
gem 'ploy'
end
gemspec
128 changes: 0 additions & 128 deletions Gemfile.lock

This file was deleted.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# aws-cache

[![Build Status](https://travis-ci.org/mantacode/aws-cache.png?branch=master)](https://travis-ci.org/mantacode/aws-cache)
[![Gem Version](http://img.shields.io/gem/v/aws-cache.svg)](https://rubygems.org/gems/aws-cache)

## Why

Expand Down
21 changes: 21 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require 'bundler/gem_tasks'
require 'rubocop/rake_task'

desc 'Run all linters on the codebase'
task :linters do
Rake::Task['rubocop'].invoke
end

desc 'rubocop compliancy checks'
RuboCop::RakeTask.new(:rubocop) do |t|
t.patterns = %w(
aws-cache.gemspec
bin/*
lib/**/*.rb
lib/*.rb
Rakefile
spec/*.rb
)
end

task default: [:rubocop]
12 changes: 9 additions & 3 deletions aws-cache.gemspec
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'aws-cache-version'
require 'aws-cache/version'

Gem::Specification.new do |s|
s.name = 'aws-cache'
s.homepage = 'https://github.com/mantacode/aws-cache'
s.version = AwsCacheVersion::VERSION
s.version = AwsCache::VERSION
s.summary = 'AWS api access layer that caches via Redis.'
s.description = 'You know, to avoid api throttling errors.'
s.licenses = ['MIT']
s.authors = ["Stephen J. Smith", "Brian J. Schrock"]
s.authors = ['Stephen J. Smith', 'Brian J. Schrock']
s.email = 'stsmith@manta.com'
s.files += Dir['lib/**/*.rb']
s.add_runtime_dependency 'aws-sdk'
s.add_runtime_dependency 'redis'

s.add_development_dependency 'awesome_print'
s.add_development_dependency 'rake'
s.add_development_dependency 'rspec'
s.add_development_dependency 'rubocop'
s.add_development_dependency 'travis'
end
33 changes: 15 additions & 18 deletions bin/proto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,47 @@
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)

require 'awesome_print'
require 'yaml'

require 'aws-cache'
require 'redis'

host = 'redis.aws.ecnext.net'
port = 6379

keyspace = ARGV[0] || 'debug'
cache = AwsCache.new({'keyspace' => keyspace, 'host' => host, 'port' => port})
cache = AwsCache.new('keyspace' => keyspace, 'host' => host, 'port' => port)

##############################################################
#To get all instances associated with a given auto scaling group
#you can do something like this.
# To get all instances associated with a given auto scaling group
# you can do something like this.
##############################################################
#placeHolder = Array.new()
#cache.get_asg_instances( "manta-site-e2e-smoketest-AdminServiceNestedStack-1LB9D75MS2SUE-AdminServiceAutoScalingGroup-1I2AY0INI3GH").each do |instances|
# placeHolder = Array.new()
# cache.get_asg_instances( "manta-site-e2e-smoketest-AdminServiceNestedStack-1LB9D75MS2SUE-AdminServiceAutoScalingGroup-1I2AY0INI3GH").each do |instances|
# placeHolder.push(instances[:instance_id])
#end
#cache.describe_instances().each do |instance|
# end
# cache.describe_instances().each do |instance|
# instance[:instances].each do |stuff|
# if placeHolder.include?(stuff[:instance_id]) then
# ap instance
# end
# end
#end
# end
##############################################################

##############################################################
#To get all instances in a stack with substacks do this.
# To get all instances in a stack with substacks do this.
##############################################################
#cache.stack_auto_scaling_groups('manta-site--main--production').each do |asg|
# cache.stack_auto_scaling_groups('manta-site--main--production').each do |asg|
# ap cache.get_asg_instances(asg[:physical_resource_id])
#end
#
#cache.get_sub_stacks('manta-site--main--production').each do |stack|
# end

# cache.get_sub_stacks('manta-site--main--production').each do |stack|
# ap stack[:stack_name]
# cache.stack_auto_scaling_groups(stack[:stack_name]).each do |asg|
# ap cache.get_asg_instances(asg[:physical_resource_id])
# end
#end
# end
##############################################################

cache.describe_instance("i-5f1824a0")
cache.describe_instance('i-5f1824a0')

puts AwsCache::VERSION

Expand Down
Loading