declare_schema 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c1bc236be22c712ca8a65ef4ed294301fc7d2021167dd0e2501066abe30b3ba
4
- data.tar.gz: b41b86f51293569be553bab41fc245601ad82f98f4546af8d5d9d46601070fe3
3
+ metadata.gz: 04233cec7c3c0cbcabde6b7731bc106bca8f416409c765af38eb5320d119824c
4
+ data.tar.gz: fc3f6b420e002fa41fd69c2c07e7013b3de4098b6033f9fc1dfc09947b9897ae
5
5
  SHA512:
6
- metadata.gz: 3a7b1808736b5f6c1ed69eb88a6afa7a69dbc6fcb014fbd5afb23734abd177348440caf5394ba941e66f6473011fae7543ce5b1e43b81ec8231ab3abfc369627
7
- data.tar.gz: b96afd3ecfc86d51a795e43f5b04859d7e45c7869ffcf9f21a6a8a63da05e8499dd03b66e4e951b967f0e4feb8d21c2c0cf6aa88e952e53b3254c12ab541e0eb
6
+ metadata.gz: 89dfe6be533b57ee00b598fe3e5ed39005fb613e0b9b873623c780debe024cf3e10044114d902db6c26bb471e94212732a709d380383a2411d60b87d76e180aa
7
+ data.tar.gz: 71e59b6eddc79a1a2dccac6c8fecaa4d6c41cb99032311df9ec595a2c2c8098a845dd5409eb245d3489ad7a6135be88b78f27a511fda348200f7c120a964c8d4
@@ -0,0 +1,37 @@
1
+ ---
2
+ dist: trusty
3
+ os: linux
4
+ language: ruby
5
+ cache: bundler
6
+ rvm:
7
+ - 2.4.5
8
+ - 2.5.8
9
+ - 2.6.5
10
+ - 2.7.1
11
+ - ruby-head
12
+ gemfile:
13
+ - gemfiles/rails_4.gemfile
14
+ - gemfiles/rails_5.gemfile
15
+ - gemfiles/rails_6.gemfile
16
+ jobs:
17
+ fast_finish: false
18
+ exclude:
19
+ - gemfile: gemfiles/rails_4.gemfile
20
+ rvm: 2.7.1
21
+ - gemfile: gemfiles/rails_5.gemfile
22
+ rvm: 2.4.5
23
+ - gemfile: gemfiles/rails_6.gemfile
24
+ rvm: 2.4.5
25
+ allow_failures:
26
+ - rvm: ruby-head
27
+ before_install:
28
+ - rm -f /home/travis/.rvm/rubies/ruby-2.*/lib/ruby/gems/2.*/specifications/default/bundler-2.*.gemspec
29
+ - echo y | rvm @global do gem install bundler -v 1.17.3 --force --default
30
+ - gem install bundler -v 1.17.3 --force --default
31
+ - gem install bundler -v 1.17.3
32
+ install:
33
+ - bundle --version
34
+ - bundle install --jobs=3 --retry=3 --path=${BUNDLE_PATH:-vendor/bundle}
35
+ script:
36
+ - bundle exec rake test:prepare_testapp[force]
37
+ - bundle exec rake test:all < test_responses.txt
@@ -1,11 +1,17 @@
1
- # CHANGELOG for `declarative_schema`
1
+ # CHANGELOG for `declare_schema`
2
2
 
3
3
  Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
5
  Note: this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## [0.1.0] - Unreleased
7
+ ## [0.1.2] - 2020-09-29
8
+ ### Changed
9
+ - Added travis support and created 2 specs as a starting point.
10
+
11
+
12
+ ## [0.1.1] - 2020-09-24
8
13
  ### Added
9
- - Initial version from https://github.com/Invoca/declare_schema v4.0.0.
14
+ - Initial version from https://github.com/Invoca/hobo_fields v4.1.0.
10
15
 
