diff --git a/.codeclimate.yml b/.codeclimate.yml index 5199e46..7897fff 100755 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -11,7 +11,7 @@ engines: enabled: true ratings: paths: - - "**.rb" + - '**.rb' exclude_paths: - script/ - spec/ diff --git a/.travis.yml b/.travis.yml index 3462fde..b90ec3a 100755 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ rvm: - 2.4.1 - 2.3.4 - 2.2.6 - - 2.1.10 gemfile: - gemfiles/rails_4.2.gemfile @@ -15,10 +14,6 @@ gemfile: matrix: allow_failures: - - gemfile: gemfiles/rails_5.0.gemfile - rvm: 2.1.10 - - gemfile: gemfiles/rails_5.1.gemfile - rvm: 2.1.10 - rvm: ruby-head before_install: diff --git a/Gemfile b/Gemfile index 72682e0..9e5dbc5 100755 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,12 @@ ruby RUBY_VERSION group :development do gem 'appraisal', require: false + gem 'gem-release', require: false + gem 'github_changelog_generator', require: false + gem 'guard', require: false + gem 'guard-rspec', require: false + gem 'guard-rubocop', require: false + gem 'guard-rubycritic', require: false gem 'rdoc', require: false gem 'rubocop-rspec', require: false end diff --git a/LICENSE.txt b/LICENSE.txt old mode 100644 new mode 100755 index 5289851..a3dbd15 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,21 +1,21 @@ -Copyright (c) 2008-2010 Peter Yandell +MIT License -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: +Copyright (c) 2008-2017 Pete Yandell, Attila Györffy, Dominic Sayers -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 3d7a059..59b7149 100755 --- a/README.md +++ b/README.md @@ -1,61 +1,71 @@ -# Machinist 2 +# Machinist 3 *Fixtures aren't fun. Machinist was.* -[![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) +[![Gem version](https://badge.fury.io/rb/machinist_redux.svg)](https://rubygems.org/gems/machinist_redux) +[![Gem downloads](https://img.shields.io/gem/dt/machinist_redux.svg)](https://rubygems.org/gems/machinist_redux) [![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/dominicsayers/machinist/issues), for reporting Machinist bugs +- [Home page](https://github.com/dominicsayers/machinist) +- [Google group](https://groups.google.com/group/machinist-users), for support +- [Bug tracker](https://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). +If you want Machinist 1, [go here](https://github.com/notahat/machinist/tree/1.0-maintenance). +If you want support for Rails 3 or Rubies prior to 2.2, [go here](https://github.com/attilagyorffy/machinist). -## Introduction +## Status + +This is a fork of [Pete Yandell's Machinist](http://github.com/notahat/machinist). The original gem was abandoned for the reasons given below, as are most of its forks. The purpose of this fork is to keep Machinist under maintenance for legacy projects that have upgraded to Ruby 2.2 or later and Rails 4.2 or later, but still have Machinist factories in the test environment. + +I'm pleased to say that Pete's code runs fine under Ruby 2.2, 2.3 & 2.4 and Rails 4.2, 5.0 and 5.1. I have allowed [RuboCop](https://github.com/bbatsov/rubocop) and [RuboCop RSpec](https://github.com/backus/rubocop-rspec) to suggest some changes, and I have converted to the more up-to-date RSpec syntax using [Transpec](https://github.com/yujinakayama/transpec). Few if any manual changes were needed. -This is a fork of [Pete Yandell's Machinist](http://github.com/notahat/machinist). Unfortunately the original gem seems to be abandoned, regardless of the numerous pull requests that are waiting for approval and to be merged in. The purpose of this fork is to keep Machinist under maintenance and add additional features and support for multiple Ruby implementations, including Rubinius or JRuby. +Pete Yandell's reason for abandoning Machinist is that he found himself with less and less need for factories in tests. He recommends Bo Jeanes' [excellent article on the topic](http://bjeanes.com/2012/02/factories-breed-complexity). + +## Introduction Machinist makes it easy to create objects for use in tests. It generates data for the attributes you don't care about, and constructs any necessary associated objects, leaving you to specify only the fields you care about in your test. For example: - describe Comment, "without_spam scope" do - it "doesn't include spam" do - # This will make a Comment, a Post, and a User (the author of the - # Post), generate values for all their attributes, and save them: - spam = Comment.make!(:spam => true) +```ruby +describe Comment, 'without_spam scope' do + it "doesn't include spam" do + # This will make a Comment, a Post, and a User (the author of the + # Post), generate values for all their attributes, and save them: + spam = Comment.make!(spam: true) - Comment.without_spam.should_not include(spam) - end - end + Comment.without_spam.should_not include(spam) + end +end +``` You tell Machinist how to do this with blueprints: - require 'machinist/active_record' +```ruby +require 'machinist/active_record' - User.blueprint do - username { "user#{sn}" } # Each user gets a unique serial number. - end +User.blueprint do + username { "user#{sn}" } # Each user gets a unique serial number. +end - Post.blueprint do - author - title { "Post #{sn}" } - body { "Lorem ipsum..." } - end - - Comment.blueprint do - post - email { "commenter#{sn}@example.com" } - body { "Lorem ipsum..." } - end +Post.blueprint do + author + title { "Post #{sn}" } + body { 'Lorem ipsum...' } +end +Comment.blueprint do + post + email { "commenter#{sn}@example.com" } + body { 'Lorem ipsum...' } +end +``` ## Installation @@ -63,29 +73,29 @@ You tell Machinist how to do this with blueprints: See [the wiki](http://wiki.github.com/notahat/machinist/machinist-2). -### Rails 3 +### Rails 4 and 5 In your app's `Gemfile`, in the `group :test` section, add: - gem 'machinist', '>= 2.0.0' +```ruby +gem 'machinist_redux' +``` Then run: - bundle install - rails generate machinist:install +```ruby +bundle install +rails generate machinist:install +``` If you want Machinist to automatically add a blueprint to your blueprints file -whenever you generate a model, add the following to your `config/application.rb` -inside the Application class: - - config.generators do |g| - g.fixture_replacement :machinist - end - -### Rails 2 - -See [the wiki](http://wiki.github.com/notahat/machinist/rails-2). +whenever you generate a model, add the following to your `config/application.rb` inside the Application class: +```ruby +config.generators do |g| + g.fixture_replacement :machinist +end +``` ## Usage @@ -97,14 +107,18 @@ just the attributes that are important for the test. A simple blueprint might look like this: - Post.blueprint do - title { "A Post" } - body { "Lorem ipsum..." } - end +```ruby +Post.blueprint do + title { 'A Post' } + body { 'Lorem ipsum...' } +end +``` You can then construct a Post from this blueprint with: - Post.make! +```ruby +Post.make! +``` When you call `make!`, Machinist calls `Post.new`, then runs through the attributes in your blueprint, calling the block for each attribute to generate @@ -113,29 +127,33 @@ Post can't be saved.) You can override values defined in the blueprint by passing a hash to make: - Post.make!(:title => "A Specific Title") +```ruby +Post.make!(title: 'A Specific Title') +``` If you want to generate an object without saving it to the database, replace `make!` with `make`. - ### Unique Attributes For attributes that need to be unique, you can call the `sn` method from within the attribute block to get a unique serial number for the object. - User.blueprint do - username { "user-#{sn}" } - end - +```ruby +User.blueprint do + username { "user-#{sn}" } +end +``` ### Associations If your object needs associated objects, you can generate them like this: - Comment.blueprint do - post { Post.make } - end +```ruby +Comment.blueprint do + post { Post.make } +end +``` Calling `Comment.make!` will construct a Comment and its associated Post, and save both. @@ -143,43 +161,51 @@ save both. Machinist is smart enough to look at the association and work out what sort of object it needs to create, so you can shorten the above blueprint to: - Comment.blueprint do - post - end +```ruby +Comment.blueprint do + post +end +``` If you want to override the value for post when constructing the comment, you can do this: - post = Post.make(:title => "A particular title) - comment = Comment.make(:post => post) - +```ruby +post = Post.make(title: 'A particular title') +comment = Comment.make(post: post) +``` For `has_many` and `has_and_belongs_to_many` associations, you can create multiple associated objects like this: - Post.blueprint do - comments(3) # Makes 3 comments. - end - +```ruby +Post.blueprint do + comments(3) # Makes 3 comments. +end +``` ### Named Blueprints Named blueprints let you define variations on an object. For example, suppose some of your Users are administrators: - User.blueprint do - name { "User #{sn}" } - email { "user-#{sn}@example.com" } - end +```ruby +User.blueprint do + name { "User #{sn}" } + email { "user-#{sn}@example.com" } +end - User.blueprint(:admin) do - name { "Admin User #{sn}" } - admin { true } - end +User.blueprint(:admin) do + name { "Admin User #{sn}" } + admin { true } +end +``` Calling: - User.make!(:admin) +```ruby +User.make!(:admin) +``` will use the `:admin` blueprint. @@ -190,59 +216,46 @@ generated even for an admin user. You must define a default blueprint for any class that has a named blueprint, even if the default blueprint is empty. - ### Blueprints on Plain Old Ruby Objects Machinist also works with plain old Ruby objects. Let's say you have a class like: - class Post - extend Machinist::Machinable +```ruby +class Post + extend Machinist::Machinable - attr_accessor :title - attr_accessor :body - end + attr_accessor :title + attr_accessor :body +end +``` You can blueprint the Post class just like anything else: - Post.blueprint do - title { "A title!" } - body { "A body!" } - end +```ruby +Post.blueprint do + title { 'A title!' } + body { 'A body!' } +end +``` And `Post.make` will construct a new Post. - ### Other Tricks You can refer to already assigned attributes when constructing a new attribute: - Post.blueprint do - author { "Author #{sn}" } - body { "Post by #{object.author}" } - end - +```ruby +Post.blueprint do + author { "Author #{sn}" } + body { "Post by #{object.author}" } +end +``` ### More Details Read the code! No, really. I wrote this code to be read. -Check out [the specs](https://github.com/dominicsayers/machinist/tree/master/spec), -starting with [the spec for -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/dominicsayers/machinist.png?branch=master)](https://travis-ci.org/dominicsayers/machinist) - -I've tested this with: - -Ruby versions: 1.8.7, 1.9.2, 1.9.3, 2.0.0 -Rails versions: 2.3, 3.0, 3.2 - -It may well be happy with other versions too, but I'm not promising anything. -Compatibility patches are welcome. - +Check out [the specs](https://github.com/dominicsayers/machinist/tree/master/spec), starting with [the spec for Machinable](https://github.com/dominicsayers/machinist/blob/master/spec/machinable_spec.rb). ## Developing @@ -259,18 +272,6 @@ If you want to submit a patch: (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull) - Send me a pull request. Bonus points for topic branches. - -## Status - -In active use in a number of large Rails 2 and 3 apps. - -Development is sporadic at best, as I find myself with less and less need for -factories in tests. See Bo Jeanes' -[excellent article on the topic](http://bjeanes.com/2012/02/factories-breed-complexity). - -If anybody wants to take over maintenance, let me know. - - ## Contributors Machinist was maintained by Pete Yandell ([pete@notahat.com](mailto:pete@notahat.com), [@notahat](http://twitter.com/notahat)) @@ -297,11 +298,10 @@ Other contributors include: [Roland Swingler](http://github.com/knaveofdiamonds), [Gareth Townsend](http://github.com/quamen), [Matt Wastrodowski](http://github.com/towski), -[Ian White](http://github.com/ianwhite) +[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 written because I loved the idea behind Factory Girl, but I thought the philosophy wasn't quite right, and I hated the syntax. - diff --git a/gemfiles/rails_4.2.gemfile b/gemfiles/rails_4.2.gemfile index 51a17fe..70ec7c5 100755 --- a/gemfiles/rails_4.2.gemfile +++ b/gemfiles/rails_4.2.gemfile @@ -7,9 +7,15 @@ ruby RUBY_VERSION gem "activerecord", "~> 4.2.8", group: :test, require: false group :development do - gem "appraisal", require: false - gem "rdoc", require: false - gem "rubocop-rspec", require: false + gem 'appraisal', require: false + gem 'gem-release', require: false + gem 'github_changelog_generator', require: false + gem 'guard', require: false + gem 'guard-rspec', require: false + gem 'guard-rubocop', require: false + gem 'guard-rubycritic', require: false + gem 'rdoc', require: false + gem 'rubocop-rspec', require: false end group :test do diff --git a/gemfiles/rails_4.2.gemfile.lock b/gemfiles/rails_4.2.gemfile.lock index ffee889..d21c204 100644 --- a/gemfiles/rails_4.2.gemfile.lock +++ b/gemfiles/rails_4.2.gemfile.lock @@ -1,7 +1,7 @@ PATH remote: .. specs: - machinist (2.0) + machinist_redux (3.0.0) GEM remote: http://rubygems.org/ @@ -18,36 +18,126 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) + addressable (2.5.1) + public_suffix (~> 2.0, >= 2.0.2) appraisal (2.2.0) bundler rake thor (>= 0.14.0) arel (6.0.4) ast (2.3.0) + axiom-types (0.1.1) + descendants_tracker (~> 0.0.4) + ice_nine (~> 0.11.0) + thread_safe (~> 0.3, >= 0.3.1) builder (3.2.3) + codeclimate-engine-rb (0.4.0) + virtus (~> 1.0) codeclimate-test-reporter (1.0.7) simplecov + coderay (1.1.1) + coercible (1.0.0) + descendants_tracker (~> 0.0.1) coveralls (0.8.21) json (>= 1.8, < 3) simplecov (~> 0.14.1) term-ansicolor (~> 1.3) thor (~> 0.19.4) tins (~> 1.6) + descendants_tracker (0.0.4) + thread_safe (~> 0.3, >= 0.3.1) diff-lcs (1.3) docile (1.1.5) + equalizer (0.0.11) + erubis (2.7.0) + faraday (0.12.1) + multipart-post (>= 1.2, < 3) + faraday-http-cache (2.0.0) + faraday (~> 0.8) + ffi (1.9.18) + flay (2.9.0) + erubis (~> 2.7.0) + path_expander (~> 1.0) + ruby_parser (~> 3.0) + sexp_processor (~> 4.0) + flog (4.6.1) + path_expander (~> 1.0) + ruby_parser (~> 3.1, > 3.1.0) + sexp_processor (~> 4.8) + formatador (0.2.5) fuubar (2.2.0) rspec-core (~> 3.0) ruby-progressbar (~> 1.4) + gem-release (1.0.0) + github_changelog_generator (1.14.3) + activesupport + faraday-http-cache + multi_json + octokit (~> 4.6) + rainbow (>= 2.1) + rake (>= 10.0) + retriable (~> 2.1) + guard (2.14.1) + formatador (>= 0.2.4) + listen (>= 2.7, < 4.0) + lumberjack (~> 1.0) + nenv (~> 0.1) + notiffany (~> 0.0) + pry (>= 0.9.12) + shellany (~> 0.0) + thor (>= 0.18.1) + guard-compat (1.2.1) + guard-rspec (4.7.3) + guard (~> 2.1) + guard-compat (~> 1.1) + rspec (>= 2.99.0, < 4.0) + guard-rubocop (1.2.0) + guard (~> 2.0) + rubocop (~> 0.20) + guard-rubycritic (2.9.3) + guard (~> 2.6) + rubycritic (>= 2.9.3) i18n (0.8.1) + ice_nine (0.11.2) json (2.1.0) + launchy (2.4.3) + addressable (~> 2.3) + listen (3.1.5) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + ruby_dep (~> 1.2) + lumberjack (1.0.12) + method_source (0.8.2) minitest (5.10.2) + multi_json (1.12.1) + multipart-post (2.0.0) + nenv (0.3.0) + notiffany (0.1.1) + nenv (~> 0.1) + shellany (~> 0.0) + octokit (4.7.0) + sawyer (~> 0.8.0, >= 0.5.3) parser (2.4.0.0) ast (~> 2.2) + path_expander (1.0.2) powerpack (0.1.1) + pry (0.10.4) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + public_suffix (2.0.5) rainbow (2.2.2) rake rake (12.0.0) + rb-fsevent (0.9.8) + rb-inotify (0.9.8) + ffi (>= 0.5.0) rdoc (5.1.0) + reek (4.6.2) + codeclimate-engine-rb (~> 0.4.0) + parser (>= 2.4.0.0, < 2.5) + rainbow (~> 2.0) + retriable (2.1.0) rspec (3.6.0) rspec-core (~> 3.6.0) rspec-expectations (~> 3.6.0) @@ -73,20 +163,43 @@ GEM rubocop-rspec (1.15.1) rubocop (>= 0.42.0) ruby-progressbar (1.8.1) + ruby_dep (1.5.0) + ruby_parser (3.9.0) + sexp_processor (~> 4.1) + rubycritic (3.2.1) + flay (~> 2.8) + flog (~> 4.4) + launchy (= 2.4.3) + parser (= 2.4.0) + rainbow (~> 2.1) + reek (~> 4.4) + ruby_parser (~> 3.8) + virtus (~> 1.0) + sawyer (0.8.1) + addressable (>= 2.3.5, < 2.6) + faraday (~> 0.8, < 1.0) + sexp_processor (4.9.0) + shellany (0.0.1) simplecov (0.14.1) docile (~> 1.1.0) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.0) + slop (3.6.0) sqlite3 (1.3.13) term-ansicolor (1.6.0) tins (~> 1.0) thor (0.19.4) thread_safe (0.3.6) - tins (1.13.3) + tins (1.14.0) tzinfo (1.2.3) thread_safe (~> 0.1) unicode-display_width (1.2.1) + virtus (1.0.5) + axiom-types (~> 0.1) + coercible (~> 1.0) + descendants_tracker (~> 0.0, >= 0.0.3) + equalizer (~> 0.0, >= 0.0.9) PLATFORMS ruby @@ -98,7 +211,13 @@ DEPENDENCIES codeclimate-test-reporter coveralls fuubar - machinist! + gem-release + github_changelog_generator + guard + guard-rspec + guard-rubocop + guard-rubycritic + machinist_redux! rdoc rspec rspec_junit_formatter diff --git a/gemfiles/rails_5.0.gemfile b/gemfiles/rails_5.0.gemfile index 82059d3..bda4439 100755 --- a/gemfiles/rails_5.0.gemfile +++ b/gemfiles/rails_5.0.gemfile @@ -7,9 +7,15 @@ ruby RUBY_VERSION gem "activerecord", "~> 5.0.3", group: :test, require: false group :development do - gem "appraisal", require: false - gem "rdoc", require: false - gem "rubocop-rspec", require: false + gem 'appraisal', require: false + gem 'gem-release', require: false + gem 'github_changelog_generator', require: false + gem 'guard', require: false + gem 'guard-rspec', require: false + gem 'guard-rubocop', require: false + gem 'guard-rubycritic', require: false + gem 'rdoc', require: false + gem 'rubocop-rspec', require: false end group :test do diff --git a/gemfiles/rails_5.0.gemfile.lock b/gemfiles/rails_5.0.gemfile.lock index 2f36786..a81bfc0 100644 --- a/gemfiles/rails_5.0.gemfile.lock +++ b/gemfiles/rails_5.0.gemfile.lock @@ -1,7 +1,7 @@ PATH remote: .. specs: - machinist (2.0) + machinist_redux (3.0.0) GEM remote: http://rubygems.org/ @@ -17,15 +17,26 @@ GEM i18n (~> 0.7) minitest (~> 5.1) tzinfo (~> 1.1) + addressable (2.5.1) + public_suffix (~> 2.0, >= 2.0.2) appraisal (2.2.0) bundler rake thor (>= 0.14.0) arel (7.1.4) ast (2.3.0) + axiom-types (0.1.1) + descendants_tracker (~> 0.0.4) + ice_nine (~> 0.11.0) + thread_safe (~> 0.3, >= 0.3.1) builder (3.2.3) + codeclimate-engine-rb (0.4.0) + virtus (~> 1.0) codeclimate-test-reporter (1.0.7) simplecov + coderay (1.1.1) + coercible (1.0.0) + descendants_tracker (~> 0.0.1) concurrent-ruby (1.0.5) coveralls (0.8.21) json (>= 1.8, < 3) @@ -33,21 +44,100 @@ GEM term-ansicolor (~> 1.3) thor (~> 0.19.4) tins (~> 1.6) + descendants_tracker (0.0.4) + thread_safe (~> 0.3, >= 0.3.1) diff-lcs (1.3) docile (1.1.5) + equalizer (0.0.11) + erubis (2.7.0) + faraday (0.12.1) + multipart-post (>= 1.2, < 3) + faraday-http-cache (2.0.0) + faraday (~> 0.8) + ffi (1.9.18) + flay (2.9.0) + erubis (~> 2.7.0) + path_expander (~> 1.0) + ruby_parser (~> 3.0) + sexp_processor (~> 4.0) + flog (4.6.1) + path_expander (~> 1.0) + ruby_parser (~> 3.1, > 3.1.0) + sexp_processor (~> 4.8) + formatador (0.2.5) fuubar (2.2.0) rspec-core (~> 3.0) ruby-progressbar (~> 1.4) + gem-release (1.0.0) + github_changelog_generator (1.14.3) + activesupport + faraday-http-cache + multi_json + octokit (~> 4.6) + rainbow (>= 2.1) + rake (>= 10.0) + retriable (~> 2.1) + guard (2.14.1) + formatador (>= 0.2.4) + listen (>= 2.7, < 4.0) + lumberjack (~> 1.0) + nenv (~> 0.1) + notiffany (~> 0.0) + pry (>= 0.9.12) + shellany (~> 0.0) + thor (>= 0.18.1) + guard-compat (1.2.1) + guard-rspec (4.7.3) + guard (~> 2.1) + guard-compat (~> 1.1) + rspec (>= 2.99.0, < 4.0) + guard-rubocop (1.2.0) + guard (~> 2.0) + rubocop (~> 0.20) + guard-rubycritic (2.9.3) + guard (~> 2.6) + rubycritic (>= 2.9.3) i18n (0.8.1) + ice_nine (0.11.2) json (2.1.0) + launchy (2.4.3) + addressable (~> 2.3) + listen (3.1.5) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + ruby_dep (~> 1.2) + lumberjack (1.0.12) + method_source (0.8.2) minitest (5.10.2) + multi_json (1.12.1) + multipart-post (2.0.0) + nenv (0.3.0) + notiffany (0.1.1) + nenv (~> 0.1) + shellany (~> 0.0) + octokit (4.7.0) + sawyer (~> 0.8.0, >= 0.5.3) parser (2.4.0.0) ast (~> 2.2) + path_expander (1.0.2) powerpack (0.1.1) + pry (0.10.4) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + public_suffix (2.0.5) rainbow (2.2.2) rake rake (12.0.0) + rb-fsevent (0.9.8) + rb-inotify (0.9.8) + ffi (>= 0.5.0) rdoc (5.1.0) + reek (4.6.2) + codeclimate-engine-rb (~> 0.4.0) + parser (>= 2.4.0.0, < 2.5) + rainbow (~> 2.0) + retriable (2.1.0) rspec (3.6.0) rspec-core (~> 3.6.0) rspec-expectations (~> 3.6.0) @@ -73,20 +163,43 @@ GEM rubocop-rspec (1.15.1) rubocop (>= 0.42.0) ruby-progressbar (1.8.1) + ruby_dep (1.5.0) + ruby_parser (3.9.0) + sexp_processor (~> 4.1) + rubycritic (3.2.1) + flay (~> 2.8) + flog (~> 4.4) + launchy (= 2.4.3) + parser (= 2.4.0) + rainbow (~> 2.1) + reek (~> 4.4) + ruby_parser (~> 3.8) + virtus (~> 1.0) + sawyer (0.8.1) + addressable (>= 2.3.5, < 2.6) + faraday (~> 0.8, < 1.0) + sexp_processor (4.9.0) + shellany (0.0.1) simplecov (0.14.1) docile (~> 1.1.0) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.0) + slop (3.6.0) sqlite3 (1.3.13) term-ansicolor (1.6.0) tins (~> 1.0) thor (0.19.4) thread_safe (0.3.6) - tins (1.13.3) + tins (1.14.0) tzinfo (1.2.3) thread_safe (~> 0.1) unicode-display_width (1.2.1) + virtus (1.0.5) + axiom-types (~> 0.1) + coercible (~> 1.0) + descendants_tracker (~> 0.0, >= 0.0.3) + equalizer (~> 0.0, >= 0.0.9) PLATFORMS ruby @@ -98,7 +211,13 @@ DEPENDENCIES codeclimate-test-reporter coveralls fuubar - machinist! + gem-release + github_changelog_generator + guard + guard-rspec + guard-rubocop + guard-rubycritic + machinist_redux! rdoc rspec rspec_junit_formatter diff --git a/gemfiles/rails_5.1.gemfile b/gemfiles/rails_5.1.gemfile index a4a49e9..8326325 100755 --- a/gemfiles/rails_5.1.gemfile +++ b/gemfiles/rails_5.1.gemfile @@ -7,9 +7,15 @@ ruby RUBY_VERSION gem "activerecord", "~> 5.1.1", group: :test, require: false group :development do - gem "appraisal", require: false - gem "rdoc", require: false - gem "rubocop-rspec", require: false + gem 'appraisal', require: false + gem 'gem-release', require: false + gem 'github_changelog_generator', require: false + gem 'guard', require: false + gem 'guard-rspec', require: false + gem 'guard-rubocop', require: false + gem 'guard-rubycritic', require: false + gem 'rdoc', require: false + gem 'rubocop-rspec', require: false end group :test do @@ -25,8 +31,4 @@ platforms :ruby do gem "sqlite3" end -platforms :jruby do - gem "activerecord-jdbcsqlite3-adapter" -end - gemspec path: "../" diff --git a/gemfiles/rails_5.1.gemfile.lock b/gemfiles/rails_5.1.gemfile.lock index b39ad5b..498edf1 100644 --- a/gemfiles/rails_5.1.gemfile.lock +++ b/gemfiles/rails_5.1.gemfile.lock @@ -1,7 +1,7 @@ PATH remote: .. specs: - machinist (2.0) + machinist_redux (3.0.0) GEM remote: http://rubygems.org/ @@ -17,15 +17,26 @@ GEM i18n (~> 0.7) minitest (~> 5.1) tzinfo (~> 1.1) + addressable (2.5.1) + public_suffix (~> 2.0, >= 2.0.2) appraisal (2.2.0) bundler rake thor (>= 0.14.0) arel (8.0.0) ast (2.3.0) + axiom-types (0.1.1) + descendants_tracker (~> 0.0.4) + ice_nine (~> 0.11.0) + thread_safe (~> 0.3, >= 0.3.1) builder (3.2.3) + codeclimate-engine-rb (0.4.0) + virtus (~> 1.0) codeclimate-test-reporter (1.0.7) simplecov + coderay (1.1.1) + coercible (1.0.0) + descendants_tracker (~> 0.0.1) concurrent-ruby (1.0.5) coveralls (0.8.21) json (>= 1.8, < 3) @@ -33,21 +44,100 @@ GEM term-ansicolor (~> 1.3) thor (~> 0.19.4) tins (~> 1.6) + descendants_tracker (0.0.4) + thread_safe (~> 0.3, >= 0.3.1) diff-lcs (1.3) docile (1.1.5) + equalizer (0.0.11) + erubis (2.7.0) + faraday (0.12.1) + multipart-post (>= 1.2, < 3) + faraday-http-cache (2.0.0) + faraday (~> 0.8) + ffi (1.9.18) + flay (2.9.0) + erubis (~> 2.7.0) + path_expander (~> 1.0) + ruby_parser (~> 3.0) + sexp_processor (~> 4.0) + flog (4.6.1) + path_expander (~> 1.0) + ruby_parser (~> 3.1, > 3.1.0) + sexp_processor (~> 4.8) + formatador (0.2.5) fuubar (2.2.0) rspec-core (~> 3.0) ruby-progressbar (~> 1.4) + gem-release (1.0.0) + github_changelog_generator (1.14.3) + activesupport + faraday-http-cache + multi_json + octokit (~> 4.6) + rainbow (>= 2.1) + rake (>= 10.0) + retriable (~> 2.1) + guard (2.14.1) + formatador (>= 0.2.4) + listen (>= 2.7, < 4.0) + lumberjack (~> 1.0) + nenv (~> 0.1) + notiffany (~> 0.0) + pry (>= 0.9.12) + shellany (~> 0.0) + thor (>= 0.18.1) + guard-compat (1.2.1) + guard-rspec (4.7.3) + guard (~> 2.1) + guard-compat (~> 1.1) + rspec (>= 2.99.0, < 4.0) + guard-rubocop (1.2.0) + guard (~> 2.0) + rubocop (~> 0.20) + guard-rubycritic (2.9.3) + guard (~> 2.6) + rubycritic (>= 2.9.3) i18n (0.8.1) + ice_nine (0.11.2) json (2.1.0) + launchy (2.4.3) + addressable (~> 2.3) + listen (3.1.5) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + ruby_dep (~> 1.2) + lumberjack (1.0.12) + method_source (0.8.2) minitest (5.10.2) + multi_json (1.12.1) + multipart-post (2.0.0) + nenv (0.3.0) + notiffany (0.1.1) + nenv (~> 0.1) + shellany (~> 0.0) + octokit (4.7.0) + sawyer (~> 0.8.0, >= 0.5.3) parser (2.4.0.0) ast (~> 2.2) + path_expander (1.0.2) powerpack (0.1.1) + pry (0.10.4) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + public_suffix (2.0.5) rainbow (2.2.2) rake rake (12.0.0) + rb-fsevent (0.9.8) + rb-inotify (0.9.8) + ffi (>= 0.5.0) rdoc (5.1.0) + reek (4.6.2) + codeclimate-engine-rb (~> 0.4.0) + parser (>= 2.4.0.0, < 2.5) + rainbow (~> 2.0) + retriable (2.1.0) rspec (3.6.0) rspec-core (~> 3.6.0) rspec-expectations (~> 3.6.0) @@ -73,32 +163,60 @@ GEM rubocop-rspec (1.15.1) rubocop (>= 0.42.0) ruby-progressbar (1.8.1) + ruby_dep (1.5.0) + ruby_parser (3.9.0) + sexp_processor (~> 4.1) + rubycritic (3.2.1) + flay (~> 2.8) + flog (~> 4.4) + launchy (= 2.4.3) + parser (= 2.4.0) + rainbow (~> 2.1) + reek (~> 4.4) + ruby_parser (~> 3.8) + virtus (~> 1.0) + sawyer (0.8.1) + addressable (>= 2.3.5, < 2.6) + faraday (~> 0.8, < 1.0) + sexp_processor (4.9.0) + shellany (0.0.1) simplecov (0.14.1) docile (~> 1.1.0) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.0) + slop (3.6.0) sqlite3 (1.3.13) term-ansicolor (1.6.0) tins (~> 1.0) thor (0.19.4) thread_safe (0.3.6) - tins (1.13.3) + tins (1.14.0) tzinfo (1.2.3) thread_safe (~> 0.1) unicode-display_width (1.2.1) + virtus (1.0.5) + axiom-types (~> 0.1) + coercible (~> 1.0) + descendants_tracker (~> 0.0, >= 0.0.3) + equalizer (~> 0.0, >= 0.0.9) PLATFORMS ruby DEPENDENCIES activerecord (~> 5.1.1) - activerecord-jdbcsqlite3-adapter appraisal codeclimate-test-reporter coveralls fuubar - machinist! + gem-release + github_changelog_generator + guard + guard-rspec + guard-rubocop + guard-rubycritic + machinist_redux! rdoc rspec rspec_junit_formatter diff --git a/lib/machinist/active_record/blueprint.rb b/lib/machinist/active_record/blueprint.rb old mode 100644 new mode 100755 diff --git a/lib/machinist/version.rb b/lib/machinist/version.rb old mode 100644 new mode 100755 index ce22243..125306b --- a/lib/machinist/version.rb +++ b/lib/machinist/version.rb @@ -1,3 +1,3 @@ module Machinist - VERSION = '2.0'.freeze + VERSION = '3.0.0'.freeze end diff --git a/machinist.gemspec b/machinist.gemspec index 77bd979..fb5634d 100755 --- a/machinist.gemspec +++ b/machinist.gemspec @@ -5,15 +5,16 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'machinist/version' Gem::Specification.new do |gem| - gem.name = 'machinist' + gem.name = 'machinist_redux' gem.version = Machinist::VERSION gem.authors = ['Pete Yandell', 'Attila Györffy', 'Dominic Sayers'] gem.email = ['dominic@sayers.cc'] gem.description = 'Machinist makes it easy to create objects for use in tests. It generates data for the ' \ "attributes you don't care about, and constructs any necessary associated objects, leaving you "\ 'to specify only the fields you care about in your test.' - gem.summary = "Fixtures aren't fun. Machinist is." - gem.homepage = 'http://github.com/liquid/machinist' + gem.summary = "Fixtures aren't fun. Machinist was." + gem.homepage = 'http://github.com/dominicsayers/machinist' + gem.license = 'MIT' gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR) gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }