Skip to content

Instantly share code, notes, and snippets.

@SafeAF
Last active October 10, 2016 23:48
Show Gist options
  • Save SafeAF/275bdf37c70b53c05d57c3574a1df551 to your computer and use it in GitHub Desktop.
Save SafeAF/275bdf37c70b53c05d57c3574a1df551 to your computer and use it in GitHub Desktop.
Here be dotfiles for a variety of applications and gem libraries etc. Procfiles, Rakefiles, Gemfiles etc
FROM ruby:2.3
ENV LC_ALL C.UTF-8
RUN apt-get update -y \
&& apt-get install -y python-pip \
&& pip install pygments
RUN mkdir -p /app/vendor
WORKDIR /app
ENV PATH /app/bin:$PATH
COPY Gemfile Gemfile.lock /app/
COPY vendor/cache /app/vendor/cache
RUN bundle install --local -j $(nproc)
CMD [ "irb" ]
# http://EditorConfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
[*.erb]
indent_style=space
indent_size=2
trim_trailing_whitespace = true
[*.html]
indent_style=space
indent_size=2
trim_trailing_whitespace = true
[*.md]
indent_style=space
indent_size=2
[*.css]
indent_style=space
indent_size=2
trim_trailing_whitespace = true
[*.rb]
indent_style=space
indent_size=2
trim_trailing_whitespace = true
[*.js]
indent_style=space
indent_size=2
trim_trailing_whitespace = true
[Rakefile]
indent_style=space
indent_size=2
trim_trailing_whitespace = true
[Gemfile]
indent_style=space
indent_size=2
trim_trailing_whitespace = true
# See http://help.github.com/ignore-files/ for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile ~/.gitignore_global
# Ignore bundler config
/.bundle
# Ignore the build directory
/build
# Ignore cache
/.sass-cache
/.cache
# Ignore .DS_store file
.DS_Store
/*.sublime-workspace

Dotfiles

Here be dotfiles for a variety of applications and gem libraries etc

require 'rake'
require 'rake/clean'
require 'rake/testtask'
CLEAN.include('**/*.gem', '**/*.rbc', '**/*.rbx')
desc "Run the test suite"
Rake::TestTask.new("test") do |t|
if File::ALT_SEPARATOR
t.libs << 'lib/windows'
else
t.libs << 'lib/unix'
end
t.warning = true
t.verbose = true
t.test_files = FileList['test/test_sys_filesystem.rb']
end
desc "Run the example program"
task :example do |t|
sh "ruby -Ilib -Ilib/unix -Ilib/windows examples/example_stat.rb"
end
namespace :gem do
desc "Build the sys-filesystem gem"
task :create => [:clean] do |t|
require 'rubygems/package'
spec = eval(IO.read('sys-filesystem.gemspec'))
spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
Gem::Package.build(spec, true)
end
desc "Install the sys-filesystem gem"
task :install => [:create] do
file = Dir['*.gem'].first
sh "gem install -l #{file}"
end
end
task :default => :test
# -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'sneakers/version'
Gem::Specification.new do |gem|
gem.name = 'sneakers'
gem.version = Sneakers::VERSION
gem.authors = ['Dotan Nahum']
gem.email = ['[email protected]']
gem.description = %q( Fast background processing framework for Ruby and RabbitMQ )
gem.summary = %q( Fast background processing framework for Ruby and RabbitMQ )
gem.homepage = 'http://sneakers.io'
gem.required_ruby_version = Gem::Requirement.new(">= 2.0")
gem.files = `git ls-files`.split($/).reject { |f| f == 'Gemfile.lock' }
gem.executables = gem.files.grep(/^bin/).map { |f| File.basename(f) }
gem.test_files = gem.files.grep(/^(test|spec|features)\//)
gem.require_paths = ['lib']
gem.add_dependency 'serverengine', '~> 1.5.11'
gem.add_dependency 'bunny', '~> 2.5'
gem.add_dependency 'thread', '~> 0.1.7'
gem.add_dependency 'thor'
# for integration environment (see .travis.yml and integration_spec)
gem.add_development_dependency 'rabbitmq_http_api_client'
gem.add_development_dependency 'redis'
gem.add_development_dependency 'rr'
gem.add_development_dependency 'unparser', '0.2.2' # keep below 0.2.5 for ruby 2.0 compat.
gem.add_development_dependency 'ruby-prof'
gem.add_development_dependency 'guard-minitest'
gem.add_development_dependency 'metric_fu'
gem.add_development_dependency 'simplecov'
gem.add_development_dependency 'simplecov-rcov-text'
gem.add_development_dependency 'rake'
gem.add_development_dependency 'minitest'
gem.add_development_dependency 'guard'
end
RUBY_IMAGE:=$(shell grep FROM Dockerfile | cut -f 2 -d ' ')
DOCKER:=tmp/docker
IMAGE:=ahawkins/vagrant-workstation
MAN:=dist/workstation.man1
.DEFAULT_GOAL:=dist
Gemfile.lock: Gemfile
docker run --rm -it -v $(CURDIR):/data -w /data $(RUBY_IMAGE) \
bundle package --all
$(DOCKER): Gemfile.lock Dockerfile
docker build -t $(IMAGE) .
mkdir -p $(@D)
touch $@
$(MAN): $(DOCKER)
mkdir -p $(@D) tmp
docker run --rm -it -v $(CURDIR):/data -w /data $(IMAGE) \
asciidoctor -d manpage -b manpage -D $(@D) -o $(@F) man.asciidoc
.PHONY: dist
dist: $(MAN)
.PHONY: clean
clean:
rm -rf $(DOCKER_IMAGE) $(MAN)
inherit_from:
- .rubocop_todo.yml
AllCops:
TargetRubyVersion: 1.9
Exclude:
- tmp/**/*
- lib/bundler/vendor/**/*
DisplayCopNames: true
# Lint
# They are idiomatic
Lint/AssignmentInCondition:
Enabled: false
Lint/EndAlignment:
AlignWith: variable
AutoCorrect: true
Lint/UnusedMethodArgument:
Enabled: false
# Style
Style/AccessModifierIndentation:
EnforcedStyle: outdent
Style/Alias:
EnforcedStyle: prefer_alias_method
Style/AlignParameters:
EnforcedStyle: with_fixed_indentation
Style/FrozenStringLiteralComment:
EnforcedStyle: always
Style/MultilineBlockChain:
Enabled: false
Style/MultilineOperationIndentation:
EnforcedStyle: indented
Style/PerlBackrefs:
Enabled: false
Style/SingleLineBlockParams:
Enabled: false
Style/SpaceInsideBlockBraces:
SpaceBeforeBlockParameters: false
Style/TrivialAccessors:
Enabled: false
# We adopted raise instead of fail.
Style/SignalException:
EnforcedStyle: only_raise
Style/StringLiterals:
EnforcedStyle: double_quotes
Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes
# Having these make it easier to *not* forget to add one when adding a new
# value and you can simply copy the previous line.
Style/TrailingCommaInLiteral:
EnforcedStyleForMultiline: comma
Style/TrailingUnderscoreVariable:
Enabled: false
# `String.new` is preferred style with enabled frozen string literal
Style/EmptyLiteral:
Enabled: false
# 1.8.7 support
Style/HashSyntax:
EnforcedStyle: hash_rockets
Style/Lambda:
Enabled: false
Style/DotPosition:
EnforcedStyle: trailing
Style/EachWithObject:
Enabled: false
Style/SpecialGlobalVars:
Enabled: false
Style/TrailingCommaInArguments:
Enabled: false
Performance/FlatMap:
Enabled: false
# Metrics
# We've chosen to use Rubocop only for style, and not for complexity or quality checks.
Metrics/ClassLength:
Enabled: false
Metrics/ModuleLength:
Enabled: false
Metrics/MethodLength:
Enabled: false
Metrics/BlockNesting:
Enabled: false
Metrics/AbcSize:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/ParameterLists:
Enabled: false
# It will be obvious which code is complex, Rubocop should only lint simple
# rules for us.
Metrics/PerceivedComplexity:
Enabled: false
Metrics/BlockNesting:
Max: 2
Metrics/LineLength:
AllowURI: true
Enabled: false
Metrics/MethodLength:
CountComments: false
Max: 10
Metrics/ModuleLength:
Max: 150 # TODO: Lower to 100
Metrics/ParameterLists:
Max: 4
CountKeywordArgs: true
Style/AccessModifierIndentation:
EnforcedStyle: outdent
Style/CollectionMethods:
Enabled: true
PreferredMethods:
map: 'collect'
map!: 'collect!'
reduce: 'inject'
find: 'detect'
find_all: 'select'
Style/Documentation:
Enabled: false
Style/DoubleNegation:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: false
Style/SpaceInsideHashLiteralBraces:
EnforcedStyle: no_space
Style/TrailingCommaInLiteral:
EnforcedStyleForMultiline: 'comma'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment