rails_4_backports 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 789b024f43cee33e28a9727ece7f775036c0146f
4
- data.tar.gz: 8b1d9c0af59b4ea2309eddab648e4d793ea268d7
3
+ metadata.gz: e122f7523c46c42c1a8c1e30415f8851eafb6175
4
+ data.tar.gz: 726a74ea5f2faaca8ac0aa77838943fc03fdd7ad
5
5
  SHA512:
6
- metadata.gz: 1e81bfdb3ce3e1de934ce14b7e35fc52de4f2145aeaade6edf55a2238eb02b8b4bf341750a0357cb5c0e8a113dc9e1147e54bb2a28da4e84a67fa2634fab4a50
7
- data.tar.gz: 54e497d984a6a9577ad184ba2ad7171377003e9374f88e917bcf2f8108dd4fde04a10fedbcb42d5c3b3b3aa821ef128a665347db15eb58d278f0b72cdbde164d
6
+ metadata.gz: d5ebc934324880bb7b4080cf68398a259491504dc7319405f62871e9554c391f86cefbefdc1ed99455d996852a023ed556c74d65f8cef169d03a5bfb08caa3bb
7
+ data.tar.gz: c53045afb6bcf1a7fb490ae6313c987d9b32b7178f19a617d26d6ce5602865a02b51d5de0370df3e0c9610da53154f96a51d5b3dea626271251f0cb6f2fa9bc1
@@ -0,0 +1,11 @@
1
+ # Change Log
2
+ All notable changes to this project will be documented in this file.
3
+ This project adheres to [Semantic Versioning](http://semver.org/).
4
+ This changelog adheres to [Keep a CHANGELOG](http://keepachangelog.com/).
5
+
6
+ ## Unreleased
7
+
8
+ ## 0.2.0
9
+ ### Added
10
+ - [TT-1392] Changelog file
11
+ - [TT-2759] Backport rails file_fixture method
@@ -1,15 +1,21 @@
1
1
  require "rails_4_backports/version"
2
2
 
3
3
  module Rails4Backports
4
- require 'rails_4_backports/active_record_dynamic_finders'
5
- if ::ActiveRecord::VERSION::MAJOR == 3
6
- ActiveRecord::Base.send(:extend, ActiveRecordDynamicFinders)
4
+ if defined?(ActiveRecord)
5
+ require 'rails_4_backports/active_record_dynamic_finders'
6
+ if ::ActiveRecord::VERSION::MAJOR == 3
7
+ ActiveRecord::Base.send(:extend, ActiveRecordDynamicFinders)
8
+ end
7
9
  end
8
10
 
9
- class Railtie < ::Rails::Railtie
10
- config.before_initialize do |app|
11
- require 'rails-secrets'
12
- app.config.secret_token ||= app.secrets.secret_key_base
11
+ require 'rails_4_backports/file_fixtures'
12
+
13
+ if defined?(Rails)
14
+ class Railtie < ::Rails::Railtie
15
+ config.before_initialize do |app|
16
+ require 'rails-secrets'
17
+ app.config.secret_token ||= app.secrets.secret_key_base
18
+ end
13
19
  end
14
20
  end
15
21
  end
@@ -0,0 +1,38 @@
1
+ # Methods backported from Rails 5:
2
+ # http://api.rubyonrails.org/classes/ActiveSupport/Testing/FileFixtures.html
3
+ module Rails4Backports
4
+ module Testing
5
+ # Adds simple access to sample files called file fixtures.
6
+ # File fixtures are normal files stored in
7
+ # <tt>ActiveSupport::TestCase.file_fixture_path</tt>.
8
+ #
9
+ # File fixtures are represented as +Pathname+ objects.
10
+ # This makes it easy to extract specific information:
11
+ #
12
+ # file_fixture("example.txt").read # get the file's content
13
+ # file_fixture("example.mp3").size # get the file size
14
+ module FileFixtures
15
+ def self.file_fixture_path=(path)
16
+ @path = path
17
+ end
18
+
19
+ def self.file_fixture_path
20
+ @path
21
+ end
22
+
23
+ # Returns a +Pathname+ to the fixture file named +fixture_name+.
24
+ #
25
+ # Raises +ArgumentError+ if +fixture_name+ can't be found.
26
+ def self.file_fixture(fixture_name)
27
+ path = Pathname.new(File.join(file_fixture_path, fixture_name))
28
+
29
+ if path.exist?
30
+ path
31
+ else
32
+ msg = "the directory '%s' does not contain a file named '%s'"
33
+ raise ArgumentError, msg % [file_fixture_path, fixture_name]
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -1,3 +1,3 @@
1
1
  module Rails4Backports
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_4_backports
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Noack
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-06-20 00:00:00.000000000 Z
11
+ date: 2017-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails-secrets
@@ -76,6 +76,7 @@ files:
76
76
  - ".gitignore"
77
77
  - ".rspec"
78
78
  - ".travis.yml"
79
+ - CHANGELOG.md
79
80
  - Gemfile
80
81
  - LICENSE.txt
81
82
  - README.md
@@ -84,6 +85,7 @@ files:
84
85
  - bin/setup
85
86
  - lib/rails_4_backports.rb
86
87
  - lib/rails_4_backports/active_record_dynamic_finders.rb
88
+ - lib/rails_4_backports/file_fixtures.rb
87
89
  - lib/rails_4_backports/version.rb
88
90
  - rails_4_backports.gemspec
89
91
  homepage: https://github.com/sealink/rails_4_backports
@@ -106,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
108
  version: '0'
107
109
  requirements: []
108
110
  rubyforge_project:
109
- rubygems_version: 2.4.8
111
+ rubygems_version: 2.5.1
110
112
  signing_key:
111
113
  specification_version: 4
112
114
  summary: Backports of rails 4 functionality, such as find_by and secrets.