Skip to content
Merged
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
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.ruby-version
.ruby-gemset
*.gem
*.rbc
.bundle
Expand All @@ -8,8 +6,11 @@
.rbenv-*
.rbx
.rbxpkg
.ruby-gemset
.ruby-version
.rvmrc
.yardoc
_yardoc
coverage
doc/
Gemfile.lock
Expand All @@ -21,4 +22,3 @@ tags
test/tmp
test/version_tmp
tmp
_yardoc
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--color
--require spec_helper
60 changes: 60 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
require: rubocop-rspec
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.2
DisplayCopNames: true
Exclude:
- 'tmp/**/*'

Style/MixinGrouping:
Exclude:
- 'spec/**/*.rb'

Metrics/BlockLength:
CountComments: false # count full line comments?
Exclude:
- '**/*_spec.rb'

StringLiterals:
EnforcedStyle: single_quotes
Enabled: true

DotPosition:
EnforcedStyle: leading
Enabled: true

ClassAndModuleChildren:
EnforcedStyle: nested
Enabled: true

Documentation:
Enabled: false

FileName:
Enabled: true

LineLength:
Max: 120
Enabled: true

Style/ExtraSpacing:
Enabled: true

Lint/LiteralInInterpolation:
AutoCorrect: true

Style/ModuleFunction:
EnforcedStyle: extend_self # Allows us to have private methods too

Style/PercentLiteralDelimiters:
# Hound and CodeClimate are currently using an old version of Rubocop with
# different defaults, so we set them explicitly here.
PreferredDelimiters:
default: ()
'%i': '[]'
'%I': '[]'
'%r': '{}'
'%w': '[]'
'%W': '[]'
92 changes: 92 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2017-05-16 15:42:20 +0100 using RuboCop version 0.48.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
Metrics/AbcSize:
Max: 17

# Offense count: 1
Metrics/CyclomaticComplexity:
Max: 7

# Offense count: 1
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 13

# Offense count: 1
Metrics/PerceivedComplexity:
Max: 8

# Offense count: 1
RSpec/DescribeMethod:
Exclude:
- 'spec/machinist/exceptions_spec.rb'

# Offense count: 17
# Configuration parameters: Max.
RSpec/ExampleLength:
Exclude:
- 'spec/machinist/active_record_spec.rb'
- 'spec/machinist/blueprint_inheritance_spec.rb'
- 'spec/machinist/blueprint_spec.rb'
- 'spec/machinist/machinable_spec.rb'

# Offense count: 2
RSpec/IteratedExpectation:
Exclude:
- 'spec/machinist/blueprint_spec.rb'
- 'spec/machinist/machinable_spec.rb'

# Offense count: 21
RSpec/MultipleExpectations:
Max: 6

# Offense count: 2
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: nested, compact
Style/ClassAndModuleChildren:
Exclude:
- 'lib/machinist/active_record/blueprint.rb'
- 'lib/machinist/active_record/lathe.rb'

# Offense count: 1
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
Style/FileName:
Exclude:
- 'Appraisals'

# Offense count: 1
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: format, sprintf, percent
Style/FormatString:
Exclude:
- 'lib/machinist/blueprint.rb'

# Offense count: 3
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Exclude:
- 'lib/generators/machinist/install/install_generator.rb'
- 'lib/machinist/lathe.rb'

# Offense count: 1
Style/MethodMissing:
Exclude:
- 'lib/machinist/lathe.rb'

# Offense count: 1
# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
# NamePrefix: is_, has_, have_
# NamePrefixBlacklist: is_, has_, have_
# NameWhitelist: is_a?
Style/PredicateName:
Exclude:
- 'spec/**/*'
- 'lib/machinist/blueprint.rb'
28 changes: 14 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
---
language: ruby

rvm:
- ruby-head
- 2.1.0
- 2.0.0
- rbx-2.1.1
- 1.9.3
- jruby-19mode # JRuby in 1.9 mode
- rbx-19mode
- 2.4.1
- 2.3.4
- 2.2.6
- 2.1.10

gemfile:
- gemfiles/3.0.gemfile
- gemfiles/3.1.gemfile
- gemfiles/3.2.gemfile
- gemfiles/4.0.gemfile
- gemfiles/4.1.gemfile
- gemfiles/4.2.gemfile
- gemfiles/rails_4.2.gemfile
- gemfiles/rails_5.0.gemfile
- gemfiles/rails_5.1.gemfile

branches:
only:
- master

matrix:
allow_failures:
- rvm: jruby-18mode
- rvm: jruby-19mode
- gemfile: gemfiles/rails_5.0.gemfile
rvm: 2.1.10
- gemfile: gemfiles/rails_5.1.gemfile
rvm: 2.1.10
- rvm: ruby-head
11 changes: 11 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
appraise 'rails-4.2' do
gem 'activerecord', '~> 4.2.8', group: :test, require: false
end

appraise 'rails-5.0' do
gem 'activerecord', '~> 5.0.3', group: :test, require: false
end

appraise 'rails-5.1' do
gem 'activerecord', '~> 5.1.1', group: :test, require: false
end
22 changes: 19 additions & 3 deletions Gemfile
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
source "http://rubygems.org"
source 'http://rubygems.org'
gemspec
ruby RUBY_VERSION

group :development do
gem 'appraisal', require: false
gem 'rdoc', require: false
gem 'rubocop-rspec', require: false
end

group :test do
gem 'codeclimate-test-reporter', require: false
gem 'coveralls', require: false
gem 'fuubar', require: false
gem 'rspec', require: false
gem 'rspec_junit_formatter', require: false
gem 'simplecov', '~> 0.14', require: false
end

platforms :ruby do
gem "sqlite3"
gem 'sqlite3'
end

platforms :jruby do
gem "activerecord-jdbcsqlite3-adapter"
gem 'activerecord-jdbcsqlite3-adapter'
end
23 changes: 16 additions & 7 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# Machinist 2

*Fixtures aren't fun. Machinist is.*
*Fixtures aren't fun. Machinist was.*

- [Home page](http://github.com/liquid/machinist)
[![Gem version](https://badge.fury.io/rb/machinist.svg)](https://rubygems.org/gems/machinist)
[![Gem downloads](https://img.shields.io/gem/dt/machinist.svg)](https://rubygems.org/gems/machinist)
[![Build Status](https://travis-ci.org/dominicsayers/machinist.svg?branch=master)](https://travis-ci.org/dominicsayers/machinist)
[![Code Climate](https://codeclimate.com/github/dominicsayers/machinist/badges/gpa.svg)](https://codeclimate.com/github/dominicsayers/machinist)
[![Test Coverage](https://codeclimate.com/github/dominicsayers/machinist/badges/coverage.svg)](https://codeclimate.com/github/dominicsayers/machinist/coverage)
[![Dependency Status](https://gemnasium.com/badges/github.com/dominicsayers/machinist.svg)](https://gemnasium.com/github.com/dominicsayers/machinist)
[![Security](https://hakiri.io/github/dominicsayers/machinist/master.svg)](https://hakiri.io/github/dominicsayers/machinist/master)

- [Home page](http://github.com/dominicsayers/machinist)
- [Google group](http://groups.google.com/group/machinist-users), for support
- [Bug tracker](http://github.com/liquid/machinist/issues), for reporting Machinist bugs
- [Bug tracker](http://github.com/dominicsayers/machinist/issues), for reporting Machinist bugs

If you want Machinist 1, [go here](http://github.com/notahat/machinist/tree/1.0-maintenance).

Expand Down Expand Up @@ -218,14 +226,14 @@ You can refer to already assigned attributes when constructing a new attribute:

Read the code! No, really. I wrote this code to be read.

Check out [the specs](https://github.com/notahat/machinist/tree/master/spec),
Check out [the specs](https://github.com/dominicsayers/machinist/tree/master/spec),
starting with [the spec for
Machinable](https://github.com/notahat/machinist/blob/master/spec/machinable_spec.rb).
Machinable](https://github.com/dominicsayers/machinist/blob/master/spec/machinable_spec.rb).


## Compatibility

Please have a look at the Travis Build Status. [![Travis Build Status](https://travis-ci.org/liquid/machinist.png?branch=master)](https://travis-ci.org/liquid/machinist)
Please have a look at the Travis Build Status. [![Travis Build Status](https://travis-ci.org/dominicsayers/machinist.png?branch=master)](https://travis-ci.org/dominicsayers/machinist)

I've tested this with:

Expand Down Expand Up @@ -265,7 +273,7 @@ If anybody wants to take over maintenance, let me know.

## Contributors

Machinist is maintained by Pete Yandell ([pete@notahat.com](mailto:pete@notahat.com), [@notahat](http://twitter.com/notahat))
Machinist was maintained by Pete Yandell ([pete@notahat.com](mailto:pete@notahat.com), [@notahat](http://twitter.com/notahat))

Other contributors include:

Expand All @@ -290,6 +298,7 @@ Other contributors include:
[Gareth Townsend](http://github.com/quamen),
[Matt Wastrodowski](http://github.com/towski),
[Ian White](http://github.com/ianwhite)
[Dominic Sayers](https://github.com/dominicsayers)

Thanks to Thoughtbot's [Factory
Girl](http://github.com/thoughtbot/factory_girl/tree/master). Machinist was
Expand Down
16 changes: 11 additions & 5 deletions Rakefile
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
require "bundler/gem_tasks"
begin
require 'rubygems'
require 'bundler/setup'
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
RSpec::Core::RakeTask.new(:spec)

task default: :spec
rescue LoadError
puts 'rspec is not available'
end

require 'rdoc/task'
RDoc::Task.new(:rdoc) do |rdoc|
Expand All @@ -10,5 +18,3 @@ RDoc::Task.new(:rdoc) do |rdoc|
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('lib')
end

task :default => :spec
13 changes: 0 additions & 13 deletions gemfiles/3.0.gemfile

This file was deleted.

13 changes: 0 additions & 13 deletions gemfiles/3.1.gemfile

This file was deleted.

13 changes: 0 additions & 13 deletions gemfiles/3.2.gemfile

This file was deleted.

Loading