rails_edge_test 1.2.2 → 2.0.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.
data/nix/sources.json CHANGED
@@ -1,26 +1,14 @@
1
1
  {
2
- "niv": {
3
- "branch": "master",
4
- "description": "Easy dependency management for Nix projects",
5
- "homepage": "https://github.com/nmattia/niv",
6
- "owner": "nmattia",
7
- "repo": "niv",
8
- "rev": "5b5508f85567e82d97e7c1a5a0aa87e131ebab39",
9
- "sha256": "0daa6gidnjbvxsmy5cl0w1h902qslc821hghppzi63q7qxg1pvr3",
10
- "type": "tarball",
11
- "url": "https://github.com/nmattia/niv/archive/5b5508f85567e82d97e7c1a5a0aa87e131ebab39.tar.gz",
12
- "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
13
- },
14
2
  "nixpkgs": {
15
- "branch": "nixos-19.09",
3
+ "branch": "release-22.11",
16
4
  "description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to",
17
5
  "homepage": "https://github.com/NixOS/nixpkgs",
18
6
  "owner": "NixOS",
19
- "repo": "nixpkgs-channels",
20
- "rev": "6d445f8398d2d585d20d9acacf00fd9d15081b3b",
21
- "sha256": "1ajd0zr31iny3g9hp0pc1y2pxcm3nakdv6260lnvyn0k4vygync2",
7
+ "repo": "nixpkgs",
8
+ "rev": "bf27e9a40d779f034e340a6758fec1a841e23acd",
9
+ "sha256": "1n5g7yyrj7kz570vyhd0lcvpzljqw65d9r12hjdr69ydj7r699d8",
22
10
  "type": "tarball",
23
- "url": "https://github.com/NixOS/nixpkgs-channels/archive/6d445f8398d2d585d20d9acacf00fd9d15081b3b.tar.gz",
11
+ "url": "https://github.com/NixOS/nixpkgs/archive/bf27e9a40d779f034e340a6758fec1a841e23acd.tar.gz",
24
12
  "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
25
13
  }
26
14
  }
data/nix/sources.nix CHANGED
@@ -6,52 +6,83 @@ let
6
6
  # The fetchers. fetch_<type> fetches specs of type <type>.
7
7
  #
8
8
 
