simple_fixture 0.1.0 → 0.1.1

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
- SHA1:
3
- metadata.gz: e200f3cabef062873b83abd891a805da6ed80ae9
4
- data.tar.gz: 6623003d66dbc648ba9367be234036821e09997f
2
+ SHA256:
3
+ metadata.gz: 46051296e22db7db77e82e16ee69ec859d2046dc4a3ed28b0fca3417b589eb6e
4
+ data.tar.gz: ad62526409460ea32e13b4883c09549d24f63496e86f908e1414c24115b84a5f
5
5
  SHA512:
6
- metadata.gz: e01922efd3734920b644927c01fee94b263715ac2d5bf8ff40c319e38eba1b2d17d3f15535f3dcdfe79437c9a3fc6684b69c334b17ebd7816da570997bca8b29
7
- data.tar.gz: 351922a88154b31afea01e328123bfd36283d748cc78eb80f9aadcc0b0962aa8c45695f2e42b13067891eb2b8682500d8991219a8b42f8429fbcff2d9a23bfb4
6
+ metadata.gz: c20eb6aeea7e592826a6114932492a151dab8c6cca17f7755b8d48251686c581a004f285fb12bbeb5aeaeb0810996f289faae6ff05181ea01b4191c625bc36e3
7
+ data.tar.gz: 8c0b7fa3e9fb6b0bf6ad848ac5be0b0e7fbb7bc5330f6a247b2c7d9ba1b7b71673239ac3947b28c835d1029f61eb71017338c94753ba6f55d77db3e89a631700
data/README.md CHANGED
@@ -20,7 +20,7 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- You should have directory `test/simple_fixture` in your project, with structure as below. (You can check file content examples in this gem's test directory)
23
+ You should have directory `test/simple_fixture` in your project, with structure as below. You can run `simple-fixture` to generate it. Also check file content examples in this gem's test directory.
24
24
 
25
25
  ```
26
26
  test
@@ -35,7 +35,7 @@ test
35
35
  └── test_helper.rb
36
36
  ```
37
37
 
38
- Then call `SimpleFixture.new`, fixtures will be loaded into a new sqlite file in directory `tmp/` of your project, and you can use ActiveRecord to find them, such as `Order.where(...)`.
38
+ Then call `SimpleFixture.new`, or just `require 'simple_fixture/load'`, then fixtures will be loaded into a new sqlite file in directory `tmp/` of your project, and you can use ActiveRecord to find them, such as `Order.where(...)`.
39
39
 
40
40
  ## Development
41
41
 
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'simple_fixture'
4
+ require 'fileutils'
5
+
6
+ if Dir.exists? SimpleFixture::CONFIG_DIR
7
+ STDERR.puts "#{SimpleFixture::CONFIG_DIR} already exists !"
8
+ return
9
+ end
10
+
11
+ FileUtils.mkdir_p SimpleFixture::FIXTURES_DIR
12
+
13
+ File.write SimpleFixture::MODELS_FILE, <<-EOF
14
+ class Thing < ActiveRecord::Base
15
+ end
16
+ EOF
17
+
18
+ File.write SimpleFixture::MIGRATION_FILE, <<-EOF
19
+ SimpleFixture.migrate do
20
+ create_table :things do |t|
21
+ end
22
+ end
23
+ EOF
24
+
25
+ puts 'simple_fixture structure done !'
@@ -0,0 +1,3 @@
1
+ require 'simple_fixture'
2
+
3
+ SimpleFixture.new
@@ -1,3 +1,3 @@
1
1
  class SimpleFixture
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -8,6 +8,8 @@ class SimpleFixture
8
8
  DB_NAME = 'simple_fixture'
9
9
  CONFIG_DIR = File.join('test', 'simple_fixture')
10
10
  FIXTURES_DIR = File.join(CONFIG_DIR, 'fixtures')
11
+ MIGRATION_FILE = File.join(CONFIG_DIR, 'migration.rb')
12
+ MODELS_FILE = File.join(CONFIG_DIR, 'models.rb')
11
13
 
12
14
  class << self
13
15
  def migrate(&block)
@@ -23,12 +25,10 @@ class SimpleFixture
23
25
  build_db_file
24
26
  establish_connection
25
27
 
26
- load File.join(CONFIG_DIR, 'migration.rb')
27
- load File.join(CONFIG_DIR, 'models.rb')
28
28
  ActiveRecord::Base.logger = Logger.new(STDOUT)
29
+ load MIGRATION_FILE
30
+ load MODELS_FILE
29
31
  ActiveRecord::FixtureSet.create_fixtures(FIXTURES_DIR, ymls)
30
-
31
- true
32
32
  end
33
33
 
34
34
  private
@@ -18,8 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
19
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
20
  end
21
- spec.bindir = "exe"
22
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.bindir = "bin"
22
+ spec.executables = ["simple-fixture"]
23
23
  spec.require_paths = ["lib"]
24
24
 
25
25
  spec.add_development_dependency "bundler", "~> 2.0"
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_fixture
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ken
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2019-10-10 00:00:00.000000000 Z
12
12
  dependencies:
@@ -97,7 +97,8 @@ dependencies:
97
97
  description:
98
98
  email:
99
99
  - block24block@gmail.com
100
- executables: []
100
+ executables:
101
+ - simple-fixture
101
102
  extensions: []
102
103
  extra_rdoc_files: []
103
104
  files:
@@ -110,7 +111,9 @@ files:
110
111
  - Rakefile
111
112
  - bin/console
112
113
  - bin/setup
114
+ - bin/simple-fixture
113
115
  - lib/simple_fixture.rb
116
+ - lib/simple_fixture/load.rb
114
117
  - lib/simple_fixture/version.rb
115
118
  - simple_fixture.gemspec
116
119
  homepage: https://github.com/turnon/simple_fixture
@@ -132,8 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
135
  - !ruby/object:Gem::Version
133
136
  version: '0'
134
137
  requirements: []
135
- rubyforge_project:
136
- rubygems_version: 2.5.2.3
138
+ rubygems_version: 3.0.3
137
139
  signing_key:
138
140
  specification_version: 4
139
141
  summary: help create fixtures off rails project