11
- [0.1.0]: https://github.com/Invoca/declarative_schema/tree/v0.1.0
16
+ [0.1.2]: https://github.com/Invoca/declare_schema/compare/v0.1.1...v0.1.2
17
+ [0.1.1]: https://github.com/Invoca/declare_schema/tree/v0.1.1
data/Gemfile CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  source 'https://rubygems.org'
4
- source 'https://gem.fury.io/invoca'
5
4
 
6
5
  gemspec
7
6
 
@@ -1,12 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- declare_schema (0.1.1)
4
+ declare_schema (0.1.2)
5
5
  rails (>= 4.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
- remote: https://gem.fury.io/invoca/
10
9
  specs:
11
10
  actioncable (5.2.4.4)
12
11
  actionpack (= 5.2.4.4)
data/Rakefile CHANGED
@@ -29,7 +29,7 @@ namespace "test" do
29
29
  desc "Run the doctests"
30
30
  task :doctest do |_t|
31
31
  files = Dir['test/*.rdoctest'].sort.map { |f| File.expand_path(f) }.join(' ')
32
- system("#{RUBYDOCTEST} #{files}") or exit(1)
32
+ system("#{RUBYDOCTEST} --trace --verbose #{files}") or exit(1)
33
33
  end
34
34
 
35
35
  desc "Prepare a rails application for testing"
@@ -1,25 +1,23 @@
1
- # frozen_string_literal: true
2
-
3
1
  # This file was generated by Appraisal
4
2
 
5
3
  source "https://rubygems.org"
6
- source "https://gem.fury.io/invoca"
7
4
 
8
5
  gem "appraisal"
6
+ gem "bundler", "< 2"
7
+ gem "climate_control", "~> 0.2"
9
8
  gem "pry"
10
9
  gem "pry-byebug"
11
10
  gem "rails", "~> 4.2"
12
11
  gem "responders"
12
+ gem "rspec"
13
+ gem "rubocop"
13
14
  gem "rubydoctest"
14
15
  gem "sqlite3", "~> 1.3.0"
15
- gem "test_overrides"
16
16
  gem "yard"
17
17
 
18
18
  group :testapp do
19
19
  gem "bootsnap", ">= 1.1.0", require: false
20
- gem "kramdown"
21
20
  gem "listen"
22
- gem "RedCloth"
23
21
  end
24
22
 
25
23
  gemspec path: "../"
@@ -1,25 +1,23 @@
1
- # frozen_string_literal: true
2
-
3
1
  # This file was generated by Appraisal
4
2
 
5
3
  source "https://rubygems.org"
6
- source "https://gem.fury.io/invoca"
7
4
 
8
5
  gem "appraisal"
6
+ gem "bundler", "< 2"
7
+ gem "climate_control", "~> 0.2"
9
8
  gem "pry"
10
9
  gem "pry-byebug"
11
10
  gem "rails", "~> 5.2"
12
11
  gem "responders"
12
+ gem "rspec"
13
+ gem "rubocop"
13
14
  gem "rubydoctest"
14
15
  gem "sqlite3"
15
- gem "test_overrides"
16
16
  gem "yard"
17
17
 
18
18
  group :testapp do
19
19
  gem "bootsnap", ">= 1.1.0", require: false
20
- gem "kramdown"
21
20
  gem "listen"
22
- gem "RedCloth"
23
21
  end
24
22
 
25
23
  gemspec path: "../"
@@ -1,25 +1,23 @@
1
- # frozen_string_literal: true
2
-
3
1
  # This file was generated by Appraisal
4
2
 
5
3
  source "https://rubygems.org"
6
- source "https://gem.fury.io/invoca"
7
4
 
8
5
  gem "appraisal"
6
+ gem "bundler", "< 2"
7
+ gem "climate_control", "~> 0.2"
9
8
  gem "pry"
10
9
  gem "pry-byebug"
11
10
  gem "rails", "~> 6.0"
12
11
  gem "responders"
12
+ gem "rspec"
13
+ gem "rubocop"
13
14
  gem "rubydoctest"
14
15
  gem "sqlite3"
15
- gem "test_overrides"
16
16
  gem "yard"
17
17
 
18
18
  group :testapp do
19
19
  gem "bootsnap", ">= 1.1.0", require: false
20
- gem "kramdown"
21
20
  gem "listen"
22
- gem "RedCloth"
23
21
  end
24
22
 
25
23
  gemspec path: "../"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeclareSchema
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
@@ -3,6 +3,7 @@
3
3
  require 'rails/generators/migration'
4
4
  require 'rails/generators/active_record'
5
5
  require 'generators/declare_schema/support/thor_shell'
6
+ require_relative '../../../declare_schema/model/field_spec'
6
7
 
7
8
  module DeclareSchema
8
9
  class MigrationGenerator < Rails::Generators::Base
@@ -218,13 +218,18 @@ module Generators
218
218
  end
219
219
 
220
220
  def always_ignore_tables
221
- # TODO: figure out how to do this in a sane way and be compatible with 2.2 and 2.3 - class has moved
222
- if defined?(CGI::Session::ActiveRecordStore::Session) &&
223
- defined?(ActionController::Base) &&
224
- ActionController::Base.session_store == CGI::Session::ActiveRecordStore
225
- sessions_table = CGI::Session::ActiveRecordStore::Session.table_name
226
- end
227
- ['schema_info', 'schema_migrations', 'simple_sesions', sessions_table].compact
221
+ sessions_table =
222
+ begin
223
+ if defined?(CGI::Session::ActiveRecordStore::Session) &&
224
+ defined?(ActionController::Base) &&
225
+ ActionController::Base.session_store == CGI::Session::ActiveRecordStore
226
+ CGI::Session::ActiveRecordStore::Session.table_name
227
+ end
228
+ rescue
229
+ nil
230
+ end
231
+
232
+ ['schema_info', 'schema_migrations', 'ar_internal_metadata', sessions_table].compact
228
233
  end
229
234
 
230
235
  def generate
@@ -2,7 +2,7 @@ doctest: prepare testapp environment
2
2
  doctest_require: 'prepare_testapp'
3
3
 
4
4
  doctest: generate declare_schema:model
5
- >> Rails::Generators.invoke 'declare_schema:model', %w(alpha/beta one:string two:integer)
5
+ >> begin; Rails::Generators.invoke 'declare_schema:model', %w(alpha/beta one:string two:integer); rescue => ex; $stderr.puts "#{ex.class}: #{ex}\n#{ex.backtrace.join("\n")}"; end
6
6
 
7
7
 
8
8
  doctest: model file exists
@@ -43,16 +43,18 @@ doctest: fixture file exists
43
43
 
44
44
 
45
45
  doctest: generate declare_schema:migration
46
- >> require_relative "#{Rails.root}/app/models/alpha.rb" if Rails::VERSION::MAJOR > 5
47
- >> require_relative "#{Rails.root}/app/models/alpha/beta.rb" if Rails::VERSION::MAJOR > 5
46
+ >> puts "#{Rails.root}/app/models/alpha.rb"
47
+ >> require "#{Rails.root}/app/models/alpha.rb" if Rails::VERSION::MAJOR > 4
48
+ >> require "#{Rails.root}/app/models/alpha/beta.rb" if Rails::VERSION::MAJOR > 4
48
49
  >> Rails::Generators.invoke 'declare_schema:migration', %w(-n -m)
49
50
 
50
51
  doctest: schema.rb file exists
52
+ >> system("ls -al db")
51
53
  >> File.exist? 'db/schema.rb'
52
54
  => true
53
55
 
54
56
  doctest: db file exists
55
- >> File.exist? 'db/development.sqlite3'
57
+ >> File.exist?("db/development.sqlite3") || File.exist?("db/test.sqlite3")
56
58
  => true
57
59
 
58
60
  doctest: Alpha::Beta class exists
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: declare_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Invoca Development adapted from hobo_fields by Tom Locke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-24 00:00:00.000000000 Z
11
+ date: 2020-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -35,11 +35,10 @@ files:
35
35
  - ".dependabot/config.yml"
36
36
  - ".github/workflows/gem_release.yml"
37
37
  - ".gitignore"
38
- - ".jenkins/Jenkinsfile"
39
- - ".jenkins/ruby_build_pod.yml"
40
38
  - ".rspec"
41
39
  - ".rubocop.yml"
42
40
  - ".ruby-version"
41
+ - ".travis.yml"
43
42
  - Appraisals
44
43
  - CHANGELOG.md
45
44
  - Gemfile
@@ -1,72 +0,0 @@
1
- #!/usr/bin/groovy
2
- @Library('jenkins-pipeline@v0.5.1')
3
- import com.invoca.ci.*;
4
-
5
- pipeline {
6
- agent {
7
- kubernetes {
8
- defaultContainer 'ruby'
9
- yamlFile '.jenkins/ruby_build_pod.yml'
10
- }
11
- }
12
-
13
- environment {
14
- GITHUB_TOKEN = credentials('github_token')
15
- BUNDLE_GEM__FURY__IO = credentials('gemfury_deploy_token')
16
- }
17
-
18
- stages {
19
- stage('Setup') {
20
- steps {
21
- updateGitHubStatus('clean-build', 'pending', "Running unit tests")
22
- sh 'bundle install'
23
- sh 'bundle exec appraisal install'
24
- }
25
- }
26
-
27
- stage("Current Unit Tests") {
28
- steps {
29
- sh 'bundle exec rake test:prepare_testapp[force]'
30
- sh 'bundle exec rake test:all < test_responses.txt'
31
- }
32
- }
33
-
34
- stage("Rails 4 Appraisal") {
35
- steps {
36
- sh 'bundle exec appraisal rails-4 rake test:prepare_testapp[force]'
37
- sh 'bundle exec appraisal rails-4 rake test:all < test_responses.txt'
38
- }
39
- }
40
-
41
- stage("Rails 5 Appraisal") {
42
- steps {
43
- sh 'bundle exec appraisal rails-5 rake test:prepare_testapp[force]'
44
- sh 'bundle exec appraisal rails-5 rake test:all < test_responses.txt'
45
- }
46
- }
47
-
48
- stage("Rails 6 Appraisal") {
49
- steps {
50
- sh 'bundle exec appraisal rails-6 rake test:prepare_testapp[force]'
51
- sh 'bundle exec appraisal rails-6 rake test:all < test_responses.txt'
52
- }
53
- }
54
- }
55
-
56
- post {
57
- success { updateGitHubStatus('clean-build', 'success', "Unit tests passed") }
58
- failure { updateGitHubStatus('clean-build', 'failure', "Unit tests failed") }
59
- }
60
- }
61
-
62
- void updateGitHubStatus(String context, String status, String description) {
63
- gitHubStatus([
64
- repoSlug: 'Invoca/declare_schema',
65
- sha: env.GIT_COMMIT,
66
- description: description,
67
- context: context,
68
- targetURL: env.RUN_DISPLAY_URL,
69
- token: env.GITHUB_TOKEN,
70
- status: status
71
- ])
72
- }
@@ -1,19 +0,0 @@
1
-
2
- ---
3
- apiVersion: v1
4
- kind: Pod
5
- metadata:
6
- labels:
7
- jenkins/declare_schema: 'true'
8
- namespace: jenkins
9
- name: declare_schema
10
- spec:
11
- containers:
12
- - name: ruby
13
- image: ruby:2.6.5
14
- tty: true
15
- resources:
16
- requests:
17
- memory: "100Mi"
18
- command:
19
- - cat