9
- fetch_file = pkgs: spec:
10
- if spec.builtin or true then
11
- builtins_fetchurl { inherit (spec) url sha256; }
12
- else
13
- pkgs.fetchurl { inherit (spec) url sha256; };
14
-
15
- fetch_tarball = pkgs: spec:
16
- if spec.builtin or true then
17
- builtins_fetchTarball { inherit (spec) url sha256; }
18
- else
19
- pkgs.fetchzip { inherit (spec) url sha256; };
9
+ fetch_file = pkgs: name: spec:
10
+ let
11
+ name' = sanitizeName name + "-src";
12
+ in
13
+ if spec.builtin or true then
14
+ builtins_fetchurl { inherit (spec) url sha256; name = name'; }
15
+ else
16
+ pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
20
17
 
21
- fetch_git = spec:
22
- builtins.fetchGit { url = spec.repo; inherit (spec) rev ref; };
18
+ fetch_tarball = pkgs: name: spec:
19
+ let
20
+ name' = sanitizeName name + "-src";
21
+ in
22
+ if spec.builtin or true then
23
+ builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
24
+ else
25
+ pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
23
26
 
24
- fetch_builtin-tarball = spec:
25
- builtins.trace
26
- ''
27
- WARNING:
28
- The niv type "builtin-tarball" will soon be deprecated. You should
29
- instead use `builtin = true`.
27
+ fetch_git = name: spec:
28
+ let
29
+ ref =
30
+ if spec ? ref then spec.ref else
31
+ if spec ? branch then "refs/heads/${spec.branch}" else
32
+ if spec ? tag then "refs/tags/${spec.tag}" else
33
+ abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
34
+ submodules = if spec ? submodules then spec.submodules else false;
35
+ submoduleArg =
36
+ let
37
+ nixSupportsSubmodules = builtins.compareVersions builtins.nixVersion "2.4" >= 0;
38
+ emptyArgWithWarning =
39
+ if submodules == true
40
+ then
41
+ builtins.trace
42
+ (
43
+ "The niv input \"${name}\" uses submodules "
44
+ + "but your nix's (${builtins.nixVersion}) builtins.fetchGit "
45
+ + "does not support them"
46
+ )
47
+ {}
48
+ else {};
49
+ in
50
+ if nixSupportsSubmodules
51
+ then { inherit submodules; }
52
+ else emptyArgWithWarning;
53
+ in
54
+ builtins.fetchGit
55
+ ({ url = spec.repo; inherit (spec) rev; inherit ref; } // submoduleArg);
30
56
 
31
- $ niv modify <package> -a type=tarball -a builtin=true
32
- ''
33
- builtins_fetchTarball { inherit (spec) url sha256; };
57
+ fetch_local = spec: spec.path;
34
58
 
35
- fetch_builtin-url = spec:
36
- builtins.trace
37
- ''
38
- WARNING:
39
- The niv type "builtin-url" will soon be deprecated. You should
40
- instead use `builtin = true`.
59
+ fetch_builtin-tarball = name: throw
60
+ ''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`.
61
+ $ niv modify ${name} -a type=tarball -a builtin=true'';
41
62
 
42
- $ niv modify <package> -a type=file -a builtin=true
43
- ''
44
- (builtins_fetchurl { inherit (spec) url sha256; });
63
+ fetch_builtin-url = name: throw
64
+ ''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`.
65
+ $ niv modify ${name} -a type=file -a builtin=true'';
45
66
 
46
67
  #
47
68
  # Various helpers
48
69
  #
49
70
 
71
+ # https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695
72
+ sanitizeName = name:
73
+ (
74
+ concatMapStrings (s: if builtins.isList s then "-" else s)
75
+ (
76
+ builtins.split "[^[:alnum:]+._?=-]+"
77
+ ((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name)
78
+ )
79
+ );
80
+
50
81
  # The set of packages used when specs are fetched using non-builtins.
51
- mkPkgs = sources:
82
+ mkPkgs = sources: system:
52
83
  let
53
84
  sourcesNixpkgs =
54
- import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) {};
85
+ import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; };
55
86
  hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
56
87
  hasThisAsNixpkgsPath = <nixpkgs> == ./.;
57
88
  in
@@ -71,14 +102,27 @@ let
71
102
 
72
103
  if ! builtins.hasAttr "type" spec then
73
104
  abort "ERROR: niv spec ${name} does not have a 'type' attribute"
74
- else if spec.type == "file" then fetch_file pkgs spec
75
- else if spec.type == "tarball" then fetch_tarball pkgs spec
76
- else if spec.type == "git" then fetch_git spec
77
- else if spec.type == "builtin-tarball" then fetch_builtin-tarball spec
78
- else if spec.type == "builtin-url" then fetch_builtin-url spec
105
+ else if spec.type == "file" then fetch_file pkgs name spec
106
+ else if spec.type == "tarball" then fetch_tarball pkgs name spec
107
+ else if spec.type == "git" then fetch_git name spec
108
+ else if spec.type == "local" then fetch_local spec
109
+ else if spec.type == "builtin-tarball" then fetch_builtin-tarball name
110
+ else if spec.type == "builtin-url" then fetch_builtin-url name
79
111
  else
80
112
  abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
81
113
 
114
+ # If the environment variable NIV_OVERRIDE_${name} is set, then use
115
+ # the path directly as opposed to the fetched source.
116
+ replace = name: drv:
117
+ let
118
+ saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
119
+ ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
120
+ in
121
+ if ersatz == "" then drv else
122
+ # this turns the string into an actual Nix path (for both absolute and
123
+ # relative paths)
124
+ if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
125
+
82
126
  # Ports of functions for older nix versions
83
127
 
84
128
  # a Nix version of mapAttrs if the built-in doesn't exist
@@ -87,23 +131,37 @@ let
87
131
  listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
88
132
  );
