infopark_opsworks_helpers 0.1.1 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ca46c6d2917d4fa95b975c686d89c9c4d3d1903f
4
- data.tar.gz: 9785487217299d190cfe0ac639bce2af4b4569da
3
+ metadata.gz: 9ab16c2081c143434e0bbd05bbfd476701f06e51
4
+ data.tar.gz: 81d3988949d9855f622b9da592f477c68be9bda9
5
5
  SHA512:
6
- metadata.gz: 840562b707583a046b5ee70fc091c12849adba1edcf24163b1306eebba7caad3df4d58c20833d288727e8bb40966a27cbbe5849f1edf38b6b2ad583dc82738a8
7
- data.tar.gz: d78228884596613e2ef9364d3ff57b950134e9f108e71221479600dba3640fadb6e8b3cecf492ea1b2ea238d96d3b6570f2ed5c4f847ab3e6586167528177f7c
6
+ metadata.gz: 241313224c4e10645be044566bf352a0f0eef695a3131b0f959910c7631373beac0627b8ebdf1c8a81192f27bcb6c0c87a6f5e8494688da530d275f4ee8a23b1
7
+ data.tar.gz: 0bfc5ab53128488a6133094dd7c3300569eb753468c1ae0711ce2a04a40ff602199ef91e18b3e8ca2a875b5d9dbf7d799f4000f7e16cba9258fd91773d8ca6f8
data/Rakefile CHANGED
@@ -1,6 +1,22 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
3
6
 
4
- RSpec::Core::RakeTask.new(:spec)
7
+ require 'rdoc/task'
5
8
 
6
- task :default => :spec
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'OpsworksHelpers'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+ load 'rails/tasks/statistics.rake'
21
+
22
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,27 @@
1
+ module OpsworksHelpers
2
+ class ApplicationController < ActionController::Base
3
+
4
+ def healthcheck
5
+ head 200
6
+ end
7
+
8
+ def status
9
+ if command_block = OpsworksHelpers.status_checks.presence
10
+ checks = StatusChecks.new(command_block)
11
+ checks.execute
12
+ @errors = checks.errors
13
+ end
14
+
15
+ if @errors.present?
16
+ render json: {
17
+ status: :internal_server_error,
18
+ message: 'Something went wrong',
19
+ errors: @errors
20
+ }, status: :internal_server_error
21
+ else
22
+ render json: {status: :ok, message: 'Everything is awesome!'}
23
+ end
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,4 @@
1
+ module OpsworksHelpers
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>OpsworksHelpers</title>
5
+ <%= stylesheet_link_tag "opsworks_helpers/application", media: "all" %>
6
+ <%= javascript_include_tag "opsworks_helpers/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,6 @@
1
+ OpsworksHelpers::Engine.routes.draw do
2
+
3
+ get '/healthcheck' => 'application#healthcheck'
4
+ get '/status' => 'application#status'
5
+
6
+ end
@@ -1,6 +1,6 @@
1
1
  require 'aws-sdk'
2
2
 
3
- module Infopark::OpsworksHelpers
3
+ module OpsworksHelpers
4
4
  class Deploy
5
5
 
6
6
  def deploy(command, comment='Run via in-app rake task')
@@ -0,0 +1,9 @@
1
+ module OpsworksHelpers
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace OpsworksHelpers
4
+
5
+ config.generators do |g|
6
+ g.test_framework :rspec
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,25 @@
1
+ module OpsworksHelpers
2
+ class StatusChecks
3
+
4
+ attr_reader :command_block
5
+ attr_accessor :result
6
+
7
+ def initialize(command_block)
8
+ @command_block = command_block
9
+ @result = [true, {}]
10
+ end
11
+
12
+ def execute
13
+ self.result = command_block.call
14
+ end
15
+
16
+ def failed?
17
+ result[0] == false
18
+ end
19
+
20
+ def errors
21
+ result[1]
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,3 @@
1
+ module OpsworksHelpers
2
+ VERSION = "0.2.1"
3
+ end
@@ -0,0 +1,9 @@
1
+ require "opsworks_helpers/engine"
2
+ require "opsworks_helpers/deploy"
3
+ require "opsworks_helpers/status_checks"
4
+
5
+ module OpsworksHelpers
6
+
7
+ mattr_accessor :status_checks
8
+
9
+ end
@@ -1,6 +1,6 @@
1
1
  namespace 'opsworks' do
2
2
 
3
- client = Infopark::OpsworksHelpers::Deploy.new
3
+ client = OpsworksHelpers::Deploy.new
4
4
 
5
5
  desc 'Deploy application to stack (and migrate database)'
6
6
  task :deploy => :environment do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_opsworks_helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Infopark AG
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-18 00:00:00.000000000 Z
12
+ date: 2015-11-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -40,7 +40,7 @@ dependencies:
40
40
  - !ruby/object:Gem::Version
41
41
  version: '10.0'
42
42
  - !ruby/object:Gem::Dependency