89
133
 
134
+ # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
135
+ range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1);
136
+
137
+ # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
138
+ stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
139
+
140
+ # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269
141
+ stringAsChars = f: s: concatStrings (map f (stringToCharacters s));
142
+ concatMapStrings = f: list: concatStrings (map f list);
143
+ concatStrings = builtins.concatStringsSep "";
144
+
145
+ # https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331
146
+ optionalAttrs = cond: as: if cond then as else {};
147
+
90
148
  # fetchTarball version that is compatible between all the versions of Nix
91
- builtins_fetchTarball = { url, sha256 }@attrs:
149
+ builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
92
150
  let
93
151
  inherit (builtins) lessThan nixVersion fetchTarball;
94
152
  in
95
153
  if lessThan nixVersion "1.12" then
96
- fetchTarball { inherit url; }
154
+ fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
97
155
  else
98
156
  fetchTarball attrs;
99
157
 
100
158
  # fetchurl version that is compatible between all the versions of Nix
101
- builtins_fetchurl = { url, sha256 }@attrs:
159
+ builtins_fetchurl = { url, name ? null, sha256 }@attrs:
102
160
  let
103
161
  inherit (builtins) lessThan nixVersion fetchurl;
104
162
  in
105
163
  if lessThan nixVersion "1.12" then
106
- fetchurl { inherit url; }
164
+ fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
107
165
  else
108
166
  fetchurl attrs;
109
167
 
@@ -115,14 +173,15 @@ let
115
173
  then abort
116
174
  "The values in sources.json should not have an 'outPath' attribute"
117
175
  else
118
- spec // { outPath = fetch config.pkgs name spec; }
176
+ spec // { outPath = replace name (fetch config.pkgs name spec); }
119
177
  ) config.sources;
120
178
 
121
179
  # The "config" used by the fetchers
122
180
  mkConfig =
123
- { sourcesFile ? ./sources.json
124
- , sources ? builtins.fromJSON (builtins.readFile sourcesFile)
125
- , pkgs ? mkPkgs sources
181
+ { sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
182
+ , sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile)
183
+ , system ? builtins.currentSystem
184
+ , pkgs ? mkPkgs sources system
126
185
  }: rec {
127
186
  # The sources, i.e. the attribute set of spec name to spec
128
187
  inherit sources;
@@ -130,5 +189,6 @@ let
130
189
  # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
131
190
  inherit pkgs;
132
191
  };
192
+
133
193
  in
134
194
  mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
data/nix/update-gemset.sh CHANGED
@@ -4,4 +4,4 @@
4
4
  SCRIPT=`realpath $0`
5
5
  CWD=`dirname $SCRIPT`
6
6
 
7
- cd $CWD && bundix -m --ruby=ruby_2_5
7
+ cd $CWD && bundix -m --ruby=ruby_3_1
@@ -21,10 +21,11 @@ Gem::Specification.new do |spec|
21
21
  spec.executables << "generate_edges"
22
22
  spec.require_paths = ["lib"]
23
23
 
24
- spec.add_dependency "actionpack", "~> 5.2"
24
+ spec.add_runtime_dependency "actionpack", ">= 5.2.0", "< 7.1.0"
25
25
 
26
- spec.add_development_dependency "rails", "~> 5.2"
26
+ spec.add_development_dependency "rails", ">= 5.2", "< 7.1.0"
27
27
  spec.add_development_dependency "sqlite3", "~> 1.4.0"
28
28
  spec.add_development_dependency "rake", "~> 13.0"
29
29
  spec.add_development_dependency "rspec", "~> 3.9"
30
+ spec.add_development_dependency "appraisal", "~> 2.3"
30
31
  end
data/shell.nix CHANGED
@@ -6,11 +6,18 @@ let
6
6
  name = "rails_edge_test";
7
7
  gemfile = nix/Gemfile;
8
8
  lockfile = nix/Gemfile.lock;
9
- ruby = nixpkgs.ruby_2_5;
9
+ ruby = nixpkgs.ruby_3_1;
10
10
  gemdir = ./nix;
11
11
  };
12
- in with nixpkgs;
12
+ in
13
+ with nixpkgs;
13
14
  stdenv.mkDerivation {
15
+ FREEDESKTOP_MIME_TYPES_PATH = "${pkgs.shared-mime-info}/share/mime/packages/freedesktop.org.xml";
14
16
  name = "rails_edge_test";
15
- buildInputs = [ gems gems.wrappedRuby ];
17
+ buildInputs = [
18
+ gems
19
+ gems.wrappedRuby
20
+ # nixpkgs.ruby_3_1
21
+ nixpkgs.sqlite
22
+ ];
16
23
  }
metadata CHANGED
@@ -1,44 +1,56 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_edge_test
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Leven
8
8
  - Ju Liu
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 1970-01-01 00:00:00.000000000 Z
12
+ date: 1980-01-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '5.2'
20
+ version: 5.2.0
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: 7.1.0
21
24
  type: :runtime
22
25
  prerelease: false
23
26
  version_requirements: !ruby/object:Gem::Requirement
24
27
  requirements:
25
- - - "~>"
28
+ - - ">="
26
29
  - !ruby/object:Gem::Version
27
- version: '5.2'
30
+ version: 5.2.0
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: 7.1.0
28
34
  - !ruby/object:Gem::Dependency
29
35
  name: rails
30
36
  requirement: !ruby/object:Gem::Requirement
31
37
  requirements:
32
- - - "~>"
38
+ - - ">="
33
39
  - !ruby/object:Gem::Version
34
40
  version: '5.2'
41
+ - - "<"
42
+ - !ruby/object:Gem::Version
43
+ version: 7.1.0
35
44
  type: :development
36
45
  prerelease: false
37
46
  version_requirements: !ruby/object:Gem::Requirement
38
47
  requirements:
39
- - - "~>"
48
+ - - ">="
40
49
  - !ruby/object:Gem::Version
41
50
  version: '5.2'
51
+ - - "<"
52
+ - !ruby/object:Gem::Version
53
+ version: 7.1.0
42
54
  - !ruby/object:Gem::Dependency
43
55
  name: sqlite3
44
56
  requirement: !ruby/object:Gem::Requirement
@@ -81,6 +93,20 @@ dependencies:
81
93
  - - "~>"
82
94
  - !ruby/object:Gem::Version
83
95
  version: '3.9'
96
+ - !ruby/object:Gem::Dependency
97
+ name: appraisal
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '2.3'
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '2.3'
84
110
  description: Keep your backend and front-end specs in sync! The rails_edge_test gem
85
111
  provides a dsl and rake task that uses your Rails app to generate json and appropriate
86
112
  wrapper files for use in your front-end testing.
@@ -92,9 +118,10 @@ extensions: []
92
118
  extra_rdoc_files: []
93
119
  files:
94
120
  - ".envrc"
121
+ - ".github/workflows/ci.yml"
95
122
  - ".gitignore"
96
123
  - ".rspec"
97
- - ".travis.yml"
124
+ - Appraisals
98
125
  - CHANGELOG.md
99
126
  - CODE_OF_CONDUCT.md
100
127
  - Gemfile
@@ -130,7 +157,7 @@ homepage: https://github.com/NoRedInk/rails_edge_test
130
157
  licenses:
131
158
  - MIT
132
159
  metadata: {}
133
- post_install_message:
160
+ post_install_message:
134
161
  rdoc_options: []
135
162
  require_paths:
136
163
  - lib
@@ -145,8 +172,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
172
  - !ruby/object:Gem::Version
146
173
  version: '0'
147
174
  requirements: []
148
- rubygems_version: 3.0.6
149
- signing_key:
175
+ rubygems_version: 3.3.20
176
+ signing_key:
150
177
  specification_version: 4
151
178
  summary: Generate json for front-end testing using your rails backend.
152
179
  test_files: []
data/.travis.yml DELETED
@@ -1,8 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.3.4
4
- - 2.4.3
5
- - 2.5.0
6
- before_install:
7
- - gem update --system
8
- - gem install bundler