43
- name: rspec
43
+ name: rspec-rails
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - ">="
@@ -53,6 +53,48 @@ dependencies:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: sqlite3
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rails
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '4.2'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '4.2'
84
+ - !ruby/object:Gem::Dependency
85
+ name: haml-rails
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :runtime
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
56
98
  - !ruby/object:Gem::Dependency
57
99
  name: aws-sdk
58
100
  requirement: !ruby/object:Gem::Requirement
@@ -74,20 +116,19 @@ executables: []
74
116
  extensions: []
75
117
  extra_rdoc_files: []
76
118
  files:
77
- - ".gitignore"
78
- - ".rspec"
79
- - ".travis.yml"
80
- - Gemfile
81
- - README.md
82
119
  - Rakefile
83
- - bin/console
84
- - bin/setup
85
- - infopark_opsworks_helpers.gemspec
86
- - lib/infopark_opsworks_helpers.rb
87
- - lib/infopark_opsworks_helpers/deploy.rb
88
- - lib/infopark_opsworks_helpers/railtie.rb
89
- - lib/infopark_opsworks_helpers/version.rb
90
- - lib/tasks/infopark_opsworks_helpers.rake
120
+ - app/assets/javascripts/opsworks_helpers/application.js
121
+ - app/assets/stylesheets/opsworks_helpers/application.css
122
+ - app/controllers/opsworks_helpers/application_controller.rb
123
+ - app/helpers/opsworks_helpers/application_helper.rb
124
+ - app/views/layouts/opsworks_helpers/application.html.erb
125
+ - config/routes.rb
126
+ - lib/opsworks_helpers.rb
127
+ - lib/opsworks_helpers/deploy.rb
128
+ - lib/opsworks_helpers/engine.rb
129
+ - lib/opsworks_helpers/status_checks.rb
130
+ - lib/opsworks_helpers/version.rb
131
+ - lib/tasks/opsworks_helpers_tasks.rake
91
132
  homepage: https://github.com/infopark/opsworks-helpers
92
133
  licenses: []
93
134
  metadata: {}
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color
data/.travis.yml DELETED
@@ -1,4 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.3
4
- before_install: gem install bundler -v 1.10.6
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
data/README.md DELETED
@@ -1,47 +0,0 @@
1
- # Infopark OpsworksHelpers
2
-
3
- ## Installation
4
-
5
- Add this line to your application's Gemfile:
6
-
7
- ```ruby
8
- gem 'infopark_opsworks_helpers'
9
- ```
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself as:
16
-
17
- $ gem install infopark_opsworks_little_helpers
18
-
19
- ## Usage
20
-
21
- ### General
22
-
23
- The tasks defined in this gem expect the following ENV variables to be set:
24
-
25
- ```ruby
26
- AWS_ACCESS_KEY_ID
27
- AWS_SECRET_ACCESS_KEY
28
- AWS_OPSWORKS_STACK_ID
29
- AWS_OPSWORKS_APP_ID
30
- ```
31
-
32
- ### Rails
33
-
34
- After adding to the Gemfile you can see the available rake tasks with
35
-
36
- $ bundle exec rake -T opsworks
37
-
38
- ## Development
39
-
40
- 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.
41
-
42
- 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).
43
-
44
- ## Contributing
45
-
46
- Bug reports and pull requests are welcome on GitHub at https://github.com/infopark/infopark_opsworks_little_helpers.
47
-
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "infopark_opsworks_little_helpers"
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
data/bin/setup DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- bundle install
6
-
7
- # Do any other automated setup that you need to do here
@@ -1,23 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'infopark_opsworks_helpers/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "infopark_opsworks_helpers"
8
- spec.version = Infopark::OpsworksHelpers::VERSION
9
- spec.authors = ["Infopark AG", "Benjamin Zimmer"]
10
- spec.email = ["info@infopark.de"]
11
-
12
- spec.summary = %q{Provides little helper functions for managing AWS OpsWorks stacks.}
13
- spec.homepage = "https://github.com/infopark/opsworks-helpers"
14
-
15
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
16
- spec.require_paths = ["lib"]
17
-
18
- spec.add_development_dependency "bundler", "~> 1.10"
19
- spec.add_development_dependency "rake", "~> 10.0"
20
- spec.add_development_dependency "rspec"
21
-
22
- spec.add_dependency "aws-sdk", "~>2"
23
- end
@@ -1,10 +0,0 @@
1
- require 'infopark_opsworks_helpers'
2
- require 'rails'
3
-
4
- module Infopark::OpsworksHelpers
5
- class Railtie < Rails::Railtie
6
- rake_tasks do
7
- load 'tasks/infopark_opsworks_helpers.rake'
8
- end
9
- end
10
- end
@@ -1,5 +0,0 @@
1
- module Infopark
2
- module OpsworksHelpers
3
- VERSION = "0.1.1"
4
- end
5
- end
@@ -1,9 +0,0 @@
1
- require "infopark_opsworks_helpers/version"
2
- require "infopark_opsworks_helpers/deploy"
3
-
4
- require "infopark_opsworks_helpers/railtie" if defined?(Rails)
5
-
6
- module Infopark
7
- module OpsworksHelpers
8
- end
9
- end