summary refs log tree commit diff
path: root/gnu/packages/ruby.scm
blob: 1dcd5f76a5788875bb522dc73b6a74669790ac30 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13400
13401
13402
13403
13404
13405
13406
13407
13408
13409
13410
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547
13548
13549
13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597
13598
13599
13600
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
13611
13612
13613
13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13893
13894
13895
13896
13897
13898
13899
13900
13901
13902
13903
13904
13905
13906
13907
13908
13909
13910
13911
13912
13913
13914
13915
13916
13917
13918
13919
13920
13921
13922
13923
13924
13925
13926
13927
13928
13929
13930
13931
13932
13933
13934
13935
13936
13937
13938
13939
13940
13941
13942
13943
13944
13945
13946
13947
13948
13949
13950
13951
13952
13953
13954
13955
13956
13957
13958
13959
13960
13961
13962
13963
13964
13965
13966
13967
13968
13969
13970
13971
13972
13973
13974
13975
13976
13977
13978
13979
13980
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14002
14003
14004
14005
14006
14007
14008
14009
14010
14011
14012
14013
14014
14015
14016
14017
14018
14019
14020
14021
14022
14023
14024
14025
14026
14027
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
14043
14044
14045
14046
14047
14048
14049
14050
14051
14052
14053
14054
14055
14056
14057
14058
14059
14060
14061
14062
14063
14064
14065
14066
14067
14068
14069
14070
14071
14072
14073
14074
14075
14076
14077
14078
14079
14080
14081
14082
14083
14084
14085
14086
14087
14088
14089
14090
14091
14092
14093
14094
14095
14096
14097
14098
14099
14100
14101
14102
14103
14104
14105
14106
14107
14108
14109
14110
14111
14112
14113
14114
14115
14116
14117
14118
14119
14120
14121
14122
14123
14124
14125
14126
14127
14128
14129
14130
14131
14132
14133
14134
14135
14136
14137
14138
14139
14140
14141
14142
14143
14144
14145
14146
14147
14148
14149
14150
14151
14152
14153
14154
14155
14156
14157
14158
14159
14160
14161
14162
14163
14164
14165
14166
14167
14168
14169
14170
14171
14172
14173
14174
14175
14176
14177
14178
14179
14180
14181
14182
14183
14184
14185
14186
14187
14188
14189
14190
14191
14192
14193
14194
14195
14196
14197
14198
14199
14200
14201
14202
14203
14204
14205
14206
14207
14208
14209
14210
14211
14212
14213
14214
14215
14216
14217
14218
14219
14220
14221
14222
14223
14224
14225
14226
14227
14228
14229
14230
14231
14232
14233
14234
14235
14236
14237
14238
14239
14240
14241
14242
14243
14244
14245
14246
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259
14260
14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
14284
14285
14286
14287
14288
14289
14290
14291
14292
14293
14294
14295
14296
14297
14298
14299
14300
14301
14302
14303
14304
14305
14306
14307
14308
14309
14310
14311
14312
14313
14314
14315
14316
14317
14318
14319
14320
14321
14322
14323
14324
14325
14326
14327
14328
14329
14330
14331
14332
14333
14334
14335
14336
14337
14338
14339
14340
14341
14342
14343
14344
14345
14346
14347
14348
14349
14350
14351
14352
14353
14354
14355
14356
14357
14358
14359
14360
14361
14362
14363
14364
14365
14366
14367
14368
14369
14370
14371
14372
14373
14374
14375
14376
14377
14378
14379
14380
14381
14382
14383
14384
14385
14386
14387
14388
14389
14390
14391
14392
14393
14394
14395
14396
14397
14398
14399
14400
14401
14402
14403
14404
14405
14406
14407
14408
14409
14410
14411
14412
14413
14414
14415
14416
14417
14418
14419
14420
14421
14422
14423
14424
14425
14426
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438
14439
14440
14441
14442
14443
14444
14445
14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458
14459
14460
14461
14462
14463
14464
14465
14466
14467
14468
14469
14470
14471
14472
14473
14474
14475
14476
14477
14478
14479
14480
14481
14482
14483
14484
14485
14486
14487
14488
14489
14490
14491
14492
14493
14494
14495
14496
14497
14498
14499
14500
14501
14502
14503
14504
14505
14506
14507
14508
14509
14510
14511
14512
14513
14514
14515
14516
14517
14518
14519
14520
14521
14522
14523
14524
14525
14526
14527
14528
14529
14530
14531
14532
14533
14534
14535
14536
14537
14538
14539
14540
14541
14542
14543
14544
14545
14546
14547
14548
14549
14550
14551
14552
14553
14554
14555
14556
14557
14558
14559
14560
14561
14562
14563
14564
14565
14566
14567
14568
14569
14570
14571
14572
14573
14574
14575
14576
14577
14578
14579
14580
14581
14582
14583
14584
14585
14586
14587
14588
14589
14590
14591
14592
14593
14594
14595
14596
14597
14598
14599
14600
14601
14602
14603
14604
14605
14606
14607
14608
14609
14610
14611
14612
14613
14614
14615
14616
14617
14618
14619
14620
14621
14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14641
14642
14643
14644
14645
14646
14647
14648
14649
14650
14651
14652
14653
14654
14655
14656
14657
14658
14659
14660
14661
14662
14663
14664
14665
14666
14667
14668
14669
14670
14671
14672
14673
14674
14675
14676
14677
14678
14679
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689
14690
14691
14692
14693
14694
14695
14696
14697
14698
14699
14700
14701
14702
14703
14704
14705
14706
14707
14708
14709
14710
14711
14712
14713
14714
14715
14716
14717
14718
14719
14720
14721
14722
14723
14724
14725
14726
14727
14728
14729
14730
14731
14732
14733
14734
14735
14736
14737
14738
14739
14740
14741
14742
14743
14744
14745
14746
14747
14748
14749
14750
14751
14752
14753
14754
14755
14756
14757
14758
14759
14760
14761
14762
14763
14764
14765
14766
14767
14768
14769
14770
14771
14772
14773
14774
14775
14776
14777
14778
14779
14780
14781
14782
14783
14784
14785
14786
14787
14788
14789
14790
14791
14792
14793
14794
14795
14796
14797
14798
14799
14800
14801
14802
14803
14804
14805
14806
14807
14808
14809
14810
14811
14812
14813
14814
14815
14816
14817
14818
14819
14820
14821
14822
14823
14824
14825
14826
14827
14828
14829
14830
14831
14832
14833
14834
14835
14836
14837
14838
14839
14840
14841
14842
14843
14844
14845
14846
14847
14848
14849
14850
14851
14852
14853
14854
14855
14856
14857
14858
14859
14860
14861
14862
14863
14864
14865
14866
14867
14868
14869
14870
14871
14872
14873
14874
14875
14876
14877
14878
14879
14880
14881
14882
14883
14884
14885
14886
14887
14888
14889
14890
14891
14892
14893
14894
14895
14896
14897
14898
14899
14900
14901
14902
14903
14904
14905
14906
14907
14908
14909
14910
14911
14912
14913
14914
14915
14916
14917
14918
14919
14920
14921
14922
14923
14924
14925
14926
14927
14928
14929
14930
14931
14932
14933
14934
14935
14936
14937
14938
14939
14940
14941
14942
14943
14944
14945
14946
14947
14948
14949
14950
14951
14952
14953
14954
14955
14956
14957
14958
14959
14960
14961
14962
14963
14964
14965
14966
14967
14968
14969
14970
14971
14972
14973
14974
14975
14976
14977
14978
14979
14980
14981
14982
14983
14984
14985
14986
14987
14988
14989
14990
14991
14992
14993
14994
14995
14996
14997
14998
14999
15000
15001
15002
15003
15004
15005
15006
15007
15008
15009
15010
15011
15012
15013
15014
15015
15016
15017
15018
15019
15020
15021
15022
15023
15024
15025
15026
15027
15028
15029
15030
15031
15032
15033
15034
15035
15036
15037
15038
15039
15040
15041
15042
15043
15044
15045
15046
15047
15048
15049
15050
15051
15052
15053
15054
15055
15056
15057
15058
15059
15060
15061
15062
15063
15064
15065
15066
15067
15068
15069
15070
15071
15072
15073
15074
15075
15076
15077
15078
15079
15080
15081
15082
15083
15084
15085
15086
15087
15088
15089
15090
15091
15092
15093
15094
15095
15096
15097
15098
15099
15100
15101
15102
15103
15104
15105
15106
15107
15108
15109
15110
15111
15112
15113
15114
15115
15116
15117
15118
15119
15120
15121
15122
15123
15124
15125
15126
15127
15128
15129
15130
15131
15132
15133
15134
15135
15136
15137
15138
15139
15140
15141
15142
15143
15144
15145
15146
15147
15148
15149
15150
15151
15152
15153
15154
15155
15156
15157
15158
15159
15160
15161
15162
15163
15164
15165
15166
15167
15168
15169
15170
15171
15172
15173
15174
15175
15176
15177
15178
15179
15180
15181
15182
15183
15184
15185
15186
15187
15188
15189
15190
15191
15192
15193
15194
15195
15196
15197
15198
15199
15200
15201
15202
15203
15204
15205
15206
15207
15208
15209
15210
15211
15212
15213
15214
15215
15216
15217
15218
15219
15220
15221
15222
15223
15224
15225
15226
15227
15228
15229
15230
15231
15232
15233
15234
15235
15236
15237
15238
15239
15240
15241
15242
15243
15244
15245
15246
15247
15248
15249
15250
15251
15252
15253
15254
15255
15256
15257
15258
15259
15260
15261
15262
15263
15264
15265
15266
15267
15268
15269
15270
15271
15272
15273
15274
15275
15276
15277
15278
15279
15280
15281
15282
15283
15284
15285
15286
15287
15288
15289
15290
15291
15292
15293
15294
15295
15296
15297
15298
15299
15300
15301
15302
15303
15304
15305
15306
15307
15308
15309
15310
15311
15312
15313
15314
15315
15316
15317
15318
15319
15320
15321
15322
15323
15324
15325
15326
15327
15328
15329
15330
15331
15332
15333
15334
15335
15336
15337
15338
15339
15340
15341
15342
15343
15344
15345
15346
15347
15348
15349
15350
15351
15352
15353
15354
15355
15356
15357
15358
15359
15360
15361
15362
15363
15364
15365
15366
15367
15368
15369
15370
15371
15372
15373
15374
15375
15376
15377
15378
15379
15380
15381
15382
15383
15384
15385
15386
15387
15388
15389
15390
15391
15392
15393
15394
15395
15396
15397
15398
15399
15400
15401
15402
15403
15404
15405
15406
15407
15408
15409
15410
15411
15412
15413
15414
15415
15416
15417
15418
15419
15420
15421
15422
15423
15424
15425
15426
15427
15428
15429
15430
15431
15432
15433
15434
15435
15436
15437
15438
15439
15440
15441
15442
15443
15444
15445
15446
15447
15448
15449
15450
15451
15452
15453
15454
15455
15456
15457
15458
15459
15460
15461
15462
15463
15464
15465
15466
15467
15468
15469
15470
15471
15472
15473
15474
15475
15476
15477
15478
15479
15480
15481
15482
15483
15484
15485
15486
15487
15488
15489
15490
15491
15492
15493
15494
15495
15496
15497
15498
15499
15500
15501
15502
15503
15504
15505
15506
15507
15508
15509
15510
15511
15512
15513
15514
15515
15516
15517
15518
15519
15520
15521
15522
15523
15524
15525
15526
15527
15528
15529
15530
15531
15532
15533
15534
15535
15536
15537
15538
15539
15540
15541
15542
15543
15544
15545
15546
15547
15548
15549
15550
15551
15552
15553
15554
15555
15556
15557
15558
15559
15560
15561
15562
15563
15564
15565
15566
15567
15568
15569
15570
15571
15572
15573
15574
15575
15576
15577
15578
15579
15580
15581
15582
15583
15584
15585
15586
15587
15588
15589
15590
15591
15592
15593
15594
15595
15596
15597
15598
15599
15600
15601
15602
15603
15604
15605
15606
15607
15608
15609
15610
15611
15612
15613
15614
15615
15616
15617
15618
15619
15620
15621
15622
15623
15624
15625
15626
15627
15628
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639
15640
15641
15642
15643
15644
15645
15646
15647
15648
15649
15650
15651
15652
15653
15654
15655
15656
15657
15658
15659
15660
15661
15662
15663
15664
15665
15666
15667
15668
15669
15670
15671
15672
15673
15674
15675
15676
15677
15678
15679
15680
15681
15682
15683
15684
15685
15686
15687
15688
15689
15690
15691
15692
15693
15694
15695
15696
15697
15698
15699
15700
15701
15702
15703
15704
15705
15706
15707
15708
15709
15710
15711
15712
15713
15714
15715
15716
15717
15718
15719
15720
15721
15722
15723
15724
15725
15726
15727
15728
15729
15730
15731
15732
15733
15734
15735
15736
15737
15738
15739
15740
15741
15742
15743
15744
15745
15746
15747
15748
15749
15750
15751
15752
15753
15754
15755
15756
15757
15758
15759
15760
15761
15762
15763
15764
15765
15766
15767
15768
15769
15770
15771
15772
15773
15774
15775
15776
15777
15778
15779
15780
15781
15782
15783
15784
15785
15786
15787
15788
15789
15790
15791
15792
15793
15794
15795
15796
15797
15798
15799
15800
15801
15802
15803
15804
15805
15806
15807
15808
15809
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821
15822
15823
15824
15825
15826
15827
15828
15829
15830
15831
15832
15833
15834
15835
15836
15837
15838
15839
15840
15841
15842
15843
15844
15845
15846
15847
15848
15849
15850
15851
15852
15853
15854
15855
15856
15857
15858
15859
15860
15861
15862
15863
15864
15865
15866
15867
15868
15869
15870
15871
15872
15873
15874
15875
15876
15877
15878
15879
15880
15881
15882
15883
15884
15885
15886
15887
15888
15889
15890
15891
15892
15893
15894
15895
15896
15897
15898
15899
15900
15901
15902
15903
15904
15905
15906
15907
15908
15909
15910
15911
15912
15913
15914
15915
15916
15917
15918
15919
15920
15921
15922
15923
15924
15925
15926
15927
15928
15929
15930
15931
15932
15933
15934
15935
15936
15937
15938
15939
15940
15941
15942
15943
15944
15945
15946
15947
15948
15949
15950
15951
15952
15953
15954
15955
15956
15957
15958
15959
15960
15961
15962
15963
15964
15965
15966
15967
15968
15969
15970
15971
15972
15973
15974
15975
15976
15977
15978
15979
15980
15981
15982
15983
15984
15985
15986
15987
15988
15989
15990
15991
15992
15993
15994
15995
15996
15997
15998
15999
16000
16001
16002
16003
16004
16005
16006
16007
16008
16009
16010
16011
16012
16013
16014
16015
16016
16017
16018
16019
16020
16021
16022
16023
16024
16025
16026
16027
16028
16029
16030
16031
16032
16033
16034
16035
16036
16037
16038
16039
16040
16041
16042
16043
16044
16045
16046
16047
16048
16049
16050
16051
16052
16053
16054
16055
16056
16057
16058
16059
16060
16061
16062
16063
16064
16065
16066
16067
16068
16069
16070
16071
16072
16073
16074
16075
16076
16077
16078
16079
16080
16081
16082
16083
16084
16085
16086
16087
16088
16089
16090
16091
16092
16093
16094
16095
16096
16097
16098
16099
16100
16101
16102
16103
16104
16105
16106
16107
16108
16109
16110
16111
16112
16113
16114
16115
16116
16117
16118
16119
16120
16121
16122
16123
16124
16125
16126
16127
16128
16129
16130
16131
16132
16133
16134
16135
16136
16137
16138
16139
16140
16141
16142
16143
16144
16145
16146
16147
16148
16149
16150
16151
16152
16153
16154
16155
16156
16157
16158
16159
16160
16161
16162
16163
16164
16165
16166
16167
16168
16169
16170
16171
16172
16173
16174
16175
16176
16177
16178
16179
16180
16181
16182
16183
16184
16185
16186
16187
16188
16189
16190
16191
16192
16193
16194
16195
16196
16197
16198
16199
16200
16201
16202
16203
16204
16205
16206
16207
16208
16209
16210
16211
16212
16213
16214
16215
16216
16217
16218
16219
16220
16221
16222
16223
16224
16225
16226
16227
16228
16229
16230
16231
16232
16233
16234
16235
16236
16237
16238
16239
16240
16241
16242
16243
16244
16245
16246
16247
16248
16249
16250
16251
16252
16253
16254
16255
16256
16257
16258
16259
16260
16261
16262
16263
16264
16265
16266
16267
16268
16269
16270
16271
16272
16273
16274
16275
16276
16277
16278
16279
16280
16281
16282
16283
16284
16285
16286
16287
16288
16289
16290
16291
16292
16293
16294
16295
16296
16297
16298
16299
16300
16301
16302
16303
16304
16305
16306
16307
16308
16309
16310
16311
16312
16313
16314
16315
16316
16317
16318
16319
16320
16321
16322
16323
16324
16325
16326
16327
16328
16329
16330
16331
16332
16333
16334
16335
16336
16337
16338
16339
16340
16341
16342
16343
16344
16345
16346
16347
16348
16349
16350
16351
16352
16353
16354
16355
16356
16357
16358
16359
16360
16361
16362
16363
16364
16365
16366
16367
16368
16369
16370
16371
16372
16373
16374
16375
16376
16377
16378
16379
16380
16381
16382
16383
16384
16385
16386
16387
16388
16389
16390
16391
16392
16393
16394
16395
16396
16397
16398
16399
16400
16401
16402
16403
16404
16405
16406
16407
16408
16409
16410
16411
16412
16413
16414
16415
16416
16417
16418
16419
16420
16421
16422
16423
16424
16425
16426
16427
16428
16429
16430
16431
16432
16433
16434
16435
16436
16437
16438
16439
16440
16441
16442
16443
16444
16445
16446
16447
16448
16449
16450
16451
16452
16453
16454
16455
16456
16457
16458
16459
16460
16461
16462
16463
16464
16465
16466
16467
16468
16469
16470
16471
16472
16473
16474
16475
16476
16477
16478
16479
16480
16481
16482
16483
16484
16485
16486
16487
16488
16489
16490
16491
16492
16493
16494
16495
16496
16497
16498
16499
16500
16501
16502
16503
16504
16505
16506
16507
16508
16509
16510
16511
16512
16513
16514
16515
16516
16517
16518
16519
16520
16521
16522
16523
16524
16525
16526
16527
16528
16529
16530
16531
16532
16533
16534
16535
16536
16537
16538
16539
16540
16541
16542
16543
16544
16545
16546
16547
16548
16549
16550
16551
16552
16553
16554
16555
16556
16557
16558
16559
16560
16561
16562
16563
16564
16565
16566
16567
16568
16569
16570
16571
16572
16573
16574
16575
16576
16577
16578
16579
16580
16581
16582
16583
16584
16585
16586
16587
16588
16589
16590
16591
16592
16593
16594
16595
16596
16597
16598
16599
16600
16601
16602
16603
16604
16605
16606
16607
16608
16609
16610
16611
16612
16613
16614
16615
16616
16617
16618
16619
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014, 2015 Pjotr Prins <pjotr.guix@thebird.nl>
;;; Copyright © 2014-2017, 2021-2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2014, 2015 David Thompson <davet@gnu.org>
;;; Copyright © 2015, 2019 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2015, 2016, 2017 Ben Woodcroft <donttrustben@gmail.com>
;;; Copyright © 2017 Nikita <nikita@n0.is>
;;; Copyright © 2017, 2019-2022 Marius Bakke <marius@gnu.org>
;;; Copyright © 2017-2023 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2017, 2018, 2020, 2021 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
;;; Copyright © 2017, 2018, 2019 Christopher Baines <mail@cbaines.net>
;;; Copyright © 2018 Vasile Dumitrascu <va511e@yahoo.com>
;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
;;; Copyright © 2019 Mikhail Kirillov <w96k.ru@gmail.com>
;;; Copyright © 2019 Jelle Licht <jlicht@fsfe.org>
;;; Copyright © 2019 Brian Leung <bkleung89@gmail.com>
;;; Copyright © 2019 Collin J. Doering <collin@rekahsoft.ca>
;;; Copyright © 2019 Diego N. Barbato <dnbarbato@posteo.de>
;;; Copyright © 2019 Brett Gilio <brettg@posteo.de>
;;; Copyright © 2020, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2020, 2021 Nicolas Goaziou <mail@nicolasgoaziou.fr>
;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
;;; Copyright © 2020 Holgr Peters <holger.peters@posteo.de>
;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
;;; Copyright © 2021 EuAndreh <eu@euandre.org>
;;; Copyright © 2020 Tomás Ortín Fernández <tomasortin@mailbox.org>
;;; Copyright © 2021 Giovanni Biscuolo <g@xelera.eu>
;;; Copyright © 2022 Philip McGrath <philip@philipmcgrath.com>
;;; Copyright © 2022 Remco van 't Veer <remco@remworks.net>
;;; Copyright © 2022 Taiju HIGASHI <higashi@taiju.info>
;;; Copyright © 2023 Yovan Naumovski <yovan@gorski.stream>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages ruby)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (gnu packages)
  #:use-module (gnu packages base)
  #:use-module (gnu packages bison)
  #:use-module (gnu packages c)
  #:use-module (gnu packages check)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages crypto)
  #:use-module (gnu packages curl)
  #:use-module (gnu packages databases)
  #:use-module (gnu packages dbm)
  #:use-module (gnu packages rails)
  #:use-module (gnu packages readline)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages haskell-xyz)
  #:use-module (gnu packages java)
  #:use-module (gnu packages libffi)
  #:use-module (gnu packages libidn)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages lsof)
  #:use-module (gnu packages man)
  #:use-module (gnu packages maths)
  #:use-module (gnu packages ncurses)
  #:use-module (gnu packages networking)
  #:use-module (gnu packages node)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages protobuf)
  #:use-module (gnu packages python)
  #:use-module (gnu packages python-xyz)
  #:use-module (gnu packages ragel)
  #:use-module (gnu packages rsync)
  #:use-module (gnu packages sqlite)
  #:use-module (gnu packages tls)
  #:use-module (gnu packages valgrind)
  #:use-module (gnu packages version-control)
  #:use-module (gnu packages web-browsers)
  #:use-module (gnu packages serialization)
  #:use-module (guix packages)
  #:use-module (guix deprecation)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix gexp)
  #:use-module (guix modules)
  #:use-module (guix utils)
  #:use-module (guix build-system gnu)
  #:use-module (gnu packages xml)
  #:use-module (gnu packages web)
  #:use-module (guix build-system ruby)
  #:use-module ((srfi srfi-1) #:select (alist-delete)))

(define %prawn-project-licenses
  ;; This set of licenses applies to most (all?) components of the Prawn
  ;; project (it is triple licensed).
  (list license:ruby
        license:gpl2+
        license:gpl3+))

(define-public ruby-2.6
  (package
    (name "ruby")
    (version "2.6.10")
    (source
     (origin
       (method url-fetch)
       (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
                           (version-major+minor version)
                           "/ruby-" version ".tar.xz"))
       (sha256
        (base32
         "1wn12klc44hn2nh5v1lkqbdyvljip6qhwjqvkkf8zf112gaxxn2z"))
       (modules '((guix build utils)))
       (snippet `(begin
                   ;; Remove bundled libffi
                   (delete-file-recursively "ext/fiddle/libffi-3.2.1")
                   #t))))
    (build-system gnu-build-system)
    (arguments
     `(#:test-target "test"
       #:configure-flags '("--enable-shared") ; dynamic linking
       #:phases
       (modify-phases %standard-phases
         (add-before 'configure 'replace-bin-sh-and-remove-libffi
           (lambda _
             (substitute* '("Makefile.in"
                            "ext/pty/pty.c"
                            "io.c"
                            "lib/mkmf.rb"
                            "process.c"
                            "test/rubygems/test_gem_ext_configure_builder.rb"
                            "test/rdoc/test_rdoc_parser.rb"
                            "test/ruby/test_rubyoptions.rb"
                            "test/ruby/test_process.rb"
                            "test/ruby/test_system.rb"
                            "tool/rbinstall.rb")
               (("/bin/sh") (which "sh")))
             #t)))))
    (inputs
     (list readline openssl-1.1 libffi gdbm))
    (propagated-inputs
     (list zlib))
    (native-search-paths
     (list (search-path-specification
            (variable "GEM_PATH")
            (files (list (string-append "lib/ruby/vendor_ruby"))))))
    (synopsis "Programming language interpreter")
    (description "Ruby is a dynamic object-oriented programming language with
a focus on simplicity and productivity.")
    (home-page "https://www.ruby-lang.org")
    (license license:ruby)))

(define-public ruby-2.7
  (package
    (inherit ruby-2.6)
    (version "2.7.6")
    (source
     (origin
       (inherit (package-source ruby-2.6))
       (uri (string-append "https://cache.ruby-lang.org/pub/ruby/"
                           (version-major+minor version)
                           "/ruby-" version ".tar.gz"))
       (sha256
        (base32
         "042xrdk7hsv4072bayz3f8ffqh61i8zlhvck10nfshllq063n877"))))
    (arguments
     `(#:test-target "test"
       #:configure-flags '("--enable-shared") ; dynamic linking
       #:phases
       (modify-phases %standard-phases
         (add-before 'configure 'replace-bin-sh-and-remove-libffi
           (lambda _
             (substitute* '("configure.ac"
                            "template/Makefile.in"
                            "lib/rubygems/installer.rb"
                            "ext/pty/pty.c"
                            "io.c"
                            "lib/mkmf.rb"
                            "process.c"
                            "test/rubygems/test_gem_ext_configure_builder.rb"
                            "test/rdoc/test_rdoc_parser.rb"
                            "test/ruby/test_rubyoptions.rb"
                            "test/ruby/test_process.rb"
                            "test/ruby/test_system.rb"
                            "tool/rbinstall.rb")
               (("/bin/sh") (which "sh")))
             #t)))))
    (native-inputs
     (list autoconf))))

(define ruby-2.7-fixed
  (package
    (inherit ruby-2.7)
    (version "2.7.7")
    (source
     (origin
       (inherit (package-source ruby-2.7))
       (uri (string-append "https://cache.ruby-lang.org/pub/ruby/"
                           (version-major+minor version)
                           "/ruby-" version ".tar.gz"))
       (sha256
        (base32
         "143vih5jzmrd2r5h94pa3qzml0ldii0qzs6g09jg6zqxd7djf0g1"))))))

(define-public ruby-3.0
  (package
    (inherit ruby-2.7)
    (version "3.0.5")
    (source
     (origin
       (method url-fetch)
       (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
                           (version-major+minor version)
                           "/ruby-" version ".tar.xz"))
       (sha256
        (base32
         "1pnxbdkkh2miq9nqfq2qscvh76nprzg0r620d9ckdzih42xbaz6g"))))
    (inputs
     (modify-inputs (package-inputs ruby-2.7)
       (replace "openssl" openssl)))))

(define-public ruby-3.1
  (package
    (inherit ruby-3.0)
    (version "3.1.3")
    (source
     (origin
       (method url-fetch)
       (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
                           (version-major+minor version)
                           "/ruby-" version ".tar.xz"))
       (sha256
        (base32
         "06ipqz45qcs0y1273gk2gwslxwd7jgighz3mzbddzg16k29n3qaf"))))))

(define-public ruby-3.2
  (package
    (inherit ruby-3.1)
    (version "3.2.1")
    (source
     (origin
       (method url-fetch)
       (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
                           (version-major+minor version)
                           "/ruby-" version ".tar.xz"))
       (sha256
        (base32
         "0333xln2jkqdfk5zwxas6rpyd4rff2910z99qnyrqi15mrhqcv3l"))))
    (inputs
     (modify-inputs (package-inputs ruby-3.1)
       (prepend libyaml)))))

(define-public ruby ruby-2.7)

(define-public mruby
  (package
    (name "mruby")
    (version "3.2.0")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/mruby/mruby")
             (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0c0scaqbnywrd9z1z4rnnj345rjc3vbklszm0rc6y6rzx1cxnsij"))))
    (build-system gnu-build-system)
    (arguments
     `(#:test-target "test"
       #:phases
       (modify-phases %standard-phases
         (delete 'configure)
         (add-after 'unpack 'enable-verbose-tests
           (lambda _
             (substitute* "Makefile"
               (("ruby ./minirake" m)
                (string-append m " --verbose")))
             #t))
         (add-after 'unpack 'disable-broken-tests
           (lambda _
             (substitute* "mrbgems/mruby-io/test/io.rb"
               (("assert\\('IO.popen.+$" m)
                (string-append m "skip \"Hangs in the Guix build environment\"\n"))
               ;; This one is really weird.  The *expected* output is all wrong.
               (("assert\\('`cmd`.*" m)
                (string-append m "skip \"Disable for Guix\"\n")))
             #t))
         ;; There is no install target
         (replace 'install
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (bin (string-append out "/bin"))
                    (lib (string-append out "/lib")))
               (mkdir-p bin)
               (copy-recursively "build/host/bin" bin)
               (mkdir-p lib)
               (copy-recursively "build/host/lib" lib))
             #t)))))
    (native-inputs
     (list ruby bison))
    (home-page "https://github.com/mruby/mruby")
    (synopsis "Lightweight Ruby")
    (description "mruby is the lightweight implementation of the Ruby
language.  Its syntax is Ruby 3.x compatible except for pattern
matching.  mruby can be linked and embedded within your application.")
    (license license:expat)))

(define-public ruby-commander
  (package
    (name "ruby-commander")
    (version "4.4.7")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "commander" version))
       (sha256
        (base32
         "1pxakz596fjqak3cdbha6iva1dlqis86i3kjrgg6lf3sp8i5vhwg"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "spec"
       #:phases
       (modify-phases %standard-phases
         ;; Don't run or require rubocop, the code linting tool, as this is a
         ;; bit unnecessary.
         (add-after 'unpack 'dont-run-rubocop
           (lambda _
             (substitute* "Rakefile"
               ((".*rubocop.*") "")
               ((".*RuboCop.*") ""))
             #t)))))
    (propagated-inputs
     (list ruby-highline))
    (native-inputs
     (list bundler ruby-rspec-core ruby-rspec-expectations
           ruby-rspec-mocks ruby-simplecov))
    (home-page "https://github.com/commander-rb/commander")
    (synopsis "Library for building Ruby command-line executables")
    (description
     "Commander aims to be a complete solution for Ruby command-line
executables.  Commander bridges the gap between other terminal related
libraries (OptionParser, HighLine), while providing many new features, and an
elegant API.")
    (license license:expat)))

(define-public ruby-highline
  (package
    (name "ruby-highline")
    (version "2.0.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "highline" version))
       (sha256
        (base32
         "0gr6pckj2jayxw1gdgh9193j5jag5zrrqqlrnl4jvcwpyd3sn2zc"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f)) ;; TODO: NameError: uninitialized constant SPEC
    (native-inputs
     (list bundler ruby-code-statistics))
    (synopsis
     "HighLine helps you build command-line interfaces")
    (description
     "HighLine provides a high-level IO library that provides validation,
type conversion, and more for command-line interfaces.  HighLine also includes
a menu system for providing multiple options to the user.")
    (home-page "https://github.com/JEG2/highline")
    (license (list license:gpl2 license:ruby))))

(define-public ruby-hoe
  (package
    (name "ruby-hoe")
    (version "3.21.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "hoe" version))
              (sha256
               (base32
                "0qid0n56mgsjvq5ksxajv0gb92akky8imwgvw22ajms5g4fd6nf4"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         ;; One of the tests fails if the SOURCE_DATE_EPOCH environment
         ;; variable is set, so unset it for the duration of the tests.
         ;;
         ;; TestHoe#test_possibly_better
         ;; [/tmp/guix-build-ruby-hoe-3.20.0.drv-0/gem/test/test_hoe.rb:250]:
         ;; Expected: 2019-11-12 00:00:00 UTC
         ;; Actual: 1970-01-01 00:00:00 UTC
         (add-before 'check 'unset-SOURCE-DATE-EPOCH
           (lambda _
             (unsetenv "SOURCE_DATE_EPOCH")
             #t))
         (add-after 'check 'set-SOURCE-DATE-EPOCH-again
           (lambda _
             (setenv "SOURCE_DATE_EPOCH" "1")
             #t)))))
    (synopsis "Ruby project management helper")
    (description
     "Hoe is a rake/rubygems helper for project Rakefiles.  It helps manage,
maintain, and release projects and includes a dynamic plug-in system allowing
for easy extensibility.  Hoe ships with plug-ins for all the usual project
tasks including rdoc generation, testing, packaging, deployment, and
announcement.")
    (home-page "https://www.zenspider.com/projects/hoe.html")
    (license license:expat)))

(define-public ruby-rake-compiler
  (package
    (name "ruby-rake-compiler")
    (version "1.1.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "rake-compiler" version))
              (sha256
               (base32
                "11sxgw10jrd6a4irb51jjwam9wikixn5kss11pw4b80cmh32yvpf"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; needs cucumber
    (synopsis "Building and packaging helper for Ruby native extensions")
    (description "Rake-compiler provides a framework for building and
packaging native C and Java extensions in Ruby.")
    (home-page "https://github.com/rake-compiler/rake-compiler")
    (license license:expat)))

(define-public ruby-rake-compiler-dock
  (package
    (name "ruby-rake-compiler-dock")
    (version "1.3.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "rake-compiler-dock" version))
              (sha256
               (base32
                "0yr5f72irvhmnk12q7bbr4qw0xwy7diqkbcvb4lygjbg7rvk3k8k"))))
    (build-system ruby-build-system)
    (arguments (list #:tests? #f))      ;test suite requires docker
    (synopsis "Cross compiler environment for building Ruby gems")
    (description "The code{rake-compiler-dock} gem provides a cross compiler
environment for building gems on a variety of platforms (GNU/Linux, JRuby,
Windows and Mac).")
    (home-page "https://github.com/rake-compiler/rake-compiler-dock")
    (license license:expat)))

(define-public ruby-rsync
  (package
    (name "ruby-rsync")
    (version "1.0.9")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "rsync" version))
       (sha256
        (base32
         "0p8b27q1gvxilqfq2528xpwglzcm2myikkjxpqk7mwbwg9r6knxv"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "spec"
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'remove-coveralls-requirement
           (lambda _
             (substitute* "spec/spec_helper.rb"
               (("require 'coveralls'") "")
               (("Coveralls.wear!") ""))
             #t)))))
    (native-inputs
     (list bundler rsync ruby-rspec-core ruby-rspec-expectations
           ruby-rspec-mocks))
    (home-page "https://github.com/jbussdieker/ruby-rsync")
    (synopsis "Ruby wrapper around rsync")
    (description
     "Ruby Rsync is a Ruby library that can synchronize files between remote
hosts by wrapping the @file{rsync} binary.")
    (license license:expat)))

(define-public ruby-i18n
  (package
    (name "ruby-i18n")
    (version "1.7.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "i18n" version))
              (sha256
               (base32
                "0hmypvx9iyc0b4hski7aic2xzm09cg1c7q1qlpnk3k8s5acxzyhl"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; no tests
    (propagated-inputs `(("concurrent-ruby" ,ruby-concurrent)))
    (synopsis "Internationalization library for Ruby")
    (description "Ruby i18n is an internationalization and localization
solution for Ruby programs.  It features translation and localization,
interpolation of values to translations, pluralization, customizable
transliteration to ASCII, flexible defaults, bulk lookup, lambdas as
translation data, custom key/scope separator, custom exception handlers, and
an extensible architecture with a swappable backend.")
    (home-page "https://github.com/ruby-i18n/i18n")
    (license license:expat)))

(define-public ruby-io-console
  (package
    (name "ruby-io-console")
    (version "0.6.0")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/ruby/io-console/")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0gwxrp29b6awkid1sf85sbh529mnq6hb86m8c2443cm6nc4vr8qb"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases #~(modify-phases %standard-phases
                        (add-after 'unpack 'delete-rakelib-files
                          (lambda _
                            ;; These depend on git and other extraneous
                            ;; dependencies, and are loaded by rake.
                            (delete-file-recursively "rakelib"))))))
    (native-inputs (list ruby-rake-compiler))
    (synopsis "Console capabilities library for IO instances")
    (description "IO.console adds console capabilities to Ruby IO instances.")
    (home-page "https://github.com/ruby/io-console")
    (license license:bsd-2)))

(define-public ruby-irb
  (package
    (name "ruby-irb")
    (version "1.6.3")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "irb" version))
              (sha256
               (base32
                "1h9s07n5v3z029v18924ws9vdkdc80n6llp9ccx77yg1krv2g0f3"))))
    (build-system ruby-build-system)
    ;; XXX: Disable the test suite, as it requires debug, which requires this
    ;; package (dependency cycle).
    (arguments (list #:tests? #f))
    (propagated-inputs (list ruby-reline))
    (synopsis "Ruby command-line tool for REPL (Read Eval Print Loop)")
    (description "IRB is an interactive Ruby command-line tool for REPL (Read
Eval Print Loop).")
    (home-page "https://github.com/ruby/irb")
    (license license:bsd-2)))

(define-public ruby-iruby
  (package
    (name "ruby-iruby")
    (version "0.3")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "iruby" version))
       (sha256
        (base32
         "1wdf2c0x8y6cya0n3y0p3p7b1sxkb2fdavdn2k58rf4rs37s7rzn"))))
    (build-system ruby-build-system)
    (arguments
     ;; TODO: Tests currently fail.
     ;;
     ;; Finished in 1.764405s, 1.1335 runs/s, 5.1009 assertions/s.
     ;;
     ;;   1) Failure:
     ;; IntegrationTest#test_interaction [/tmp/guix-build-ruby-iruby-0.3.drv-0/gem/test/integration_test.rb:25]:
     ;; In [ expected
     ;;
     ;; 2 runs, 9 assertions, 1 failures, 0 errors, 0 skips
     '(#:tests? #f
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'patch-ipython
           (lambda* (#:key inputs #:allow-other-keys)
             (substitute* "lib/iruby/command.rb"
               (("version = `")
                (string-append
                 "version = `"
                 (assoc-ref inputs "python-ipython")
                 "/bin/"))
               (("Kernel\\.exec\\('")
                (string-append
                 "Kernel.exec('"
                 (assoc-ref inputs "python-ipython")
                 "/bin/")))
             #t)))))
    (inputs
     (list python-ipython))
    (propagated-inputs
     (list ruby-bond
           ruby-data_uri
           ruby-mimemagic
           ruby-multi-json
           ruby-cztop
           ;; Optional inputs
           ruby-pry))
    (synopsis "Ruby kernel for Jupyter/IPython")
    (description
     "This package provides a Ruby kernel for Jupyter/IPython frontends (e.g.
notebook).")
    (home-page "https://github.com/SciRuby/iruby")
    (license license:expat)))

;; RSpec is the dominant testing library for Ruby projects.  Even RSpec's
;; dependencies use RSpec for their test suites!  To avoid these circular
;; dependencies, we disable tests for all of the RSpec-related packages.
(define-public ruby-rspec-support
  (package
    (name "ruby-rspec-support")
    (version "3.12.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "rspec-support" version))
              (sha256
               (base32
                "12y52zwwb3xr7h91dy9k3ndmyyhr3mjcayk0nnarnrzz8yr48kfx"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; avoid dependency cycles
    (synopsis "RSpec support library")
    (description "Support utilities for RSpec gems.")
    (home-page "https://github.com/rspec/rspec-support")
    (license license:expat)))

(define-public ruby-rspec-core
  (package
    (name "ruby-rspec-core")
    (version "3.12.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "rspec-core" version))
              (sha256
               (base32
                "0da45cvllbv39sdbsl65vp5djb2xf5m10mxc9jm7rsqyyxjw4h1f"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; avoid dependency cycles
    (propagated-inputs
     (list ruby-rspec-support))
    (synopsis "RSpec core library")
    (description "Rspec-core provides the RSpec test runner and example
groups.")
    (home-page "https://github.com/rspec/rspec-core")
    (license license:expat)))

(define-public ruby-rspec-core-2
  (package (inherit ruby-rspec-core)
    (version "2.14.8")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "rspec-core" version))
              (sha256
               (base32
                "0psjy5kdlz3ph39br0m01w65i1ikagnqlg39f8p65jh5q7dz8hwc"))))
    (propagated-inputs `())))

(define-public ruby-date
  (package
    (name "ruby-date")
    (version "3.3.3")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/ruby/date")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1jiqjnaap1jk1r8z37iicnzqha1rhc713qmcir17f4vnz8ac8v75"))))
    (build-system ruby-build-system)
    (arguments (list #:test-target "default"))
    (native-inputs (list ruby-rake-compiler))
    (synopsis "Ruby @code{Object} subclass with date comparison capability")
    (description "This package provides a subclass of @code{Object} that
includes the @code{Comparable} module for handling dates.")
    (home-page "https://github.com/ruby/date")
    (license license:bsd-2)))

(define-public ruby-diff-lcs
  (package
    (name "ruby-diff-lcs")
    (version "1.3")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "diff-lcs" version))
              (sha256
               (base32
                "18w22bjz424gzafv6nzv98h0aqkwz3d9xhm7cbr1wfbyas8zayza"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; avoid dependency cycles
    (synopsis "Compute the difference between two Enumerable sequences")
    (description "Diff::LCS computes the difference between two Enumerable
sequences using the McIlroy-Hunt longest common subsequence (LCS) algorithm.
It includes utilities to create a simple HTML diff output format and a
standard diff-like tool.")
    (home-page "https://github.com/halostatue/diff-lcs")
    (license license:expat)))

(define-public ruby-rspec-expectations
  (package
    (name "ruby-rspec-expectations")
    (version "3.12.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "rspec-expectations" version))
              (sha256
               (base32
                "03ba3lfdsj9zl00v1yvwgcx87lbadf87livlfa5kgqssn9qdnll6"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; avoid dependency cycles
    (propagated-inputs
     (list ruby-rspec-support ruby-diff-lcs))
    (synopsis "RSpec expectations library")
    (description "Rspec-expectations provides a simple API to express expected
outcomes of a code example.")
    (home-page "https://github.com/rspec/rspec-expectations")
    (license license:expat)))

(define-public ruby-rspec-expectations-2
  (package (inherit ruby-rspec-expectations)
    (version "2.14.5")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "rspec-expectations" version))
              (sha256
               (base32
                "1ni8kw8kjv76jvwjzi4jba00k3qzj9f8wd94vm6inz0jz3gwjqf9"))))
    (propagated-inputs
     (list ruby-diff-lcs))))

(define-public ruby-sorcerer
  (package
    (name "ruby-sorcerer")
    (version "2.0.1")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "sorcerer" version))
        (sha256
          (base32
            "0d32ha9pp9slpmsm027pkdpbr9vc5jn2m8rl6hwwx6a87m8cr58h"))))
    (build-system ruby-build-system)
    (synopsis "Ripper-style abstract syntax tree to Ruby source generator")
    (description "Sorcerer generates Ruby code from a Ripper-like abstract
syntax tree (i.e. S-Expressions).  Sorcerer is targeted mainly at small
snippets of Ruby code, expressible in a single line.  Longer examples may be
re-sourced, but they will be rendered in a single-line format.")
    (home-page "https://github.com/rspec-given/sorcerer")
    (license license:expat)))

(define-public ruby-given-core
  (package
    (name "ruby-given-core")
    (version "3.8.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "given_core" version))
       (sha256
        (base32
         "0w1pyhgb2am7c267s8v06dpd9qhmsk2x4hfr2aq8l8lh49ma227s"))))
    (build-system ruby-build-system)
    (arguments '(#:tests? #f))          ;no test suite for the core package
    (propagated-inputs
     (list ruby-sorcerer))
    (synopsis "Core abstractions used by rspec-given and minitest-given")
    (description "Given_core is the basic functionality behind rspec-given and
minitest-given, extensions that allow the use of Given/When/Then terminology
when defining specifications.")
    (home-page "https://github.com/rspec-given/rspec-given")
    (license license:expat)))

(define-public ruby-rspec-given
  (package
    (name "ruby-rspec-given")
    (version "3.8.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "rspec-given" version))
       (sha256
        (base32
         "0xzzxjjzwrsp84p12sd6ab3jbm9kh7sbnqpxgc9mlfq3s3ll0fdj"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "rs"
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'fix-rakefile
           (lambda _
             (substitute* '("Rakefile" "rakelib/gemspec.rake")
               (("require '\\./lib/given/.*") "")
               (("Given::VERSION") (format #f "~s" ,version))
               ;; Fix the error: "cannot load such file -- example_helper"
               (("sh \"rspec")
                "sh \"rspec -Ilib:examples"))))
         (add-after 'extract-gemspec 'delete-failing-tests
           ;; See: https://github.com/jimweirich/rspec-given/issues/57.
           (lambda _
             (substitute* ".gemspec"
               (("\"spec/lib/given/natural_assertion_spec.rb\".freeze, ")
                "")
               (("\"examples/integration/failing_messages_spec.rb\".freeze, ")
                ""))
             (delete-file "spec/lib/given/natural_assertion_spec.rb")
             (delete-file "examples/integration/failing_messages_spec.rb"))))))
    (native-inputs
     (list ruby-rspec ruby-minitest))
    (propagated-inputs
     (list ruby-given-core ruby-rspec))
    (synopsis "Given/When/Then for RSpec and Minitest")
    (description "Given is an RSpec extension that allows the use of
Given/When/Then terminology when defining specifications, in a way similar to
the Cucumber Gherkin language.")
    (home-page "https://github.com/rspec-given/rspec-given")
    (license license:expat)))

(define-public ruby-rspec-its
  (package
    (name "ruby-rspec-its")
    (version "1.3.0")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/rspec/rspec-its")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "02mlsc9d4d1cjj5vahi8v3q8hyn9fyiv8nnlidhgfh186qp20g1p"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "spec"
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'dont-install-gems-from-gemfile
           (lambda _
             (substitute* "Gemfile"
               (("rspec rspec-core rspec-expectations rspec-mocks rspec-support")
                ""))
             #t))
         (add-before 'build 'loosen-ffi-requirement
           (lambda _
             ;; Accept any version of ruby-ffi.
             (substitute* "Gemfile"
               (("  gem 'ffi', '~> 1\\.9\\.25'")
                "  gem 'ffi'"))
             #t))
         (add-before 'build 'remove-unnecessary-dependency-versions-from-gemfile
           (lambda _
             (substitute* "rspec-its.gemspec"
               (("rake.*") "rake'\n")
               (("spec.add_development_dependency 'cucumber'.*")
                "spec.add_development_dependency 'cucumber'\n")
               (("bundler.*") "bundler'\n")
               (("\"aruba.*") "'aruba'\n"))
             #t)))))
    (propagated-inputs
     (list ruby-rspec-core ruby-rspec-expectations))
    (native-inputs
     (list bundler ruby-cucumber ruby-ffi ruby-aruba))
    (synopsis "RSpec extension that provides the @code{its} method")
    (description
     "RSpec::Its provides the its method as a short-hand to specify the expected
value of an attribute.  For example, one can use @code{its(:size)\\{should
eq(1)\\}}.")
    (home-page "https://github.com/rspec/rspec-its")
    (license license:expat)))

;;; This variant is used to break a cycle with ruby-protobuf.
(define-public ruby-rspec-its-minimal
  (hidden-package
   (package
     (inherit ruby-rspec-its)
     (arguments
      (substitute-keyword-arguments (package-arguments ruby-rspec-its)
        ((#:tests? _ #f) #f)))
     (native-inputs '()))))

(define-public ruby-rspec-mocks
  (package
    (name "ruby-rspec-mocks")
    (version "3.12.4")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "rspec-mocks" version))
              (sha256
               (base32
                "1dcfh85m3ksir6n8gydsal4d85chpww1b2nahb05nl8xhgh0r2ij"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; avoid dependency cycles
    (propagated-inputs
     (list ruby-rspec-support ruby-diff-lcs))
    (synopsis "RSpec stubbing and mocking library")
    (description "Rspec-mocks provides RSpec's \"test double\" framework, with
support for stubbing and mocking.")
    (home-page "https://github.com/rspec/rspec-mocks")
    (license license:expat)))

(define-public ruby-rspec-mocks-2
  (package (inherit ruby-rspec-mocks)
    (version "2.14.6")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "rspec-mocks" version))
              (sha256
               (base32
                "1fwsmijd6w6cmqyh4ky2nq89jrpzh56hzmndx9wgkmdgfhfakv30"))))
    (propagated-inputs
     (list ruby-diff-lcs))))

(define-public ruby-rspec-block-is-expected
  (package
    (name "ruby-rspec-block-is-expected")
    (version "1.0.2")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/pboling/rspec-block_is_expected")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1w8mj00k8am24yw7lbhg616m111p7h7bbfxaw7np4i7wnlwzm8fk"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases #~(modify-phases %standard-phases
                        (add-after 'unpack 'relax-requirements
                          (lambda _
                            (substitute* "Rakefile"
                              (("require 'rubocop/rake_task'") "")
                              (("RuboCop::RakeTask.new") ""))
                            ;; Contains extraneous requirements not actually
                            ;; needed for the test suite.
                            (delete-file "Gemfile"))))))
    (native-inputs (list ruby-rspec-pending-for ruby-rspec-expectations))
    (propagated-inputs (list ruby-rspec-core))
    (synopsis "Simplify testing of blocks in RSpec")
    (description "This RSpec plugin allows you to use @code{block_is_expected}
similarly to how you would use @code{is_expected} if a block was wrapping the
subject.")
    (home-page "https://github.com/pboling/rspec-block_is_expected")
    (license license:expat)))

(define-public ruby-rspec-pending-for
  (package
    (name "ruby-rspec-pending-for")
    (version "0.1.16")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/pboling/rspec-pending_for")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "107l560vm0kx25w5iy5rsk9ly8dxzr81b31284j514f4hkd0qv3m"))))
    (build-system ruby-build-system)
    (native-inputs (list ruby-rspec ruby-simplecov))
    (propagated-inputs (list ruby-rspec-core ruby-ruby-engine
                             ruby-ruby-version))
    (synopsis "Skip RSpec tests for specific Ruby engines or versions")
    (description "This RSpec plugin makes it easy to mark test cases as
pending or skipped for a specific Ruby engine (e.g. MRI or JRuby) or version
combinations.")
    (home-page "https://github.com/pboling/rspec-pending_for")
    (license license:expat)))

(define-public ruby-rspec-rerun
  (package
    (name "ruby-rspec-rerun")
    (version "1.1.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "rspec-rerun" version))
       (sha256
        (base32
         "1gy7znkcaqhpccfnk2nvaqbsvgxy3q57cmjwkl9fi1zabaq5lbkj"))))
    (build-system ruby-build-system)
    (arguments
     '(;; No included tests
       #:tests? #f))
    (propagated-inputs (list ruby-rspec))
    (synopsis "Track failed RSpec tests to re-run them")
    (description
     "This package provides an automated way to track, and then re-run failed
RSpec tests.")
    (home-page "https://github.com/dblock/rspec-rerun")
    (license license:expat)))

(define-public ruby-rspec-stubbed-env
  ;; There is no release nor tag (see:
  ;; https://github.com/pboling/rspec-stubbed_env/issues/7).
  (let ((revision "0")
        (commit "9d767dec77a6d130f6ad83c48a00a5c81b14b9fa"))
    (package
      (name "ruby-rspec-stubbed-env")
      (version (git-version "1.0.0" revision commit))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/pboling/rspec-stubbed_env")
                      (commit commit)))
                (file-name (git-file-name name version))
                (sha256
                 (base32
                  "1dy4m04h613dp0s59rknjd6h4lqs1h17mffc5kd8kh046mk8nr1p"))))
      (build-system ruby-build-system)
      (arguments
       (list #:test-target "spec"
             #:phases #~(modify-phases %standard-phases
                          (add-after 'unpack 'streamline-requirements
                            (lambda _
                              ;; Remove extraneous development dependencies.
                              (substitute* "rspec-stubbed_env.gemspec"
                                ((".*bundler.*") "")
                                ((".*rubocop.*") "")))))))
      (native-inputs (list ruby-simplecov))
      (propagated-inputs (list ruby-rspec))
      (synopsis "RSpec plugin to stub environment variables")
      (description
       "This RSpec plugin can be used to stub environment variables in a scoped
context for testing.")
      (home-page "https://github.com/pboling/rspec-stubbed_env")
      (license license:expat))))

(define-public ruby-rspec-wait
  (package
    (name "ruby-rspec-wait")
    (version "0.0.9")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "rspec-wait" version))
        (sha256
         (base32
          "0gvj1bp5ccx001dyvcgk2j49s5sl6vs9fdaqqb08z3bd1554hsww"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             (invoke "rake" "spec"))))))
    (native-inputs
     (list bundler))
    (propagated-inputs
     (list ruby-rspec))
    (home-page "https://github.com/laserlemon/rspec-wait")
    (synopsis "Wait for conditions in RSpec")
    (description
     "RSpec::Wait strives to make it easier to test asynchronous or slow
interactions.")
    (license license:expat)))

(define-public ruby-rspec
  (package
    (name "ruby-rspec")
    (version "3.12.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "rspec" version))
              (sha256
               (base32
                "171rc90vcgjl8p1bdrqa92ymrj8a87qf6w20x05xq29mljcigi6c"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; avoid dependency cycles
    (propagated-inputs
     (list ruby-rspec-core ruby-rspec-mocks ruby-rspec-expectations))
    (synopsis "Behavior-driven development framework for Ruby")
    (description "RSpec is a behavior-driven development (BDD) framework for
Ruby.  This meta-package includes the RSpec test runner, along with the
expectations and mocks frameworks.")
    (home-page "https://rspec.info/")
    (license license:expat)))

(define-public ruby-rspec-2
  (package (inherit ruby-rspec)
    (version "2.14.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "rspec" version))
              (sha256
               (base32
                "134y4wzk1prninb5a0bhxgm30kqfzl8dg06af4js5ylnhv2wd7sg"))))
    (propagated-inputs
     (list ruby-rspec-core-2 ruby-rspec-mocks-2 ruby-rspec-expectations-2))))

(define-public ruby-rspec-debug
  (package
    (name "ruby-rspec-debug")
    (version "0.2.0")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/ko1/rspec-debug")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "125p1zxjznkk765nyqvkksw8x1nbm7xk4sjc1wza2fyp5hvyiddn"))))
    (build-system ruby-build-system)
    (arguments
     (list #:test-target "spec"
           #:phases #~(modify-phases %standard-phases
                        (add-after 'extract-gemspec 'relax-dependencies
                          (lambda _
                            (substitute* "Gemfile"
                              (("~>") ">=")))))))
    (native-inputs (list ruby-rspec))
    (propagated-inputs (list ruby-debug))
    (synopsis "Invoke Ruby debugger when spec fails")
    (description "This package can be used to have the execution stopped for
inspection in the Ruby debugger upon encountering a failure.  To use it, set
the @env{RSPEC_DEBUG} environment variable to @samp{true} then invoke the
@command{rspec} command as usual.")
    (home-page "https://github.com/ko1/rspec-debug")
    (license license:expat)))

;; Bundler is yet another source of circular dependencies, so we must disable
;; its test suite as well.
(define-public bundler
  (package
    (name "bundler")
    (version "2.4.10")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "bundler" version))
              (sha256
               (base32
                "08d1nj2h4yl6c1bnrwl2pk1kcskpgi6fvyd8fs36lfh68jlnz05r"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; avoid dependency cycles
    (synopsis "Ruby gem bundler")
    (description "Bundler automatically downloads and installs a list of gems
specified in a \"Gemfile\", as well as their dependencies.")
    (home-page "https://bundler.io/")
    (license license:expat)))

(define-public ruby-builder
  (package
    (name "ruby-builder")
    (version "3.2.4")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "builder" version))
              (sha256
               (base32
                "045wzckxpwcqzrjr353cxnyaxgf0qg22jh00dcx7z38cys5g1jlr"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'do-not-use-rvm
          (lambda _
            (substitute* "rakelib/tags.rake"
              (("RVM_GEMDIR = .*") "RVM_GEMDIR = 'no-rvm-please'\n"))
            #t)))))
    (synopsis "Ruby library to create structured data")
    (description "Builder provides a number of builder objects that make it
easy to create structured data.  Currently the following builder objects are
supported: XML Markup and XML Events.")
    (home-page "https://github.com/jimweirich/builder")
    (license license:expat)))

(define-public ruby-bump
  (package
    (name "ruby-bump")
    (version "0.7.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "bump" version))
       (sha256
        (base32
         "1xinbr9rzh6cj75x24niwgqcnbhdxc68a8bc41lk8xv6fd906fym"))))
    (build-system ruby-build-system)
    (arguments
     '(;; No included tests
       #:tests? #f))
    (synopsis "Tool for working with Rubygems")
    (description
     "Bump provides commands to manage Rubygem versioning, updating to the
next patch version for example.")
    (home-page "https://github.com/gregorym/bump")
    (license license:expat)))

(define-public ruby-rjb
  (package
    (name "ruby-rjb")
    (version "1.5.5")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "rjb" version))
              (sha256
               (base32
                "1ppj8rbicj3w0nhh7f73mflq19yd7pzdzkh2a91hcvphriy5b0ca"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f ; no rakefile
       #:phases
       (modify-phases %standard-phases
         (add-before 'build 'set-java-home
          (lambda* (#:key inputs #:allow-other-keys)
            (setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
            #t)))))
    (native-inputs
     `(("jdk" ,icedtea "jdk")))
    (synopsis "Ruby-to-Java bridge using the Java Native Interface")
    (description "RJB is a bridge program that connects Ruby and Java via the
Java Native Interface.")
    (home-page "https://www.artonx.org/collabo/backyard/?RubyJavaBridge")
    (license license:lgpl2.1+)))

(define-public ruby-log4r
  (package
    (name "ruby-log4r")
    (version "1.1.10")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "log4r" version))
        (sha256
          (base32
            "0ri90q0frfmigkirqv5ihyrj59xm8pq5zcmf156cbdv4r4l2jicv"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; no Rakefile in gem
    (synopsis "Flexible logging library for Ruby")
    (description "Comprehensive and flexible logging library written
in Ruby for use in Ruby programs.  It features a hierarchical logging
system of any number of levels, custom level names, logger
inheritance, multiple output destinations per log event, execution
tracing, custom formatting, thread safteyness, XML and YAML
configuration, and more.")
     (home-page "http://log4r.rubyforge.org/")
     (license license:bsd-3)))

(define-public ruby-atoulme-antwrap
  (package
    (name "ruby-atoulme-antwrap")
    (version "0.7.5")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "atoulme-Antwrap" version))
              (sha256
               (base32
                "05s3iw44lqa81f8nfy5f0xjj808600h82zb9bsh46b9kcq2w2kmz"))))
    (build-system ruby-build-system)
    ;; Test data required for most of the tests are not included.
    (arguments `(#:tests? #f))
    (native-inputs
     (list ruby-hoe))
    (inputs
     (list ruby-rjb))
    (synopsis "Ruby wrapper for the Ant build tool")
    (description "Antwrap is a Ruby module that wraps the Apache Ant build
tool.  Antwrap can be used to invoke Ant tasks from a Ruby or a JRuby
script.")
    (home-page "http://rubyforge.org/projects/antwrap/")
    (license license:expat)))

(define-public ruby-atoulme-saikuro
  (package
    (name "ruby-atoulme-saikuro")
    (version "1.2.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "atoulme-Saikuro" version))
              (sha256
               (base32
                "0kvd2nsxffbza61d3q4j94wrbnbv50r1zy3a7q26f6k706fw1f19"))))
    (build-system ruby-build-system)
    ;; FIXME: There are no unit tests.  The tests are demonstrations of the
    ;; "saikuro" tool.
    (arguments `(#:tests? #f))
    (synopsis "Cyclomatic complexity analyzer")
    (description "Saikuro is a Ruby cyclomatic complexity analyzer.  When
given Ruby source code Saikuro will generate a report listing the cyclomatic
complexity of each method found.  In addition, Saikuro counts the number of
lines per method and can generate a listing of the number of tokens on each
line of code.")
    (home-page "http://www.github.com/atoulme/Saikuro")
    ;; File headers contain the BSD-3 license and the README.rdoc says that
    ;; "Saikuro uses the BSD license", but the LICENSE file contains the text
    ;; of the Expat license.
    (license license:bsd-3)))

(define-public ruby-awesome-print
  (package
    (name "ruby-awesome-print")
    (version "1.8.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "awesome_print" version))
       (sha256
        (base32
         "14arh1ixfsd6j5md0agyzvksm5svfkvchb90fp32nn7y3avcmc2h"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             ;; Remove failing test.
             (for-each delete-file
                       '("spec/ext/nokogiri_spec.rb"
                         "spec/colors_spec.rb"
                         "spec/formats_spec.rb"
                         "spec/methods_spec.rb"
                         "spec/misc_spec.rb"
                         "spec/objects_spec.rb"))
             (invoke "rspec" "-c" "spec"))))))
    (native-inputs
     (list ruby-nokogiri ruby-rspec ruby-simplecov))
    (synopsis "Pretty print Ruby objects to visualize their structure")
    (description
     "Ruby dubugging companion: pretty print Ruby objects to visualize their
structure.  Supports custom object formatting via plugins.")
    (home-page "https://github.com/awesome-print/awesome_print")
    (license license:expat)))

(define-public ruby-pandoc-ruby
  (package
    (name "ruby-pandoc-ruby")
    (version "2.1.4")
    (source
     (origin
       (method git-fetch)               ;the gem lacks many test files
       (uri (git-reference
             (url "https://github.com/xwmx/pandoc-ruby")
             (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "03a11clhycyn0jhc7g9davpqd83sn60jqwjy1y145ag9sq6sp935"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f ; Disable tests since they depend on pandoc behavior
                   ; and there are no upstream releases.
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'patch-pandoc-path
           (lambda* (#:key inputs #:allow-other-keys)
             (let ((pandoc (search-input-file inputs "/bin/pandoc")))
               (substitute* "lib/pandoc-ruby.rb"
                 (("@@pandoc_path = 'pandoc'")
                  (format #f "@@pandoc_path = '~a'" pandoc)))
               (substitute* "test/test_pandoc_ruby.rb"
                 (("('|\")pandoc" _ quote)
                  (string-append quote pandoc))
                 (("\\^pandoc")
                  ".*pandoc")))))
         (add-after 'unpack 'adjust-tests
           ;; The tests expect filenames with spaces.  Because they don't have
           ;; spaces the quotes around the output are dropped automatically.
           (lambda _
             (substitute* "test/test_pandoc_ruby.rb"
               (("\\\\\"#\\{file\\.path\\}\\\\\"") "#{file.path}"))))
         (add-after 'extract-gemspec 'remove-Gemfile.lock
           (lambda _
             (delete-file "Gemfile.lock")
             (substitute* "pandoc-ruby.gemspec"
               (("Gemfile\\.lock") "")))))))
    (native-inputs
     (list ruby-mocha))
    (inputs
     (list pandoc))
    (synopsis "Ruby wrapper for Pandoc")
    (description "PandocRuby is a wrapper for Pandoc, a Haskell library with
command line tools for converting one markup format to another.  Pandoc can
convert documents from a variety of formats including markdown,
reStructuredText, textile, HTML, DocBook, LaTeX, and MediaWiki markup to a
variety of other formats, including markdown, reStructuredText, HTML, LaTeX,
ConTeXt, PDF, RTF, DocBook XML, OpenDocument XML, ODT, GNU Texinfo, MediaWiki
markup, groff man pages, HTML slide shows, EPUB, Microsoft Word docx, and
more.")
    (home-page "https://github.com/xwmx/pandoc-ruby")
    (license license:expat)))

(define-public ruby-patron
  (package
    (name "ruby-patron")
    (version "0.13.3")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "patron" version))
       (sha256
        (base32
         "0523gddx88zql2mq6655k60gy2ac8vybpzkcf90lmd9nx7wl3fi9"))))
    (build-system ruby-build-system)
    (inputs
     (list curl))
    (arguments
     `(#:tests? #f))                    ; no included tests
    (synopsis "Ruby HTTP client library based on @code{libcurl}")
    (description
     "Patron is a Ruby HTTP client library based on @code{libcurl}.  It does
not try to expose the full power (read complexity) of @code{libcurl} but
instead tries to provide a sane API while taking advantage of @code{libcurl}
under the hood.")
    (home-page "https://github.com/toland/patron")
    (license license:expat)))

(define-public ruby-slim
  (package
    (name "ruby-slim")
    (version "5.1.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "slim" version))
       (sha256
        (base32
         "1rp437r8hr9kdgabb7c96yw4z2wyrajl4cxiij038y10f8i6hbn4"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         ;; See: https://github.com/slim-template/slim/issues/857 and
         ;; https://github.com/slim-template/slim/issues/858.
         (add-after 'unpack 'skip-broken-tests
           (lambda _
             (substitute* "test/core/test_embedded_engines.rb"
               (("def test_render_with_markdown")
                "def skipped_test_render_with_markdown"))
             (substitute* "test/translator/test_translator.rb"
               (("raise (\"Missing test for.*)" _ tail)
                (string-append "print " tail)))))
         ;; See: https://salsa.debian.org/ruby-team/ruby-slim/-/commit/
         ;; 824862bd99d1675bc699d8fc71ba965a785c1f44.
         (add-after 'unpack 'prevent-bundler-interference
           (lambda _
             (substitute* "Rakefile"
               (("require 'bundler/setup'") "nil")
               (("Bundler::GemHelper\\.install_tasks") "nil")))))))
    (native-inputs
     (list ruby-rack-test ruby-rspec-core ruby-sinatra))
    (propagated-inputs
     (list ruby-temple ruby-tilt))
    (synopsis "Minimalist template language for Ruby")
    (description "Slim is a template language for Ruby that aims to reduce the
syntax to the minimum while remaining clear.")
    (home-page "http://slim-lang.com/")
    (license license:expat)))

(define-public ruby-asciidoctor
  (package
    (name "ruby-asciidoctor")
    (version "2.0.18")
    (source
     (origin
       (method git-fetch)               ;the gem release lacks a Rakefile
       (uri (git-reference
             (url "https://github.com/asciidoctor/asciidoctor")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "1mpk3y69lqz9ywfkjmr40dm3mkabrnf92bb011qq1axj73yyrajv"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:test-target "test:all"
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'extract-gemspec 'strip-version-requirements
            (lambda _
              (delete-file "Gemfile")
              (substitute* "asciidoctor.gemspec"
                (("(.*add_.*dependency '[_A-Za-z0-9-]+').*" _ stripped)
                 (string-append stripped "\n")))))
          (add-after 'install 'install-man-page
            (lambda* (#:key outputs #:allow-other-keys)
              (install-file (search-input-file
                             outputs (string-append "lib/ruby/vendor_ruby/"
                                                    "gems/asciidoctor-"
                                                    #$version
                                                    "/man/asciidoctor.1"))
                            (string-append #$output "/share/man/man1")))))))
    (native-inputs
     (list ruby-asciimath
           ruby-coderay
           ruby-cucumber
           ruby-erubis
           ruby-haml
           ruby-minitest
           ruby-nokogiri
           ruby-open-uri-cached
           ruby-rouge
           ruby-rspec-expectations
           ruby-simplecov
           ruby-slim
           ruby-tilt
           ruby-erubi))
    (synopsis "Converter from AsciiDoc content to other formats")
    (description "Asciidoctor is a text processor and publishing toolchain for
converting AsciiDoc content to HTML5, DocBook 5, PDF, and other formats.")
    (home-page "https://asciidoctor.org")
    (license license:expat)))

(define-public ruby-asciidoctor-multipage
  (package
    (name "ruby-asciidoctor-multipage")
    (version "0.0.16")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/owenh000/asciidoctor-multipage")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0rnz7qxdw5qbi3qjplihhk468kv690njdi06yllgylc75k62ar1p"))))
    (propagated-inputs (list ruby-asciidoctor ruby-slim))
    (build-system ruby-build-system)
    (arguments
     `(#:phases (modify-phases %standard-phases
                  (add-after 'extract-gemspec 'strip-version-requirements
                    (lambda _
                      (delete-file "Gemfile")
                      (substitute* "asciidoctor-multipage.gemspec"
                        (("(.*add_.*dependency '[_A-Za-z0-9-]+').*" _ stripped)
                         (string-append stripped "\n"))))))))
    (synopsis
     "Asciidoctor extension for generating HTML output using multiple pages")
    (description
     "Asciidoctor generates single-page documents.  This extension
splits documents up into multiple HTML pages according to their headings, with
configurable levels.")
    (license license:expat)
    (home-page "https://github.com/owenh000/asciidoctor-multipage")))

(define-public ruby-prawn-icon
  (package
    (name "ruby-prawn-icon")
    (version "3.1.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "prawn-icon" version))
       (sha256
        (base32
         "049k42bqy4iq9hddf7jah83b6qr8ka63w1d63illh1mf4f4dihdk"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "spec"
       #:phases (modify-phases %standard-phases
                  (add-after 'unpack 'remove-unnecessary-dependencies
                    (lambda _
                      (substitute* '("Rakefile" "spec/spec_helper.rb")
                        ((".*[Bb]undler.*") "")
                        (("^require 'rubocop.*") "")
                        (("^RuboCop.*") "")))))))
    (native-inputs
     (list ruby-pdf-inspector ruby-pdf-reader ruby-rspec ruby-simplecov))
    (propagated-inputs
     (list ruby-prawn))
    (synopsis "Icon fonts for use with the Prawn PDF toolkit")
    (description "@code{Prawn::Icon} provides various icon fonts including
FontAwesome, PaymentFont and Foundation Icons for use with the Prawn PDF
toolkit.")
    (home-page "https://github.com/jessedoyle/prawn-icon/")
    (license %prawn-project-licenses)))

(define-public ruby-css-parser
  (package
    (name "ruby-css-parser")
    (version "1.7.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "css_parser" version))
       (sha256
        (base32
         "04c4dl8cm5rjr50k9qa6yl9r05fk9zcb1zxh0y0cdahxlsgcydfw"))))
    (build-system ruby-build-system)
    (arguments `(#:tests? #f))          ;gem doesn't ship with test suite
    (propagated-inputs
     (list ruby-addressable))
    (synopsis "Ruby Cascading Style Sheets (CSS) parser")
    (description "This package allows loading, parsing and cascading Cascading
Style Sheets (CSS) rule sets in Ruby.")
    (home-page "https://github.com/premailer/css_parser")
    (license license:expat)))

(define-public ruby-prawn-svg
  (package
    (name "ruby-prawn-svg")
    (version "0.32.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "prawn-svg" version))
       (sha256
        (base32
         "0mbxzw7r7hv43db9422flc24ib9d8bdy1nasbni2h998jc5a5lb6"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases
           #~(modify-phases %standard-phases
               (add-after 'unpack 'do-not-use-bundler
                 (lambda _
                   (substitute* "spec/spec_helper.rb"
                     ((".*[Bb]undler.*") ""))))
               (replace 'check
                 (lambda* (#:key tests? #:allow-other-keys)
                   (when tests?
                     ;; This test fails due to the recent rspec 3.12 used
                     ;; (see: https://github.com/mogest/prawn-svg/issues/151).
                     (delete-file "spec/prawn/svg/interface_spec.rb")
                     (invoke "rspec" "-Ilib" "-rprawn-svg")))))))
    (native-inputs (list ruby-rspec))
    (propagated-inputs (list ruby-css-parser ruby-prawn))
    (synopsis "SVG renderer for the Prawn PDF library")
    (description "This library allows rendering Scalable Vector Graphics (SVG)
graphics directly into a Portable Document Format (PDF) document using the
Prawn module.")
    (home-page "https://github.com/mogest/prawn-svg")
    (license license:expat)))

(define-public ruby-prawn-templates
  (package
    (name "ruby-prawn-templates")
    (version "0.1.2")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/prawnpdf/prawn-templates")
             (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0wll54wxxwixpwazfn4ffbqvqbfrl01cfsv8y11vnlzy7isx5xvl"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases (modify-phases %standard-phases
                  (add-after 'unpack 'do-not-use-bundler
                    (lambda _
                      (substitute* "spec/spec_helper.rb"
                        ((".*[Bb]undler.*") ""))
                      #t))
                  (replace 'check
                    (lambda* (#:key tests? #:allow-other-keys)
                      (when tests?
                        (invoke "rspec"))
                      #t)))))
    (native-inputs
     (list ruby-pdf-inspector ruby-rspec))
    (propagated-inputs
     (list ruby-pdf-reader ruby-prawn))
    (synopsis "Prawn extension to include or combine PDF documents")
    (description "This @strong{unmaintained} package provides a Prawn
extension that allows including other Portable Document Format (PDF) documents
as background or combining several PDF documents into one.  This functionality
used to be part of Prawn itself, but was extracted from Prawn 0.15.0 because
of its many longstanding issues.")
    (home-page "https://github.com/prawnpdf/prawn-templates")
    (license %prawn-project-licenses)))

(define-public ruby-polyglot
  (package
    (name "ruby-polyglot")
    (version "0.3.5")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "polyglot" version))
       (sha256
        (base32
         "1bqnxwyip623d8pr29rg6m8r0hdg08fpr2yb74f46rn1wgsnxmjr"))))
    (build-system ruby-build-system)
    (arguments `(#:tests? #f))           ;no test suite
    (synopsis "Augment @code{require} to load non-Ruby file types")
    (description "The Polyglot library allows a Ruby module to register a
loader for the file type associated with a filename extension, and it augments
@code{require} to find and load matching files.")
    (home-page "https://github.com/cjheath/polyglot")
    (license license:expat)))

(define-public ruby-treetop
  (package
    (name "ruby-treetop")
    (version "1.6.10")
    (source
     (origin
       (method git-fetch)               ;no test suite in distributed gem
       (uri (git-reference
             (url "https://github.com/cjheath/treetop")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "1dmk94z6ivhrz5hsq68vl5vgydhkz89n394rha1ymddw3rymbfcv"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "spec"))
    (native-inputs
     (list ruby-activesupport ruby-rr ruby-rspec))
    (propagated-inputs
     (list ruby-polyglot))
    (synopsis "Ruby-based parsing DSL based on parsing expression grammars")
    (description "This package provides a Ruby-based Parsing Expression
Grammar (PEG) parser generator Domain Specific Language (DSL).")
    (home-page "https://github.com/cjheath/treetop")
    (license license:expat)))

(define-public ruby-typhoeus
  (package
    (name "ruby-typhoeus")
    (version "1.4.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "typhoeus" version))
       (sha256
        (base32
         "1m22yrkmbj81rzhlny81j427qdvz57yk5wbcf3km0nf3bl6qiygz"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))                    ; no included tests
    (propagated-inputs
     (list ruby-ethon))
    (synopsis "@code{libcurl} wrapper in Ruby")
    (description
     "Like a modern code version of the mythical beast with 100 serpent heads,
Typhoeus runs HTTP requests in parallel while cleanly encapsulating handling
logic.")
    (home-page "https://github.com/typhoeus/typhoeus")
    (license license:expat)))

;;; A minimal variant used to build ruby-rubocop itself.
(define ruby-rubocop-capybara-minimal
  (package
    (name "ruby-rubocop-capybara")
    (version "2.17.1")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/rubocop/rubocop-capybara")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "137y21b6g0kj1001zp95gwchx2cvgz8pglw2ik1cw647lh77qdsp"))))
    (build-system ruby-build-system)
    (arguments (list #:tests? #f))
    (synopsis "Capybara plugin for RuboCop")
    (description "This package provides a RuboCop plugin that can be used for
code style checking of Capybara test files (RSpec, Cucumber, Minitest).")
    (home-page "https://github.com/rubocop/rubocop-capybara")
    (license license:expat)))

(define-public ruby-rubocop-capybara
  (package
    (inherit ruby-rubocop-capybara-minimal)
    (arguments
     (list #:test-target "spec"
           #:phases #~(modify-phases %standard-phases
                        (add-after 'unpack 'relax-requirements
                          (lambda _
                            (substitute* "Gemfile"
                              (("gem 'rubocop-rspec', '~> 2.16.0'")
                               "gem 'rubocop-rspec', '>= 2.16.0'")))))))
    (native-inputs
     (list ruby-bump
           ruby-rack
           ruby-rake
           ruby-rspec
           ruby-rubocop
           ruby-rubocop-performance-minimal
           ruby-rubocop-rake-minimal
           ruby-rubocop-rspec-minimal
           ruby-simplecov
           ruby-yard))))

;;; A minimal variant used to build ruby-rubocop itself.
(define ruby-rubocop-rake-minimal
  (package
    (name "ruby-rubocop-rake")
    (version "0.6.0")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/rubocop/rubocop-rake")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1r53szwglikbir1fvpz4i51p915khrrkl6rp61zcx3dcrclkr3ld"))))
    (build-system ruby-build-system)
    (arguments (list #:tests? #f))      ;avoid extra dependencies
    (synopsis "RuboCop plugin for Rake")
    (description "This package provides a RuboCop plugin for Rake.")
    (home-page "https://github.com/rubocop/rubocop-rake")
    (license license:expat)))

(define-public ruby-rubocop-rake
  (package
    (inherit ruby-rubocop-rake-minimal)
    (arguments
     (list #:test-target "spec"))
    (native-inputs
     (list ruby-rake
           ruby-rspec
           ruby-rubocop
           ruby-rubocop-rspec))
    (propagated-inputs
     (list ruby-rubocop))))

;;; A minimal variant used to build ruby-rubocop itself.
(define ruby-rubocop-rspec-minimal
  (package
    (name "ruby-rubocop-rspec")
    (version "2.19.0")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/rubocop/rubocop-rspec")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0mgjyrzi8r44v3gb8xscdwspirz9kqkaf7zlsjhhlxr0di0rlj2r"))))
    (build-system ruby-build-system)
    (arguments (list #:tests? #f))      ;avoid extra dependencies
    (synopsis "Code style checking for RSpec files")
    (description "This package provides a plugin for the RuboCop code style
enforcing & linting tool.")
    (home-page "https://github.com/rubocop/rubocop-rspec")
    (license license:expat)))

(define-public ruby-rubocop-rspec
  (package
    (inherit ruby-rubocop-rspec-minimal)
    (arguments '(#:test-target "spec"))
    (native-inputs
     (list ruby-bump
           ruby-rack
           ruby-rspec
           ruby-rubocop-performance-minimal
           ruby-rubocop-rake-minimal
           ruby-simplecov
           ruby-yard))
    (propagated-inputs
     (list ruby-rubocop
           ruby-rubocop-ast
           ruby-rubocop-capybara))))

(define-public ruby-rubocop-performance
  (package
    (name "ruby-rubocop-performance")
    (version "1.16.0")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
              (url "https://github.com/rubocop/rubocop-performance")
              (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "1axafki2mpdz38y7i0afmnxcan5wj54l8crp8pbs7h1cip7y4s49"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f  ; tests require a git checkout of rubocop's source code.
       #:phases
       (modify-phases %standard-phases
         (replace 'replace-git-ls-files
           (lambda _
             (substitute* "rubocop-performance.gemspec"
               (("`git ls-files -z config lib LICENSE.txt README.md`")
                "`find config lib LICENSE.txt README.md \
-type f -print0 |sort -z`"))))
         (add-before 'check 'set-HOME
           (lambda _
             (setenv "HOME" "/tmp"))))))
    (propagated-inputs
     (list ruby-rubocop ruby-rubocop-ast))
    (native-inputs
     (list ruby-bump ruby-yard))
    (synopsis "Performance optimizations checkers for Ruby code")
    (description "This package provides a collection of RuboCop cops to check
for performance optimizations in Ruby code.")
    (home-page "https://docs.rubocop.org/rubocop-performance/")
    (license license:expat)))

(define-public ruby-rubocop-performance-minimal
  (hidden-package
   (package
     (inherit ruby-rubocop-performance)
     (arguments
      (substitute-keyword-arguments (package-arguments ruby-rubocop-performance)
        ((#:tests? _ #f) #f)))
     (propagated-inputs '())
     (native-inputs '()))))

(define-public ruby-gimme
  (let ((revision "1")
        (commit "4e71f0236f1271871916dd403261d26533db34c0"))
    (package
      (name "ruby-gimme")
      (version (git-version "0.5.0" revision commit))
      (source
       (origin
         (method git-fetch)
         (uri (git-reference
               (url "https://github.com/searls/gimme")
               (commit commit)))
         (file-name (git-file-name name version))
         (sha256
          (base32
           "0hrd32ygvf3i7h47ak8f623cz8ns9q7g60nnnvvlnywbggjaz3h6"))))
      (build-system ruby-build-system)
      (native-inputs
       (list ruby-coveralls ruby-cucumber ruby-pry ruby-simplecov
             ruby-rspec-given))
      (arguments
       `(;; The cucumber task fails with error: "index 3 out of matches
         ;; (IndexError)", apparently due to our newer Cucumber version.
         ;; TODO: Try the "default" task with a future release.
         #:test-target "spec"
         #:phases
         (modify-phases %standard-phases
           (add-after 'extract-gemspec 'prepare-for-tests
             (lambda _
               ;; Delete failing tests (possibly due to our newer rspec
               ;; version).
               (delete-file "spec/gimme/gives_class_methods_spec.rb")
               (delete-file "spec/gimme/rspec_adapter_spec.rb")
               (delete-file "spec/gimme/verifies_class_methods_spec.rb")
               ;; Fix duplicate version requirements and de-register files.
               (delete-file "Gemfile")
               (delete-file "Gemfile.lock")
               (substitute* "gimme.gemspec"
                 ((".*\"Gemfile\".*") "")
                 ((".*\"Gemfile\\.lock\",.*") "")
                 ((".*(rspec|cucumber).*\">= 0\".*") "")
                 (("\"spec/gimme/gives_class_methods_spec.rb\",") "")
                 (("\"spec/gimme/rspec_adapter_spec.rb\",") "")
                 (("\"spec/gimme/verifies_class_methods_spec.rb\",") "")
                 ;; All of these gems relate to development, and are
                 ;; unnecessary when running the tests.
                 ((".*(add|gem).*guard-.*") "")
                 ((".*(add|gem).*jeweler.*") "")
                 ((".*(add|gem).*pry.*") "")
                 ((".*(add|gem).*growl.*") "")
                 ((".*(add|gem).*rb-fsevent.*") ""))
               #t)))))
      (synopsis "Lightweight test double library for Ruby")
      (description "Gimme is a very lightweight test double library for Ruby,
based on Mockito (a mocking framework for Java).  It is an opinionated (but
not noisy) means to facilitate test-driving by enabling the authors to specify
only what they care about.")
      (home-page "https://github.com/searls/gimme")
      (license license:expat))))

(define-public ruby-stud
  (package
    (name "ruby-stud")
    (version "0.0.23")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "stud" version))
              (sha256
               (base32
                "0qpb57cbpm9rwgsygqxifca0zma87drnlacv49cqs2n5iyi6z8kb"))))
    (build-system ruby-build-system)
    (native-inputs (list ruby-rspec))
    (arguments
     (list #:phases #~(modify-phases %standard-phases
                        ;; No Rakefile is included, so run rspec directly.
                        (replace 'check
                          (lambda* (#:key tests? #:allow-other-keys)
                            (when tests?
                              (invoke "rspec")))))))
    (synopsis "Retries, worker supervision, resource pools and more for Ruby")
    (description "The Stud Ruby library adds a few things missing from the
standard Ruby library such as:
@table @code
@item {Stud::Try}
Retry on failure, with back-off, where failure is any exception.
@item {Stud::Pool}
Generic resource pools.
@item {Stud::Task}
Tasks (threads that can return values, exceptions, etc.)
@item {Stud.interval}
Interval execution (do X every N seconds).
@item {Stud::Buffer}
Batch and flush behavior.
@end itemize")
    (home-page "https://github.com/jordansissel/ruby-stud")
    (license license:asl2.0)))

(define-public ruby-standard
  (package
    (name "ruby-standard")
    (version "1.25.3")
    (source
     (origin
       (method git-fetch)               ;no test suite in distributed gem
       (uri (git-reference
             (url "https://github.com/testdouble/standard")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0q42gv7wgrc818a5hm599sy07vjq69hbijzpkpgh6jws6x7wzyh3"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'set-HOME
           (lambda _
             ;; Some tests fail otherwise.
             (setenv "HOME" "/tmp")))
         (add-after 'unpack 'relax-requirements
           (lambda _
             (substitute* "standard.gemspec"
               (("\"rubocop\", \"1.44.1\"")
                "\"rubocop\", \">= 1.44.1\"")
               (("\"rubocop-performance\", \"1.15.2\"")
                "\"rubocop-performance\", \">= 1.15.2\""))))
         (add-after 'unpack 'delete-problematic-tests
           ;; These tests fail for unknown reasons (see:
           ;; https://github.com/testdouble/standard/issues/532).
           (lambda _
             (for-each
              delete-file
              '("test/standard_test.rb"
                "test/standard/cop/block_single_line_braces_test.rb")))))))
    (native-inputs
     (list ruby-gimme
           ruby-pry
           ruby-simplecov))
    (propagated-inputs
     (list ruby-language-server-protocol
           ruby-rubocop
           ruby-rubocop-performance))
    (synopsis "Ruby Style Guide, with linter & automatic code fixer")
    (description "Standard is a port of StandardJS.  Like StandardJS, it aims
to save time in the following ways:
@itemize
@item No configuration.
@item Automatically format code.
@item Catch style issues and programmer errors early.
@end itemize")
    (home-page "https://github.com/testdouble/standard")
    (license license:expat)))

(define-public ruby-chunky-png
  (package
    (name "ruby-chunky-png")
    (version "1.3.14")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/wvanbergen/chunky_png")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "1m7y11ix38h5a2pj5v81qdmvqh980ql9hp62hk2dxwkwsa4nh22h"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "spec"
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'disable-bundler
           (lambda _
             (substitute* (find-files "." "\\.rb$")
               (("require.*bundler/setup.*") ""))
             #t)))))
    (native-inputs
     (list bundler ruby-rspec ruby-standard ruby-yard))
    (synopsis "Ruby library to handle PNG images")
    (description "ChunkyPNG is a pure Ruby library that can read and write
Portable Network Graphics (PNG) images without depending on an external image
library.  It tries to be memory efficient and reasonably fast.  It has
features such as:
@itemize
@item
Decoding support for any image that the PNG standard allows.  This includes all
standard color modes, all bit depths, all transparency, and interlacing and
filtering options.
@item
Encoding support for images of all color modes (true color, grayscale, and
indexed) and transparency for all these color modes.  The best color mode is
chosen automatically, based on the amount of used colors.
@item Read/write access to the image's pixels.
@item Read/write access to all image metadata that is stored in chunks.
@item
Memory efficiency: @code{fixnum} are used, i.e. 4 or 8 bytes of memory per
pixel, depending on the hardware).
@item
Performance: ChunkyPNG is reasonably fast for Ruby standards, by only using
integer math and a highly optimized saving routine.
@item Interoperability with RMagick.
@end itemize

ChunkyPNG is vulnerable to decompression bombs and can run out of memory when
loading a specifically crafted PNG file.  This is hard to fix in pure Ruby.
Deal with untrusted images in a separate process, e.g., by using @code{fork}
or a background processing library.")
    (home-page "https://github.com/wvanbergen/chunky_png/wiki")
    (license license:expat)))

(define-public ruby-text-hyphen
  (package
    (name "ruby-text-hyphen")
    (version "1.4.1")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "text-hyphen" version))
        (sha256
          (base32
            "1gj4awvs9ryf960m0iawg43jyjmfwcqgfwrbcfp890a57b9ag7q1"))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-hoe))
    (synopsis "Ruby library to hyphenate words in various languages")
    (description "Text::Hyphen is a Ruby library to hyphenate words in various
languages using Ruby-fied versions of TeX hyphenation patterns.  It will
properly hyphenate various words according to the rules of the language the
word is written in.  The algorithm is based on that of the TeX typesetting
system by Donald E.  Knuth.")
    (home-page "https://github.com/halostatue/text-hyphen")
    ;; The whole is licensed under the Expat license, but parts use various
    ;; versions of the LaTeX Project Public License.
    (license license:expat)))

(define-public ruby-open-uri-cached
  (package
    (name "ruby-open-uri-cached")
    (version "1.0.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "open-uri-cached" version))
       (sha256
        (base32
         "03v0if3jlvbclnd6jgjk94fbhf0h2fq1wxr0mbx7018sxzm0biwr"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))                    ;no test suite
    (synopsis "OpenURI with transparent disk caching")
    (description "OpenURI with transparent disk caching, which is
useful to avoid making excessive queries, for example when scraping
web pages.")
    (home-page "https://github.com/tigris/open-uri-cached")
    (license license:expat)))

(define-public ruby-asciidoctor-pdf
  (package
    (name "ruby-asciidoctor-pdf")
    (version "2.3.4")
    (source
     (origin
       (method git-fetch)               ;no test suite in the distributed gem
       (uri (git-reference
             (url "https://github.com/asciidoctor/asciidoctor-pdf")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "07krhpj2ylz7h7hy8vg0js8yv828qxh3mkhx0bsrfh0p24xwbjrm"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:test-target "spec"
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'extract-gemspec 'strip-version-requirements
            (lambda _
              (substitute* "asciidoctor-pdf.gemspec"
                (("(.*add_.*dependency '[_A-Za-z0-9-]+').*" _ stripped)
                 (string-append stripped "\n")))))
          ;; The tests rely on the Gem being installed, so move the check
          ;; phase after the install phase.
          (delete 'check)
          (add-after 'install 'check
            (lambda* (#:key tests? #:allow-other-keys)
              (setenv "GEM_PATH" (string-append
                                  (getenv "GEM_PATH") ":"
                                  #$output "/lib/ruby/vendor_ruby"))
              (when tests?
                (invoke "rspec" "-t" "~visual" "-t" "~cli"
                        "-t" "~network")))))))
    (native-inputs
     (list ruby-chunky-png
           ruby-coderay
           ruby-pdf-inspector
           ruby-rouge
           ruby-rspec))
    (propagated-inputs
     (list ruby-asciidoctor
           ruby-concurrent
           ruby-open-uri-cached
           ruby-prawn
           ruby-prawn-icon
           ruby-prawn-svg
           ruby-prawn-table
           ruby-prawn-templates
           ruby-safe-yaml
           ruby-text-hyphen
           ruby-thread-safe
           ruby-treetop
           ruby-ttfunk))
    (synopsis"AsciiDoc to Portable Document Format (PDF)} converter")
    (description "Asciidoctor PDF is an extension for Asciidoctor that
converts AsciiDoc documents to Portable Document Format (PDF) using the Prawn
PDF library.  It has features such as:
@itemize
@item Direct AsciiDoc to PDF conversion
@item Configuration-driven theme (style and layout)
@item Scalable Vector Graphics (SVG) support
@item PDF document outline (i.e., bookmarks)
@item Table of contents page(s)
@item Document metadata (title, authors, subject, keywords, etc.)
@item Internal cross reference links
@item Syntax highlighting with Rouge, Pygments, or CodeRay
@item Page numbering
@item Customizable running content (header and footer)
@item
“Keep together” blocks (i.e., page breaks avoided in certain block content)
@item Orphaned section titles avoided
@item Autofit verbatim blocks (as permitted by base_font_size_min setting)
@item Table border settings honored
@item Font-based icons
@item Custom TrueType (TTF) fonts
@item Double-sided printing mode (margins alternate on recto and verso pages)
@end itemize")
    (home-page "https://asciidoctor.org/docs/asciidoctor-pdf")
    (license license:expat)))

(define-public ruby-ast
  (package
    (name "ruby-ast")
    (version "2.4.2")
    (source
     (origin
       (method git-fetch)               ;no test included in gem from v2.4.1
       (uri (git-reference
             (url "https://github.com/whitequark/ast")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0vm94yml8rknr7z034vg6s3fpx6lml2prz9fn3hr67cx0143bb4h"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'remove-coveralls-requirement
           (lambda _
             (substitute* "test/helper.rb"
               (("require 'coveralls'") "")
               (("Coveralls::SimpleCov::Formatter") ""))
             #t))
         (add-after 'extract-gemspec 'remove-unnecessary-requirements
           (lambda* (#:key inputs #:allow-other-keys)
             (substitute* "ast.gemspec"
               ((".*coveralls.*") "\n")
               (("%q<rest-client>.*") "%q<rest-client>.freeze, [\">= 0\"])\n")
               (("%q<mime-types>.*") "%q<mime-types>.freeze, [\">= 0\"])\n")
               (("%q<rake>.*") "%q<rake>.freeze, [\">= 0\"])\n")
               (("12\\.3") "13.0"))
             #t)))))
    (native-inputs
     (list bundler
           ruby-bacon
           ruby-bacon-colored-output
           ruby-json-pure
           ruby-kramdown
           ruby-mime-types
           ruby-racc
           ruby-rest-client
           ruby-simplecov
           ruby-yard))
    (synopsis "Library for working with Abstract Syntax Trees")
    (description
     "@code{ast} is a Ruby library for working with Abstract Syntax Trees.
It does this through immutable data structures.")
    (home-page "https://whitequark.github.io/ast/")
    (license license:expat)))

(define-public ruby-sporkmonger-rack-mount
  ;; Testing the addressable gem requires a newer commit than that released, so
  ;; use an up to date version.
  (let ((revision "1")
        (commit "076aa2c47d9a4c081f1e9bcb56a826a9e72bd5c3"))
    (package
      (name "ruby-sporkmonger-rack-mount")
      (version (git-version "0.8.3" revision commit))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/sporkmonger/rack-mount")
                      (commit commit)))
                (file-name (git-file-name name version))
                (sha256
                 (base32
                  "1scx273g3xd93424x9lxc4zyvcp2niknbw5mkz6wkivpf7xsyxdq"))))
      (build-system ruby-build-system)
      (arguments
       ;; Tests currently fail so disable them.
       ;; https://github.com/sporkmonger/rack-mount/pull/1
       `(#:tests? #f))
      (propagated-inputs (list ruby-rack))
      (synopsis "Stackable dynamic tree based Rack router")
      (description
       "@code{Rack::Mount} supports Rack's @code{X-Cascade} convention to
continue trying routes if the response returns pass.  This allows multiple
routes to be nested or stacked on top of each other.")
      (home-page "https://github.com/sporkmonger/rack-mount")
      (license license:expat))))

(define-public ruby-ci-reporter
  (package
    (name "ruby-ci-reporter")
    (version "2.0.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "ci_reporter" version))
              (sha256
               (base32
                "17fm20jmw3ajdryhkkxpjahcfx7bgswqzxrskivlkns2718ayyyg"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "rspec"))
    (propagated-inputs
     (list ruby-builder))
    (native-inputs
     (list bundler ruby-rspec))
    (synopsis "Generate XML reports of runs test")
    (description
     "@code{CI::Reporter} is an add-on to Ruby testing frameworks that allows
you to generate XML reports of your test runs.  The resulting files can be
read by a continuous integration system that understands Ant's JUnit report
format.")
    (home-page "https://github.com/nicksieger/ci_reporter")
    (license license:expat)))

(define-public ruby-console
  (package
    (name "ruby-console")
    (version "1.16.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "console" version))
              (sha256
               (base32
                "0y1bv3kd1l9p0k5n3anvvjxdrcq113pyngz2g29i9mvdgbbx7kq2"))))
    (build-system ruby-build-system)
    ;; XXX: Disable test suite to avoid dependency cycles with ruby-samovar.
    (arguments (list #:tests? #f))
    (propagated-inputs (list ruby-fiber-local))
    (synopsis "Console logging library for Ruby")
    (description "This gem provides beautiful console logging for Ruby
applications.  It implements fast, buffered log output and has the following
features:
@itemize
@item Thread safe global logger with per-fiber context
@item Carry along context with nested loggers
@item Enable/disable log levels per class
@item Detailed logging of exceptions
@item Beautiful logging to the terminal or structured logging using JSON.
@end itemize")
    (home-page "https://github.com/socketry/console")
    (license license:expat)))

(define-public ruby-contracts
  (package
    (name "ruby-contracts")
    (version "0.16.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "contracts" version))
       (sha256
        (base32
         "119f5p1n6r5svbx8h09za6a4vrsnj5i1pzr9cqdn9hj3wrxvyl3a"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "spec"
       #:phases
       (modify-phases %standard-phases
         ;; Don't run or require rubocop, the code linting tool, as this is a
         ;; bit unnecessary.
         (add-after 'unpack 'dont-run-rubocop
          (lambda _
            (substitute* "Rakefile"
              ((".*rubocop.*") "")
              ((".*RuboCop.*") ""))
            #t)))))
    (native-inputs
     (list ruby-rspec))
    (synopsis "Method contracts for Ruby")
    (description
     "This library provides contracts for Ruby.  A contract describes the
correct inputs and output for a method, and will raise an error if a incorrect
value is found.")
    (home-page "https://github.com/egonSchiele/contracts.ruby")
    (license license:bsd-2)))

(define-public ruby-crack
  (package
    (name "ruby-crack")
    (version "0.4.5")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "crack" version))
       (sha256
        (base32
         "1cr1kfpw3vkhysvkk3wg7c54m75kd68mbm9rs5azdjdq57xid13r"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (for-each (lambda (file)
                           (display file)(display "\n")
                           (invoke "ruby" "-Ilib" "-Itest" "-rrubygems" file))
                         (find-files "test" ".*rb$")))
             #t)))))
    (synopsis "Simple JSON and XML parsing for Ruby")
    (description
     "@code{crack} provides really simple JSON and XML parsing, extracted from
code in Merb and Rails.")
    (home-page "https://github.com/jnunemaker/crack")
    (license license:expat)))

(define-public ruby-clamp
  (package
    (name "ruby-clamp")
    (version "1.3.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "clamp" version))
              (sha256
               (base32
                "08m0syh06bhx8dqn560ivjg96l5cs5s3l9jh2szsnlcdcyl9jsjg"))))
    (build-system ruby-build-system)
    (arguments
     (list #:test-target "spec"
           #:phases #~(modify-phases %standard-phases
                        (add-after 'unpack 'do-not-require-rubocop
                          (lambda _
                            (substitute* "Rakefile"
                              (("require \"rubocop/rake_task\"")
                               "")
                              (("RuboCop::RakeTask.new")
                               "")))))))
    (native-inputs (list ruby-rspec))
    (synopsis "Command-line parsing library for Ruby")
    (description "Clamp provides an object-model for command-line utilities.
It handles parsing of command-line options, and generation of usage help.")
    (home-page "https://github.com/mdub/clamp")
    (license license:expat)))

(define-public ruby-cliver
  (package
    (name "ruby-cliver")
    (version "0.3.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "cliver" version))
       (sha256
        (base32
         "096f4rj7virwvqxhkavy0v55rax10r4jqf8cymbvn4n631948xc7"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         ;; Avoid a incompatibility between rspec@2 and rake. Using rspec@3
         ;; would be nice, but the tests look to be incompatible:
         ;;
         ;; NoMethodError: undefined method `last_comment'
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (invoke "rspec"))
             #t)))))
    (native-inputs
     (list bundler ruby-rspec-2))
    (synopsis "Assertions for command-line dependencies in Ruby")
    (description
     "@code{cliver} provides a way to detect missing command-line
dependencies, including versions.")
    (home-page "https://github.com/yaauie/cliver")
    (license license:expat)))

(define-public ruby-czmq-ffi-gen
  (package
    (name "ruby-czmq-ffi-gen")
    (version "0.13.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "czmq-ffi-gen" version))
       (sha256
        (base32
         "1yf719dmf4mwks1hqdsy6i5kzfvlsha69sfnhb2fr2cgk2snbys3"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f ;; Tests are not included in the release on rubygems.org
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'patch-lib_dirs
           (lambda* (#:key inputs #:allow-other-keys)
             (substitute* "lib/czmq-ffi-gen/czmq/ffi.rb"
               (("lib\\_dirs = \\[.*\\]")
                (string-append "lib_dirs = ['"
                               (assoc-ref inputs "czmq") "/lib"
                               "']")))
             (substitute* "lib/czmq-ffi-gen/libzmq.rb"
               (("lib\\_dirs = \\[.*\\]")
                (string-append "lib_dirs = ['"
                               (assoc-ref inputs "zeromq") "/lib"
                               "']"))))))))
    (inputs
     (list zeromq czmq))
    (propagated-inputs (list ruby-ffi))
    (synopsis "Low-level Ruby bindings for CZMQ (generated using zproject)")
    (description
     "These Ruby bindings are not intended to be directly used, but rather
used by higher level bindings like those provided by CZTop.")
    (home-page
     "https://github.com/paddor/czmq-ffi-gen")
    (license license:isc)))

(define-public ruby-cztop
  (package
    (name "ruby-cztop")
    (version "0.12.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "cztop" version))
       (sha256
        (base32
         "0yqbpaiw5d7f271d73lyrsh8xpx6n4zi6xqwfgi00dacxrq3s3fa"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "spec"
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'patch-lib_paths
           (lambda* (#:key inputs #:allow-other-keys)
             (substitute* "lib/cztop/poller/zmq.rb"
               (("lib\\_paths = \\[.*\\]")
                (string-append "lib_paths = ['"
                               (assoc-ref inputs "zeromq") "/lib"
                               "']"))))))))
    (native-inputs
     (list bundler ruby-rspec))
    (inputs
     (list zeromq))
    (propagated-inputs
     (list ruby-czmq-ffi-gen))
    (synopsis "CZMQ Ruby bindings")
    (description
     "CZMQ Ruby bindings, based on the generated low-level FFI bindings of
CZMQ.  The focus of of CZTop is on being easy to use and providing first class
support for security mechanisms.")
    (home-page "https://github.com/paddor/cztop")
    (license license:isc)))

(define-public ruby-saikuro-treemap
  (package
    (name "ruby-saikuro-treemap")
    (version "0.2.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "saikuro_treemap" version))
              (sha256
               (base32
                "0w70nmh43mwfbpq20iindl61siqqr8acmf7p3m7n5ipd61c24950"))))
    (build-system ruby-build-system)
    ;; Some of the tests fail because the generated JSON has keys in a
    ;; different order.  This is a problem with the test suite rather than any
    ;; of the involved libraries.
    (arguments `(#:tests? #f))
    (propagated-inputs
     (list ruby-json-pure ruby-atoulme-saikuro))
    (synopsis "Generate complexity treemap based on saikuro analysis")
    (description
     "This gem generates a treemap showing the complexity of Ruby code on
which it is run.  It uses Saikuro under the covers to analyze Ruby code
complexity.")
    (home-page "https://github.com/ThoughtWorksStudios/saikuro_treemap")
    (license license:expat)))

(define-public ruby-oauth2
  (package
    (name "ruby-oauth2")
    (version "2.0.9")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://gitlab.com/oauth-xx/oauth2")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "191j1f4gjw8wij1jy2fvddgi8cv1mm0ki7v0b0795clix1avnj29"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases #~(modify-phases %standard-phases
                        (add-after 'unpack 'relax-requirements
                          (lambda _
                            (substitute* "Gemfile"
                              (("^linting = .*")
                               "linting = false\n")
                              (("^coverage = .*")
                               "coverage = false\n")
                              (("^debug = .*")
                               "debug = false\n"))
                            (substitute* "spec/spec_helper.rb"
                              (("^RUN_COVERAGE = .*")
                               "RUN_COVERAGE = false\n")
                              (("^ALL_FORMATTERS = .*")
                               "ALL_FORMATTERS = false\n")))))))
    (native-inputs
     (list ruby-addressable
           ruby-backports
           ruby-rexml
           ruby-rspec-block-is-expected
           ruby-rspec-pending-for
           ruby-rspec-stubbed-env
           ruby-silent-stream))
    (propagated-inputs
     (list ruby-faraday
           ruby-jwt
           ruby-multi-json
           ruby-multi-xml
           ruby-rack
           ruby-snaky-hash))
    (synopsis "Ruby wrapper for the OAuth 2.0")
    (description
     "This package provides a Ruby wrapper for the OAuth 2.0 protocol built
with a similar style to the original OAuth spec.")
    (home-page "https://github.com/oauth-xx/oauth2")
    (license license:expat)))

(define-public ruby-omniauth
  (package
    (name "ruby-omniauth")
    (version "2.1.1")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/omniauth/omniauth")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1mm7a4ll7ymamrbsl63yi6i34qpwmh2nh5a9kj961gja1iz2gyd1"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases
           #~(modify-phases %standard-phases
               (add-after 'unpack 'relax-requirements
                 (lambda _
                   (substitute* "spec/helper.rb"
                     ;; This condition is used to require coveralls and
                     ;; simplecov; override it to avoid these extraneous
                     ;; requirements.
                     (("RUBY_VERSION >= '1.9'")
                      "false")
                     (("require 'rack/freeze'") "")))))))
    (native-inputs (list ruby-rspec))
    (propagated-inputs (list ruby-hashie ruby-rack ruby-rack-test
                             ruby-rack-protection))
    (synopsis "Generalized Rack framework for multiple-provider authentication")
    (description
     "This package provides a generalized Rack framework for multiple-provider
authentication.")
    (home-page "https://github.com/omniauth/omniauth")
    (license license:expat)))

(define-public ruby-omniauth-oauth2
  (package
    (name "ruby-omniauth-oauth2")
    (version "1.8.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "omniauth-oauth2" version))
       (sha256
        (base32
         "0y4y122xm8zgrxn5nnzwg6w39dnjss8pcq2ppbpx9qn7kiayky5j"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases
           #~(modify-phases %standard-phases
               (add-after 'unpack 'relax-requirements
                 (lambda _
                   (substitute* "spec/helper.rb"
                     ;; This condition is used to require coveralls and
                     ;; simplecov; override it to avoid these extraneous
                     ;; requirements.
                     (("RUBY_VERSION >= \"1.9\"")
                      "false")))))))
    (propagated-inputs (list ruby-oauth2 ruby-omniauth))
    (native-inputs (list ruby-rspec ruby-rack-test ruby-webmock))
    (synopsis "Abstract OAuth2 strategy for OmniAuth")
    (description
     "This library provides a generic OAuth2 strategy for OmniAuth.  It
doesn't provide a way to gather user information, so should be used as a
building block for authentication strategies.")
    (home-page "https://github.com/omniauth/omniauth-oauth2")
    (license license:expat)))

(define-public ruby-open4
  (package
  (name "ruby-open4")
  (version "1.3.4")
  (source
    (origin
      (method url-fetch)
      (uri (rubygems-uri "open4" version))
      (sha256
        (base32
          "1cgls3f9dlrpil846q0w7h66vsc33jqn84nql4gcqkk221rh7px1"))))
  (build-system ruby-build-system)
  (arguments
   '(#:phases
     (modify-phases %standard-phases
       (add-after 'unpack 'patch
         (lambda _
           (substitute* "rakefile"
             ;; Update the Rakefile so it works
             (("-rubygems") "-rrubygems")
             (("Config") "RbConfig"))
           #t))
       (add-before 'check 'set-LIB
         (lambda _
           ;; This is used in the rakefile when running the tests
           (setenv "LIB" "open4")
           #t)))))
  (synopsis "Open child processes from Ruby and manage them easily")
  (description
    "@code{Open4} is a Ruby library to run child processes and manage their
input and output.")
  (home-page "https://github.com/ahoward/open4")
  (license license:ruby)))

(define-public ruby-options
  (package
    (name "ruby-options")
    (version "2.3.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "options" version))
       (sha256
        (base32
         "1s650nwnabx66w584m1cyw82icyym6hv5kzfsbp38cinkr5klh9j"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f ;; TODO: NameError: uninitialized constant Config
       #:phases
       (modify-phases %standard-phases
         (add-before 'check 'set-LIB
           (lambda _
             ;; This is used in the Rakefile, and setting it avoids an issue
             ;; with running the tests.
             (setenv "LIB" "options")
             #t)))))
    (synopsis "Ruby library to parse options from *args cleanly")
    (description
     "The @code{options} library helps with parsing keyword options in Ruby
functions.")
    (home-page "https://github.com/ahoward/options")
    (license license:ruby)))

(define-public ruby-erubi
  (package
    (name "ruby-erubi")
    (version "1.8.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "erubi" version))
       (sha256
        (base32
         "1kagnf6ziahj0d781s6ryy6fwqwa3ad4xbzzj84p9m4nv4c2jir1"))))
    (build-system ruby-build-system)
    (synopsis "ERB template engine for Ruby")
    (description
     "Erubi is a ERB template engine for Ruby.  It is a simplified fork of
Erubis")
    (home-page "https://github.com/jeremyevans/erubi")
    (license license:expat)))

(define-public ruby-erubis
  (package
    (name "ruby-erubis")
    (version "2.7.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "erubis" version))
       (sha256
        (base32
         "1fj827xqjs91yqsydf0zmfyw9p4l2jz5yikg3mppz6d7fi8kyrb3"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; tests do not run properly with Ruby 2.0
    (synopsis "Implementation of embedded Ruby (eRuby)")
    (description
     "Erubis is a fast implementation of embedded Ruby (eRuby) with several
features such as multi-language support, auto escaping, auto trimming spaces
around @code{<% %>}, a changeable embedded pattern, and Ruby on Rails
support.")
    (home-page "http://www.kuwata-lab.com/erubis/")
    (license license:expat)))

(define-public ruby-ethon
  (package
    (name "ruby-ethon")
    (version "0.12.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "ethon" version))
       (sha256
        (base32
         "0gggrgkcq839mamx7a8jbnp2h7x2ykfn34ixwskwb0lzx2ak17g9"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))                    ; no included tests
    (inputs
     (list curl))
    (propagated-inputs
     (list ruby-ffi))
    (synopsis "Very lightweight @code{libcurl} wrapper")
    (description
     "Ethon is a very basic @code{libcurl} wrapper using ffi.")
    (home-page "https://github.com/typhoeus/ethon")
    (license license:expat)))

(define-public ruby-execjs
  (package
    (name "ruby-execjs")
    (version "2.7.0")
    (source
     (origin
       ;; fetch from github as the gem does not contain testing code
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/rails/execjs")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0c0vd2mmqq3ar4plbwi2wsbr31vn4h45i19r5km66skydnnbp1y6"))))
    (build-system ruby-build-system)
    (native-inputs
     (list bundler
           ;; The test suite tests all the available backends. Currenly, this just
           ;; means the node backend.
           ;;
           ;; PASSED: test:node
           ;; SKIPPED: test:duktape, ;; test:javascriptcore, test:jscript,
           ;; test:miniracer, test:rubyracer, ;; test:rubyrhino, test:v8
           node))
    (synopsis "Run JavaScript code from Ruby")
    (description
     "ExecJS lets you run JavaScript code from Ruby.  It automatically picks a
runtime to evaluate your JavaScript program, then returns the result to you as
a Ruby object.")
    (home-page "https://github.com/rails/execjs")
    (license license:expat)))

(define-public ruby-fakefs
  (package
    (name "ruby-fakefs")
    (version "1.2.2")
    (home-page "https://github.com/fakefs/fakefs")
    (source (origin
              ;; The Rubygems release does not contain tests.
              (method git-fetch)
              (uri (git-reference
                    (url home-page)
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "008dq9knyip2bfbl0mrk8b8r7bv0k3bf128wcfqsgy1rqal4mgwk"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases (modify-phases %standard-phases
                  (replace 'replace-git-ls-files
                    (lambda _
                      (substitute* "fakefs.gemspec"
                        (("`git ls-files lib README.md LICENSE`")
                         "`find lib README.md LICENSE -type f | sort`"))
                      #t))
                  (add-before 'check 'remove-version-constraints
                    (lambda _
                      ;; Drop hard version requirements for test dependencies.
                      (substitute* "fakefs.gemspec"
                        (("(.*add_development_dependency .*), .*" _ dep)
                         (string-append dep "\n")))
                      #t)))))
    (native-inputs
     (list ruby-bump ruby-maxitest ruby-rubocop ruby-rspec))
    (synopsis "Fake file system for Ruby")
    (description
     "This package provides a fake file system for use in test suites.  It
avoids the need for manually creating temporary directories, or dealing
with platform intricacies in @code{File} and @code{FileUtils}.")
    (license license:expat)))

(define-public ruby-orderedhash
  (package
    (name "ruby-orderedhash")
    (version "0.0.6")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "orderedhash" version))
              (sha256
               (base32
                "0fryy7f9jbpx33jq5m402yqj01zcg563k9fsxlqbhmq638p4bzd7"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; no test suite
    (synopsis "Ruby library providing an order-preserving hash")
    (description "Orderedhash is a Ruby library providing a hash
implementation that preserves the order of items and features some array-like
extensions.")
    (home-page "http://codeforpeople.com/lib/ruby/orderedhash/")
    (license license:public-domain)))

(define-public ruby-libxml
  (package
    (name "ruby-libxml")
    (version "3.0.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "libxml-ruby" version))
       (sha256
        (base32
         "0xy8wmjwjcnv36zi042678ncjzpxvy351ccbv7mzkns2n3kxfp54"))))
    (build-system ruby-build-system)
    (inputs
     (list zlib libxml2))
    (arguments
     '(#:tests? #f ; test suite hangs for unknown reason
       #:gem-flags
       (list "--no-document"            ; TODO: Re-enable when documentation
                                        ; generation works
             "--"
             (string-append "--with-xml2-include="
                            (assoc-ref %build-inputs "libxml2")
                            "/include/libxml2" ))))
    (synopsis "Ruby bindings for GNOME Libxml2")
    (description "The Libxml-Ruby project provides Ruby language bindings for
the GNOME Libxml2 XML toolkit.")
    (home-page "https://xml4r.github.com/libxml-ruby")
    (license license:expat)))

(define-public ruby-lino
  (package
    (name "ruby-lino")
    (version "1.1.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "lino" version))
       (sha256
        (base32
         "11d29g0fk372b9fcpyr0k6hxm2b4j4igpysmi542hgbbgqgp9cd3"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; No included tests
    (propagated-inputs
     (list ruby-hamster ruby-open4))
    (synopsis "Build and execute commands in Ruby")
    (description
     "@code{Lino} provides an interface to run external commands.  It provides
an interface to add options as well as managing the standard input, output and
error streams.")
    (home-page "https://github.com/tobyclemson/lino")
    (license license:expat)))

(define-public ruby-xml-simple
  (package
    (name "ruby-xml-simple")
    (version "1.1.5")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "xml-simple" version))
              (sha256
               (base32
                "0xlqplda3fix5pcykzsyzwgnbamb3qrqkgbrhhfz2a2fxhrkvhw8"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; no test suite
    (synopsis "Simple Ruby library for XML processing")
    (description "This library provides a simple API for XML processing in
Ruby.")
    (home-page "https://github.com/maik/xml-simple")
    (license license:ruby)))

(define-public ruby-xpath
  (package
    (name "ruby-xpath")
    (version "3.2.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "xpath" version))
              (sha256
               (base32
                "0bh8lk9hvlpn7vmi6h4hkcwjzvs2y0cmkk3yjjdr8fxvj6fsgzbd"))))
    (build-system ruby-build-system)
    (arguments (list #:phases #~(modify-phases %standard-phases
                                  (replace 'check
                                    (lambda* (#:key tests? #:allow-other-keys)
                                      (when tests?
                                        (invoke "rspec" "spec" )))))))
    (native-inputs (list ruby-pry ruby-rspec))
    (propagated-inputs (list ruby-nokogiri))
    (synopsis "Ruby DSL for generating XPath expressions")
    (description "XPath is a Ruby domain-specific language (DSL) for
generating XPath expressions.")
    (home-page "https://github.com/teamcapybara/xpath")
    (license license:expat)))

(define-public ruby-thor
  (package
    (name "ruby-thor")
    (version "1.2.1")
    (source (origin
              ;; Pull from git because the gem has no tests.
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/rails/thor")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1vjm628ks5kw8q6dskh38dqyz2j8c3n694wsqkj4jb4jrn6rkfzx"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'remove-coveralls-dependency
            (lambda _
              ;; Do not hook the test suite into the online coveralls service.
              (substitute* "Gemfile"
                ((".*coveralls.*") ""))
              (substitute* "spec/helper.rb"
                (("require \"coveralls\"") "")
                (("Coveralls::SimpleCov::Formatter") ""))))
          (add-after 'unpack 'disable-problematic-tests
            (lambda _
              ;; These tests attempt to check the git repository for
              ;; tabs vs spaces, double vs single quotes, etc, and
              ;; depend on the git checkout.
              (delete-file "spec/quality_spec.rb")
              (substitute* "spec/parser/options_spec.rb"
                ;; This test fails for unknown reasons (see:
                ;; https://github.com/rails/thor/issues/814).
                (("it \"raises an error for unknown switches" all)
                 (string-append "x" all)))))
          (replace 'check
            (lambda* (#:key tests? #:allow-other-keys)
              (when tests?
                (invoke "rspec" "spec" )))))))
    (native-inputs (list ruby-rspec ruby-simplecov ruby-webmock))
    (synopsis "Ruby toolkit for building command-line interfaces")
    (description "Thor is a toolkit for building powerful command-line
interfaces.")
    (home-page "http://whatisthor.com/")
    (license license:expat)))

(define-public ruby-lumberjack
  (package
    (name "ruby-lumberjack")
    (version "1.0.13")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "lumberjack" version))
              (sha256
               (base32
                "06im7gcg42x77yhz2w5da2ly9xz0n0c36y5ks7xs53v0l9g0vf5n"))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-rspec ruby-timecop))
    (synopsis "Logging utility library for Ruby")
    (description "Lumberjack is a simple logging utility that can be a drop in
replacement for Logger or ActiveSupport::BufferedLogger.  It provides support
for automatically rolling log files even with multiple processes writing the
same log file.")
    (home-page "https://github.com/bdurand/lumberjack")
    (license license:expat)))

(define-public ruby-rbnacl
  (package
    (name "ruby-rbnacl")
    (version "6.0.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "rbnacl" version))
       (sha256
        (base32
         "0ajxy5kj2jw09wdsla3jmha8w07vj5l14288xr9djpl327g3lzhn"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'remove-unnecessary-dependencies
           (lambda _
             ;; Coveralls relates to a network service, and Rubocop to code
             ;; linting and both are unnecessary to run the tests
             (substitute* "Gemfile"
               ((".*rubocop.*") "\n")
               ((".*guard-rspec.*") "\n")
               ((".*coveralls.*") "\n"))
             (substitute* "spec/spec_helper.rb"
               (("require \"coveralls\"") "")
               (("Coveralls.wear!") ""))
             #t))
         (add-after 'unpack 'use-libsodium-from-store
           (lambda* (#:key inputs #:allow-other-keys)
             (substitute* '("lib/rbnacl/init.rb"
                            "lib/rbnacl/sodium.rb")
               (("ffi_lib \\[.+\\]")
                (string-append "ffi_lib [\""
                               (assoc-ref inputs "libsodium") "/lib/libsodium.so"
                               "\"]")))
             #t))
         ;; Run Rspec directly to avoid the Rubocop dependency in the Rakefile
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (invoke "rspec"))
             #t)))))
    (propagated-inputs
     (list ruby-ffi))
    (inputs
     (list libsodium))
    (native-inputs
     (list bundler ruby-rspec))
    (synopsis "Ruby FFI binding to libsodium")
    (description
     "This package provides Ruby FFI bindings to the Networking and
Cryptography (NaCl) library, also known as libsodium.  This provides a
high-level toolkit for building cryptographic systems and protocols.")
    (home-page "https://github.com/crypto-rb/rbnacl")
    (license license:expat)))

(define-public ruby-hkdf
  (package
    (name "ruby-hkdf")
    (version "1.0.0")
    (source
      (origin
        (method git-fetch)
        (uri (git-reference
               (url "https://github.com/jtdowney/hkdf")
               (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
         (base32
          "1xqwdmxfnhagivwgb5v9ilwpb4jxlsqwj7pnj43d65zzg5m8p9r5"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "default"))
    (native-inputs
     (list ruby-rspec))
    (synopsis "HMAC-based Key Derivation Function")
    (description
     "This package provides a Ruby implementation of RFC5869: @acronym{HKDF,
HMAC-based Extract-and-Expand Key Derivation Function}.  The goal of HKDF is to
take some source key material and generate suitable cryptographic keys from it.")
    (home-page "https://github.com/jtdowney/hkdf")
    (license license:expat)))

(define-public ruby-nenv
  (package
    (name "ruby-nenv")
    (version "0.3.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "nenv" version))
              (sha256
               (base32
                "0r97jzknll9bhd8yyg2bngnnkj8rjhal667n7d32h8h7ny7nvpnr"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f)) ; no tests included
    (native-inputs
     (list ruby-rspec bundler))
    (synopsis "Ruby interface for modifying the environment")
    (description "Nenv provides a convenient wrapper for Ruby's ENV to modify
and inspect the environment.")
    (home-page "https://github.com/e2/nenv")
    (license license:expat)))

(define-public ruby-ptools
  (package
    (name "ruby-ptools")
    (version "1.3.5")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "ptools" version))
              (sha256
               (base32
                "1jb1h1nsk9zwykpniw8filbsk26kjsdlpk5wz6w0zyamcd41h87j"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases (modify-phases %standard-phases
                  (add-after 'unpack 'patch-/bin/ls
                    (lambda _
                      (substitute* "test/test_binary.rb"
                        (("/bin/ls")
                         (which "ls")))
                      #t))
                   (add-before 'install 'create-gem
                     (lambda _
                       ;; Do not attempt to sign the gem.
                       (substitute* "Rakefile"
                         (("spec\\.signing_key = .*")
                          ""))
                       (invoke "rake" "gem:create"))))))
    (synopsis "Extra methods for Ruby's @code{File} class")
    (description
     "The @dfn{ptools} (power tools) library extends Ruby's core @code{File}
class with many additional methods modelled after common POSIX tools, such as
@code{File.which} for finding executables, @code{File.tail} to print the last
lines of a file, @code{File.wc} to count words, and so on.")
    (home-page "https://github.com/djberg96/ptools")
    (license license:artistic2.0)))

(define-public ruby-permutation
  (package
    (name "ruby-permutation")
    (version "0.1.8")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "permutation" version))
              (sha256
               (base32
                "13crwk2vfbzv99czva7881027dbcnidihmvx2jc58z2vm3bp9sl8"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'fix-rakefile
          (lambda _
            (substitute* "Rakefile"
              (("require 'rake/gempackagetask'")
               "require 'rubygems/package_task'")
              (("include Config") ""))
            #t))
         (replace 'check
          (lambda _
            (invoke "ruby" "-Ilib" "test/test.rb"))))))
    (synopsis "Library to perform operations with sequence permutations")
    (description "This package provides a Ruby library to perform different
operations with permutations of sequences, such as strings and arrays.")
    (home-page "https://flori.github.io/permutation")
    (license license:gpl2))) ; GPL 2 only

(define-public ruby-shellany
  (package
    (name "ruby-shellany")
    (version "0.0.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "shellany" version))
              (sha256
               (base32
                "1ryyzrj1kxmnpdzhlv4ys3dnl2r5r3d2rs2jwzbnd1v96a8pl4hf"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "default"
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'fix-version-test
          (lambda _
            (substitute* "spec/shellany_spec.rb"
              (("^RSpec") "require \"shellany\"\nRSpec"))
            #t)))))
    (native-inputs
     (list ruby-rspec ruby-nenv bundler))
    (synopsis "Capture command output")
    (description "Shellany is a Ruby library providing functions to capture
the output produced by running shell commands.")
    (home-page "https://rubygems.org/gems/shellany")
    (license license:expat)))

(define-public ruby-notiffany
  (package
    (name "ruby-notiffany")
    (version "0.1.3")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "notiffany" version))
              (sha256
               (base32
                "0f47h3bmg1apr4x51szqfv3rh2vq58z3grh4w02cp3bzbdh6jxnk"))))
    (build-system ruby-build-system)
    ;; Tests are not included in the gem.
    (arguments `(#:tests? #f))
    (propagated-inputs
     (list ruby-shellany ruby-nenv))
    (native-inputs
     (list bundler))
    (synopsis "Wrapper library for notification libraries")
    (description "Notiffany is a Ruby wrapper library for notification
libraries such as Libnotify.")
    (home-page "https://github.com/guard/notiffany")
    (license license:expat)))

(define-public ruby-forking-test-runner
  (package
    (name "ruby-forking-test-runner")
    (version "1.6.0")
    (home-page "https://github.com/grosser/forking_test_runner")
    (source (origin
              (method git-fetch)
              (uri (git-reference (url home-page)
                                  (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1mrglzkj2nrgisccf2f30zbfmcs0awv1g3lw994b2az90fl39x8m"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "spec"
       ;; FIXME: ActiveRecord depends on sqlite3 1.3.6, but Guix has
       ;; 1.4.1, which in turn breaks the tests that use ActiveRecord.
       #:tests? #f
       #:phases (modify-phases %standard-phases
                  (replace 'replace-git-ls-files
                    (lambda _
                      (substitute* "forking_test_runner.gemspec"
                        (("`git ls-files lib/ bin/ MIT-LICENSE`")
                         "`find lib/ bin/ MIT-LICENSE -type f | sort`"))
                      #t))
                  (add-before 'check 'remove-version-constraints
                    (lambda _
                      ;; Ignore hard coded version constraints for the tests.
                      (delete-file "Gemfile.lock")
                      #t))
                  (add-before 'check 'set-HOME
                    (lambda _
                      ;; Many tests invoke Bundler, and fails when Bundler
                      ;; warns that /homeless-shelter does not exist.
                      (setenv "HOME" "/tmp")
                      #t)))))
    (native-inputs
     (list ruby-activerecord ruby-bump ruby-rspec ruby-sqlite3 ruby-wwtd))
    (propagated-inputs
     (list ruby-parallel-tests))
    (synopsis "Run every test in a fork")
    (description
     "This package is a wrapper around @code{parallel_tests} that runs every
test in a fork to avoid pollution and get clean output per test.")
    (license license:expat)))

(define-public ruby-formatador
  (package
    (name "ruby-formatador")
    (version "0.2.5")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "formatador" version))
              (sha256
               (base32
                "1gc26phrwlmlqrmz4bagq1wd5b7g64avpx0ghxr9xdxcvmlii0l0"))))
    (build-system ruby-build-system)
    ;; Circular dependency: Tests require ruby-shindo, which requires
    ;; ruby-formatador at runtime.
    (arguments `(#:tests? #f))
    (synopsis "Ruby library to format text on stdout")
    (description "Formatador is a Ruby library to format text printed to the
standard output stream.")
    (home-page "https://github.com/geemus/formatador")
    (license license:expat)))

(define-public ruby-fuubar
  (package
    (name "ruby-fuubar")
    (version "2.3.2")
    (source
     (origin
       ;; Fetch from the git repository, as the gem package doesn't include
       ;; the tests.
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/thekompanee/fuubar")
             (commit (string-append "releases/v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0jm1x2xp13csbnadixaikj7mlkp5yk4byx51npm56zi13izp7259"))))
    (build-system ruby-build-system)
    (arguments
     '(;; TODO: Some tests fail, unsure why.
       ;; 21 examples, 7 failures
       #:tests? #f
       #:phases
       (modify-phases %standard-phases
         (add-before 'build 'delete-certificate
           (lambda _
             ;; Remove 's.cert_chain' as we do not build with a private key
             (substitute* "fuubar.gemspec"
               ((".*cert_chain.*") "")
               ((".*signing_key.*") ""))
             #t))
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (invoke "rspec"))
             #t)))))
    (native-inputs
     (list bundler))
    (propagated-inputs
     (list ruby-rspec-core ruby-progressbar))
    (synopsis "Fuubar is an RSpec formatter that uses a progress bar")
    (description
     "Fuubar is an RSpec formatter that uses a progress bar instead of a
string of letters and dots as feedback.  It also stops on the first test
failure.")
    (home-page "https://github.com/thekompanee/fuubar")
    (license license:expat)))

(define-public ruby-haml
  (package
    (name "ruby-haml")
    (version "5.0.4")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "haml" version))
       (sha256
        (base32
         "1q0a9fvqh8kn6wm97fcks6qzbjd400bv8bx748w8v87m7p4klhac"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; No included tests
    (propagated-inputs
     (list ruby-tilt ruby-temple))
    (synopsis "Haml is a Ruby library to generate HTML documents")
    (description
     "@acronym{Haml, HTML Abstraction Markup Language} is a layer on top of
HTML or XML that is designed to express the structure of documents using
indentation rather than closing tags.  It was originally envisioned as a
plugin for Ruby on Rails, but it can function as a stand-alone templating
engine.")
    (home-page "https://haml.info/")
    (license license:expat)))

(define-public ruby-hamster
  (package
  (name "ruby-hamster")
  (version "3.0.0")
  (source
    (origin
      (method url-fetch)
      (uri (rubygems-uri "hamster" version))
      (sha256
        (base32
          "1n1lsh96vnyc1pnzyd30f9prcsclmvmkdb3nm5aahnyizyiy6lar"))))
  (build-system ruby-build-system)
  (arguments
   '(#:phases
     (modify-phases %standard-phases
       (add-after 'unpack 'remove-unnecessary-dependencies
         (lambda _
           ;; pry is a debugging tool, and is unnecessary when running the
           ;; tests
           (substitute* "spec/lib/hamster/vector/insert_spec.rb"
             (("require 'pry'") ""))
           (substitute* "spec/spec_helper.rb"
             (("require \"pry\"") "")
             ;; CodeClimate is an online service, and is unnecessary for
             ;; running the tests
             (("require \"codeclimate-test-reporter\"") "")
             (("CodeClimate.*\n") ""))
           #t))
       ;; No Rakefile is included, so run rspec directly.
       (replace 'check
         (lambda* (#:key tests? #:allow-other-keys)
           (when tests?
             (invoke "rspec"))
           #t)))))
  (propagated-inputs
   (list ruby-concurrent))
  (native-inputs
   (list ruby-rspec))
  (synopsis "Efficient, immutable, thread-safe collection classes for Ruby")
  (description
    "Hamster provides 6 persistent data structures: @code{Hash}, @code{Vector},
@code{Set}, @code{SortedSet}, @code{List}, and @code{Deque} (which works as an
immutable queue or stack).")
  (home-page "https://github.com/hamstergem/hamster")
  (license license:expat)))

(define-public ruby-hashdiff
  (package
    (name "ruby-hashdiff")
    (version "1.0.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "hashdiff" version))
       (sha256
        (base32
         "1nynpl0xbj0nphqx1qlmyggq58ms1phf5i03hk64wcc0a17x1m1c"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         ;; Run tests directly via rspec to avoid depending on rubocop.
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (invoke "rspec"))
             #t)))))
    (native-inputs
     (list bundler ruby-rspec-2))
    (synopsis "HashDiff computes the smallest difference between two hashes")
    (description
     "HashDiff is a Ruby library to compute the smallest difference between
two hashes.")
    (home-page "https://github.com/liufengyun/hashdiff")
    (license license:expat)))

(define-public ruby-hydra-minimal
  ;; No releases yet.
  (let ((commit "5abfa378743756ae4d9306cc134bcc482f5c9525")
        (revision "0"))
    (package
      (name "ruby-hydra-minimal")
      (version (git-version "0.0" revision commit))
      (home-page "https://github.com/hyphenation/hydra")
      (source (origin
                (method git-fetch)
                (uri (git-reference (url home-page) (commit commit)))
                (file-name (git-file-name name version))
                ;; byebug is a non-essential debugging utility that brings in
                ;; many dependencies.
                (patches (search-patches "ruby-hydra-minimal-no-byebug.patch"))
                (sha256
                 (base32
                  "1cik398l2765y3d9sdhjzki3303hkry58ac6jlkiy7iy62nm529f"))))
      (build-system ruby-build-system)
      (arguments
       ;; Avoid rspec dependency.
       '(#:tests? #f))
      (synopsis "Ruby hyphenation patterns")
      (description
       "ruby-hydra-minimal is a Ruby library for working with hyphenation patterns.
It is a low-dependency variant of ruby-hydra.")
      (license license:expat))))

(define-public ruby-hydra
  (package
    (inherit ruby-hydra-minimal)
    (name "ruby-hydra")
    (arguments
        '(#:phases (modify-phases %standard-phases
                    (add-after 'unpack 'make-files-writable
                      (lambda _
                        (for-each make-file-writable (find-files "."))
                        #t))
                    (replace 'check
                      (lambda _
                        (invoke "rspec"))))))
    (native-inputs
     (list ruby-rspec))
    (propagated-inputs
     (list ruby-byebug))
    (description
     "ruby-hydra is a Ruby library for working with hyphenation patterns.")))

(define-public ruby-shindo
  (package
    (name "ruby-shindo")
    (version "0.3.8")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "shindo" version))
              (sha256
               (base32
                "0s8v1jbz8i0jh92f2fgxb3p51l1azrpkc8nv4mhrqy4vndpvd7wq"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "shindo_tests"
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'fix-tests
           (lambda _
             (substitute* "tests/tests_helper.rb"
               (("-rubygems") ""))
             (substitute* "Rakefile"
               (("system \"shindo") "system \"./bin/shindo")
               ;; This test doesn't work, so we disable it.
               (("fail \"The build_error test should fail") "#")
               ((" -rubygems") ""))
             #t)))))
    (propagated-inputs
     (list ruby-formatador))
    (synopsis "Simple depth first Ruby testing")
    (description "Shindo is a simple depth first testing library for Ruby.")
    (home-page "https://github.com/geemus/shindo")
    (license license:expat)))

(define-public ruby-rubygems-tasks
  (package
    (name "ruby-rubygems-tasks")
    (version "0.2.5")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "rubygems-tasks" version))
              (sha256
               (base32
                "1x3sz3n2dlknd3v7w1mrq6f0ag6pwzhjvg7z29p75w3p42ma1gbx"))))
    (build-system ruby-build-system)
    ;; Tests need Internet access.
    (arguments `(#:tests? #f))
    (native-inputs
     (list ruby-rspec ruby-yard))
    (synopsis "Rake tasks for managing and releasing Ruby Gems")
    (description "Rubygems-task provides Rake tasks for managing and releasing
Ruby Gems.")
    (home-page "https://github.com/postmodern/rubygems-tasks")
    (license license:expat)))

(define-public ruby-rubyzip
  (package
    (name "ruby-rubyzip")
    (version "2.3.2")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/rubyzip/rubyzip")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "03p8c990n6c1r4g64w0vv7z2iaswisl07l2f1lbh1s78cvmlmfxx"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'disable-rubocop
           (lambda _
             (substitute* "Rakefile"
               (("require 'rubocop/rake_task'") "")
               (("RuboCop::RakeTask.new") ""))))
         (add-before 'check 'patch-tests
           (lambda* (#:key inputs #:allow-other-keys)
             (substitute* "test/gentestfiles.rb"
               (("/usr/bin/zip") (which "zip")))))
         (add-after 'patch-source-shebangs 'unpatch-some-source-shebangs
           (lambda _
             ;; The tests compare zipped files with data test files; since the
             ;; zip files do not have their shebangs patched, the data files
             ;; compared with their extracted version must also be left
             ;; un-patched.
             (substitute* (find-files "test/data" "\\.(txt|rb)$")
               (((which "ruby"))
                "/usr/bin/env ruby")))))))
    (native-inputs
     (list bundler ruby-simplecov zip unzip))
    (synopsis "Ruby module is for reading and writing zip files")
    (description
     "The rubyzip module provides ways to read from and create zip files.")
    (home-page "https://github.com/rubyzip/rubyzip")
    (license license:bsd-2)))

(define-public ruby-silent-stream
  (package
    (name "ruby-silent-stream")
    (version "1.0.6")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "silent_stream" version))
              (sha256
               (base32
                "10381fpvjzfjvhgfyv700607fpa29firgf52w5w5536m4fh6x63m"))))
    (build-system ruby-build-system)
    (synopsis "ActiveSupport stream silencing without ActiveSupport")
    (description "SilentStream is an extraction of some parts of
ActiveSupport's Kernel Reporting Core Extentions around silencing IO
streams.")
    (home-page "https://github.com/pboling/silent_stream")
    (license license:expat)))

(define-public ruby-simplecov-html
  (package
    (name "ruby-simplecov-html")
    (version "0.12.3")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "simplecov-html" version))
              (sha256
               (base32
                "0yx01bxa8pbf9ip4hagqkp5m0mqfnwnw2xk8kjraiywz4lrss6jb"))))
    (build-system ruby-build-system)
    (arguments `(#:tests? #f)) ; there are no tests
    (native-inputs
     (list bundler))
    (synopsis "Default HTML formatter for SimpleCov code coverage tool")
    (description "This package provides the default HTML formatter for
the SimpleCov code coverage tool for Ruby version 1.9 and above.")
    (home-page "https://github.com/simplecov-ruby/simplecov-html")
    (license license:expat)))

(define-public ruby-simplecov-json-formatter
  (package
    (name "ruby-simplecov-json-formatter")
    (version "0.1.4")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "simplecov_json_formatter" version))
              (sha256
               (base32
                "0a5l0733hj7sk51j81ykfmlk2vd5vaijlq9d5fn165yyx3xii52j"))))
    (build-system ruby-build-system)
    ;; The test suite is disabled because it requires simplecov, which
    ;; requires this, introducing a dependency cycle.
    (arguments (list #:tests? #f))
    (synopsis "JSON formatter for SimpleCov")
    (description "This package provides a JSON formatter for SimpleCov, the
Ruby code coverage tool.")
    (home-page
     "https://github.com/codeclimate-community/simplecov_json_formatter")
    (license license:expat)))

(define-public ruby-simplecov
  (package
    (name "ruby-simplecov")
    (version "0.22.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "simplecov" version))
              (sha256
               (base32
                "198kcbrjxhhzca19yrdcd6jjj9sb51aaic3b0sc3pwjghg3j49py"))))
    (build-system ruby-build-system)
    ;; Simplecov depends on rubocop for code style checking at build time.
    ;; Rubocop needs simplecov at build time.
    (arguments `(#:tests? #f))
    (propagated-inputs
     (list ruby-json
           ruby-docile
           ruby-simplecov-html
           ruby-simplecov-json-formatter))
    (synopsis "Code coverage framework for Ruby")
    (description "SimpleCov is a code coverage framework for Ruby with a
powerful configuration library and automatic merging of coverage across test
suites.")
    (home-page "https://github.com/simplecov-ruby/simplecov")
    (license license:expat)))

(define-public ruby-simplecov-lcov
  (package
    (name "ruby-simplecov-lcov")
    (version "0.8.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "simplecov-lcov" version))
              (sha256
               (base32
                "1h8kswnshgb9zidvc88f4zjy4gflgz3854sx9wrw8ppgnwfg6581"))))
    (build-system ruby-build-system)
    ;; The test suite fails half of its tests; it seems to rely on older
    ;; versions of simplecov, rspec, possibly others (see:
    ;; https://github.com/fortissimo1997/simplecov-lcov/issues/29).
    (arguments (list #:tests? #f
                     #:test-target "spec"))
    (native-inputs
     (list ruby-activesupport
           ruby-coveralls
           ruby-rspec
           ruby-simplecov))
    (synopsis "SimpleCov formatter to generate a lcov style coverage")
    (description "This package provides a SimpleCov formatter to generate a
lcov-style coverage report.")
    (home-page "https://github.com/fortissimo1997/simplecov-lcov")
    (license license:expat)))

(define-public ruby-snaky-hash
  (package
    (name "ruby-snaky-hash")
    (version "2.0.1")
    (source (origin
              (method git-fetch)
              (uri (git-reference       ;for tests
                    (url "https://gitlab.com/oauth-xx/snaky_hash")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0zmixxzi2g2d75zii65bq037j4g67p25l6aqddbmmwizspsp5az6"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases #~(modify-phases %standard-phases
                        (add-after 'unpack 'relax-requirements
                          (lambda _
                            (substitute* "Gemfile"
                              (("^linting = .*")
                               "linting = false\n")
                              (("^coverage = .*")
                               "coverage = false\n")
                              (("^debug = .*")
                               "debug = false\n"))
                            (substitute* "spec/spec_helper.rb"
                              (("^RUN_COVERAGE = .*")
                               "RUN_COVERAGE = false\n")
                              (("^ALL_FORMATTERS = .*")
                               "ALL_FORMATTERS = false\n"))))
                        (add-before 'build 'drop-signing-key-requirement
                          (lambda _
                            (substitute* "snaky_hash.gemspec"
                              (("spec.signing_key =.*")
                               "spec.signing_key = nil")))))))
    (native-inputs (list ruby-rspec ruby-rspec-block-is-expected))
    (propagated-inputs (list ruby-hashie ruby-version-gem))
    (synopsis "Hash keys and look-ups normalization Ruby library")
    (description "The SnakyHash Ruby library provides classes for normalizing
hash keys and look-ups, and a pseudo-object interface.")
    (home-page "https://gitlab.com/oauth-xx/snaky_hash")
    (license license:expat)))

(define-public ruby-useragent
  (package
    (name "ruby-useragent")
    (version "0.16.10")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "useragent" version))
              (sha256
               (base32
                "1fv5kvq494swy0p17h9qya9r50w15xsi9zmvhzb8gh55kq6ki50p"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; no test suite
    (synopsis "HTTP user agent parser for Ruby")
    (description "UserAgent is a Ruby library that parses and compares HTTP
User Agents.")
    (home-page "https://github.com/gshutler/useragent")
    (license license:expat)))

(define-public ruby-backports
  (package
  (name "ruby-backports")
  (version "3.11.4")
  (source
    (origin
      (method url-fetch)
      (uri (rubygems-uri "backports" version))
      (sha256
        (base32
          "1hshjxww2h7s0dk57njrygq4zpp0nlqrjfya7zwm27iq3rhc3y8g"))))
  (build-system ruby-build-system)
  (arguments
   '(;; TODO: This should be default, but there is one test failure
     #:test-target "all_spec"))
  (native-inputs
   (list ruby-mspec ruby-activesupport))
  (synopsis "Backports of the features in newer Ruby versions")
  (description
    "Backports enables more compatibility across Ruby versions by providing
backports of some features.")
  (home-page "https://github.com/marcandre/backports")
  (license license:expat)))

(define-public ruby-bacon
  (package
    (name "ruby-bacon")
    (version "1.2.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "bacon" version))
              (sha256
               (base32
                "1f06gdj77bmwzc1k5iragl1595hbn67yc7sqvs56ca8plrr2vmai"))))
    (build-system ruby-build-system)
    (synopsis "Small RSpec clone")
    (description "Bacon is a small RSpec clone providing all essential
features.")
    (home-page "https://github.com/chneukirchen/bacon")
    (license license:expat)))

(define-public ruby-bacon-bits
  (package
    (name "ruby-bacon-bits")
    (version "0.1.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "bacon-bits" version))
       (sha256
        (base32
         "1ghpj8ja94lhi8rgi872hqk4fd2amz2k7g9znd64z5dj7v6l0dmx"))))
    (build-system ruby-build-system)
    (arguments
     ;; No tests
     '(#:tests? #f))
    (propagated-inputs (list ruby-bacon))
    (synopsis "Extensions to Bacon, for disabling tests, before and after
blocks and more")
    (description
     "This extends the bacon testing framework with useful extensions to
disable tests, have before and after blocks that run once and more.")
    (home-page "https://github.com/cldwalker/bacon-bits")
    (license license:expat)))

(define-public ruby-bacon-colored-output
  (package
    (name "ruby-bacon-colored-output")
    (version "1.1.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "bacon-colored_output" version))
       (sha256
        (base32
         "1znyh3vkfdlmf19p3k4zip88ibym41dn5g4p4n5hmks2iznb7qpx"))))
    (build-system ruby-build-system)
    (arguments
     '(;; No included tests
       #:tests? #f))
    (propagated-inputs
     (list ruby-bacon))
    (synopsis "Colored output for Bacon test framework")
    (description
     "This package adds color through ANSI escape codes to Bacon test
output.")
    (home-page "https://github.com/whitequark/bacon-colored_output")
    (license license:expat)))

(define-public ruby-bake
  (package
    (name "ruby-bake")
    (version "0.18.2")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/ioquatix/bake")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "19yi1fxzz9n580gig3p3j6nxbgcfcassa6b0q07jkqrzxdqn7xhn"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases
           #~(modify-phases %standard-phases
               (add-after 'unpack 'sanitize-dependencies
                 (lambda _
                   ;; These dependencies are not needed to build and run tests
                   ;; and contain circular dependencies.
                   (substitute* "gems.rb"
                     ((".*'bake-modernize'.*") "")
                     ((".*'bake-gem'.*") "")
                     ((".*'bake-github-pages'.*") "")
                     ((".*'utopia-project'.*") ""))))
               (add-before 'build 'drop-signing-key-requirement
                 (lambda _
                   (substitute* "bake.gemspec"
                     (("spec.signing_key =.*")
                      "spec.signing_key = nil"))))
               (replace 'check
                 (lambda* (#:key tests? #:allow-other-keys)
                   (when tests?
                     (invoke "rspec")))))))
    (native-inputs (list ruby-covered ruby-rspec))
    (propagated-inputs (list ruby-samovar))
    (synopsis "Replacement for rake with a simpler syntax")
    (description "Bake is a task execution tool, inspired by Rake, but
codifying many of the use cases which are typically implemented in an ad-hoc
manner.")
    (home-page "https://github.com/ioquatix/bake")
    (license license:expat)))

(define-public ruby-bake-test
  (package
    (name "ruby-bake-test")
    (version "0.2.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "bake-test" version))
              (sha256
               (base32
                "1p6kfpncj0s4zyynrrq6c735jvh0dnwyv7kfqym4rpyka4f85qdp"))))
    (build-system ruby-build-system)
    ;; XXX: Disable the test suite to avoid a circular dependency with
    ;; ruby-sus.
    (arguments (list #:tests? #f))
    (propagated-inputs (list ruby-bake))
    (synopsis "Test suite automatic runner for Ruby")
    (description "@command{bake-test} automatically discovers how to run local
test suites for Ruby projects.  It supports @command{rspec}, @command{sus}, as
well as @samp{rake}.")
    (home-page "https://github.com/ioquatix/bake-test")
    (license license:expat)))

(define-public ruby-bake-test-external
  (package
    (name "ruby-bake-test-external")
    (version "0.3.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "bake-test-external" version))
              (sha256
               (base32
                "0749xc7jkz1c5gsq1giwhrqy6s6xqm48bdvs414372881wki2jmh"))))
    (build-system ruby-build-system)
    ;; The test suite relies on git and network access to clone external
    ;; repositories.
    (arguments (list #:tests? #f))
    (propagated-inputs (list ruby-bake))
    (synopsis "Continuous integration extension for Bake")
    (description "Bake Test External adds a @samp{test:external} action to the
@command{bake} command to run the test suites of dependent projects to check
for breakage.")
    (home-page "https://github.com/ioquatix/bake-test-external")
    (license license:expat)))

(define-public ruby-connection-pool
  (package
    (name "ruby-connection-pool")
    (version "2.2.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "connection_pool" version))
              (sha256
               (base32
                "0lflx29mlznf1hn0nihkgllzbj8xp5qasn8j7h838465pi399k68"))))
    (build-system ruby-build-system)
    (native-inputs
     (list bundler))
    (synopsis "Generic connection pool for Ruby")
    (description "Connection_pool provides a generic connection pooling
interface for Ruby programs.")
    (home-page "https://github.com/mperham/connection_pool")
    (license license:expat)))

(define-public ruby-fast-gettext
  (package
    (name "ruby-fast-gettext")
    (version "2.0.3")
    (home-page "https://github.com/grosser/fast_gettext")
    (source (origin
              (method git-fetch)
              (uri (git-reference (url home-page)
                                  (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1dg14apq5sfjshhcq0idphhs7aq9ikzswhqmn689p1h76mxqr1v6"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "spec"
       #:phases (modify-phases %standard-phases
                  (add-before 'check 'remove-version-constraints
                    (lambda _
                      (delete-file "Gemfile.lock")
                      #t))
                  (add-before 'check 'remove-activerecord-test
                    (lambda _
                      ;; FIXME: This test fails because ActiveRecord depends on
                      ;; a different version of ruby-sqlite than the currently
                      ;; available one.
                      (delete-file
                       "spec/fast_gettext/translation_repository/db_spec.rb")
                      #t))
                  (add-before 'check 'disable-i18n-test
                    (lambda _
                      ;; XXX: This test checks i18n intricasies with Rails 3 and
                      ;; automatically disables itself for Rails 4.0, but does
                      ;; not know about newer versions as it has not been updated
                      ;; since 2014.  Disable for later versions of Rails too.
                      (substitute* "spec/fast_gettext/vendor/string_spec.rb"
                        (((string-append "ActiveRecord::VERSION::MAJOR == 4 and "
                                         "ActiveRecord::VERSION::MINOR == 0"))
                         "ActiveRecord::VERSION::MAJOR >= 4"))
                      #t)))))
    (native-inputs
     (list ;; For tests.
           ruby-activerecord
           ruby-activesupport
           ruby-bump
           ruby-forking-test-runner
           ruby-i18n
           ruby-rubocop
           ruby-rspec
           ruby-single-cov
           ruby-sqlite3
           ruby-wwtd))
    (synopsis "Fast implementation of @code{GetText}")
    (description
     "This package provides an alternative implementation of the Ruby
@code{GetText} library that is approximately 12x faster yet thread safe.")
    ;; Some parts are covered by the Ruby license, see file headers.
    (license (list license:expat license:ruby))))

(define-public ruby-fiber-local
  (package
    (name "ruby-fiber-local")
    (version "1.0.0")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/socketry/fiber-local")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0pp5b81h0lysdnphgprkixh1az0fkrgir5sbcp0mm8arxf3f8m90"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases
           #~(modify-phases %standard-phases
               (add-after 'extract-gemspec 'sanitize-dependencies
                 (lambda _
                   ;; This pulls in extraneous maintenance dependencies.
                   (delete-file "gems.rb")
                   ;; Depending on ruby-covered would introduce a dependency
                   ;; cycle with it.
                   (substitute* '("fiber-local.gemspec" "spec/spec_helper.rb")
                     ((".*covered.*") ""))))
               (replace 'check
                 (lambda* (#:key tests? #:allow-other-keys)
                   (when tests?
                     (invoke "rspec")))))))
    (native-inputs (list ruby-rspec))
    (synopsis "Ruby module to simplify fiber-local state management")
    (description "This package provides a class-level mixin to make managing
fiber-local state easy.  It provides easy access to a fiber-local state from a
fiber, and defaults to a shared thread-local state.")
    (home-page "https://github.com/socketry/fiber-local")
    (license license:expat)))

(define-public ruby-flores
  (package
    (name "ruby-flores")
    (version "0.0.8")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "flores" version))
              (sha256
               (base32
                "0pd8gqgy67rp1baq5r7himl0r9jzv5kqlhdmqh8wngynv548w2ai"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases
           #~(modify-phases %standard-phases
               (replace 'check
                 (lambda* (#:key tests? #:allow-other-keys)
                   (when tests?
                     (invoke "rspec")))))))
    (native-inputs (list ruby-rspec ruby-simplecov))
    (synopsis "Fuzzing, randomization, and stress testing library")
    (description "Flores is a fuzzing, randomization, and stress library to
help tests uncover more bugs.")
    (home-page "https://github.com/jordansissel/ruby-flores")
    (license license:asl2.0)))

(define-public ruby-net-http-persistent
  (package
    (name "ruby-net-http-persistent")
    (version "3.0.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "net-http-persistent" version))
              (sha256
               (base32
                "156rv95bgxfz6qw5y1r7c7bswr77918hygl8dyl14qzbqc5vyp18"))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-connection-pool ruby-hoe))
    (synopsis "Persistent HTTP connection manager")
    (description "Net::HTTP::Persistent manages persistent HTTP connections
using Net::HTTP, supporting reconnection and retry according to RFC 2616.")
    (home-page "https://github.com/drbrain/net-http-persistent")
    (license license:expat)))

(define-public ruby-net-imap
  (package
    (name "ruby-net-imap")
    (version "0.3.4")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/ruby/net-imap")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0nx49i1n9q1wpancqaac2srrpb8mb43mc8wryyqyhpgki2grwyxw"))))
    (build-system ruby-build-system)
    (arguments
     ;; The test suite appears to rely on RFCs it tries fetching from the
     ;; network (see: https://github.com/ruby/net-imap/issues/136).
     (list #:tests? #f
           #:phases
           #~(modify-phases %standard-phases
               (add-before 'replace-git-ls-files 'adjust-for-git-ls-files
                 (lambda _
                   ;; Adjust the git ls-files invocation so that it matches
                   ;; the expected pattern.
                   (substitute* "net-imap.gemspec"
                     (("`git ls-files -z 2>/dev/null`")
                      "`git ls-files -z`")))))))
    (propagated-inputs (list ruby-date ruby-net-protocol))
    (synopsis "Ruby client api for Internet Message Access Protocol")
    (description "@code{Net::IMAP} implements Internet Message Access
Protocol (IMAP) client functionality.  The protocol is described in
@url{https://tools.ietf.org/html/rfc3501, IMAP}.")
    (home-page "https://github.com/ruby/net-imap")
    (license license:bsd-2)))

(define-public ruby-net-pop
  (package
    (name "ruby-net-pop")
    (version "0.1.2")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/ruby/net-pop")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "05vz6a56va2rbr7ld78gdzwy1j5mzs98cz82ax5aqa83pzzk6jld"))))
    (build-system ruby-build-system)
    (propagated-inputs (list ruby-net-protocol))
    (synopsis "Ruby client library for POP3")
    (description "This library provides functionality for retrieving email via
POP3, the Post Office Protocol version 3, as specified by
@url{http://www.ietf.org/rfc/rfc1939.txt, RFC1939}.")
    (home-page "https://github.com/ruby/net-pop")
    (license license:bsd-2)))

(define-public ruby-net-smtp
  (package
    (name "ruby-net-smtp")
    (version "0.3.3")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/ruby/net-smtp")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0ca2wh45xvc09rv6v6sz3vbnkzrjzk5c4l6dk50zk4dwxvghma8r"))))
    (build-system ruby-build-system)
    (propagated-inputs (list ruby-net-protocol))
    (synopsis "Simple Mail Transfer Protocol client library for Ruby")
    (description "This library provides functionality to send Internet mail
via SMTP, the Simple Mail Transfer Protocol.  The SMTP protocol specification
is known as @url{http://www.ietf.org/rfc/rfc2821.txt, RFC2821}.")
    (home-page "https://github.com/ruby/net-smtp")
    (license license:bsd-2)))

(define-public ruby-pleaserun
  (package
    (name "ruby-pleaserun")
    (version "0.0.32")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "pleaserun" version))
              (sha256
               (base32
                "1aykf0l8327bqkkf5xd9jcglsib973zpy37cfnlf4j0vp0cdpn2d"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases
           #~(modify-phases %standard-phases
               (add-after 'extract-gemspec 'relax-requirements
                 (lambda _
                   (substitute* "pleaserun.gemspec"
                     ;; Mustache is pinned at 0.99.8, for portability with
                     ;; older Rubies.
                     (("dependency\\(%q<mustache>.freeze.*")
                      "dependency(%q<mustache>.freeze)\n"))))
               (replace 'check
                 (lambda* (#:key tests? #:allow-other-keys)
                   (when tests?
                     ;; The cli_spec.rb test fails non-deterministically with
                     ;; a Errno::EISDIR error (see:
                     ;; https://github.com/jordansissel/pleaserun/issues/155)
                     (invoke "rspec" "--exclude-pattern" "cli_spec.rb")))))))
    (native-inputs (list ruby-flores ruby-rspec))
    (propagated-inputs (list ruby-cabin
                             ruby-clamp
                             ruby-dotenv
                             ruby-insist
                             ruby-mustache
                             ruby-stud))
    (synopsis "Init scripts and service definitions generation tool")
    (description "Pleaserun is a tool to generate startup scripts and service
definitions.  It targets service managers such as systemd, Upstart, launchd,
sysv init, and runit.")
    (home-page "https://github.com/jordansissel/pleaserun")
    (license license:asl2.0)))

(define-public ruby-power-assert
  (package
    (name "ruby-power-assert")
    (version "1.1.5")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "power_assert" version))
              (sha256
               (base32
                "1dii0wkfa0jm8sk9b20zl1z4980dmrjh0zqnii058485pp3ws10s"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f))                    ; No included tests
    (native-inputs
     (list bundler))
    (synopsis "Assert library with descriptive assertion messages")
    (description "Power-assert is an assertion library providing descriptive
assertion messages for tests.")
    (home-page "https://github.com/k-tsj/power_assert")
    (license (list license:bsd-2 license:ruby))))

(define-public ruby-powerpack
  (package
    (name "ruby-powerpack")
    (version "0.1.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "powerpack" version))
       (sha256
        (base32
         "1r51d67wd467rpdfl6x43y84vwm8f5ql9l9m85ak1s2sp3nc5hyv"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "spec"))
    (native-inputs
     (list bundler ruby-rspec ruby-yard))
    (synopsis "Useful extensions to core Ruby classes")
    (description
     "This package provides a few useful extensions to core Ruby classes,
including @code{Array}, @code{Enumerable}, @code{Hash}, @code{Numeric}, and
@code{String}.")
    (home-page "https://github.com/bbatsov/powerpack")
    (license license:expat)))

(define-public ruby-locale
  (package
    (name "ruby-locale")
    (version "2.1.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "locale" version))
              (sha256
               (base32
                "1sls9bq4krx0fmnzmlbn64dw23c4d6pz46ynjzrn9k8zyassdd0x"))))
    (build-system ruby-build-system)
    ;; ruby-test-unit is required to run tests, but that needs ruby-packnga,
    ;; which needs ruby-gettext, which needs ruby-locale.  To break the
    ;; dependency cycle we disable tests.
    (arguments `(#:tests? #f))
    (native-inputs
     (list bundler ruby-yard))
    (synopsis "Ruby library providing basic localization APIs")
    (description
     "Ruby-Locale is the pure ruby library which provides basic APIs for
localization.")
    (home-page "https://github.com/ruby-gettext/locale")
    (license (list license:lgpl3+ license:ruby))))

(define-public ruby-temple
  (package
    (name "ruby-temple")
    (version "0.10.0")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/judofyr/temple")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0rr9fnlcgj9nm3b6hzzjsvcw8x3y7z48j7slk7xxff2mh8s7y3y0"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases
           #~(modify-phases %standard-phases
               (add-after 'replace-git-ls-files 'replace-more-git-ls-files
                 (lambda _
                   (substitute* "temple.gemspec"
                     ;; There no longer are test, spec or features
                     ;; directories.
                     ((".*`git ls-files -- \\{test,spec,features}/\\*`.*")
                      "")
                     ;; There isn't any bin directory either.
                     ((".*`git ls-files -- bin/\\*`.*")
                      ""))))
               (replace 'check
                 (lambda* (#:key tests? #:allow-other-keys)
                   (when tests?
                     (invoke "rspec")))))))
    (native-inputs (list ruby-bacon ruby-erubi ruby-rspec ruby-tilt))
    (synopsis "Template compilation framework in Ruby")
    (description "Temple is an abstraction and framework for compiling
templates to pure Ruby.")
    (home-page "https://github.com/judofyr/temple")
    (license license:expat)))

(define-public ruby-text
  (package
    (name "ruby-text")
    (version "1.3.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "text" version))
              (sha256
               (base32
                "1x6kkmsr49y3rnrin91rv8mpc3dhrf3ql08kbccw8yffq61brfrg"))))
    (build-system ruby-build-system)
    (synopsis "Collection of text algorithms for Ruby")
    (description
     "This package provides a collection of text algorithms: Levenshtein,
Soundex, Metaphone, Double Metaphone, Porter Stemming.")
    (home-page "https://github.com/threedaymonk/text")
    (license license:expat)))

(define-public ruby-gettext
  (package
    (name "ruby-gettext")
    (version "3.1.7")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "gettext" version))
              (sha256
               (base32
                "1hg9islkm324mb4sd4za1fgafj1hqnm3bdvzj3k4fqpnzqnbcfiq"))))
    (build-system ruby-build-system)
    ;; ruby-test-unit is required to run tests, but that needs ruby-packnga,
    ;; which needs ruby-gettext.  To break the dependency cycle we disable
    ;; tests.
    (arguments `(#:tests? #f))
    (propagated-inputs
     (list ruby-locale ruby-text))
    (native-inputs
     (list bundler ruby-yard))
    (synopsis "GNU gettext-like program for Ruby")
    (description
     "Gettext is a GNU gettext-like program for Ruby.  The catalog
file (po-file) used is the same as that used by GNU gettext, allowing you to
use GNU gettext tools for maintenance.")
    (home-page "https://ruby-gettext.github.com/")
    (license (list license:lgpl3+ license:ruby))))

(define-public ruby-packnga
  (package
    (name "ruby-packnga")
    (version "1.0.4")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "packnga" version))
              (sha256
               (base32
                "1vv2j0i43s4xid2km5hgrrxqlqpwgq8nlm8kaxfg2531c1vwfsd4"))))
    (build-system ruby-build-system)
    ;; ruby-test-unit is required to run tests, but that needs ruby-packnga.
    ;; To break the dependency cycle we disable tests.
    (arguments `(#:tests? #f))
    (propagated-inputs
     (list ruby-gettext ruby-yard))
    (native-inputs
     (list bundler))
    (synopsis "Utility library to package internationalized libraries")
    (description
     "Packnga is a library to translate to many languages using YARD.")
    (home-page "https://ranguba.org/packnga/")
    (license license:lgpl2.0+)))

(define-public ruby-test-construct
  (package
    (name "ruby-test-construct")
    (version "2.0.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "test_construct" version))
       (sha256
        (base32
         "1a2ym3l068d0pxzzr95kvqx87zpdsarxslz9ygd4qfm9frrz0kgj"))))
    (build-system ruby-build-system)
    (native-inputs
     (list bundler ruby-mocha ruby-rspec))
    (synopsis "Creates temporary files and directories for testing")
    (description
     "TestConstruct is a @acronym{DSL, Domain Specific Language} for creating
temporary files and directories during tests.")
    (home-page "https://github.com/bhb/test_construct")
    (license license:expat)))

(define-public ruby-test-unit
  (package
    (name "ruby-test-unit")
    (version "3.4.4")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "test-unit" version))
              (sha256
               (base32
                "15isy7vhppbfd0032klirj9gxp65ygkzjdwrmm28xpirlcsk6qpd"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-power-assert))
    (native-inputs
     (list bundler ruby-packnga ruby-yard))
    (synopsis "Unit testing framework for Ruby")
    (description "@code{Test::Unit} is unit testing framework for Ruby, based
on xUnit principles.  These were originally designed by Kent Beck, creator of
extreme programming software development methodology, for Smalltalk's SUnit.
It allows writing tests, checking results and automated testing in Ruby.")
    (home-page "https://test-unit.github.io/")
    (license (list license:psfl license:ruby))))

(define-public ruby-mapping
  (package
    (name "ruby-mapping")
    (version "1.1.1")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/ioquatix/mapping")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0yhmqp8mprjqf9m7wzc4hhi50qbfax86r89w852csns0ijaffjjs"))))
    (build-system ruby-build-system)
    (arguments (list #:test-target "spec"))
    (native-inputs (list ruby-rspec))
    (synopsis "Map model objects based on their class to a given output model")
    (description "The @code{mapping} gem maps model objects based on their
class to a given output model.  It is useful for versioning external
interfaces (e.g. JSON APIs) or processing structured data from one format to
another.")
    (home-page "https://github.com/ioquatix/mapping")
    (license license:expat)))

(define-public ruby-markaby
  (package
    (name "ruby-markaby")
    (version "0.9.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "markaby" version))
       (sha256
        (base32
         "1j4jc31ycydbkh5h3q6zwidzpavg3g5mbb5lqyaczd3jrq78rd7i"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         ;; Run rspec manually without using the Rakefile, as the versions of
         ;; Rake and RSpec 2 are incompatible:
         ;;
         ;; NoMethodError: undefined method `last_comment'
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (invoke "rspec"))
             #t)))))
    (propagated-inputs
     (list ruby-builder))
    (native-inputs
     (list bundler ruby-rspec-2))
    (synopsis "Write HTML pages in pure Ruby")
    (description
     "Markaby allows writing HTML packages in pure Ruby.  This is similar to
the functionality provided by @acronym{ERB, Embedded Ruby}, but without the
mixture of HTML and additional ERB syntax.")
    (home-page "https://markaby.github.io/")
    (license license:expat)))

(define-public ruby-maruku
  (package
    (name "ruby-maruku")
    (version "0.7.3")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "maruku" version))
       (sha256
        (base32
         "1r7bxpgnx2hp3g12bjrmdrpv663dfqxsdp0af69kjhxmaxpia56x"))))
    (build-system ruby-build-system)
    (arguments
     '(;; TODO: 3 tests seem to fail due to HTML encoding issues
       #:tests? #f
       #:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (invoke "rspec"))
             #t)))))
    (native-inputs
     (list ruby-rspec ruby-simplecov ruby-nokogiri-diff))
    (synopsis "Markdown interpreter in Ruby")
    (description
     "Maruku is a Markdown interpreter in Ruby.  It can export Markdown to
HTML, and PDF through LaTeX.")
    (home-page "https://github.com/bhollis/maruku")
    (license license:expat)))

(define-public ruby-metaclass
  (package
    (name "ruby-metaclass")
    (version "0.0.4")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "metaclass" version))
              (sha256
               (base32
                "0hp99y2b1nh0nr8pc398n3f8lakgci6pkrg4bf2b2211j1f6hsc5"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'add-test-unit-to-search-path
           (lambda* (#:key inputs #:allow-other-keys)
             (let* ((test-unit (assoc-ref inputs "ruby-test-unit")))
               (substitute* "Rakefile"
                 (("t\\.libs << \"test\"" line)
                  (string-append line "; t.libs << \""
                                 test-unit "/lib/ruby/vendor_ruby"
                                 "/gems/test-unit-"
                                 ,(package-version ruby-test-unit)
                                 "/lib\""))))
             #t)))))
    (native-inputs
     (list bundler ruby-test-unit))
    (synopsis "Ruby library adding metaclass method to all objects")
    (description
     "Metaclass is a Ruby library adding a @code{metaclass} method to all Ruby
objects.")
    (home-page "https://github.com/floehopper/metaclass")
    (license license:expat)))

(define-public ruby-mkmf-lite
  (package
    (name "ruby-mkmf-lite")
    (version "0.3.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "mkmf-lite" version))
              (sha256
               (base32
                "0br9k6zijj1zc25n8p7f2j1mwl58nfgdknf3q13h9k156jvrir06"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-ptools))
    (synopsis "Lightweight alternative to @code{mkmf}")
    (description
     "@code{mkmf-lite} is a light version of Ruby's @code{mkmf.rb} designed
for use as a library.  It does not create packages, builds, or log files of
any kind.  Instead, it provides mixin methods that you can use in FFI or tests
to check for the presence of header files, constants, and so on.")
    (home-page "https://github.com/djberg96/mkmf-lite")
    (license license:asl2.0)))

(define-public ruby-msgpack
  (package
    (name "ruby-msgpack")
    (version "1.6.1")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/msgpack/msgpack-ruby")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "08wi853nv02clrdwx8s6dg9lmcyzq5fk84l4rb94pglps76rlvz7"))))
    (build-system ruby-build-system)
    (arguments (list #:test-target "spec"))
    (native-inputs
     (list ruby-rake-compiler
           ruby-ruby-memcheck
           ruby-rspec
           ruby-yard))
    (synopsis "Efficient object serialization library for Ruby")
    (description "MessagePack is a binary-based efficient object serialization
library.  It enables to exchange structured objects between many languages
like JSON.  Unlike JSON, it is very fast and small.")
    (home-page "https://msgpack.org/")
    (license license:asl2.0)))

(define-public ruby-mspec
  (package
    (name "ruby-mspec")
    (version "1.9.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "mspec" version))
       (sha256
        (base32
         "0wmyh2n40m4srwdx9z6h6g6p46k02pzyhcsja3hqcw5h5b0hfmhd"))))
    (build-system ruby-build-system)
    (arguments
     '(;; TODO: 3 test failures
       ;; ./spec/mocks/mock_spec.rb:82
       ;; ./spec/utils/name_map_spec.rb:151
       ;; ./spec/utils/name_map_spec.rb:155
       #:tests? #f
       #:phases
       (modify-phases %standard-phases
         (add-after 'extract-gemspec 'change-dependency-constraints
           (lambda _
             (substitute* "mspec.gemspec"
               (("rake.*") "rake>)\n")
               (("rspec.*") "rspec>)\n"))
             #t))
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (invoke "rspec" "spec"))
             #t)))))
    (native-inputs
     (list bundler ruby-rake ruby-rspec))
    (synopsis "MSpec is a specialized framework for RubySpec")
    (description
     "MSpec is a specialized framework that is syntax-compatible with RSpec 2
for basic features.  MSpec contains additional features that assist in writing
specs for Ruby implementations in ruby/spec.")
    (home-page "http://rubyspec.org")
    (license license:expat)))

(define-public ruby-mysql2
  (package
    (name "ruby-mysql2")
    (version "0.5.2")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/brianmario/mysql2")
             (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "11lvfgc2rmvkm52jp0nbi6pvhk06klznghr7llldfw8basl9n5wv"))))
    (build-system ruby-build-system)
    (arguments
     '(;; TODO: Tests require a running MySQL/MariaDB service
       #:tests? #f
       #:phases
       (modify-phases %standard-phases
         (replace 'replace-git-ls-files
           (lambda _
             (substitute* "mysql2.gemspec"
               (("git ls-files .*`") "find . -type f |sort`"))
             #t))
         (add-before 'install 'set-MAKEFLAGS
           (lambda* (#:key outputs #:allow-other-keys)
             (setenv "MAKEFLAGS"
                     (string-append
                      "V=1 "
                      "prefix=" (assoc-ref outputs "out")))
             #t))
         ;; Move the 'check phase to after 'install, as then you can test
         ;; using the installed mysql2 gem in the store.
         (delete 'check)
         (add-after 'install 'check
           (lambda* (#:key outputs tests? #:allow-other-keys)
             (setenv "GEM_PATH"
                     (string-append
                      (getenv "GEM_PATH")
                      ":"
                      (assoc-ref outputs "out") "/lib/ruby/vendor_ruby"))
             (when tests?
               (invoke "rspec"))
             #t)))))
    (inputs
     `(("mariadb-dev" ,mariadb "dev")
       ("zlib" ,zlib)))
    (native-inputs
     (list ruby-rspec ruby-rake-compiler))
    (synopsis "MySQL library for Ruby, binding to libmysql")
    (description
     "This package provides a simple, fast MySQL library for Ruby, binding to
libmysql.")
    (home-page "https://github.com/brianmario/mysql2")
    (license license:expat)))

(define-public ruby-blankslate
  (package
    (name "ruby-blankslate")
    (version "3.1.3")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "blankslate" version))
              (sha256
               (base32
                "0fwkb4d1j9gc7vdwn2nxvwgy2g5wlag4c4bp7bl85jvq0kgp6cyx"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
          (lambda _ (invoke "rspec" "spec/"))))))
    (native-inputs
     (list bundler ruby-rspec))
    (synopsis "Abstract base class with no predefined methods")
    (description
     "BlankSlate provides an abstract base class with no predefined
methods (except for @code{__send__} and @code{__id__}).  BlankSlate is useful
as a base class when writing classes that depend upon
@code{method_missing} (e.g. dynamic proxies).")
    (home-page "https://github.com/masover/blankslate")
    (license license:expat)))

(define-public ruby-bond
  (package
    (name "ruby-bond")
    (version "0.5.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "bond" version))
       (sha256
        (base32
         "1r19ifc4skyl2gxnifrxa5jvbbay9fb2in79ppgv02b6n4bhsw90"))))
    (build-system ruby-build-system)
    (arguments
     ;; The test suite fails (see:
     ;; https://github.com/cldwalker/bond/issues/46).
     `(#:tests? #f))
    (native-inputs
     (list ruby-bacon ruby-bacon-bits ruby-mocha-on-bacon))
    (synopsis "Bond can provide custom autocompletion for arguments, methods
and more")
    (description
     "Bond can autocomplete argument(s) to methods, uniquely completing per
module, per method and per argument.  Bond provides a configuration system and
a DSL for creating custom completions and completion rules.  Bond can also
load completions that ship with gems.  Bond is able to offer more than irb's
completion since it uses the full line of input when completing as opposed to
irb's last-word approach.")
    (home-page "http://tagaholic.me/bond/")
    (license license:expat)))

(define-public ruby-idn-ruby
  (package
    (name "ruby-idn-ruby")
    (version "0.1.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "idn-ruby" version))
       (sha256
        (base32
         "07vblcyk3g72sbq12xz7xj28snpxnh3sbcnxy8bglqbfqqhvmawr"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (delete 'check)
         (add-after 'install 'check
           (lambda* (#:key tests? outputs #:allow-other-keys)
             (when tests?
               (let* ((gem-file (cadr (find-files "." "\\.gem")))
                      (name-and-version (basename gem-file ".gem")))
                 (apply invoke
                        "ruby" "--verbose"
                        (string-append "-I"
                                       (assoc-ref outputs "out")
                                       "/lib/ruby/vendor_ruby/gems/"
                                       name-and-version
                                       "/lib")
                        (find-files "./test" ".*\\.rb"))))
             #t)))))
    (inputs
     (list libidn))
    (synopsis "Ruby Bindings for the GNU LibIDN library")
    (description
     "Ruby Bindings for the GNU LibIDN library, an implementation of the
Stringprep, Punycode and IDNA specifications.  These are used to encode and
decode internationalized domain + names according to the IDNA2003
specifications.

Included are the most important parts of the Stringprep, Punycode and IDNA
APIs like performing Stringprep processings, encoding to and decoding from
Punycode strings and converting entire domain names to and from the ACE
encoded form.")
    (home-page "https://github.com/deepfryed/idn-ruby")
    (license license:asl2.0)))

(define-public ruby-insist
  (package
    (name "ruby-insist")
    (version "1.0.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "insist" version))
              (sha256
               (base32
                "0bw3bdwns14mapbgb8cbjmr0amvwz8y72gyclq04xp43wpp5jrvg"))))
    (build-system ruby-build-system)
    (arguments (list #:phases #~(modify-phases %standard-phases
                                  (replace 'check
                                    (lambda* (#:key tests? #:allow-other-keys)
                                      (when tests?
                                        (invoke "ruby" "test/testing.rb")))))))
    (synopsis "Testing tool for Ruby")
    (description "This package provides a simple block-driven assertion
library for both testing and for production code that attempts to make test
definitions more readable.")
    (home-page "https://github.com/jordansissel/ruby-insist/")
    (license license:asl2.0)))

(define-public ruby-instantiator
  (package
    (name "ruby-instantiator")
    (version "0.0.7")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "instantiator" version))
              (sha256
               (base32
                "0w07w3gkyqr7m0vz5h13vm8b411660qywjm2xxxgdjv4wb3fazbr"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'add-test-unit-to-search-path
           (lambda* (#:key inputs #:allow-other-keys)
             (let* ((test-unit (assoc-ref inputs "ruby-test-unit")))
               (substitute* "Rakefile"
                 (("t\\.libs << \"test\"" line)
                  (string-append line "; t.libs << \""
                                 test-unit "/lib/ruby/vendor_ruby"
                                 "/gems/test-unit-"
                                 ,(package-version ruby-test-unit)
                                 "/lib\""))))
             #t)))))
    (propagated-inputs
     (list ruby-blankslate))
    (native-inputs
     (list bundler ruby-test-unit))
    (synopsis "Instantiate an arbitrary Ruby class")
    (description
     "Instantiator lets you instantiate an arbitrary Ruby class without
knowing anything about the constructor.")
    (home-page "https://github.com/floehopper/instantiator")
    (license license:expat)))

(define-public ruby-introspection
  (package
    (name "ruby-introspection")
    (version "0.0.4")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "introspection" version))
              (sha256
               (base32
                "1y2nbijkc0zlfmn9ss6588ilarq2kbn2i7w7pwwsli66dj84zgca"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'add-test-unit-to-search-path
          (lambda* (#:key inputs #:allow-other-keys)
            (let* ((test-unit (assoc-ref inputs "ruby-test-unit")))
              (substitute* "Rakefile"
                (("t\\.libs << \"test\"" line)
                 (string-append line "; t.libs << \""
                                test-unit "/lib/ruby/vendor_ruby"
                                "/gems/test-unit-"
                                ,(package-version ruby-test-unit)
                                "/lib\""))))
            #t)))))
    (propagated-inputs
     (list ruby-instantiator ruby-metaclass))
    (native-inputs
     (list bundler ruby-blankslate ruby-test-unit))
    (synopsis "Dynamic inspection of the method hierarchy on a Ruby object")
    (description
     "Introspection provides tools to inspect the hierarchy of method
definitions on a Ruby object.")
    (home-page "https://github.com/floehopper/introspection")
    (license license:expat)))

(define-public ruby-redcarpet
  (package
    (name "ruby-redcarpet")
    (version "3.5.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "redcarpet" version))
              (sha256
               (base32
                "0skcyx1h8b5ms0rp2zm3ql6g322b8c1adnkwkqyv7z3kypb4bm7k"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         ;; The gem archive does not include the conformance tests.
         (add-after 'unpack 'disable-conformance-tests
          (lambda _
            (substitute* "Rakefile"
              (("task :test => %w\\[test:unit test:conformance\\]")
               "task :test => %w[test:unit]"))
            #t)))))
    (native-inputs
     (list bundler ruby-test-unit ruby-rake-compiler))
    (synopsis "Extensible Markdown to (X)HTML converter")
    (description
     "Redcarpet is an extensible Ruby library for Markdown processing and
conversion to (X)HTML.")
    (home-page "https://github.com/vmg/redcarpet")
    (license license:expat)))

(define-public ruby-reline
  (package
    (name "ruby-reline")
    (version "0.3.3")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/ruby/reline")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1papa4f4prjml9qk6yydi4k5a4zgbzmxmbhd8fz9kfg1i34s35cw"))))
    (build-system ruby-build-system)
    (propagated-inputs (list ruby-io-console))
    (synopsis "GNU Readline or Editline implementation in Ruby")
    (description "Reline is a pure Ruby alternative GNU Readline or Editline
implementation.")
    (home-page "https://github.com/ruby/reline")
    (license (list license:bsd-2 license:ruby)))) ;dual license

(define-public ruby-rerun
  (package
  (name "ruby-rerun")
  (version "0.13.0")
  (source
    (origin
      (method url-fetch)
      (uri (rubygems-uri "rerun" version))
      (sha256
        (base32
          "1cskvxk8z8vmfail8na7hj91hs0qnvds9nydj04zi3dbddgnbmvz"))))
  (build-system ruby-build-system)
  (arguments
   '(#:tests? #f)) ; No included tests
  (propagated-inputs
   (list ruby-listen))
  (synopsis "Run a process, and restart when some monitored files change")
  (description
    "Rerun is a tool to launch programs, then monitor the file system, and
restart the program when any of the monitored files change.  It's written in
Ruby, but can be used for all programs.")
  (home-page "https://github.com/alexch/rerun/")
  (license license:expat)))

(define-public ruby-maxitest
  (package
    (name "ruby-maxitest")
    (version "4.4.1")
    (home-page "https://github.com/grosser/maxitest")
    (source (origin
              ;; Pull from git because the gem does not contain tests.
              (method git-fetch)
              (uri (git-reference
                    (url home-page)
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0l646lgrgsfgg9qh05b8a3jd43kgrmr6xzbdvyspmdlhchk1qszg"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "default"
       #:phases (modify-phases %standard-phases
                  (replace 'replace-git-ls-files
                    (lambda _
                      (substitute* "maxitest.gemspec"
                        (("`git ls-files lib/ bin/ MIT-LICENSE Readme.md`")
                         "`find lib/ bin/ MIT-LICENSE Readme.md -type f | sort`"))))
                  (add-before 'check 'remove-version-constraints
                    (lambda _
                      ;; Don't use specific versions of dependencies, instead
                      ;; take whatever is available in Guix.
                      (delete-file "Gemfile.lock")))
                  (add-before 'check 'add-mtest-on-PATH
                    (lambda _
                      ;; Tests use 'mtest' which is not automatically added on
                      ;; PATH.
                      (setenv "PATH" (string-append (getcwd) "/bin:"
                                                    (getenv "PATH"))))))))
    (native-inputs
     (list procps
           ruby-bump
           ruby-byebug
           ruby-rspec
           ruby-wwtd))
    (propagated-inputs
     (list ruby-minitest))
    (synopsis "Minitest with extra features")
    (description
     "Maxitest is a wrapper around Minitest with extra functionality such
as timeouts, an @command{mtest} executable that can run tests by line
number, support for interrupted tests, better backtraces, and more.")
    (license license:expat)))

(define-public ruby-mocha
  (package
    (name "ruby-mocha")
    (version "1.13.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "mocha" version))
              (sha256
               (base32
                "15s53ggsykk69kxqvs4416s8yxdhz6caggva55n8sjgy4ixzwp10"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-before 'check 'remove-rubocop-dependency
           (lambda _
             ;; Disable dependency on Rubocop, which is just a linter,
             ;; and would introduce a circular dependency.
             (substitute* "mocha.gemspec"
               ((".*rubocop.*")
                "true\n"))
             #t)))))
    (native-inputs
     (list ruby-introspection))
    (synopsis "Mocking and stubbing library for Ruby")
    (description
     "Mocha is a mocking and stubbing library with JMock/SchMock syntax, which
allows mocking and stubbing of methods on real (non-mock) classes.")
    (home-page "https://mocha.jamesmead.org/")
    ;; Mocha can be used with either license at the users choice.
    (license (list license:expat license:ruby))))

(define-public ruby-mocha-on-bacon
  (package
    (name "ruby-mocha-on-bacon")
    (version "0.2.3")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "mocha-on-bacon" version))
       (sha256
        (base32
         "1h49b33rq889hn8x3wp9byczl91va16jh1w4d2wyy4yj23icdrcp"))))
    (build-system ruby-build-system)
    (arguments
     ;; rubygems.org release missing tests
     '(#:tests? #f))
    (propagated-inputs (list ruby-mocha))
    (synopsis "Mocha adapter for Bacon")
    (description
     "This package provides a Mocha adapter for Bacon, allowing you to use the
Mocha stubbing and mocking library with Bacon, a small RSpec clone.")
    (home-page
     "https://github.com/alloy/mocha-on-bacon")
    (license license:expat)))

(define-public ruby-net-ssh
  (package
    (name "ruby-net-ssh")
    (version "4.2.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "net-ssh" version))
              (sha256
               (base32
                "07c4v97zl1daabmri9zlbzs6yvkl56z1q14bw74d53jdj0c17nhx"))))
    (build-system ruby-build-system)
    (native-inputs
     (list bundler ruby-mocha ruby-test-unit))
    (synopsis "Ruby implementation of the SSH2 client protocol")
    (description "@code{Net::SSH} is a pure-Ruby implementation of the SSH2
client protocol.  It allows you to write programs that invoke and interact
with processes on remote servers, via SSH2.")
    (home-page "https://github.com/net-ssh/net-ssh")
    (license license:expat)))

(define-public ruby-net-scp
  (package
    (name "ruby-net-scp")
    (version "4.0.0")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/net-ssh/net-scp")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "1mdxh81z2hkcc359g6z96fywbr57azlv2yj4zq76adn5lyqq4hgw"))))
    (build-system ruby-build-system)
    (native-inputs
     (list bundler ruby-test-unit ruby-mocha))
    (propagated-inputs
     (list ruby-net-ssh))
    (synopsis "Pure-Ruby SCP client library")
    (description "@code{Net::SCP} is a pure-Ruby implementation of the SCP
client protocol.")
    (home-page "https://github.com/net-ssh/net-scp")
    (license license:expat)))

(define-public ruby-minitest
  (package
    (name "ruby-minitest")
    (version "5.18.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "minitest" version))
              (sha256
               (base32
                "0ic7i5z88zcaqnpzprf7saimq2f6sad57g5mkkqsrqrcd6h3mx06"))))
    (build-system ruby-build-system)
    (native-inputs (list ruby-hoe))
    (home-page "https://github.com/minitest/minitest")
    (synopsis "Small test suite library for Ruby")
    (description "Minitest provides a complete suite of Ruby testing
facilities supporting TDD, BDD, mocking, and benchmarking.")
    (license license:expat)))

(define-public ruby-minitest-5.15
  (package
    (inherit ruby-minitest)
    (version "5.15.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "minitest" version))
              (sha256
               (base32
                "06xf558gid4w8lwx13jwfdafsch9maz8m0g85wnfymqj63x5nbbd"))))))

;; This is the last release of Minitest 4, which is used by some packages.
(define-public ruby-minitest-4
  (package
    (inherit ruby-minitest)
    (version "4.7.5")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "minitest" version))
              (sha256
               (base32
                "03p6iban9gcpcflzp4z901s1hgj9369p6515h967ny6hlqhcf2iy"))))
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'remove-unsupported-method
           (lambda _
             (substitute* "Rakefile"
               (("self\\.rubyforge_name = .*") ""))))
         (add-after 'build 'exclude-failing-tests
           (lambda _
             ;; Some tests are failing on Ruby 2.4 due to the deprecation of
             ;; Fixnum.
             (delete-file "test/minitest/test_minitest_spec.rb"))))))))

(define-public ruby-minitest-around
  (package
    (name "ruby-minitest-around")
    (version "0.5.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "minitest-around" version))
       (sha256
        (base32
         "15ywnqx0719jl9c25yqfshmwcir57i5f4hr1ra9v9vay9ylcwndr"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (add-after 'extract-gemspec 'remove-unnecessary-dependency-versions
           (lambda _
             (substitute* "minitest-around.gemspec"
               (("%q<cucumber>.*") "%q<cucumber>, [\">= 0\"])\n"))
             #t)))))
    (propagated-inputs
     (list ruby-minitest))
    (native-inputs
     (list bundler ruby-cucumber ruby-bump ruby-test-construct))
    (synopsis "Run code around tests in Minitest")
    (description
     "This library provides a way to run code around tests in Minitest,
written using either the unit test or spec style.")
    (home-page "https://github.com/splattael/minitest-around")
    (license license:expat)))

(define-public ruby-minitest-retry
  (package
    (name "ruby-minitest-retry")
    (version "0.2.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "minitest-retry" version))
              (sha256
               (base32
                "1c1zq0b1a9y0hbqphq4ybijnjldlis1g6kyhx92q2ynnqfmzhfga"))))
    (build-system ruby-build-system)
    (propagated-inputs (list ruby-minitest))
    (synopsis "Minitest extension to re-run failing tests")
    (description "This package provides the @code{Minitest::Retry} class,
which extends Minitest to allow retrying tests when they fail.")
    (home-page "https://github.com/y-yagi/minitest-retry")
    (license license:expat)))

(define-public ruby-minitest-sprint
  (package
    (name "ruby-minitest-sprint")
    (version "1.1.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "minitest-sprint" version))
              (sha256
               (base32
                "179d6pj56l9xzm46fqsqj10mzjkr1f9fv4cxa8wvchs97hqz33w1"))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-hoe ruby-minitest))
    (synopsis "Fast test suite runner for minitest")
    (description "Minitest-sprint is a test runner for minitest that makes it
easier to re-run individual failing tests.")
    (home-page "https://github.com/seattlerb/minitest-sprint")
    (license license:expat)))

(define-public ruby-minitest-stub-const
  (package
    (name "ruby-minitest-stub-const")
    (version "0.6")                     ;for Rakefile
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/adammck/minitest-stub-const")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0cz4r9fxplx94c7wakx0998n2gv7l21prn8pfpw6z2c33k3g2xar"))))
    (build-system ruby-build-system)
    (synopsis "Stub constants for the duration of a block in MiniTest")
    (description "This package provides a MiniTest extension to stub constants
for the duration of a block in MiniTest.")
    (home-page "https://github.com/adammck/minitest-stub-const")
    (license license:expat)))

(define-public ruby-minitest-bacon
  (package
    (name "ruby-minitest-bacon")
    (version "1.0.3")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "minitest-bacon" version))
              (sha256
               (base32
                "0zhdwcl6bgha61qiyfvr7zs7ywaxc33wmj9xhxl8jdmpdvifvfaj"))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-hoe))
    (inputs
     (list ruby-minitest))
    (synopsis "Bacon compatibility library for minitest")
    (description "Minitest-bacon extends minitest with bacon-like
functionality, making it easier to migrate test suites from bacon to minitest.")
    (home-page "https://github.com/seattlerb/minitest-bacon")
    (license license:expat)))

(define-public ruby-minitest-focus
  (package
    (name "ruby-minitest-focus")
    (version "1.1.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "minitest-focus" version))
       (sha256
        (base32
         "1zgjslp6d7dzcn8smj595idymgd5j603p9g2jqkfgi28sqbhz6m0"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-minitest))
    (native-inputs
     (list ruby-hoe))
    (synopsis "Allows a few specific tests to be focused on")
    (description
     "@code{minitest-focus} gives the ability focus on a few tests with ease
without having to use command-line arguments.  It introduces a @code{focus}
class method for use in testing classes, specifying that the next defined test
is to be run.")
    (home-page "https://github.com/seattlerb/minitest-focus")
    (license license:expat)))

(define-public ruby-minitest-power-assert
  (package
    (name "ruby-minitest-power-assert")
    (version "0.3.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "minitest-power_assert" version))
              (sha256
               (base32
                "1dazl6nbxjvvmi5jamrsygkz396s29b7cd841ni6qy4izk8jd9b7"))))
    (build-system ruby-build-system)
    (propagated-inputs (list ruby-minitest ruby-power-assert))
    (synopsis "Power Assert implementation for Minitest")
    (description "This gem provides a Power Assert implementation for
Minitest.  It is inspired by the @code{test-unit-power_assert} gem.")
    (home-page "https://github.com/hsbt/minitest-power_assert")
    (license license:bsd-2)))

(define-public ruby-minitest-profile
  (package
    (name "ruby-minitest-profile")
    (version "0.0.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "minitest-profile" version))
              (sha256
               (base32
                "13h4nwbq6yv7hsaa7dpj90lry4rc5qqnpzvm9n2s57mm2xi31xfa"))))
    (build-system ruby-build-system)
    (synopsis "Display the slowest tests in a MiniTest suite")
    (description "This package provides a MiniTest plugin for displaying the
slowest tests in a minitest suite.")
    (home-page "https://github.com/nmeans/minitest-profile")
    (license license:expat)))

(define-public ruby-minitest-pretty-diff
  ;; Use git reference because gem is out of date and does not contain testing
  ;; script.  There are no releases on GitHub.
  (let ((commit "11f32e930f574225432f42e5e1ef6e7471efe572"))
    (package
      (name "ruby-minitest-pretty-diff")
      (version (string-append "0.1-1." (string-take commit 8)))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/adammck/minitest-pretty_diff")
                      (commit commit)))
                (file-name (string-append name "-" version "-checkout"))
                (sha256
                 (base32
                  "13y5dhmcckhzd83gj1nfwh41iykbjcm2w7y4pr6j6rpqa5as122r"))))
      (build-system ruby-build-system)
      (arguments
       `(#:phases
         (modify-phases %standard-phases
           (replace 'check
             (lambda* (#:key tests? #:allow-other-keys)
               (when tests?
                 (invoke "sh" "script/test")))))))
      (native-inputs
       (list bundler ruby-turn))
      (synopsis "Pretty-print hashes and arrays in MiniTest")
      (description
       "@code{minitest-pretty_diff} monkey-patches
@code{MiniTest::Assertions#mu_pp} to pretty-print hashes and arrays before
diffing them.  This makes it easier to spot differences between nested
structures when tests fail.")
      (home-page "https://github.com/adammck/minitest-pretty_diff")
      (license license:expat))))

(define-public ruby-minitest-proveit
  (package
    (name "ruby-minitest-proveit")
    (version "1.0.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "minitest-proveit" version))
              (sha256
               (base32
                "0k1hpr8lgkgygfivgcsnnib7xjlf9ribgpn7yidvb4q0l0q2yfmr"))))
    (build-system ruby-build-system)
    (native-inputs (list ruby-hoe))
    (propagated-inputs (list ruby-minitest))
    (synopsis "Assertion-based tests extension for MiniTest")
    (description "The @code{minitest-proveit} MiniTest extension ensures all
tests to prove success (via at least one assertion) rather than rely on the
absence of failure.")
    (home-page "https://github.com/seattlerb/minitest-proveit")
    (license license:expat)))

(define-public ruby-minitest-moar
  (package
    (name "ruby-minitest-moar")
    (version "0.0.4")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "minitest-moar" version))
       (sha256
        (base32
         "0nb83blrsab92gcy6nfpw39njys7zisia8pw4igzzfzfl51cis0x"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-before 'check 'clean-dependencies
           (lambda _
             ;; Remove all gems defined in the Gemfile because these are not
             ;; truly needed.
             (substitute* "Gemfile"
               (("gem .*") ""))
             ;; Remove byebug as not needed to run tests.
             (substitute* "test/test_helper.rb"
               (("require 'byebug'") ""))
             #t)))))
    (native-inputs
     (list bundler ruby-minitest))
    (synopsis "Extra features and changes to MiniTest")
    (description "@code{MiniTest Moar} add some additional features and
changes some default behaviours in MiniTest.  For instance, Moar replaces the
MiniTest @code{Object#stub} with a global @code{stub} method.")
    (home-page "https://github.com/dockyard/minitest-moar")
    (license license:expat)))

(define-public ruby-minitest-bonus-assertions
  (package
    (name "ruby-minitest-bonus-assertions")
    (version "3.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "minitest-bonus-assertions" version))
       (sha256
        (base32
         "1hbq9jk904xkz868yha1bqcm6azm7kmjsll2k4pn2nrcib508h2a"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f          ; Test suite has bitrotted.
       #:phases
       (modify-phases %standard-phases
         (add-before 'check 'clean-dependencies
           (lambda _
             ;; Remove unneeded require statement that would entail another
             ;; dependency.
             (substitute* "test/minitest_config.rb"
               (("require 'minitest/bisect'") ""))
             #t)))))
    (native-inputs
     (list ruby-hoe ruby-minitest-pretty-diff ruby-minitest-focus
           ruby-minitest-moar))
    (synopsis "Bonus assertions for @code{Minitest}")
    (description
     "Minitest bonus assertions provides extra MiniTest assertions.  For
instance, it provides @code{assert_true}, @code{assert_false} and
@code{assert_set_equal}.")
    (home-page "https://github.com/halostatue/minitest-bonus-assertions")
    (license license:expat)))

(define-public ruby-minitest-reporters
  (package
    (name "ruby-minitest-reporters")
    (version "1.3.6")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "minitest-reporters" version))
       (sha256
        (base32
         "1a3das80rwgys5rj48i5ly144nvszyqyi748bk9bss74jblcf5ay"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         ;; Remove the requirement on Rubocop, as it isn't useful to run, and
         ;; including it as an input can lead to circular dependencies.
         (add-after 'unpack 'remove-rubocop-from-Rakefile
           (lambda _
             (substitute* "Rakefile"
               (("require 'rubocop/rake\\_task'") "")
               (("RuboCop::RakeTask\\.new\\(:rubocop\\)") "[].each"))
             #t))
         (add-after 'extract-gemspec 'remove-rubocop-from-gemspec
           (lambda _
             (substitute* "minitest-reporters.gemspec"
               ((".*%q<rubocop>.*") "\n"))
             #t)))))
    (propagated-inputs
     (list ruby-ansi ruby-builder ruby-minitest ruby-progressbar))
    (native-inputs
     (list bundler ruby-maruku))
    (synopsis "Enhanced reporting for Minitest tests")
    (description
     "@code{minitest/reporters} provides a custom Minitest runner to improve
how the test state is reported.  A number of different reporters are
available, including a spec reporter, progress bar reporter, a HTML
reporter.")
    (home-page "https://github.com/kern/minitest-reporters")
    (license license:expat)))

(define-public ruby-minitest-rg
  (package
    (name "ruby-minitest-rg")
    (version "5.2.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "minitest-rg" version))
       (sha256
        (base32
         "0sq509ax1x62rd0w10b0hcydcxyk5bxxr3fwrgxv02r8drq2r354"))))
    (build-system ruby-build-system)
    (arguments
     ;; Some tests fail even outside Guix, so disable tests.
     ;; https://github.com/blowmage/minitest-rg/issues/12
     ;; https://github.com/blowmage/minitest-rg/pull/13
     `(#:tests? #f))
    (propagated-inputs
     (list ruby-minitest))
    (synopsis "Coloured output for Minitest")
    (description
     "@code{minitest-rg} changes the colour of the output from Minitest.")
    (home-page "https://blowmage.com/minitest-rg/")
    (license license:expat)))

(define-public ruby-minitest-global-expectations
  (package
    (name "ruby-minitest-global-expectations")
    (version "1.0.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "minitest-global_expectations"
                          version))
       (sha256
        (base32
         "1pp3k2608spj4kvqy2y16hs18an917g6vwgvphrfhjviac83090x"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-minitest))
    (synopsis "Adjust minitest behaviour for calling expectation methods")
    (description
     "Minitest-global_expectations allows continued use of expectation methods
on all objects.  Calling expectation methods on all objects was deprecated in
minitest 5.12, and is planned to be removed from minitest 6.")
    (home-page "https://github.com/jeremyevans/minitest-global_expectations")
    (license license:expat)))

(define-public ruby-minitest-hooks
  (package
    (name "ruby-minitest-hooks")
    (version "1.5.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "minitest-hooks" version))
       (sha256
        (base32
         "05z8r6sw3fz4s44fs1150ndlcmcy82vlxmhps5nncg8vk59k3gmf"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "spec"
       ;; Test suite is incompatible with ruby-2.7.
       ;; https://github.com/jeremyevans/minitest-hooks/issues/19
       #:tests? #f))
    (native-inputs
     (list ruby-sequel ruby-sqlite3))
    (synopsis "Hooks for the minitest framework")
    (description
     "Minitest-hooks adds @code{around}, @code{before_all}, @code{after_all},
@code{around_all} hooks for Minitest.  This allows, for instance, running each
suite of specs inside a database transaction, running each spec inside its own
savepoint inside that transaction.  This can significantly speed up testing
for specs that share expensive database setup code.")
    (home-page "https://github.com/jeremyevans/minitest-hooks")
    (license license:expat)))

(define-public ruby-daemons
  (package
    (name "ruby-daemons")
    (version "1.2.5")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "daemons" version))
              (sha256
               (base32
                "15smbsg0gxb7nf0nrlnplc68y0cdy13dm6fviavpmw7c630sring"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f)) ; no test suite
    (synopsis "Daemonize Ruby programs")
    (description "Daemons provides a way to wrap existing Ruby scripts to be
run as a daemon and to be controlled by simple start/stop/restart commands.")
    (home-page "https://github.com/thuehlinger/daemons")
    (license license:expat)))

(define-public ruby-dalli
  (package
    (name "ruby-dalli")
    (version "3.2.4")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/petergoldstein/dalli")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1hhqqv1j3zd2y0vr6maaabsflrvkf1x0i6z8n725mhqydp3f9gwp"))))
    (build-system ruby-build-system)
    ;; Disable tests to avoid a dependency cycle with ruby-activesupport,
    ;; through ruby-ruby-prof.
    (arguments (list #:tests? #f))
    (synopsis "High performance memcached client for Ruby")
    (description "Dalli is a high performance pure Ruby client for accessing
memcached servers.  Dalli supports:

@itemize
@item Simple and complex memcached configurations
@item Fail-over between memcached instances
@item Fine-grained control of data serialization and compression
@item Thread-safe operation
@item SSL/TLS connections to memcached
@item SASL authentication.
@end itemize

The name is a variant of Salvador Dali for his famous painting The Persistence
of Memory.")
    (home-page "https://github.com/petergoldstein/dalli")
    (license license:expat)))

(define-public ruby-data_uri
  (package
    (name "ruby-data_uri")
    (version "0.1.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "data_uri" version))
       (sha256
        (base32
         "0fzkxgdxrlbfl4537y3n9mjxbm28kir639gcw3x47ffchwsgdcky"))))
    (build-system ruby-build-system)
    (synopsis "URI class for parsing data URIs")
    (description
     "Data @acronym{URI, universal resource idenfitier}s allow resources to be
embedded inside a URI.  The URI::Data class provides support for parsing these
URIs using the normal URI.parse method.")
    (home-page "https://github.com/dball/data_uri")
    (license license:expat)))

(define-public ruby-debug
  (package
    (name "ruby-debug")
    (version "1.7.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "debug" version))
              (sha256
               (base32
                "0x59508j69w9p275gabysv521n210pd3n060gqfgsiqjms1h0ldf"))))
    (build-system ruby-build-system)
    (arguments (list #:test-target "test_all"))
    (propagated-inputs (list ruby-irb ruby-reline))
    (synopsis "Debugging functionality for Ruby")
    (description "Debugging functionality for Ruby.  This is completely
rewritten debug.rb which was contained by the ancient Ruby versions.  It is
included with Ruby itself, but this package is made available so that the
latest version can be made available independently from Ruby.")
    (home-page "https://github.com/ruby/debug")
    (license license:bsd-2)))

(define-public ruby-deep-merge
  (package
    (name "ruby-deep-merge")
    (version "1.2.1")
    (home-page "https://github.com/danielsdeleo/deep_merge")
    ;; The Rubygem source does not contain the gemspec required for tests.
    (source (origin
              (method git-fetch)
              (uri (git-reference (url home-page) (commit version)))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0c9rk23ilhc0n4489y6lda2wzphpzh6ish6fahlbpjhxn82wb931"))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-minitest))
    (synopsis "Recursively merge hashes")
    (description
     "Deep Merge is a set of utility functions for @code{Hash}.  It permits
you to merge elements inside a hash together recursively.")
    (license license:expat)))

(define-public ruby-delayed-job
  (package
    (name "ruby-delayed-job")
    (version "4.1.11")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "delayed_job" version))
              (sha256
               (base32
                "0s2xg72ljg4cwmr05zi67vcyz8zib46gvvf7rmrdhsyq387m2qcq"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases
           #~(modify-phases %standard-phases
               (add-after 'unpack 'disable-bundler
                 (lambda _
                   (substitute* "Rakefile"
                     (("require 'bundler/setup'") "")
                     (("Bundler::GemHelper\\.install_tasks") ""))))
               (add-after 'unpack 'disable-rubocop
                 (lambda _
                   (substitute* "Rakefile"
                     (("require 'rubocop/rake_task'") "")
                     (("RuboCop::RakeTask.new") ""))))
               (add-after 'extract-gemspec 'remove-dependency-on-actionmailer
                 (lambda _
                   (substitute* "spec/helper.rb"
                     (("require 'action_mailer'") ""))
                   (substitute* "delayed_job.gemspec"
                     (("\"spec/performable_mailer_spec.rb\".freeze, ") ""))
                   (delete-file "spec/performable_mailer_spec.rb"))))))
    (native-inputs
     (list ruby-activerecord
           ruby-rspec
           ruby-simplecov
           ruby-simplecov-lcov
           ruby-zeitwerk))
    (propagated-inputs
     (list ruby-activesupport))
    (synopsis "Asynchronous background tasks execution library")
    (description "Delayed_job (or DJ) encapsulates the common pattern of
asynchronously executing longer tasks in the background.  It is a direct
extraction from Shopify where the job table is responsible for a multitude of
core tasks.")
    (home-page "https://github.com/collectiveidea/delayed_job")
    (license license:expat)))

(define-public ruby-git
  (package
    (name "ruby-git")
    (version "1.3.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "git" version))
              (sha256
               (base32
                "1waikaggw7a1d24nw0sh8fd419gbf7awh000qhsf411valycj6q3"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f ; no tests
       #:phases (modify-phases %standard-phases
                  (add-after 'install 'patch-git-binary
                    (lambda* (#:key inputs outputs #:allow-other-keys)
                      ;; Make the default git binary an absolute path to the
                      ;; store.
                      (let ((git    (search-input-file inputs "/bin/git"))
                            (config (string-append
                                     (assoc-ref outputs "out")
                                     "/lib/ruby/vendor_ruby/gems/git-"
                                     ,version "/lib/git/config.rb")))
                        (substitute* (list config)
                          (("'git'")
                           (string-append "'" git "'")))
                        #t))))))
    (inputs
     (list git))
    (synopsis "Ruby wrappers for Git")
    (description "Ruby/Git is a Ruby library that can be used to create, read
and manipulate Git repositories by wrapping system calls to the git binary.")
    (home-page "https://github.com/schacon/ruby-git")
    (license license:expat)))

(define-public ruby-hocon
  (package
    (name "ruby-hocon")
    (version "1.3.1")
    (home-page "https://github.com/puppetlabs/ruby-hocon")
    (source (origin
              (method git-fetch)
              (uri (git-reference (url home-page) (commit version)))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "172hh2zr0n9nnszv0qvlgwszgkrq84yahrg053m68asy79zpmbqr"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases (modify-phases %standard-phases
                  (replace 'check
                    (lambda* (#:key tests? #:allow-other-keys)
                      (if tests?
                          (invoke "rspec")
                          (format #t "test suite not run~%"))
                      #t)))))
    (native-inputs
     (list bundler ruby-rspec))
    (synopsis "HOCON config library")
    (description
     "This package provides Ruby support for the @acronym{HOCON,
Human-Optimized Config Object Notation} configuration file format.  It
supports parsing and modifying HOCON and JSON files, and rendering parsed
objects back to a @code{String}.")
    (license license:asl2.0)))

(define-public ruby-slop
  (package
    (name "ruby-slop")
    (version "4.5.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "slop" version))
              (sha256
               (base32
                "0bfm8535g0rkn9cbjndkckf0f7a3wj0rg4rqhrpsgxnbfdf2lm0p"))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-minitest))
    (synopsis "Ruby command line option parser")
    (description "Slop provides a Ruby domain specific language for gathering
options and parsing command line flags.")
    (home-page "https://github.com/leejarvis/slop")
    (license license:expat)))

(define-public ruby-slop-3
  (package (inherit ruby-slop)
    (version "3.6.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "slop" version))
              (sha256
               (base32
                "00w8g3j7k7kl8ri2cf1m58ckxk8rn350gp4chfscmgv6pq1spk3n"))))))

(define-public ruby-multi-xml
  (package
    (name "ruby-multi-xml")
    (version "0.6.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "multi_xml" version))
       (sha256
        (base32
         "0lmd4f401mvravi1i1yq7b2qjjli0yq7dfc4p1nj5nwajp7r6hyj"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; No included tests
    (synopsis "Swappable XML backends for Ruby")
    (description
     "@code{MultiXml} provides swappable XML backends utilizing either LibXML,
Nokogiri, Ox, or REXML.")
    (home-page "https://github.com/sferik/multi_xml")
    (license license:expat)))

(define-public ruby-multipart-parser
  (package
    (name "ruby-multipart-parser")
    (version "0.1.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "multipart-parser" version))
              (sha256
               (base32
                "0xb4p475yrfm883h9kn80a021myn17dvs50wpa1djzcmlq7p0882"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:phases #~(modify-phases %standard-phases
                   (add-after 'unpack 'skip-failing-test
                     ;; One test fails for unknown reasons (see:
                     ;; https://github.com/danabr/multipart-parser/issues/7).
                     (lambda _
                       (substitute* "test/multipart_parser/reader_test.rb"
                         (("def test_long" all)
                          (string-append all "\n      return true"))))))))
    (synopsis "Parser for multipart MIME messages")
    (description "@code{multipart-parser} is a simple parser for multipart
MIME messages, written in Ruby, based on felixge/node-formidable's parser.  It
has the following characteristics:
@itemize
@item Pure Ruby
@item Event-driven API
@item Only supports one level of multipart parsing
@item Does not perform I/O
@item Does not depend on any other library.
@end itemize")
    (home-page "https://github.com/danabr/multipart-parser")
    (license license:expat)))

(define-public ruby-multipart-post
  (package
    (name "ruby-multipart-post")
    (version "2.0.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "multipart-post" version))
              (sha256
               (base32
                "09k0b3cybqilk1gwrwwain95rdypixb2q9w65gd44gfzsd84xi1x"))))
    (build-system ruby-build-system)
    (native-inputs
     (list bundler))
    (synopsis "Multipart POST library for Ruby")
    (description "Multipart-Post Adds multipart POST capability to Ruby's
net/http library.")
    (home-page "https://github.com/nicksieger/multipart-post")
    (license license:expat)))

(define-public ruby-multi-json
  (package
    (name "ruby-multi-json")
    (version "1.15.0")
    (source
     (origin
       (method git-fetch)
       ;; Tests are not distributed at rubygems.org so download from GitHub
       ;; instead.
       (uri (git-reference
              (url "https://github.com/intridea/multi_json")
              (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0mkdvy6i00yyksjvnv6znh7wf89j9506qzzjq6bsbmbkyqrszp4d"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-before 'check 'pre-check
           (lambda _
             ;; As seen in the .travis.yml file.
             (setenv "SKIP_ADAPTERS" "gson,jr_jackson,nsjsonserialization"))))))
    (native-inputs
     (list ruby-rspec ruby-json-pure ruby-oj ruby-yajl-ruby))
    (synopsis "Common interface to multiple JSON libraries for Ruby")
    (description
     "This package provides a common interface to multiple JSON libraries,
including Oj, Yajl, the JSON gem (with C-extensions), the pure-Ruby JSON gem,
NSJSONSerialization, gson.rb, JrJackson, and OkJson.")
    (home-page "https://github.com/intridea/multi_json")
    (license license:expat)))

(define-public ruby-multi-test
  (package
    (name "ruby-multi-test")
    (version "0.1.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "multi_test" version))
       (sha256
        (base32
         "1sx356q81plr67hg16jfwz9hcqvnk03bd9n75pmdw8pfxjfy1yxd"))))
    (build-system ruby-build-system)
    (arguments
     '(;; Tests require different sets of specific gem versions to be available,
       ;; and there is no gemfile that specifies the newest versions of
       ;; dependencies to be tested.
       #:tests? #f))
    (synopsis
     "Interface to testing libraries loaded into a running Ruby process")
    (description
     "@code{multi_test} provides a uniform interface onto whatever testing
libraries that have been loaded into a running Ruby process to help control
rogue test/unit/autorun requires.")
    (home-page "https://github.com/cucumber/multi_test")
    (license license:expat)))

(define-public ruby-arr-pm
  (package
    (name "ruby-arr-pm")
    (version "0.0.12")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "arr-pm" version))
              (sha256
               (base32
                "0fddw0vwdrr7v3a0lfqbmnd664j48a9psrjd3wh3k4i3flplizzx"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases
           #~(modify-phases %standard-phases
               (replace 'check
                 (lambda* (#:key tests? #:allow-other-keys)
                   (when tests?
                     (invoke "rspec")))))))
    (native-inputs (list ruby-flores ruby-insist ruby-rspec ruby-stud))
    (synopsis "RPM reader/writer library written in Ruby")
    (description "This library allows reading and writing RPM packages.  It is
used by the @command{fpm} tool.  It is written in pure Ruby because
@code{librpm} is not available on all systems and requires many
dependencies.")
    (home-page "https://github.com/jordansissel/ruby-arr-pm")
    (license license:asl2.0)))

(define-public ruby-arel
  (package
    (name "ruby-arel")
    (version "9.0.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "arel" version))
              (sha256
               (base32
                "1jk7wlmkr61f6g36w9s2sn46nmdg6wn2jfssrhbhirv5x9n95nk0"))))
    (build-system ruby-build-system)
    (arguments '(#:tests? #f)) ; no tests
    (home-page "https://github.com/rails/arel")
    (synopsis "SQL AST manager for Ruby")
    (description "Arel is an SQL @dfn{Abstract Syntax Tree} (AST) manager for
Ruby.  It simplifies the generation of complex SQL queries and adapts to
various relational database implementations.")
    (license license:expat)))

(define-public ruby-minitar
  ;; We package from the GitHub source to fix the security issue reported at
  ;; https://github.com/halostatue/minitar/issues/16.
  (let ((commit "e25205ecbb6277ae8a3df1e6a306d7ed4458b6e4"))
    (package
      (name "ruby-minitar")
      (version (string-append "0.5.4-1." (string-take commit 8)))
      (source
       (origin
         (method git-fetch)
         (uri (git-reference
               (url "https://github.com/halostatue/minitar")
               (commit commit)))
         (file-name (string-append name "-" version "-checkout"))
         (sha256
          (base32
           "1iywfx07jgjqcmixzkxk9zdwfmij1fyg1z2jlwzj15cj7s99qlfv"))))
      (build-system ruby-build-system)
      (arguments
       '(#:tests? #f)) ; missing a gemspec
      (synopsis "Ruby library and utility for handling tar archives")
      (description
       "Archive::Tar::Minitar is a pure-Ruby library and command-line utility
that provides the ability to deal with POSIX tar archive files.")
      (home-page "http://www.github.com/atoulme/minitar")
      (license (list license:gpl2+ license:ruby)))))

(define-public ruby-mini-portile
  (package
    (name "ruby-mini-portile")
    (version "0.6.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "mini_portile" version))
       (sha256
        (base32
         "0h3xinmacscrnkczq44s6pnhrp4nqma7k056x5wv5xixvf2wsq2w"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; tests require network access
    (synopsis "Ports system for Ruby developers")
    (description "Mini-portile is a port/recipe system for Ruby developers.
It provides a standard way to compile against specific versions of libraries
to reproduce user environments.")
    (home-page "https://github.com/flavorjones/mini_portile")
    (license license:expat)))

(define-public ruby-mini-portile-2
  (package
    (inherit ruby-mini-portile)
    (version "2.8.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "mini_portile2" version))
              (sha256
               (base32
                "1af4yarhbbx62f7qsmgg5fynrik0s36wjy3difkawy536xg343mp"))))))

(define-public ruby-nokogiri
  (package
    (name "ruby-nokogiri")
    (version "1.13.10")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "nokogiri" version))
              (sha256
               (base32
                "0n79k78c5vdcyl0m3y3l5x9kxl6xf5lgriwi2vd665qmdkr01vnk"))))
    (build-system ruby-build-system)
    (arguments
     ;; Tests fail because Nokogiri can only test with an installed extension,
     ;; and also because many test framework dependencies are missing.
     (list
      #:tests? #f
      #:gem-flags #~(list "--" "--use-system-libraries"
                          (string-append "--with-xml2-include="
                                         #$(this-package-input "libxml2")
                                         "/include/libxml2" ))
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'install 'delete-mkmf.log
            (lambda _
              ;; Rubygems installs build log files that embed volatile file
              ;; names (see:
              ;; https://github.com/rubygems/rubygems/issues/6259).
              (for-each delete-file (find-files #$output "^mkmf\\.log$")))))))
    (native-inputs (list ruby-hoe))
    (inputs (list zlib libxml2 libxslt))
    (propagated-inputs (list ruby-mini-portile-2 ruby-pkg-config))
    (synopsis "HTML, XML, SAX, and Reader parser for Ruby")
    (description "Nokogiri (鋸) parses and searches XML/HTML, and features
both CSS3 selector and XPath 1.0 support.")
    (home-page "https://www.nokogiri.org/")
    (license license:expat)))

(define-public ruby-method-source
  (package
    (name "ruby-method-source")
    (version "1.0.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "method_source" version))
       (sha256
        (base32
         "1pnyh44qycnf9mzi1j6fywd5fkskv3x7nmsqrrws0rjn5dd4ayfp"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "spec"
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'remove-git-ls-files
           (lambda* (#:key outputs #:allow-other-keys)
             (substitute* "Rakefile"
               (("git ls-files") "find . -type f"))
             #t)))))
    (native-inputs
     (list ruby-rspec))
    (synopsis "Retrieve the source code for Ruby methods")
    (description "Method_source retrieves the source code for Ruby methods.
Additionally, it can extract source code from Proc and Lambda objects or just
extract comments.")
    (home-page "https://github.com/banister/method_source")
    (license license:expat)))

(define-public ruby-coderay
  (package
    (name "ruby-coderay")
    (version "1.1.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "coderay" version))
       (sha256
        (base32
         "15vav4bhcc2x3jmi3izb11l4d9f3xv8hp2fszb7iqmpsccv1pz4y"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; missing test files
    (synopsis "Ruby syntax highlighting library")
    (description "Coderay is a Ruby library that provides syntax highlighting
for select languages.")
    (home-page "http://coderay.rubychan.de")
    (license license:expat)))

(define-public ruby-cuke-modeler
  (package
    (name "ruby-cuke-modeler")
    (version "3.19.0")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/enkessler/cuke_modeler")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0bizla3k124lj4r7f2k5cdfm2sawzd6rdmb6rgbkbng2fygxsjib"))))
    (build-system ruby-build-system)
    (arguments
     (list #:test-target "default"
           #:phases
           #~(modify-phases %standard-phases
               (add-after 'unpack 'relax-requirements
                 (lambda _
                   (substitute* "Gemfile"
                     ;; Cucumber appears pinned to an older version for no
                     ;; particular reason (see:
                     ;; https://github.com/enkessler/cuke_modeler/issues/14).
                     (("'cucumber', '2.2.0'")
                      "'cucumber', '>= 2.2.0'"))
                   ;; Disable Bundler.
                   (substitute* "bin/console"
                     (("require 'bundler/setup'") ""))
                   (substitute* "rakefiles/testing_tasks.rb"
                     (("'bundle', 'exec', ") ""))
                   ;; Remove extraneous dependencies.
                   (substitute* "cuke_modeler.gemspec"
                     ((".*bundler.*") "")
                     ((".*rubocop.*") "")
                     ((".*yard.*") ""))
                   (substitute* "Rakefile"
                     (("Rainbow.enabled = true") "")
                     (("require_relative 'rakefiles/documentation_tasks'") "")
                     (("require_relative 'rakefiles/other_tasks'") "")
                     (("require_relative 'rakefiles/release_tasks'") "")))))))
    (native-inputs
     (list ruby-childprocess
           ruby-cucumber
           ruby-rainbow
           ruby-rspec
           ruby-simplecov
           ruby-simplecov-lcov))
    (propagated-inputs (list ruby-cucumber-gherkin))
    (synopsis "Gherkin test suite analysis tool")
    (description "CukeModeler facilitates modeling a test suite that is
written in Gherkin (e.g.  Cucumber, SpecFlow, Lettuce, etc.).  It does this by
providing an abstraction layer on top of the Abstract Syntax Tree (AST) that
the @code{cucumber-gherkin} generates when parsing features, as well as
providing models for feature files and directories in order to be able to have
a fully traversable model tree of a test suite's structure.  These models can
then be analyzed or manipulated more easily than the underlying AST layer.")
    (home-page "https://github.com/enkessler/cuke_modeler")
    (license license:expat)))

(define-public ruby-parallel-tests
  (package
    (name "ruby-parallel-tests")
    (version "4.2.0")
    (home-page "https://github.com/grosser/parallel_tests")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url home-page)
                    (commit (string-append "v" version))))
              (file-name (string-append name version))
              (sha256
               (base32
                "00gbg5q36ayspkzd6r0kg4gk46lsw9s6misx14rczxaf9kqcdrmv"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "spec"             ;avoid rubocop dependency
       #:phases (modify-phases %standard-phases
                  (add-after 'patch-source-shebangs 'patch-shell-invokations
                    (lambda _
                      (substitute* '("lib/parallel_tests/tasks.rb"
                                     "spec/parallel_tests/tasks_spec.rb")
                        (("/bin/sh") (which "sh"))
                        (("/bin/bash") (which "bash")))))
                  (add-before 'check 'relax-requirements
                    (lambda _
                      ;; Remove hard coded version constraints, instead just
                      ;; use whatever versions are available in Guix.
                      (delete-file "Gemfile.lock")
                      (substitute* "Gemfile"
                        (("'minitest',.*")
                         "'minitest'\n")
                        (("'cucumber',.*")
                         "'cucumber'\n")
                        ;; Do not depend on a git-fetched spinach version.
                        (("gem 'spinach',.*")
                         "gem 'spinach'\n")
                        ((".*rubocop.*") ""))))
                  (add-before 'check 'disable-rails-test
                    (lambda _
                      ;; XXX: This test attempts to download and run the test
                      ;; suites of multiple Rails versions(!) directly.
                      (delete-file "spec/rails_spec.rb")))
                  (add-before 'check 'disable-problematic-tests
                    (lambda _
                      ;; This test fails, probably because of the newer
                      ;; Cucumber version used here.
                      (delete-file "spec/parallel_tests/cucumber/\
failure_logger_spec.rb")                      ))
                  (add-before 'check 'set-HOME
                    (lambda _
                      ;; Some tests check the output of Bundler, and fail when
                      ;; Bundler warns that /homeless-shelter does not exist.
                      (setenv "HOME" "/tmp"))))))
    (native-inputs
     (list ruby-bump
           ruby-cucumber
           ruby-cuke-modeler
           ruby-minitest
           ruby-rake
           ruby-rspec
           ruby-spinach))
    (propagated-inputs
     (list ruby-parallel))
    (synopsis "Run tests in parallel")
    (description
     "This package can speed up @code{Test::Unit}, @code{RSpec},
@code{Cucumber}, and @code{Spinach} tests by running them concurrently
across multiple CPU cores.")
    (license license:expat)))

(define-public ruby-parser
  (package
    (name "ruby-parser")
    (version "3.2.2.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "parser" version))
       (sha256
        (base32
         "0s5afi89p76k8vpwiqvh343pm5l23ijqlpszhz65afym3zpkxhzx"))))
    (build-system ruby-build-system)
    (arguments '(#:tests? #f))          ; tests not included in gem
    (native-inputs (list bundler ruby-cliver ruby-simplecov ruby-racc))
    (inputs (list ragel))
    (propagated-inputs (list ruby-ast))
    (synopsis "Ruby parser written in pure Ruby")
    (description
     "This package provides a Ruby parser written in pure Ruby.")
    (home-page "https://github.com/whitequark/parser")
    (license license:expat)))

(define-public ruby-sexp-processor
  (package
    (name "ruby-sexp-processor")
    (version "4.15.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "sexp_processor" version))
       (sha256
        (base32
         "0d1vks77xnd0m3s94a58f9bkdwlaml5qdkmprx279m2s0pc2gv55"))))
    (build-system ruby-build-system)
    (native-inputs
     ;; TODO: Add ruby-minitest-proveit once available.
     (list ruby-hoe))
    (synopsis "ParseTree fork which includes generic S-exp processing tools")
    (description "The sexp_processor package is derived from ParseTree, but
contrary to ParseTree, it includes all the generic S-exp processing tools.
Amongst the included tools are @code{Sexp}, @code{SexpProcessor} and
@code{Environment}")
    (home-page "https://github.com/seattlerb/sexp_processor")
    (license license:expat)))

(define-public ruby-ruby-parser
  (package
    (name "ruby-ruby-parser")
    (version "3.14.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "ruby_parser" version))
       (sha256
        (base32
         "09qcdyjjw3p7g6cjm5m9swkms1xnv35ndiy7yw24cas16qrhha6c"))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-hoe ruby-racc unifdef))
    (propagated-inputs
     (list ruby-sexp-processor))
    (home-page "https://github.com/seattlerb/ruby_parser/")
    (synopsis "Ruby parser written in pure Ruby")
    (description "The ruby_parser (RP) package provides a Ruby parser written
in pure Ruby.  It outputs S-expressions which can be manipulated and converted
back to Ruby via the @code{ruby2ruby} library.")
    (license license:expat)))

(define-public ruby-ruby-version
  (package
    (name "ruby-ruby-version")
    (version "1.0.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "ruby_version" version))
              (sha256
               (base32
                "0lvc7bd5ps3w2vq2wb02i0pi3vfcx2rnckx2ix4rjym1qf52kb2j"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases
           #~(modify-phases %standard-phases
               (add-after 'extract-gemspec 'delete-gem-files
                 ;; There are some pre-built files in the source, and
                 ;; registered in the .gemspec (see:
                 ;; https://github.com/janlelis/ruby_version/issues/1).
                 (lambda _
                   (delete-file-recursively "pkg")
                   (substitute* "ruby_version.gemspec"
                     (("\"pkg/ruby_version-1.0.0.gem\".freeze, ")
                      "")
                     (("\"pkg/ruby_version-1.0.1.gem\".freeze, ")
                      ""))))
               (add-after 'extract-gemspec 'relax-requirements
                 (lambda _
                   (delete-file "Gemfile.lock")
                   (substitute* "ruby_version.gemspec"
                     (("\"Gemfile.lock\".freeze, ") "")
                     ;; Allow a newers versions of development dependencies.
                     (("~>") ">=")))))))
    (native-inputs (list ruby-rdoc ruby-rubygems-tasks ruby-rspec))
    (synopsis "Ruby class for checking the Ruby version")
    (description "This package provides a @code{RubyVersion} class which
offers a convenient Domain Specific Language (DSL) for checking for the right
Ruby version.")
    (home-page "https://github.com/janlelis/ruby_version")
    (license license:expat)))

(define-public ruby-prawn-manual-builder
  (package
    (name "ruby-prawn-manual-builder")
    (version "0.3.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "prawn-manual_builder" version))
       (sha256
        (base32 "1vlg5w7wq43g2hgpgra2nrcxj1kb4ayqliz4gmja2rhs037j2vzs"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f                      ; no included tests
       #:phases
       (modify-phases %standard-phases
         (add-after 'extract-gemspec 'patch-gemspec
           (lambda _
             (substitute* ".gemspec"
               ;; Loosen the requirement for pdf-inspector
               (("~> 1\\.0\\.7") ">= 0")))))))
    (propagated-inputs
     (list ruby-coderay))
    (synopsis "Tool for writing manuals for Prawn and Prawn accessories")
    (description
     "This package provides a tool for writing manuals for Prawn and Prawn
accessories")
    (home-page "https://github.com/prawnpdf/prawn-manual_builder")
    (license %prawn-project-licenses)))

(define-public ruby-progress_bar
  (package
    (name "ruby-progress_bar")
    (version "1.1.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "progress_bar" version))
       (sha256
        (base32
         "1qc40mr6p1z9a3vlpnsg1zfgk1qswviql2a31y63wpv3vr6b5f48"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "spec"))
    (propagated-inputs
     (list ruby-highline ruby-options))
    (native-inputs
     (list bundler ruby-rspec ruby-timecop))
    (synopsis
     "Ruby library for displaying progress bars")
    (description
     "ProgressBar is a simple library for displaying progress bars.  The
maximum value is configurable, and additional information can be displayed
like the percentage completion, estimated time remaining, elapsed time and
rate.")
    (home-page "https://github.com/paul/progress_bar")
    (license license:wtfpl2)))

(define-public ruby-dep
  (package
    (name "ruby-dep")
    (version "1.5.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "ruby_dep" version))
       (sha256
        (base32
         "1c1bkl97i9mkcvkn1jks346ksnvnnp84cs22gwl0vd7radybrgy5"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; No included tests
    (synopsis "Creates a version constraint of supported Rubies")
    (description
     "This package helps create a version constraint of supported Rubies,
suitable for a gemspec file.")
    (home-page "https://github.com/e2/ruby_dep")
    (license license:expat)))

(define-public ruby-progressbar
  (package
    (name "ruby-progressbar")
    (version "1.10.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "ruby-progressbar" version))
       (sha256
        (base32 "1k77i0d4wsn23ggdd2msrcwfy0i376cglfqypkk2q77r2l3408zf"))))
    (build-system ruby-build-system)
    (arguments
     '(;; TODO: There looks to be a circular dependency with ruby-fuubar.
       #:tests? #f))
    (synopsis "Text progress bar library for Ruby")
    (description
     "Ruby/ProgressBar is an flexible text progress bar library for Ruby.
The output can be customized with a formatting system.")
    (home-page "https://github.com/jfelchner/ruby-progressbar")
    (license license:expat)))

(define-public ruby-latest-ruby
  (package
    (name "ruby-latest-ruby")
    (version "3.1.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "latest_ruby" version))
              (sha256
               (base32
                "15rqwgxzpnkzdiz8m02jra0zq5sx0fiz61vkfrj1ls6slqfhnzqg"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; No Rakefile
    (synopsis "Answers the question of what the latest Ruby version is")
    (description "Knows about MRI, Rubinius, JRuby, MagLev and MacRuby.")
    (home-page "https://github.com/kyrylo/latest_ruby")
    (license license:zlib)))

(define-public ruby-pry
  (package
    (name "ruby-pry")
    (version "0.13.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "pry" version))
       (sha256
        (base32
         "0iyw4q4an2wmk8v5rn2ghfy2jaz9vmw2nk8415nnpx2s866934qk"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; no tests
    (propagated-inputs
     (list ruby-coderay ruby-method-source))
    (synopsis "Ruby REPL")
    (description "Pry is an IRB alternative and runtime developer console for
Ruby.  It features syntax highlighting, a plugin architecture, runtime
invocation, and source and documentation browsing.")
    (home-page "https://cobaltbluemedia.com/pryrepl/")
    (license license:expat)))

(define-public ruby-pry-doc
  (package
    (name "ruby-pry-doc")
    (version "1.3.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "pry-doc" version))
              (sha256
               (base32
                "0wyvql6pb6m8jl8bsamabxhxhd86bnqblspaxzz05sl0fm2ynj0r"))))
    (build-system ruby-build-system)
    (propagated-inputs (list ruby-pry ruby-yard))
    (native-inputs (list ruby-latest-ruby ruby-rspec ruby-rake)) ;for tests
    (synopsis "Provides YARD and extended documentation support for Pry")
    (description
     "Pry Doc is a Pry REPL plugin.  It provides extended documentation
support for the REPL by means of improving the @code{show-doc} and
@code{show-source} commands.  With help of the plugin the commands are
be able to display the source code and the docs of Ruby methods and
classes implemented in C.")
    (home-page "https://github.com/pry/pry-doc")
    (license license:expat)))

(define-public ruby-single-cov
  (package
    (name "ruby-single-cov")
    (version "1.9.1")
    (home-page "https://github.com/grosser/single_cov")
    (source (origin
              (method git-fetch)
              (uri (git-reference (url home-page)
                                  (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1w4k81f2mdg620m6pwkrqayddnz9mr8qx0myqn33mw8k6imfip05"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "spec"             ;to avoid rubocop requirement
       #:phases (modify-phases %standard-phases
                  (replace 'replace-git-ls-files
                    (lambda _
                      (substitute* "single_cov.gemspec"
                        (("`git ls-files lib/ bin/ MIT-LICENSE`")
                         ;; There no longer appear to be a 'bin'
                         ;; sub-directory.
                         "`find lib/ MIT-LICENSE -type f | sort`"))))
                  (add-before 'check 'remove-version-constraints
                    (lambda _
                      (delete-file "Gemfile.lock")))
                  (add-before 'check 'relax-requirements
                    (lambda _
                      ;; Remove extraneous requirements.
                      (substitute* "Rakefile"
                        ((".*require.*bump.*") ""))
                      (substitute* "Gemfile"
                        ((".*gem \"bump\".*") "")
                        ((".*gem \"rubocop\".*") ""))))
                  (add-before 'check 'disable-failing-test
                    (lambda _
                      ;; XXX: This test copies assets from minitest, but can
                      ;; not cope with the files being read-only.  Just skip
                      ;; it for now.
                      (substitute* "specs/single_cov_spec.rb"
                        (("it \"complains when coverage is bad\"")
                         "xit \"complains when coverage is bad\"")))))))
    (native-inputs (list ruby-minitest ruby-rspec ruby-simplecov))
    (synopsis "Code coverage reporting tool")
    (description
     "This package provides actionable code coverage reports for Ruby
projects.  It has very little overhead and can be easily integrated with
development tools to catch coverage problems early.")
    (license license:expat)))

(define-public ruby-oedipus-lex
  (package
    (name "ruby-oedipus-lex")
    (version "2.6.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "oedipus_lex" version))
       (sha256
        (base32
         "094nd7jd3klv45mvprfn2ivcgw8cckq3jhlly77j903vlamfi0df"))))
    (build-system ruby-build-system)
    (native-inputs (list ruby-hoe))
    (synopsis "Ruby lexer")
    (description
     "Oedipus Lex is a lexer generator in the same family as Rexical and Rex.
It is based primarily on generating code much like you would a hand-written
lexer.  It uses StrScanner within a multi-level case statement.  As such,
Oedipus matches on the first match, not the longest.")
    (home-page "https://github.com/seattlerb/oedipus_lex")
    (license license:expat)))

(define-public ruby-guard
  (package
    (name "ruby-guard")
    (version "2.13.0")
    (source (origin
              (method git-fetch)
              ;; The gem does not include a Rakefile, nor does it contain a
              ;; gemspec file, nor does it come with the tests.  This is why
              ;; we fetch the tarball from Github.
              (uri (git-reference
                     (url "https://github.com/guard/guard")
                     (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "16pxcszr0g2jnl3090didxh1d8z5m2mly14m3w4rspb8fmclsnjs"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f ; tests require cucumber
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'remove-git-ls-files
          (lambda* (#:key outputs #:allow-other-keys)
            (substitute* "guard.gemspec"
              (("git ls-files -z") "find . -type f -print0"))
            #t))
         (replace 'build
          (lambda _
            (invoke "gem" "build" "guard.gemspec"))))))
    (propagated-inputs
     (list ruby-formatador
           ruby-listen
           ruby-lumberjack
           ruby-nenv
           ruby-notiffany
           ruby-pry
           ruby-shellany
           ruby-thor))
    (native-inputs
     (list bundler ruby-rspec))
    (synopsis "Tool to handle events on file system modifications")
    (description
     "Guard is a command line tool to easily handle events on file system
modifications.  Guard automates various tasks by running custom rules whenever
file or directories are modified.")
    (home-page "https://guardgem.org/")
    (license license:expat)))

(define-public ruby-spinach
  (package
    (name "ruby-spinach")
    (version "0.11.0")
    (home-page "https://github.com/codegram/spinach")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "spinach" version))
              (sha256
               (base32
                "1mv053mqz9c8ngqa6wp1ymk2fax6j0yqzax6918akrdr7c3fx3c6"))))
    (build-system ruby-build-system)
    (arguments
       ;; FIXME: Disable tests altogether because they depend on 'capybara'
       ;; which in turn depends on many other unpackaged gems.  Enable once
       ;; capybara is available.
       '(#:tests? #f))
    (propagated-inputs
     (list ruby-colorize ruby-gherkin-ruby ruby-json))
    (synopsis "Gherkin-based BDD framework")
    (description
     "Spinach is a high-level @acronym{BDD, Behavior-driven development}
framework that leverages the expressive @code{Gherkin} language to help you
define executable specifications of your code.")
    (license license:expat)))

(define-public ruby-timers
  (package
    (name "ruby-timers")
    (version "4.3.5")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/socketry/timers")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1vvahlhk6i1xks1bsha6s64pjjxhagmzvvf1q9h6z3lpcba43rpx"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases
           #~(modify-phases %standard-phases
               (add-before 'build 'prune-gems.rb
                 (lambda _
                   (substitute* "gems.rb"
                     ;; These are only required for maintenance.
                     ((".*gem \"bake-modernize\".*") "")
                     ((".*gem \"bake-gem\".*") "")
                     ;; Not actually required by the tests.
                     ((".*gem 'benchmark-ips'.*") "")
                     ((".*gem \"ruby-prof\".*") ""))))
               (add-before 'build 'remove-missing-signing-key
                 (lambda _
                   ;; Otherwise, the build fails with ENOENT.
                   (substitute* "timers.gemspec"
                     ((".*spec.signing_key.*") ""))))
               (replace 'check
                 (lambda* (#:key tests? #:allow-other-keys)
                   (when tests?
                     (invoke "bake" "test")))))))
    (native-inputs
     (list ruby-covered
           ruby-bake-test
           ruby-bake-test-external
           ruby-sus))
    (synopsis "Collection of Ruby timer classes")
    (description "Timers offers a collections of one-shot and periodic timers,
intended for use with event loops such as async.")
    (home-page "https://github.com/socketry/timers")
    (license license:expat)))

(define-public ruby-tilt
  (package
    (name "ruby-tilt")
    (version "2.0.10")
    (source
     (origin
       (method git-fetch)               ;the distributed gem lacks tests
       (uri (git-reference
             (url "https://github.com/rtomayko/tilt")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0adb7fg7925n2rd9a8kkqz3mgylw2skp9hkh9qc1rnph72mqsm6r"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'remove-some-dependencies
           (lambda _
             (substitute* "Gemfile"
               ;; TODO ronn is used for generating the manual
               (("gem 'ronn'.*") "\n")
               ;; ruby-haml has a runtime dependency on ruby-tilt, so don't
               ;; pass it in as a native-input
               (("gem 'haml'.*") "\n")
               ;; TODO Not all of these gems are packaged for Guix yet:
               ;; less, coffee-script, livescript, babel-transpiler,
               ;; typescript-node
               (("if can_execjs") "if false")
               ;; Disable the secondary group to reduce the number of
               ;; dependencies. None of the normal approaches work, so patch
               ;; the Gemfile instead.
               (("group :secondary") "[].each"))
             #t)))))
    (propagated-inputs
     (list ruby-pandoc-ruby ruby-sassc))
    (native-inputs
     (list bundler ruby-yard ruby-builder ruby-erubis ruby-markaby))
    (synopsis "Generic interface to multiple Ruby template engines")
    (description
     "Tilt is a thin interface over a number of different Ruby template
engines in an attempt to make their usage as generic as possible.")
    (home-page "https://github.com/rtomayko/tilt/")
    (license license:expat)))

(define-public ruby-thread-safe
  (package
    (name "ruby-thread-safe")
    (version "0.3.6")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "thread_safe" version))
       (sha256
        (base32
         "0nmhcgq6cgz44srylra07bmaw99f5271l0dpsvl5f75m44l0gmwy"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; needs simplecov, among others
    (synopsis "Thread-safe utilities for Ruby")
    (description "The thread_safe library provides thread-safe collections and
utilities for Ruby.")
    (home-page "https://github.com/ruby-concurrency/thread_safe")
    (license license:asl2.0)))

(define-public ruby-tzinfo
  (package
    (name "ruby-tzinfo")
    (version "2.0.4")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
              ;; Pull from git because the gem has no tests.
              (url "https://github.com/tzinfo/tzinfo")
              (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0jaq1givdaz5jxz47xngyj3j315n872rk97mnpm5njwm48wy45yh"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'skip-safe-tests
           (lambda _
             (substitute* "test/test_utils.rb"
               (("def safe_test\\(options = \\{\\}\\)")
                 "def safe_test(options = {})
      skip('The Guix build environment has an unsafe load path')"))
             #t))
         (add-before 'check 'pre-check
           (lambda _
             (setenv "HOME" (getcwd))
             (substitute* "Gemfile"
               (("simplecov.*") "simplecov'\n"))
             #t))
         (replace 'check
           (lambda* (#:key tests? test-target #:allow-other-keys)
             (when tests?
               (invoke "bundler" "exec" "rake" test-target))
             #t)))))
    (propagated-inputs
     `(("ruby-concurrent-ruby" ,ruby-concurrent)))
    (native-inputs
     (list ruby-simplecov))
    (synopsis "Time zone library for Ruby")
    (description "TZInfo is a Ruby library that provides daylight savings
aware transformations between times in different time zones.")
    (home-page "https://tzinfo.github.io")
    (license license:expat)))

(define-public ruby-tzinfo-data
  (package
    (name "ruby-tzinfo-data")
    (version "1.2021.1")
    (source
     (origin
       (method git-fetch)
       ;; Download from GitHub because the rubygems version does not contain
       ;; Rakefile or tests.
       (uri (git-reference
              (url "https://github.com/tzinfo/tzinfo-data")
              (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0yzyr3rf8qaw6kxfc0gwpxsb7gl3rhfpx9g1c2z15vapyminhi60"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'patch-source
           (lambda* (#:key inputs #:allow-other-keys)
             (substitute* "Rakefile"
               (("https://data.iana.org/time-zones/releases")
                (assoc-ref inputs "tzdata")))))
         (add-before 'check 'pre-check
           (lambda _
             (setenv "HOME" (getcwd))
             (substitute* "Rakefile"
               ;; Don't need gpg, and it may break after a time.
               (("gpg ") "echo ")
               (("    sh\\(\\\"make -C" text)
                (string-append "    sh(\"sed -i 's@/bin/sh@sh@' #{tzdb_combined_path}/Makefile \")\n"
                               "    sh(\"sed -i 's@cc=@cc?=@' #{tzdb_combined_path}/Makefile \")\n" text)))
               (setenv "cc" ,(cc-for-target)))))))
    (propagated-inputs
     (list ruby-tzinfo))
    (native-inputs
     `(("tzdata"
        ,(file-union "tzdata-for-ruby-tzdata-info"
           `(("tzdata2021a.tar.gz"
              ,(origin
                 (method url-fetch)
                 (uri "https://data.iana.org/time-zones/releases/tzdata2021a.tar.gz")
                 (sha256
                  (base32
                   "022fn6gkmp7pamlgab04x0dm5hnyn2m2fcnyr3pvm36612xd5rrr"))))
             ("tzdata2021a.tar.gz.asc"
              ,(origin
                 (method url-fetch)
                 (uri "https://data.iana.org/time-zones/releases/tzdata2021a.tar.gz.asc")
                 (sha256
                  (base32
                   "0n7h2w8ji1lrxpk0d44wyfshlhr7c9jmwj6lqbxlyvqnfi3gbicx"))))
             ("tzcode2021a.tar.gz"
              ,(origin
                 (method url-fetch)
                 (uri "https://data.iana.org/time-zones/releases/tzcode2021a.tar.gz")
                 (sha256
                  (base32
                   "1l02b0jiwp3fl0xd6227i69d26rmx3yrnq0ssq9vvdmm4jhvyipb"))))
             ("tzcode2021a.tar.gz.asc"
              ,(origin
                 (method url-fetch)
                 (uri "https://data.iana.org/time-zones/releases/tzcode2021a.tar.gz.asc")
                 (sha256
                  (base32
                   "1qhlj4lr810s47s1lwcvv1sgvg2sflf98w4sbg1lc8wzv5qxxv7g")))))))))
    (synopsis "Data from the IANA Time Zone database")
    (description
     "This library provides @code{TZInfo::Data}, which contains data from the
IANA Time Zone database packaged as Ruby modules for use with @code{TZInfo}.")
    (home-page "https://tzinfo.github.io")
    (license license:expat)))

(define-public ruby-rb-inotify
  (package
    (name "ruby-rb-inotify")
    (version "0.9.10")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "rb-inotify" version))
       (sha256
        (base32
         "0yfsgw5n7pkpyky6a9wkf1g9jafxb0ja7gz0qw0y14fd2jnzfh71"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f ; there are no tests
       #:phases
       (modify-phases %standard-phases
         ;; Building the gemspec with rake is not working here since it is
         ;; generated with Jeweler.  It is also unnecessary because the
         ;; existing gemspec does not use any development tools to generate a
         ;; list of files.
         (replace 'build
          (lambda _
            (invoke "gem" "build" "rb-inotify.gemspec"))))))
    (propagated-inputs
     (list ruby-ffi))
    (native-inputs
     (list ruby-yard))
    (synopsis "Ruby wrapper for Linux's inotify")
    (description "rb-inotify is a simple wrapper over the @code{inotify} Linux
kernel subsystem for monitoring changes to files and directories.")
    (home-page "https://github.com/nex3/rb-inotify")
    (license license:expat)))

(define-public ruby-pry-editline
  (package
    (name "ruby-pry-editline")
    (version "1.1.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "pry-editline" version))
              (sha256
               (base32
                "1pjxyvdxvw41xw3yyl18pwzix8hbvn6lgics7qcfhjfsf1zs8x1z"))))
    (build-system ruby-build-system)
    (arguments `(#:tests? #f)) ; no tests included
    (native-inputs
     (list bundler))
    (synopsis "Open the current REPL line in an editor")
    (description
     "This gem provides a plugin for the Ruby REPL to enable opening the
current line in an external editor.")
    (home-page "https://github.com/tpope/pry-editline")
    (license license:expat)))

(define-public ruby-sdoc
  (package
    (name "ruby-sdoc")
    (version "1.1.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "sdoc" version))
              (sha256
               (base32
                "1am73dldx1fqlw2xny5vyk00pgkisg6bvs0pa8jjd7c19drjczrd"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-before 'check 'set-rubylib-and-patch-gemfile
          (lambda _
            (setenv "RUBYLIB" "lib")
            (substitute* "sdoc.gemspec"
              (("s.add_runtime_dependency.*") "\n")
              (("s.add_dependency.*") "\n"))
            (substitute* "Gemfile"
              (("gem \"rake\".*")
               "gem 'rake'\ngem 'rdoc'\ngem 'json'\n"))
            #t)))))
    (propagated-inputs
     (list ruby-json))
    (native-inputs
     (list bundler ruby-minitest ruby-hoe))
    (synopsis "Generate searchable RDoc documentation")
    (description
     "SDoc is an RDoc documentation generator to build searchable HTML
documentation for Ruby code.")
    (home-page "https://github.com/voloko/sdoc")
    (license license:expat)))

(define-public ruby-tins
  (package
    (name "ruby-tins")
    (version "1.29.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "tins" version))
              (sha256
               (base32
                "0nzp88y19rqlcizp1nw8m44fvfxs9g3bhjpscz44dwfawfrmr0cb"))))
    (build-system ruby-build-system)
    ;; This gem needs gem-hadar at development time, but gem-hadar needs tins
    ;; at runtime.  To avoid the dependency on gem-hadar we disable rebuilding
    ;; the gemspec.
    (arguments
     `(#:tests? #f ; there are no tests
       #:phases
       (modify-phases %standard-phases
         (replace 'build
          (lambda _
            ;; "lib/spruz" is a symlink.  Leaving it in the gemspec file
            ;; causes an error.
            (substitute* "tins.gemspec"
              (("\"lib/spruz\", ") ""))
            (invoke "gem" "build" "tins.gemspec"))))))
    (propagated-inputs
     (list ruby-sync))
    (synopsis "Assorted tools for Ruby")
    (description "Tins is a Ruby library providing assorted tools.")
    (home-page "https://github.com/flori/tins")
    (license license:expat)))

(define-public ruby-gem-hadar
  (package
    (name "ruby-gem-hadar")
    (version "1.11.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "gem_hadar" version))
              (sha256
               (base32
                "160abb3l4n3gkhd86f22n981bhqxkbf5ym6fhsk796pix6696pd5"))))
    (build-system ruby-build-system)
    ;; This gem needs itself at development time. We disable rebuilding of the
    ;; gemspec to avoid this loop.
    (arguments
     `(#:tests? #f ; there are no tests
       #:phases
       (modify-phases %standard-phases
         (replace 'build
          (lambda _
            (invoke "gem" "build" "gem_hadar.gemspec"))))))
    (propagated-inputs
     (list git ruby-tins ruby-yard))
    (synopsis "Library for the development of Ruby gems")
    (description
     "This library contains some useful functionality to support the
development of Ruby gems.")
    (home-page "https://github.com/flori/gem_hadar")
    (license license:expat)))

(define-public ruby-minitest-tu-shim
  (package
    (name "ruby-minitest-tu-shim")
    (version "1.3.3")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "minitest_tu_shim" version))
              (sha256
               (base32
                "0xlyh94iirvssix157ng2akr9nqhdygdd0c6094hhv7dqcfrn9fn"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'fix-test-include-path
          (lambda* (#:key inputs #:allow-other-keys)
             (let* ((minitest (assoc-ref inputs "ruby-minitest-4")))
               (substitute* "Rakefile"
                 (("Hoe\\.add_include_dirs .*")
                  (string-append "Hoe.add_include_dirs \""
                                 minitest "/lib/ruby/vendor_ruby"
                                 "/gems/minitest-"
                                 ,(package-version ruby-minitest-4)
                                 "/lib" "\""))))
             #t))
         (add-before 'check 'fix-test-assumptions
          (lambda _
            ;; The test output includes the file name, so a couple of tests
            ;; fail.  Changing the regular expressions slightly fixes this
            ;; problem.
            (substitute* "test/test_mini_test.rb"
              (("output.sub!\\(.*, 'FILE:LINE'\\)")
               "output.sub!(/\\/.+-[\\w\\/\\.]+:\\d+/, 'FILE:LINE')")
              (("gsub\\(/.*, 'FILE:LINE'\\)")
               "gsub(/\\/.+-[\\w\\/\\.]+:\\d+/, 'FILE:LINE')"))
            #t)))))
    (propagated-inputs
     `(("ruby-minitest-4" ,ruby-minitest-4)))
    (native-inputs
     (list ruby-hoe))
    (synopsis "Adapter library between minitest and test/unit")
    (description
     "This library bridges the gap between the small and fast minitest and
Ruby's large and slower test/unit.")
    (home-page "https://rubygems.org/gems/minitest_tu_shim")
    (license license:expat)))

(define-public ruby-term-ansicolor
  (package
    (name "ruby-term-ansicolor")
    (version "1.7.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "term-ansicolor" version))
              (sha256
               (base32
                "1xq5kci9215skdh27npyd3y55p812v4qb4x2hv3xsjvwqzz9ycwj"))))
    (build-system ruby-build-system)
    ;; Rebuilding the gemspec seems to require git, even though this is not a
    ;; git repository, so we just build the gem from the existing gemspec.
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'fix-test
           (lambda -
             (substitute* "tests/hsl_triple_test.rb"
               (("0\\\\\\.0%")
                "0\\.?0?%"))))
         (replace 'build
          (lambda _
            (invoke "gem" "build" "term-ansicolor.gemspec"))))))
    (propagated-inputs
     (list ruby-tins))
    (native-inputs
     (list ruby-gem-hadar ruby-minitest-tu-shim))
    (synopsis "Ruby library to control the attributes of terminal output")
    (description
     "This Ruby library uses ANSI escape sequences to control the attributes
of terminal output.")
    (home-page "https://flori.github.io/term-ansicolor/")
    ;; There is no mention of the "or later" clause.
    (license license:gpl2)))

(define-public ruby-terraform
  (package
  (name "ruby-terraform")
  (version "0.22.0")
  (source
   (origin
     (method url-fetch)
     (uri (rubygems-uri "ruby-terraform" version))
     (sha256
      (base32
       "13zjkp71cd19j2ds2h9rqwcfr1zdg5nsh63p89l6qcsc9z39z324"))))
  (build-system ruby-build-system)
  (arguments
   '(#:tests? #f)) ; No included tests
  (propagated-inputs
   (list ruby-lino))
  (synopsis "Ruby wrapper around the Terraform command line interface")
  (description
   "This package provides a Ruby wrapper around the Terraform command line
interface so that Terraform can be more easily invoked from Ruby code.")
  (home-page "https://github.com/infrablocks/ruby_terraform")
  (license license:expat)))

(define-public ruby-pstree
  (package
    (name "ruby-pstree")
    (version "0.3.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "pstree" version))
              (sha256
               (base32
                "0ld3ng37y92kv9vqnachw1l3n07hsc8hrnjs9d840liw0mysf1vp"))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-gem-hadar bundler))
    (synopsis "Create a process tree data structure")
    (description
     "This library uses the output of the @code{ps} command to create a
process tree data structure for the current host.")
    (home-page "https://github.com/flori/pstree")
    ;; There is no mention of the "or later" clause.
    (license license:gpl2)))

(define-public ruby-utils
  (package
    (name "ruby-utils")
    (version "0.9.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "utils" version))
              (sha256
               (base32
                "196zhgcygrnx09bb9mh22qas03rl9avzx8qs0wnxznpin4pffwcl"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-tins ruby-term-ansicolor ruby-pstree ruby-pry-editline))
    (native-inputs
     (list ruby-gem-hadar bundler))
    (synopsis "Command line tools for working with Ruby")
    (description
     "This package provides assorted command line tools that may be useful
when working with Ruby code.")
    (home-page "https://github.com/flori/utils")
    ;; There is no mention of the "or later" clause.
    (license license:gpl2)))

(define-public ruby-jaro-winkler
  (package
    (name "ruby-jaro-winkler")
    (version "1.5.4")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "jaro_winkler" version))
       (sha256
        (base32 "1y8l6k34svmdyqxya3iahpwbpvmn3fswhwsvrz0nk1wyb8yfihsh"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f))                    ; no included tests
    (synopsis "Ruby implementation of Jaro-Winkler distance algorithm")
    (description
     "@code{jaro_winkler} is an implementation of Jaro-Winkler distance
algorithm.  It is written as a C extension and will fallback to a pure Ruby
implementation on platforms where this is unsupported.")
    (home-page "https://github.com/tonytonyjan/jaro_winkler")
    (license license:expat)))

(define-public ruby-json
  (package
    (name "ruby-json")
    (version "2.1.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "json" version))
       (sha256
        (base32
         "01v6jjpvh3gnq6sgllpfqahlgxzj50ailwhj9b3cd20hi2dx0vxp"))))
    (build-system ruby-build-system)
    (arguments '(#:tests? #f)) ; dependency cycle with sdoc
    (synopsis "JSON library for Ruby")
    (description "This Ruby library provides a JSON implementation written as
a native C extension.")
    (home-page "http://json-jruby.rubyforge.org/")
    (license (list license:ruby license:gpl2)))) ; GPL2 only

(define-public ruby-json-pure
  (package
    (name "ruby-json-pure")
    (version "2.3.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "json_pure" version))
              (sha256
               (base32
                "00pziwkfqwk8vj19s65sdki31q1wvmf5v9b3sfglxm94qfvas1lx"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'fix-rakefile
           (lambda _
             (substitute* "Rakefile"
               ;; Since this is not a git repository, do not call 'git'.
               (("`git ls-files`") "`find . -type f |sort`")))))))
    (native-inputs
     (list bundler ragel ruby-simplecov ruby-test-unit which))
    (synopsis "JSON implementation in pure Ruby")
    (description
     "This package provides a JSON implementation written in pure Ruby.")
    (home-page "https://flori.github.com/json/")
    (license license:ruby)))

(define-public ruby-jwt
  (package
    (name "ruby-jwt")
    (version "2.1.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "jwt" version))
       (sha256
        (base32
         "1w0kaqrbl71cq9sbnixc20x5lqah3hs2i93xmhlfdg2y3by7yzky"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "test"
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'remove-unnecessary-dependencies
           (lambda _
             (substitute* "spec/spec_helper.rb"
               (("require 'simplecov.*") "\n")
               ;; Use [].each to disable running the SimpleCov configuration
               ;; block
               (("SimpleCov\\.configure") "[].each")
               (("require 'codeclimate-test-reporter'") "")
               (("require 'codacy-coverage'") "")
               (("Codacy::Reporter\\.start") ""))
             #t)))))
    (native-inputs
     (list bundler ruby-rspec ruby-rbnacl))
    (synopsis "Ruby implementation of the JSON Web Token standard")
    (description
     "This package provides a pure Ruby implementation of the RFC 7519 OAuth
@acronym{JWT, JSON Web Token} standard.")
    (home-page "https://github.com/jwt/ruby-jwt")
    (license license:expat)))

;; Even though this package only provides bindings for a Mac OSX API it is
;; required by "ruby-listen" at runtime.
(define-public ruby-rb-fsevent
  (package
    (name "ruby-rb-fsevent")
    (version "0.10.3")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "rb-fsevent" version))
              (sha256
               (base32
                "1lm1k7wpz69jx7jrc92w3ggczkjyjbfziq5mg62vjnxmzs383xx8"))))
    (build-system ruby-build-system)
    ;; Tests need "guard-rspec", which needs "guard".  However, "guard" needs
    ;; "listen", which needs "rb-fsevent" at runtime.
    (arguments `(#:tests? #f))
    (synopsis "FSEvents API with signals catching")
    (description
     "This library provides Ruby bindings for the Mac OSX FSEvents API.")
    (home-page "https://rubygems.org/gems/rb-fsevent")
    (license license:expat)))

(define-public ruby-listen
  (package
    (name "ruby-listen")
    (version "3.2.0")
    (source
     (origin
       ;; The gem does not include a Rakefile, so fetch from the Git
       ;; repository.
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/guard/listen")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "1hkp1g6hk5clsmbd001gkc12ma6s459x820piajyasv61m87if24"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "spec"
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'fix-files-in-gemspec
           (lambda _
             (substitute* "listen.gemspec"
               (("`git ls-files -z`") "`find . -type f -printf '%P\\\\0' |sort -z`"))
             #t))
         (add-before 'check 'remove-unnecessary-dependencies'
           (lambda _
             (substitute* "Rakefile"
               ;; Rubocop is for code linting, and is unnecessary for running
               ;; the tests.
               ((".*rubocop.*") ""))
             #t)))))
    (native-inputs
     (list bundler ruby-rspec))
    (inputs
     (list ;; ruby-thor is used for the command line interface, and is referenced
           ;; in the wrapper, and therefore just needs to be an input.
           ruby-thor))
    (propagated-inputs
     (list ruby-rb-fsevent ruby-rb-inotify ruby-dep))
    (synopsis "Listen to file modifications")
    (description "The Listen gem listens to file modifications and notifies
you about the changes.")
    (home-page "https://github.com/guard/listen")
    (license license:expat)))

(define-public ruby-loofah
  (package
    (name "ruby-loofah")
    (version "2.13.0")
    (home-page "https://github.com/flavorjones/loofah")
    (source
     (origin
       ;; Build from git because the gem lacks tests.
       (method git-fetch)
       (uri (git-reference (url home-page)
                           (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0rmsm7mckiq0gslfqdl02yvn500n42v84gq28qjqn4yq9jwfs9ga"))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-hoe ruby-hoe-markdown ruby-rr))
    (propagated-inputs
     (list ruby-nokogiri ruby-crass))
    (synopsis "Ruby library for manipulating and transforming HTML/XML")
    (description
     "Loofah is a general library for manipulating and transforming HTML/XML
documents and fragments.  It's built on top of Nokogiri and libxml2.")
    (license license:expat)))

(define-public ruby-crass
  (package
    (name "ruby-crass")
    (version "1.0.6")
    (home-page "https://github.com/rgrove/crass")
    (source (origin
              ;; The gem does not contain tests, so pull from git.
              (method git-fetch)
              (uri (git-reference
                    (url home-page)
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1gbsb81psgb6xhnwpx4s409jc0mk0gijh039sy5xyi8jpaaadp40"))))
    (build-system ruby-build-system)
    (synopsis "Pure Ruby CSS parser")
    (description
     "Crass is a pure Ruby CSS parser based on the CSS Syntax Level 3 spec.")
    (license license:expat)))

;;; The ruby-nokogumbo package has been absorbed into ruby-nokogiri.
(define-public ruby-nokogumbo
  (deprecated-package "ruby-nokogumbo" ruby-nokogiri))

(define-public ruby-samovar
  (package
    (name "ruby-samovar")
    (version "2.1.4")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/ioquatix/samovar")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "05pc5xlbv44anx0sfqssh0xhxg297bvl5slsl7k1vnka4k5fhax6"))))
    (build-system ruby-build-system)
    (native-inputs (list ruby-covered ruby-rspec))
    (propagated-inputs (list ruby-console ruby-mapping))
    (synopsis "Flexible option parser for Ruby")
    (description "Samovar is a modern framework for building command-line
tools and applications.  It provides a declarative class-based DSL for
building command-line parsers that include automatic documentation generation.
It helps you keep your functionality clean and isolated where possible.")
    (home-page "https://github.com/ioquatix/samovar")
    (license license:expat)))

(define-public ruby-sanitize
  (package
    (name "ruby-sanitize")
    (version "6.0.0")
    (home-page "https://github.com/rgrove/sanitize")
    (source (origin
              (method git-fetch)
              ;; The gem does not include the Rakefile, so we download the
              ;; source from Github.
              (uri (git-reference
                    (url home-page)
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0p1a28vx95vscy9xzzyyddzgb9496x42a5i2ka39cpxbl5f3gkl0"))))
    (build-system ruby-build-system)
    (propagated-inputs (list ruby-crass ruby-nokogiri))
    (native-inputs (list ruby-minitest))
    (synopsis "Whitelist-based HTML and CSS sanitizer")
    (description
     "Sanitize is a whitelist-based HTML and CSS sanitizer.  Given a list of
acceptable elements, attributes, and CSS properties, Sanitize will remove all
unacceptable HTML and/or CSS from a string.")
    (license license:expat)))

(define-public ruby-sync
  (package
    (name "ruby-sync")
    (version "0.5.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "sync" version))
        (sha256
         (base32
          "1z9qlq4icyiv3hz1znvsq1wz2ccqjb1zwd6gkvnwg6n50z65d0v6"))))
    (build-system ruby-build-system)
    (synopsis "Ruby module with a two-phase lock and counter")
    (description "This package provides a Ruby module that provides a two-phase
lock with a counter.")
    (home-page "https://github.com/ruby/sync")
    (license license:bsd-2)))

(define-public ruby-oj
  (package
    (name "ruby-oj")
    (version "3.13.9")
    (source
     (origin
       (method git-fetch)
       ;; Version on rubygems.org does not contain Rakefile, so download from
       ;; GitHub instead.
       (uri (git-reference
              (url "https://github.com/ohler55/oj")
              (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0a24zd28y58nyhjxgrpn2k9p72vzj3zbmdrcsbhwbdycj7nn9fpd"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "test_all"
       #:phases
       (modify-phases %standard-phases
         (add-before 'check 'disable-bundler
           (lambda _
             (substitute* "Rakefile"
               (("Bundler\\.with_clean_env") "1.times")
               (("bundle exec ") "")))))))
    (native-inputs
     (list bundler ruby-rspec ruby-rake-compiler))
    (synopsis "JSON parser for Ruby optimized for speed")
    (description
     "Oj is a JSON parser and generator for Ruby, where the encoding and
decoding of JSON is implemented as a C extension to Ruby.")
    (home-page "https://www.ohler.com/oj/")
    (license (list license:expat     ; Ruby code
                   license:bsd-3)))) ; extension code

(define-public ruby-ox
  (package
    (name "ruby-ox")
    (version "2.6.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "ox" version))
       (sha256
        (base32
         "0fmk62b1h2i79dfzjj8wmf8qid1rv5nhwfc17l489ywnga91xl83"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; no tests
    (synopsis "Optimized XML library for Ruby")
    (description
     "Optimized XML (Ox) is a fast XML parser and object serializer for Ruby
written as a native C extension.  It was designed to be an alternative to
Nokogiri and other Ruby XML parsers for generic XML parsing and as an
alternative to Marshal for Object serialization.")
    (home-page "https://www.ohler.com/ox")
    (license license:expat)))

(define-public ruby-redcloth
  (package
    (name "ruby-redcloth")
    (version "4.3.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "RedCloth" version))
              (sha256
               (base32
                "0m9dv7ya9q93r8x1pg2gi15rxlbck8m178j1fz7r5v6wr1avrrqy"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f ; no tests
       #:phases
       (modify-phases %standard-phases
         ;; Redcloth has complicated rake tasks to build various versions for
         ;; multiple targets using RVM.  We don't want this so we just use the
         ;; existing gemspec.
         (replace 'build
          (lambda _
            (invoke "gem" "build" "redcloth.gemspec"))))))
    (native-inputs
     `(("bundler" ,bundler)
       ("ruby-diff-lcs" ,ruby-diff-lcs)
       ("ruby-rspec-2" ,ruby-rspec-2)))
    (synopsis "Textile markup language parser for Ruby")
    (description
     "RedCloth is a Ruby parser for the Textile markup language.")
    (home-page "http://redcloth.org")
    (license license:expat)))

(define-public ruby-pg
  (package
    (name "ruby-pg")
    (version "1.4.6")
    (home-page "https://github.com/ged/ruby-pg")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url home-page)
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0k7jgx7x7p6gbsbrv2l5rq27nff2nphnls1sdq525d82b068qnfm"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:test-target "spec"
      #:phases
      #~(modify-phases %standard-phases
               (add-before 'build 'compile
                 (lambda _
                   (invoke "rake" "compile")))
               ;; Some tests rely on postgresql_lib_path.rb, but it is not
               ;; available until the gem is installed.  Run tests after
               ;; installing to work around it.
               (delete 'check)
               (add-after 'install 'check
                 (lambda* (#:key tests? #:allow-other-keys)
                   (let ((new-gem (string-append #$output
                                                 "/lib/ruby/vendor_ruby")))
                     (setenv "GEM_PATH"
                             (string-append (getenv "GEM_PATH") ":" new-gem))
                     (when tests?
                       (invoke "rspec"))))))))
    (native-inputs (list ruby-rake-compiler ruby-hoe ruby-rspec))
    (inputs (list postgresql))
    (synopsis "Ruby interface to PostgreSQL")
    (description "Pg is the Ruby interface to the PostgreSQL RDBMS.  It works
with PostgreSQL 9.3 and later.")
    (license license:ruby)))

(define-public ruby-byebug
  (package
    (name "ruby-byebug")
    (version "11.1.3")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/deivid-rodriguez/byebug")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0vyy3k2s7dcndngj6m8kxhs1vxc2c93dw8b3yyand3srsg9ffpij"))
       (modules '((guix build utils)))
       (snippet
        '(begin
           ;; Remove wrappers that try to setup a bundle environment.
           (with-directory-excursion "bin"
             (for-each delete-file '("bundle" "rake" "rubocop"))
             ;; ruby-minitest doesn't come with a launcher, so fix the one
             ;; provided.
             (substitute* "minitest"
               (("load File\\.expand_path\\(\"bundle\".*") "")
               (("require \"bundler/setup\".*") "")))))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'sanitize-dependencies
           (lambda _
             (substitute* "Rakefile"
               ((".*chandler/tasks.*") ""))))
         (add-after 'unpack 'skip-tmp-path-sensitive-test
           (lambda _
             (substitute* "test/commands/where_test.rb"
               (("unless /cygwin\\|mswin\\|mingw\\|darwin/.*")
                "unless true\n"))))
         (add-before 'build 'compile
           (lambda _
             (invoke "rake" "compile")))
         (add-before 'check 'disable-misbehaving-test
           ;; Expects 5, gets 162. From a file containing ~10 lines.
           (lambda _
             (substitute* "test/commands/finish_test.rb"
               (("test_finish_inside_autoloaded_files")
                "finish_inside_autoloaded_files"))))
         (add-before 'check 'set-home
           (lambda _
             (setenv "HOME" (getcwd)))))))
    (native-inputs
     (list bundler
           ;; Using minitest 5.17 would cause 5 new bug failures.  This is
           ;; probably related to
           ;; https://github.com/deivid-rodriguez/byebug/pull/837.  Use
           ;; minitest 5.15 until this is resolved and released.
           ruby-minitest-5.15
           ruby-pry
           ruby-rake-compiler
           ruby-rubocop
           ruby-yard))
    (synopsis "Debugger for Ruby 2")
    (description "Byebug is a Ruby 2 debugger implemented using the Ruby 2
TracePoint C API for execution control and the Debug Inspector C API for call
stack navigation.  The core component provides support that front-ends can
build on.  It provides breakpoint handling and bindings for stack frames among
other things and it comes with a command line interface.")
    (home-page "https://github.com/deivid-rodriguez/byebug")
    (license license:bsd-2)))

(define-public ruby-netrc
  (package
    (name "ruby-netrc")
    (version "0.11.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "netrc" version))
              (sha256
               (base32
                "0gzfmcywp1da8nzfqsql2zqi648mfnx6qwkig3cv36n9m0yy676y"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           ;; There is no Rakefile and minitest can only run one file at once,
           ;; so we have to iterate over all test files.
           (lambda _
             (for-each (lambda (file)
                         (invoke "ruby" "-Itest" file))
                       (find-files "./test" "test_.*\\.rb"))))
         (add-before 'check 'patch-tests-for-newer-ruby
           (lambda _
             (substitute* "test/test_netrc.rb"
               (("Dir.pwd, '.netrc'") "Netrc.home_path, '.netrc'")))))))
    (native-inputs
     (list ruby-minitest))
    (synopsis "Library to read and update netrc files")
    (description
     "This library can read and update netrc files, preserving formatting
including comments and whitespace.")
    (home-page "https://github.com/geemus/netrc")
    (license license:expat)))

(define-public ruby-unf-ext
  (package
    (name "ruby-unf-ext")
    (version "0.0.8.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "unf_ext" version))
              (sha256
               (base32
                "1yj2nz2l101vr1x9w2k83a0fag1xgnmjwp8w8rw4ik2rwcz65fch"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'build 'build-ext
           (lambda _ (invoke "rake" "compile:unf_ext")))
         (add-before 'check 'lose-rake-compiler-dock-dependency
           (lambda _
             ;; rake-compiler-dock is listed in the gemspec, but only
             ;; required when cross-compiling.
             (substitute* "unf_ext.gemspec"
               ((".*rake-compiler-dock.*") "")))))))
    (native-inputs
     (list bundler ruby-rake-compiler ruby-test-unit))
    (synopsis "Unicode normalization form support library")
    (description
     "This package provides unicode normalization form support for Ruby.")
    (home-page "https://github.com/knu/ruby-unf_ext")
    (license license:expat)))

(define-public ruby-tdiff
  ;; Use a newer than released snapshot so that rspec-2 is not required.
  (let ((commit "b662a6048f08abc45c1a834e5f34dd1c662935e2"))
    (package
      (name "ruby-tdiff")
      (version (string-append "0.3.3-1." (string-take commit 8)))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/postmodern/tdiff")
                      (commit commit)))
                (file-name (string-append name "-" version "-checkout"))
                (sha256
                 (base32
                  "0n3gq8rx49f7ln6zqlshqfg2mgqyy30rsdjlnki5mv307ykc7ad4"))))
      (build-system ruby-build-system)
      (native-inputs
       (list ruby-rspec ruby-yard ruby-rubygems-tasks))
      (synopsis "Calculate the differences between two tree-like structures")
      (description
       "This library provides functions to calculate the differences between two
tree-like structures.  It is similar to Ruby's built-in @code{TSort} module.")
      (home-page "https://github.com/postmodern/tdiff")
      (license license:expat))))

(define-public ruby-nokogiri-diff
  ;; Use a newer than released snapshot so that rspec-2 is not required.
  (let ((commit "a38491e4d8709b7406f2cae11a50226d927d06f5"))
    (package
      (name "ruby-nokogiri-diff")
      (version (string-append "0.2.0-1." (string-take commit 8)))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/postmodern/nokogiri-diff")
                      (commit commit)))
                (file-name (string-append name "-" version "-checkout"))
                (sha256
                 (base32
                  "1ah2sfjh9n1p0ln2wkqzfl448ml7j4zfy6dhp1qgzq2m41php6rf"))))
      (build-system ruby-build-system)
      (propagated-inputs
       (list ruby-tdiff
             ruby-nokogiri))
      (native-inputs
       (list ruby-rspec ruby-yard ruby-rubygems-tasks))
      (synopsis "Calculate the differences between two XML/HTML documents")
      (description
       "@code{Nokogiri::Diff} adds the ability to calculate the
differences (added or removed nodes) between two XML/HTML documents.")
      (home-page "https://github.com/postmodern/nokogiri-diff")
      (license license:expat))))

(define-public ruby-racc
  (package
    (name "ruby-racc")
    (version "1.5.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "racc" version))
       (sha256
        (base32
         "178k7r0xn689spviqzhvazzvxfq6fyjldxb3ywjbgipbfi4s8j1g"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))            ; Fails while parsing test instructions.
    (native-inputs
     (list ruby-hoe ruby-rake-compiler))
    (synopsis "LALR(1) parser generator for Ruby")
    (description
     "Racc is a LALR(1) parser generator.  It is written in Ruby itself, and
generates Ruby program.")
    (home-page "https://i.loveruby.net/en/projects/racc/")
    (license (list
              ;; Generally licensed under the LGPL2.1, and some files also
              ;; available under the same license as Ruby.
              license:lgpl2.1
              license:ruby))))

(define-public ruby-rack
  (package
    (name "ruby-rack")
    ;; Do not upgrade to version 3, as Rails doesn't support it yet.
    (version "2.2.6.3")
    (source
     (origin
       (method git-fetch)               ;for tests
       (uri (git-reference
             (url "https://github.com/rack/rack")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "19n33q0v15qjh7kbp2painyzyqg16kkf0mp68vcnlswghmmjcyzq"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-before 'check 'fix-tests
            (lambda _
              ;; This test fails in the build environment (and passes outside
              ;; of it).
              (substitute* "test/spec_files.rb"
                (("res.body.must_equal expected_body") ""))
              ;; A few of the tests use the length of a file on disk for
              ;; Content-Length and Content-Range headers.  However, this file
              ;; has a shebang in it which an earlier phase patches, growing
              ;; the file size from 193 to 239 bytes when the store prefix is
              ;; "/gnu/store".
              (let ((size-diff (- (string-length (which "ruby"))
                                  (string-length "/usr/bin/env ruby"))))
                (substitute* '("test/spec_files.rb")
                  (("208" bytes)
                   (number->string (+ (string->number bytes) size-diff)))
                  (("bytes(.)22-33" all delimiter)
                   (string-append "bytes"
                                  delimiter
                                  (number->string (+ 22 size-diff))
                                  "-"
                                  (number->string (+ 33 size-diff)))))))))))
    (native-inputs (list ruby-minitest ruby-minitest-global-expectations))
    (synopsis "Unified web application interface for Ruby")
    (description "Rack provides a minimal, modular and adaptable interface for
developing web applications in Ruby.  By wrapping HTTP requests and responses,
it unifies the API for web servers, web frameworks, and software in between
into a single method call.")
    (home-page "https://github.com/rack/rack")
    (license license:expat)))

(define-public ruby-rack-next
  (package
    (inherit ruby-rack)
    (name "ruby-rack")
    (version "3.0.7")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/rack/rack")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0msf14655nfcq1kgmib6932lgzm9nw3nb0m3c7nh6nj4sx30yxfr"))))
    (arguments '())))

(define-public ruby-rackup
  (package
    (name "ruby-rackup")
    (version "2.1.0")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/rack/rackup")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "19b7sy700zjwaw7x47qpxvhnnz5hrp5bhrxfyljgagrli824dajy"))))
    (build-system ruby-build-system)
    (native-inputs (list ruby-minitest-global-expectations))
    (inputs (list ruby-rack-next ruby-webrick))
    (synopsis "Command line interface (CLI) for running for Rack applications")
    (description "This package provides a command line interface for running
for Rack applications.")
    (home-page "https://github.com/rack/rackup")
    (license license:expat)))

(define-public ruby-rack-cache
  (package
    (name "ruby-rack-cache")
    (version "1.13.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "rack-cache" version))
              (sha256
               (base32
                "1cqpax628h2mhnsjfg91c3klxwx2pkvaj061cisb0saqa99b0jgm"))))
    (build-system ruby-build-system)
    (arguments
     (list
      ;; The test suite depends on ruby-memcached, which is not available in
      ;; Guix and bundles a very dated copy of memcached (undesirable).
      #:tests? #f))
    (propagated-inputs (list ruby-rack))
    (synopsis "Component to enable HTTP caching for Rack-based applications")
    (description "Rack::Cache is suitable as a drop-in component to enable
HTTP caching for Rack-based applications that produce freshness (Expires,
Cache-Control) and/or validation (Last-Modified, ETag) information.")
    (home-page "https://github.com/rtomayko/rack-cache")
    (license license:expat)))

(define-public ruby-rack-test
  (package
    (name "ruby-rack-test")
    (version "2.1.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "rack-test" version))
       (sha256
        (base32
         "1ysx29gk9k14a14zsp5a8czys140wacvp91fja8xcja0j1hzqq8c"))))
    (build-system ruby-build-system)
    (arguments
     ;; Disable tests because of circular dependencies: requires sinatra,
     ;; which requires rack-protection, which requires rack-test.  Instead
     ;; simply require the library.
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (invoke "ruby" "-Ilib" "-r" "rack/test")))))))
    (propagated-inputs
     (list ruby-rack))
    (synopsis "Testing API for Rack applications")
    (description
     "Rack::Test is a small, simple testing API for Rack applications.  It can
be used on its own or as a reusable starting point for Web frameworks and
testing libraries to build on.")
    (home-page "https://github.com/rack/rack-test")
    (license license:expat)))

(define-public ruby-rack-session
  (package
    (name "ruby-rack-session")
    ;; Stay on version 1 until all the rack users such as Rails can use rack 3
    ;; (rack-session 2 requires rack 3).
    (version "1.0.1")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/rack/rack-session")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0rv955wd7ckp5jgy5c229wmajh48jpcy8s0iv5i8ma61wf7qw0i1"))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-minitest-global-expectations
           ruby-minitest-sprint))
    (propagated-inputs
     (list ruby-rack))
    (synopsis "Session management for Rack")
    (description "This package provides a session management implementation
for Rack.")
    (home-page "https://github.com/rack/rack-session")
    (license license:expat)))

(define-public ruby-rack-protection
  (package
    (name "ruby-rack-protection")
    (version "3.0.5")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "rack-protection" version))
       (sha256
        (base32
         "1a12m1mv8dc0g90fs1myvis8vsgr427k1arg1q4a9qlfw6fqyhis"))))
    (build-system ruby-build-system)
    (arguments
     '(;; Tests missing from the gem.
       #:tests? #f))
    (propagated-inputs
     (list ruby-rack))
    (native-inputs
     (list bundler ruby-rspec-2 ruby-rack-test))
    (synopsis "Rack middleware that protects against typical web attacks")
    (description "Rack middleware that can be used to protect against typical
web attacks.  It can protect all Rack apps, including Rails.  For instance, it
protects against cross site request forgery, cross site scripting,
clickjacking, directory traversal, session hijacking and IP spoofing.")
    (home-page "https://github.com/sinatra/sinatra/tree/master/rack-protection")
    (license license:expat)))

(define-public ruby-rainbow
  (package
    (name "ruby-rainbow")
    (version "3.0.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "rainbow" version))
       (sha256
        (base32
         "0bb2fpjspydr6x0s8pn1pqkzmxszvkfapv0p4627mywl7ky4zkhk"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         ;; Run rspec directly, to avoid requiring Rubocop which is used from
         ;; the Rakefile.
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (invoke "rspec"))
             #t)))))
    (native-inputs
     (list bundler ruby-rspec))
    (synopsis "Colorize printed text on ANSI terminals")
    (description
     "@code{rainbow} provides a string presenter object to colorize strings by
wrapping them in ANSI escape codes.")
    (home-page "https://github.com/sickill/rainbow")
    (license license:expat)))

(define-public ruby-rr
  (package
    (name "ruby-rr")
    (version "1.2.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "rr" version))
       (sha256
        (base32
         "1n9g78ba4c2zzmz8cdb97c38h1xm0clircag00vbcxwqs4dq0ymp"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; test files not included
    (native-inputs
     (list bundler ruby-rspec))
    (synopsis "Ruby test double framework")
    (description
     "RR is a test double framework that features a rich selection of double
techniques and a terse syntax.")
    (home-page "https://rr.github.io/rr/")
    (license license:expat)))

(define-public ruby-rest-client
  (package
    (name "ruby-rest-client")
    (version "2.0.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "rest-client" version))
       (sha256
        (base32
         "1hzcs2r7b5bjkf2x2z3n8z6082maz0j8vqjiciwgg3hzb63f958j"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (add-before 'check 'remove-unnecessary-development-dependencies
           (lambda _
             (substitute* "rest-client.gemspec"
               ;; Remove rubocop as it's unused. Rubocop also indirectly
               ;; depends on this package through ruby-parser and ruby-ast so
               ;; this avoids a dependency loop.
               ((".*rubocop.*") "\n")
               ;; Remove pry as it's unused, it's a debugging tool
               ((".*pry.*") "\n")
               ;; Remove an unnecessarily strict rdoc dependency
               ((".*rdoc.*") "\n"))
             #t))
         (add-before 'check 'delete-network-dependent-tests
           (lambda _
             (delete-file "spec/integration/request_spec.rb")
             (delete-file "spec/integration/httpbin_spec.rb")
             #t)))))
    (propagated-inputs
     (list ruby-http-cookie ruby-mime-types ruby-netrc))
    (native-inputs
     (list bundler ruby-webmock-2 ruby-rspec))
    (synopsis "Simple HTTP and REST client for Ruby")
    (description
     "@code{rest-client} provides a simple HTTP and REST client for Ruby,
inspired by the Sinatra microframework style of specifying actions:
@code{get}, @code{put}, @code{post}, @code{delete}.")
    (home-page "https://github.com/rest-client/rest-client")
    (license license:expat)))

(define-public ruby-rubocop-ast
  (package
    (name "ruby-rubocop-ast")
    (version "1.28.0")
    (source
     (origin
       (method git-fetch)               ;no test suite in distributed gem
       (uri (git-reference
             (url "https://github.com/rubocop/rubocop-ast")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "1dp09gcmahmdfi3s6xsksr3ka9dddjpy9ymhr9wjwv67y1falffr"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "spec"
       #:phases (modify-phases %standard-phases
                  (add-after 'unpack 'relax-dependencies
                    (lambda _
                      (substitute* "Gemfile"
                        (("gem 'simplecov', '~> 0.10', '< 0.18'")
                         "gem 'simplecov', '~> 0.10'"))))
                  (add-before 'build 'generate-lexer
                    (lambda _
                      (setenv "RUBOCOP_VERSION" "none")
                      (invoke "rake" "generate")))
                  (replace 'replace-git-ls-files
                    (lambda _
                      (substitute* "rubocop-ast.gemspec"
                        (("`git ls-files(.*)`" _ files)
                         (format #f "`find ~a -type f| sort`" files))))))))
    (native-inputs
     (list ruby-bump
           ruby-oedipus-lex
           ruby-pry
           ruby-racc
           ruby-rake
           ruby-rspec
           ruby-simplecov))
    (propagated-inputs
     (list ruby-parser))
    (synopsis "RuboCop's AST extensions and NodePattern functionality")
    (description "Rubocop::AST extends @code{ruby-parser} with classes used
by RuboCop to deal with Ruby's Abstract Syntax Tree (AST), in particular:
@itemize
@item @code{RuboCop::AST::Node}
@item @code{RuboCop::AST::NodePattern}
@end itemize")
    (home-page "https://rubocop.org/")
    (license license:expat)))

(define-public ruby-rexml
  (package
    (name "ruby-rexml")
    (version "3.2.5")
    (source
     (origin
       (method git-fetch)               ;no tests in distributed gem
       (uri (git-reference
             (url "https://github.com/ruby/rexml")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "13n6vaa80drqic2wri4q6k22qzvsn683vp5s8c9dllil6x04kn0x"))))
    (build-system ruby-build-system)
    (synopsis "XML toolkit for Ruby")
    (description "Inspired by Electric XML library for Java, REXML aims to be
easy-to-use API, small and fast.  It supports both tree and stream document
parsing.")
    (home-page "https://github.com/ruby/rexml")
    (license license:bsd-2)))

(define-public ruby-character-set
  (package
    (name "ruby-character-set")
    (version "1.4.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "character_set" version))
        (sha256
          (base32
            "0affq9n77vwy897ri2zhmfinfagf37hcwwimrccy1bcxan9mj3h3"))))
    (build-system ruby-build-system)
    (arguments '(#:tests? #f))          ;avoid a cycle with ruby-regexp-parser
    (synopsis "Ruby library to manipulate Unicode")
    (description "CharacterSet is a C-extended Ruby library to work with sets
of Unicode code points.  It can read and write these sets in various formats
and implements the @code{stdlib} @code{Set} interface for them.  It also
offers an alternate paradigm of @code{String} processing which grants much
better performance than @code{Regexp} and @code{String} methods from the
@code{stdlib} where applicable.  Many parts can be used independently, e.g.:
@itemize
@item @code{CharacterSet::Character}
@item @code{CharacterSet::Parser}
@item @code{CharacterSet::Writer}
@item @code{RangeCompressor}
@end itemize")
    (home-page "https://github.com/jaynetics/character_set")
    (license license:expat)))

(define-public ruby-range-compressor
  (package
    (name "ruby-range-compressor")
    (version "1.0.0")
    (source
      (origin
        (method git-fetch)
        (uri (git-reference
              (url "https://github.com/janosch-x/range_compressor")
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
         (base32
          "0y8slri2msyyg2szgwgriqd6qw9hkxycssdrcl5lk2dbcq5zvn54"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "spec"
       #:phases (modify-phases %standard-phases
                  (add-after 'extract-gemspec 'strip-version-requirements
                    (lambda _
                      (substitute* "range_compressor.gemspec"
                        (("(.*add_.*dependency '[_A-Za-z0-9-]+').*" _ stripped)
                         (string-append stripped "\n")))
                      #t)))))
    (native-inputs
     (list ruby-rspec))
    (synopsis "Simple arrays of objects to arrays of ranges compressor")
    (description "RangeCompresses is a tiny library that allows compressing
arrays of objects into arrays of ranges.  For example, it can turn the
following: @code{[1, 2, 3, 4, 6, 8, 9, 10]} into @code{[1..4, 6..6, 8..10]}.")
    (home-page "https://github.com/janosch-x/range_compressor")
    (license license:expat)))

(define-public ruby-regexp-property-values
  (let ((commit "03007a66c912949a7130b973cc0eca109c20811f")
        (revision "1"))
    (package
      (name "ruby-regexp-property-values")
      (version (git-version "1.0.0" revision commit))
      (source
       (origin
         (method git-fetch)
         (uri (git-reference              ;no test suite in distributed gem
               (url "https://github.com/jaynetics/regexp_property_values")
               (commit commit)))
         (file-name (git-file-name name version))
         (sha256
          (base32
           "1zsax784p16zdkf60lyq9z924zvsafhx9ckxx9srsgkyiqrifi1s"))))
      (build-system ruby-build-system)
      (arguments
       '(#:test-target "default"))
      (native-inputs
       (list ruby-character-set ruby-rake ruby-rake-compiler
             ruby-range-compressor ruby-rspec))
      (synopsis "Inspect Ruby's regex engine property values")
      (description "This small library lets you see which property values are
supported by the regular expression engine of the Ruby version you are running
and can directly read out their code point ranges.  In other words, it
determines all supported values for @code{\\p{value}} expressions and what
they match.")
      (home-page "https://github.com/jaynetics/regexp_property_values")
      (license license:expat))))

(define-public ruby-regexp-parser
  (package
    (name "ruby-regexp-parser")
    (version "2.0.0")
    (source
     (origin
       (method git-fetch)               ;bin/test missing from gem
       (uri (git-reference
             (url "https://github.com/ammar/regexp_parser")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "09ddxdwlml30q6j4rqf06bbjj1mwx00rs0bksnyblhv85anrqz3k"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "default"
       #:phases (modify-phases %standard-phases
                  (add-before 'build 'compile-scanner.rb
                    (lambda _
                      (invoke "rake" "build")
                      ;; XXX: This is needed otherwise the install
                      ;; phase fails to delete the installed cached
                      ;; gem file.
                      (delete-file-recursively "pkg")
                      #t)))))
    (native-inputs
     (list ragel ruby-regexp-property-values ruby-rspec))
    (synopsis "Regular expression parser library for Ruby")
    (description "A Ruby gem for tokenizing, parsing, and transforming regular
expressions.  It comprises the following components:
@itemize
@item A scanner/tokenizer based on Ragel,
@item A lexer that produces a stream of token objects,
@item A parser that produces a tree of Expression objects.
@end itemize")
    (home-page "https://github.com/ammar/regexp_parser")
    (license license:expat)))

(define-public ruby-test-queue
  (package
    (name "ruby-test-queue")
    (version "0.4.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "test-queue" version))
       (sha256
        (base32
         "0hvm3n1qrqxqilhqk4rjivw3gcrd08zz1i6am9qzg1ppjxv6f36f"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (invoke "rspec"))
             #t)))))
    (native-inputs
     (list ruby-rspec))
    (synopsis "Minitest/RSpec parallel test runner for CI environments")
    (description "The test-queue module is a parallel test runner,
built using a centralized queue to ensure optimal distribution of
tests between workers.  It is specifically optimized for Continuous
Integration (CI) environments: build statistics from each run are
stored locally and used to sort the queue at the beginning of the next
run.")
    (home-page "https://github.com/tmm1/test-queue")
    (license license:expat)))

(define-public ruby-rubocop
  (package
    (name "ruby-rubocop")
    (version "1.48.1")
    (source
     (origin
       (method git-fetch)               ;no tests in distributed gem
       (uri (git-reference
             (url "https://github.com/rubocop/rubocop")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "1l4j99mbrdjy2bzcnky30pjgjv8sxjr187jzliyqmldvpf7dizbp"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "default"
       ;; TODO: Figure out why test hangs.
       #:tests? ,(not (or (%current-target-system)
                          (target-riscv64?)))
       #:phases
       (modify-phases %standard-phases
         (add-before 'check 'set-home
           (lambda _
             (setenv "HOME" (getcwd))))
         ;; Rubocop depends on itself for tests, directly and indirectly. By
         ;; regenerating the TODO list we test rubocop against itself and
         ;; forgo adjusting the test suite to our environment each release.
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (make-file-writable ".rubocop_todo.yml")
               (invoke "./exe/rubocop" "--auto-gen-config")))))))
    (native-inputs
     (list ruby-pry
           ruby-rake
           ruby-rspec
           ruby-rubocop-ast
           ruby-rubocop-capybara-minimal
           ruby-rubocop-minimal
           ruby-rubocop-performance-minimal
           ruby-rubocop-rake-minimal
           ruby-rubocop-rspec-minimal
           ruby-simplecov
           ruby-stackprof
           ruby-test-queue
           ruby-webmock
           ruby-yard))
    (propagated-inputs
     (list ruby-json
           ruby-parallel
           ruby-parser
           ruby-progressbar
           ruby-rainbow
           ruby-regexp-parser
           ruby-rexml
           ruby-rubocop-ast
           ruby-unicode-display-width))
    (synopsis "Ruby code style checking tool")
    (description
     "@code{rubocop} is a Ruby code style checking tool.  It aims to enforce
the community-driven Ruby Style Guide.")
    (home-page "https://github.com/rubocop/rubocop")
    (license license:expat)))

(define-public ruby-rubocop-minimal
  (hidden-package
   (package
     (inherit ruby-rubocop)
     (arguments
      (substitute-keyword-arguments (package-arguments ruby-rubocop)
        ((#:tests? _ #f) #f)))
     (propagated-inputs '())
     (native-inputs '()))))

(define-public ruby-contest
  (package
    (name "ruby-contest")
    (version "0.1.3")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "contest" version))
       (sha256
        (base32
         "1p9f2292b7b0fbrcjswvj9v01z7ig5ig52328wyqcabgb553qsdf"))))
    (build-system ruby-build-system)
    (synopsis "Write declarative tests using nested contexts")
    (description
     "Contest allows writing declarative @code{Test::Unit} tests using nested
contexts without performance penalties.")
    (home-page "https://github.com/citrusbyte/contest")
    (license license:expat)))

(define-public ruby-creole
  (package
    (name "ruby-creole")
    (version "0.5.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "creole" version))
       (sha256
        (base32
         "00rcscz16idp6dx0dk5yi5i0fz593i3r6anbn5bg2q07v3i025wm"))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-bacon))
    (synopsis "Creole markup language converter")
    (description
     "Creole is a lightweight markup language and this library for converting
creole to @code{HTML}.")
    (home-page "https://github.com/minad/creole")
    (license license:ruby)))

(define-public ruby-docile
  (package
    (name "ruby-docile")
    (version "1.1.5")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "docile" version))
       (sha256
        (base32
         "0m8j31whq7bm5ljgmsrlfkiqvacrw6iz9wq10r3gwrv5785y8gjx"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; needs github-markup, among others
    (synopsis "Ruby EDSL helper library")
    (description "Docile is a Ruby library that provides an interface for
creating embedded domain specific languages (EDSLs) that manipulate existing
Ruby classes.")
    (home-page "https://ms-ati.github.io/docile/")
    (license license:expat)))

(define-public ruby-middleware
  (package
    (name "ruby-middleware")
    (version "0.1.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "middleware" version))
       (sha256
        (base32
         "0703nkf2v371wqr41c04x5qid7ww45cxqv3hnlg07if3b3xrm9xl"))))
    (build-system ruby-build-system)
    (arguments '(#:tests? #f))          ;no test suite
    (synopsis "Implementation of a middleware abstraction for Ruby")
    (description "Middleware is a generalized implementation of a middleware
abstraction for Ruby.")
    (home-page "https://github.com/mitchellh/middleware")
    (license license:expat)))

(define-public ruby-benchmark-ips
  (package
    (name "ruby-benchmark-ips")
    (version "2.8.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "benchmark-ips" version))
       (sha256
        (base32
         "1n9397j7kh4vvikfann1467qgksc679imlr50hax3lk1q3af8kdw"))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-hoe))
    (synopsis "Iterations per second enhancement for the Ruby Benchmark module")
    (description "Benchmark-ips enhances the Ruby Benchmark module with the
iterations per second count.  For short snippets of code, it can automatically
figure out how many times to run the code to get interesting data.")
    (home-page "https://github.com/evanphx/benchmark-ips")
    (license license:expat)))

(define-public ruby-ffi-rzmq-core
  (package
    (name "ruby-ffi-rzmq-core")
    (version "1.0.7")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "ffi-rzmq-core" version))
       (sha256
        (base32
         "0amkbvljpjfnv0jpdmz71p1i3mqbhyrnhamjn566w0c01xd64hb5"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
                  (add-after 'unpack 'patch-libzmq-search-path
                    (lambda* (#:key inputs #:allow-other-keys)
                      (let ((zeromq (assoc-ref inputs "zeromq")))
                        (substitute* "lib/ffi-rzmq-core/libzmq.rb"
                          (("/usr/local/lib")
                           (string-append zeromq "/lib")))
                        #t)))
                  (replace 'check
                    (lambda _
                      (invoke "rspec"))))))
    (native-inputs
     (list ruby-rspec))
    (inputs
     (list zeromq))
    (propagated-inputs (list ruby-ffi))
    (synopsis "Low-level Ruby FFI wrapper for the ZeroMQ networking library")
    (description "This library only provides the FFI wrapper for the ZeroMQ
networking library.  It can be used to implement a Ruby API for the ZeroMQ
library.")
    (home-page "https://github.com/chuckremes/ffi-rzmq-core")
    (license license:expat)))

(define-public ruby-ffi-rzmq
  (package
    (name "ruby-ffi-rzmq")
    (version "2.0.7")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "ffi-rzmq" version))
       (sha256
        (base32
         "14a5kxfnf8l3ngyk8hgmk30z07aj1324ll8i48z67ps6pz2kpsrg"))))
    (build-system ruby-build-system)
    (arguments '(#:phases (modify-phases %standard-phases
                            (replace 'check
                              (lambda* (#:key tests? #:allow-other-keys)
                                (when tests?
                                  (invoke "rspec")))))))
    (native-inputs
     (list ruby-rspec))
    (propagated-inputs
     (list ruby-ffi-rzmq-core))
    (synopsis "High-level Ruby wrapper for the ZeroMQ networking library")
    (description "This library provides a high-level API that wraps the ZeroMQ
networking library using the Ruby foreign function interface (FFI).  It is a
pure Ruby wrapper, hence is compatible with any Ruby runtime that has support
for FFI.")
    (home-page "https://github.com/chuckremes/ffi-rzmq")
    (license license:expat)))

(define-public ruby-sawyer
  (package
    (name "ruby-sawyer")
    (version "0.9.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "sawyer" version))
       (sha256
        (base32
         "1jks1qjbmqm8f9kvwa81vqj39avaj9wdnzc531xm29a55bb74fps"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-addressable ruby-faraday))
    (synopsis "Experimental hypermedia agent for Ruby")
    (description "Sawyer is an experimental hypermedia agent for Ruby built on
top of Faraday.")
    (home-page "https://github.com/lostisland/sawyer")
    (license license:expat)))

(define-public ruby-octokit
  (package
    (name "ruby-octokit")
    (version "6.1.0")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/octokit/octokit.rb")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "01njrd17bz28mlsa8hi9gad7s6d1d0vpyn0g66p3d42zgplr9qkq"))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-faraday-multipart
           ruby-jwt
           ruby-mime-types
           ruby-multi-json
           ruby-netrc
           ruby-pry-byebug
           ruby-rbnacl
           ruby-rspec
           ruby-simplecov
           ruby-webmock
           ruby-vcr-expat))
    (propagated-inputs (list ruby-faraday ruby-sawyer))
    (synopsis "Ruby toolkit for the GitHub API")
    (description "Octokit wraps the GitHub API in a flat API client that
follows Ruby conventions and requires little knowledge of REST.")
    (home-page "https://github.com/octokit/octokit.rb")
    (license license:expat)))

(define-public ruby-pry-byebug
  (package
    (name "ruby-pry-byebug")
    (version "3.10.1")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/deivid-rodriguez/pry-byebug")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0z8rhvmr9qmlbk8c8h6jbig5qd5xbdg9qihvx3g0cv1whqzbfikq"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases (modify-phases %standard-phases
                  (add-after 'unpack 'sanitize-dependencies
                    (lambda _
                      (substitute* "Rakefile"
                        ((".*chandler/tasks.*") ""))))
                  (add-before 'check 'set-home
                    (lambda _
                      (setenv "HOME" (getcwd)))))))
    (native-inputs (list ruby-rubocop ruby-simplecov))
    (propagated-inputs (list ruby-byebug ruby-pry))
    (synopsis "Step-by-step debugging and stack navigation in Pry")
    (description "This package adds step-by-step debugging and stack
navigation capabilities to @code{pry}, using @code{byebug}.")
    (home-page "https://github.com/deivid-rodriguez/pry-byebug")
    (license license:expat)))

(define-public ruby-stackprof
  (package
    (name "ruby-stackprof")
    (version "0.2.17")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "stackprof" version))
       (sha256
        (base32 "06lz70k8c0r7fyxk1nc3idh14x7nvsr21ydm1bsmbj00jyhmfzsn"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-before 'check 'skip-dubious-test
           (lambda _
             ,@(if (or (target-riscv64?)
                       (target-ppc32?))
                 ;; This unreliable test can fail with "Expected 32 to be <= 25."
                 '((substitute* "test/test_stackprof.rb"
                     ((".*assert_operator profile\\[:missed_samples.*") "")))
                 ;; This unreliable test can fail with "Expected 0 to be >= 1."
                 '((substitute* "test/test_stackprof.rb"
                     (("def test_(cputime)" _ name)
                      (string-append "def skip_" name)))))))
         (add-before 'check 'build-tests
           (lambda _
             (invoke "rake" "compile"))))))
    (native-inputs
     (list ruby-mocha ruby-rake-compiler))
    (synopsis "Sampling profiler for Ruby code")
    (description
     "@code{stackprof} is a fast sampling profiler for Ruby code, with cpu,
wallclock and object allocation samplers.")
    (home-page "https://github.com/tmm1/stackprof")
    (license license:expat)))

(define-public ruby-binding-of-caller
  (package
    (name "ruby-binding-of-caller")
    (version "0.8.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "binding_of_caller" version))
       (sha256
        (base32
         "05syqlks7463zsy1jdfbbdravdhj9hpj5pv2m74blqpv8bq4vv5g"))))
    (build-system ruby-build-system)
    ;; Attempting to run the test suite fails with a rake deprecation error
    ;; (see: https://github.com/banister/binding_of_caller/issues/76).
    (arguments '(#:tests? #f))
    (propagated-inputs
     (list ruby-debug-inspector))
    (synopsis "Retrieve the binding of a method's caller")
    (description "The @code{binding_of_caller} module provides the
@code{Binding#of_caller} method.  It allows accessing bindings from upper
frames in the call stack and can evaluate code in that context.")
    (home-page "https://github.com/banister/binding_of_caller")
    (license license:expat)))

(define-public ruby-pry-stack-explorer
  (package
    (name "ruby-pry-stack-explorer")
    (version "0.5.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "pry-stack_explorer" version))
       (sha256
        (base32
         "157rd2n9pfvcmmicm0xkq8z4p6famaj13syrpra6b4032qpb1wn0"))))
    (build-system ruby-build-system)
    (arguments '(#:tests? #f))          ;no test suite in gem release
    (propagated-inputs
     (list ruby-binding-of-caller ruby-pry))
    (synopsis "Call-stack navigation plugin for the Pry REPL")
    (description "@code{pry-stack_explorer} is a plugin for the Pry REPL that
add support to navigate the call-stack.")
    (home-page "https://github.com/pry/pry-stack_explorer")
    (license license:expat)))

(define-public ruby-varint
  (package
    (name "ruby-varint")
    (version "0.1.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "varint" version))
       (sha256
        (base32
         "1y0l2qc64cwsyv76ygg9bbjnk86riz2kq73kmn87gdrlmpiyrdac"))))
    (build-system ruby-build-system)
    (arguments '(#:tests? #f))          ;no test suite
    (synopsis "Variable length integers (varint) C extension for Ruby")
    (description "This package provides a small C extension to speed up
variable length integers (varint) in Ruby Protocol Buffers.")
    (home-page "https://github.com/liquidm/varint")
    (license license:bsd-3)))

(define-public ruby-version-gem
  (package
    (name "ruby-version-gem")
    (version "1.1.2")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://gitlab.com/oauth-xx/version_gem")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "17y4dydlczd5xvvwfy94x63d5wi14cdkfhi6g94fm1sgsxxzzmq0"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases #~(modify-phases %standard-phases
                        (add-after 'unpack 'relax-requirements
                          (lambda _
                            (substitute* "Gemfile"
                              (("^linting = .*")
                               "linting = false\n")
                              (("^coverage = .*")
                               "coverage = false\n")
                              (("^debug = .*")
                               "debug = false\n"))
                            (substitute* "spec/spec_helper.rb"
                              (("^RUN_COVERAGE = .*")
                               "RUN_COVERAGE = false\n")
                              (("^ALL_FORMATTERS = .*")
                               "ALL_FORMATTERS = false\n"))))
                        (add-before 'build 'drop-signing-key-requirement
                          (lambda _
                            (substitute* "version_gem.gemspec"
                              (("spec.signing_key =.*")
                               "spec.signing_key = nil"))))
                        (add-before 'check 'disable-problematic-tests
                          (lambda _
                            (substitute* "spec/version_gem/ruby_spec.rb"
                              ;; The test validates the minimum version of
                              ;; Ruby to be 2.7.7, but because our Ruby is
                              ;; 2.7.4 grafted with 2.7.7, the version seen is
                              ;; 2.7.4 and it fails.
                              (("it 'returns true when current ruby greater \
than minimum'" all)
                               (string-append "x" all))))))))
    (native-inputs (list ruby-rspec ruby-rspec-block-is-expected))
    (synopsis "Improved @code{Version} module for Ruby")
    (description "VersionGem aims to provide introspection of a @code{Version}
module based on a @code{Version::VERSION} constant string wile not interfering
with gemspec parsing where the @code{VERSION} string is traditionally used.")
    (home-page "https://gitlab.com/oauth-xx/version_gem")
    (license license:expat)))

;;; Note: Do NOT update to a newer version; this is the last commit that is
;;; still licensed as free software, the project having switched to the
;;; Hippocratic license afterward (see:
;;; https://github.com/vcr/vcr/issues/959).
(define-public ruby-vcr-expat
  (let ((revision "0")
        (commit-dont-touch "842b2bf89099dc91f2c643d0d85d1abd54eb7e85")) ;
    (package
      (name "ruby-vcr-expat")
      (version (git-version "5.0.0" revision commit-dont-touch))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/vcr/vcr")
                      (commit commit-dont-touch)))
                (file-name (git-file-name name version))
                (sha256
                 (base32
                  "02mzifd2655kjh35bbry01n66jjcjrsw6ncqlybfkjcaqrw2zalv"))))
      (build-system ruby-build-system)
      (arguments (list #:tests? #f))    ;avoid all dependencies
      (home-page "https://github.com/vcr/vcr")
      (synopsis "HTTP interaction recorder [old version]")
      (description "Record your test suite's HTTP interactions and replay them
during future test runs for fast, deterministic, accurate tests.  This is an
older version of VCR that is free software under the Expat license.  The
project later switched to the Hippocratic license, which is non-free.
@emph{Do not use it in new free software projects}.")
      (license license:expat))))

(define-public ruby-ruby-prof
  (package
    (name "ruby-ruby-prof")
    (version "1.4.5")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "ruby-prof" version))
       (sha256
        (base32
         "09n13bzm1p956z318xx1v7ikqdp2i971v7p3kwf3170axz368ccy"))))
    (build-system ruby-build-system)
    (arguments
      ;; FIXME: Investigate why the tests fail on i686-linux.
     `(#:tests? ,(not (or (%current-target-system)
                          (target-x86-32?)))
       #:phases
       (modify-phases %standard-phases
         ;; The LineNumbersTest test fails non-deterministically (see:
         ;; https://github.com/ruby-prof/ruby-prof/issues/276).
         (add-after 'extract-gemspec 'delete-flaky-test
           (lambda _
             (delete-file "test/line_number_test.rb")
             (substitute* "ruby-prof.gemspec"
               (("\"test/line_number_test\\.rb\"\\.freeze, ") ""))))
         (add-before 'check 'compile
          (lambda _
            (invoke "rake" "compile"))))))
    (native-inputs (list bundler ruby-minitest ruby-rake-compiler ruby-rdoc))
    (synopsis "Fast code profiler for Ruby")
    (description "RubyProf is a fast code profiler for Ruby.  Its features
include:
@table @asis
@item Speed
Being a C extension, it is many times faster than the standard Ruby profiler.
@item Measurement Modes
It can measure program wall time, process time, object allocations and memory
usage.
@item Reports
A variety of text and cross-referenced HTML reports can be generated.
@item Threads
Profiling multiple threads simultaneously is supported.
@end table")
    (home-page "https://github.com/ruby-prof/ruby-prof")
    (license license:bsd-2)))

(define-public ruby-ruby-memcheck
  (package
    (name "ruby-ruby-memcheck")
    (version "1.2.0")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/Shopify/ruby_memcheck")
                    (commit version)))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1sx8nhx7w4z5s5vj6kq6caqsfznswqzwca372j82cd80hf9iznra"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'patch-valgrind-path
            (lambda* (#:key inputs #:allow-other-keys)
              (substitute* "lib/ruby_memcheck/configuration.rb"
                (("DEFAULT_VALGRIND = \"valgrind\"")
                 (format #f "DEFAULT_VALGRIND = ~s"
                         (search-input-file inputs "bin/valgrind"))))))
          (add-before 'replace-git-ls-files 'standardize-git-ls-files
            (lambda _
              (substitute* "ruby_memcheck.gemspec"
                (("%x\\(git ls-files -z)")
                 "`git ls-files -z`")))))))
    (native-inputs (list ruby-rake-compiler ruby-rspec))
    (inputs (list valgrind/interactive))
    (propagated-inputs (list ruby-nokogiri))
    (synopsis "Valgrind memcheck tool for Ruby")
    (description "The @code{ruby_memcheck} gem provides a sane way to use
Valgrind's memcheck on your native extension gem, that filters out all the
false positives caused by Ruby not freeing all of the memory it allocates
during shutdown.")
    (home-page "https://github.com/Shopify/ruby_memcheck")
    (license license:expat)))

(define-public ruby-memory-profiler
  (package
    (name "ruby-memory-profiler")
    (version "1.0.0")
    (source
      (origin
        (method git-fetch)
        (uri (git-reference
               (url "https://github.com/SamSaffron/memory_profiler")
               (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
         (base32
          "07yqv11q68xg2fqkrhs6ysngryk8b9zq6qzh24rgx9xqv6qfnj0w"))))
    (build-system ruby-build-system)
    (synopsis "Memory profiling routines for Ruby")
    (description
     "This package provides memory profiling routines for Ruby.")
    (home-page "https://github.com/SamSaffron/memory_profiler")
    (license license:expat)))

(define-public ruby-cucumber-compatibility-kit
  (package
    (name "ruby-cucumber-compatibility-kit")
    (version "11.2.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "cucumber-compatibility-kit" version))
              (sha256
               (base32
                "17c8zx0yn68rcpfbw4nb1gzvh9fzpwsi1y0qivb99ahdlgzcdp8q"))))
    (build-system ruby-build-system)
    (arguments (list #:phases #~(modify-phases %standard-phases
                                  (replace 'check
                                    (lambda* (#:key tests? #:allow-other-keys)
                                      (when tests?
                                        (invoke "rspec")))))))
    (propagated-inputs (list ruby-cucumber-messages ruby-rake ruby-rspec))
    (synopsis "Cucumber compatibility verification utility")
    (description "The Cucumber Compatibility Kit (CCK) aims to validate a
Cucumber implementation's support for the Cucumber Messages protocol.")
    (home-page "https://github.com/cucumber/compatibility-kit")
    (license license:expat)))

;;; Variant package to break a cycle with ruby-cucumber-messages.
(define ruby-cucumber-compatibility-kit-bootstrap
  (package/inherit ruby-cucumber-compatibility-kit
    (arguments (list #:tests? #f))
    (propagated-inputs (modify-inputs (package-propagated-inputs
                                       ruby-cucumber-compatibility-kit)
                         (delete "ruby-cucumber-messages")))))

(define-public ruby-cucumber-messages
  (package
    (name "ruby-cucumber-messages")
    (version "21.0.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "cucumber-messages" version))
              (sha256
               (base32
                "0482a63y7my0arn2bv208g401dq8525f0gwhnwaa11mhv6ph0q5i"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases
           #~(modify-phases %standard-phases
               ;; The test suite requires the gem to be installed, so move it
               ;; after the install phase.
               (delete 'check)
               (add-after 'install 'check
                 (lambda* (#:key tests? #:allow-other-keys)
                   (setenv "GEM_PATH" (string-append
                                       (getenv "GEM_PATH") ":"
                                       #$output "/lib/ruby/vendor_ruby"))
                   (when tests?
                     (invoke "rspec")))))))
    (native-inputs
     (list ruby-cucumber-compatibility-kit-bootstrap ruby-rspec))
    (home-page "https://github.com/cucumber/messages/")
    (synopsis "Cucumber Messages for Ruby (Protocol Buffers)")
    (description "Cucumber Messages for Ruby is a library which allows
serialization and deserialization of the protocol buffer messages used in
Cucumber.")
    (license license:expat)))

(define-public ruby-cucumber-gherkin
  (package
    (name "ruby-cucumber-gherkin")
    (version "26.1.0")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/cucumber/gherkin")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1rsannfcg5rqh5a3d3paw10kf6mmqjrgbq3k235px4swbyqysmgn"))))
    (build-system ruby-build-system)
    (arguments (list #:test-target "spec"
                     #:phases #~(modify-phases %standard-phases
                                  (add-after 'unpack 'chdir
                                    (lambda _
                                      (chdir "ruby"))))))
    (native-inputs (list ruby-rspec))
    (propagated-inputs (list ruby-cucumber-messages))
    (synopsis "Gherkin parser for Ruby")
    (description "Gherkin is a parser and compiler for the Gherkin language.
It is intended be used by all Cucumber implementations to parse
@file{.feature} files.")
    (home-page "https://github.com/cucumber/gherkin")
    (license license:expat)))

(define-deprecated ruby-gherkin ruby-cucumber-gherkin)

(define-public ruby-gherkin-ruby
  (package
    (name "ruby-gherkin-ruby")
    (version "0.3.2")
    (home-page "https://github.com/codegram/gherkin-ruby")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "gherkin-ruby" version))
              (sha256
               (base32
                "18ay7yiibf4sl9n94k7mbi4k5zj2igl4j71qcmkswv69znyx0sn1"))))
    (build-system ruby-build-system)
    (synopsis "Pure Ruby Gherkin parser")
    (description
     "Gherkin-ruby is a Gherkin parser written in pure Ruby and less than
200 lines of code.")
    ;; XXX: No license information anywhere but Readme.md.
    (license license:expat)))

(define-public ruby-aruba
  (package
    (name "ruby-aruba")
    (version "2.1.0")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/cucumber/aruba")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1mmlgqhi6yww3z34hmrrnha2rygkv6kx0q962z31dqxjkcv23yfd"))))
    (build-system ruby-build-system)
    (arguments
     (list
      ;; XXX: Only run the "spec" target and not the "cucumber" one, as it is
      ;; slow and has multiple unexplained test failures.
      #:test-target "spec"
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'patch-paths
            (lambda _
              ;; This test file relies on a dynamically generated script;
              ;; patch its #!/bin/bash shebang.
              (substitute* "spec/aruba/api/commands_spec.rb"
                (("/bin/bash")
                 (which "bash")))))
          (add-before 'check 'relax-requirements
            ;; Many development requirements are not actually needed.
            (lambda _
              (substitute* "aruba.gemspec"
                (("\\[\">= 0.18.0\", \"< 0.22.0\"]") ;simplecov
                 "\">= 0.18.0\"")
                ((".*appraisal.*") "")
                ((".*pry.*") "")
                ((".*kramdown.*") "")
                ((".*rubocop.*") "")
                ((".*yard-junk.*") ""))
              (substitute* "Rakefile"
                ((".*require \"rubocop/rake_task\".*") "")
                ((".*require \"yard-junk/rake\".*") "")
                ((".*RuboCop::RakeTask.new.*") "")
                ((".*YardJunk::Rake.define_task.*") ""))))
          ;; The tests rely on the Gem being installed, so move the check
          ;; phase after the install phase.
          (delete 'check)
          (add-after 'install 'check
            (assoc-ref %standard-phases 'check))
          (add-before 'check 'set-GEM_PATH
            (lambda _
              (setenv "GEM_PATH" (string-append
                                  (getenv "GEM_PATH") ":"
                                  #$output "/lib/ruby/vendor_ruby"))))
          (add-before 'check 'set-home
            (lambda _
              (setenv "HOME" "/tmp"))))))
    (native-inputs
     (list ruby-rake-manifest
           ruby-rspec
           ruby-simplecov))
    (propagated-inputs
     (list bundler
           ruby-childprocess
           ruby-contracts
           ruby-cucumber
           ruby-rspec-expectations
           ruby-thor))
    (synopsis "Test command-line applications with Cucumber, RSpec or Minitest")
    (description
     "Aruba is an extension for Cucumber, RSpec and Minitest for testing
command-line applications.  It supports applications written in any
language.")
    (home-page "https://github.com/cucumber/aruba")
    (license license:expat)))

(define-public ruby-sys-uname
  (package
  (name "ruby-sys-uname")
  (version "1.2.1")
  (source
    (origin
      (method url-fetch)
      (uri (rubygems-uri "sys-uname" version))
      (sha256
        (base32
          "00p3wwvkdbg6pl38bchaagncv3i4fq4y0ks470imwykjanpy2ic0"))))
  (build-system ruby-build-system)
  (arguments
   `(#:test-target "spec"))
  (propagated-inputs (list ruby-ffi))
  (native-inputs (list ruby-rspec))
  (synopsis "Ruby interface for gathering system information")
  (description "The sys-uname library provides an interface for gathering
information about your current platform.  It allows retrieving information
such as the OS name, OS version, system name, etc.")
  (home-page "https://github.com/djberg96/sys-uname")
  (license license:asl2.0)))

(define-public ruby-cucumber-html-formatter
  (package
    (name "ruby-cucumber-html-formatter")
    (version "20.2.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "cucumber-html-formatter" version))
       (sha256
        (base32
         "0c7r9mfmph4c6yzc7y3dkr92rhwvpyksr0mdhpqp67xmmr8z1br4"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases #~(modify-phases %standard-phases
                        (add-after 'extract-gemspec 'relax-requirements
                          (lambda _
                            (substitute* ".gemspec"
                              (("~> 18.0") "~> 21.0")))) ;cucumber-messages
                        (replace 'check
                          (lambda* (#:key tests? #:allow-other-keys)
                            (when tests?
                              (invoke "rspec")))))))
    (native-inputs (list ruby-cucumber-compatibility-kit ruby-rspec))
    (propagated-inputs (list ruby-cucumber-messages))
    (synopsis "HTML formatter for Cucumber")
    (description "Cucumber HTML Formatter produces a HTML report for Cucumber
runs.  It is built on top of cucumber-react and works with any Cucumber
implementation with a protocol buffer formatter that outputs Cucumber
messages.")
    (home-page "https://github.com/cucumber/html-formatter")
    (license license:expat)))

(define-public ruby-cucumber-ci-environment
  (package
    (name "ruby-cucumber-ci-environment")
    (version "9.1.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "cucumber-ci-environment" version))
              (sha256
               (base32
                "1nmn2hfrjlbazgcryr3hwvsa5v4csfbjqxb4q7wbjhaxl9xxn0k7"))))
    (build-system ruby-build-system)
    (arguments (list #:phases #~(modify-phases %standard-phases
                                  (replace 'check
                                    (lambda* (#:key tests? #:allow-other-keys)
                                      (when tests?
                                        (invoke "rspec")))))))
    (native-inputs (list ruby-rspec))
    (synopsis "Detect CI Environment from environment variables")
    (description "This is a Ruby utility library for Cucumber that detects a
CI environment from environment variables.")
    (home-page "https://github.com/cucumber/ci-environment")
    (license license:expat)))

(define-public ruby-cucumber
  (package
    (name "ruby-cucumber")
    (version "8.0.0")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/cucumber/cucumber-ruby")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "1dz880fdz6rfbh1nwwcq21v65byik46jnf9gppnrqf3p5k61i55r"))))
    (build-system ruby-build-system)
    (arguments
     (list #:test-target "spec"
           #:phases
           #~(modify-phases %standard-phases
               (add-after 'unpack 'disable-rubocop
                 ;; Remove extraneous Lint checks.
                 (lambda _
                   (substitute* "Rakefile"
                     (("require 'rubocop/rake_task'")
                      "")
                     (("RuboCop::RakeTask.new")
                      ""))))
               (add-after 'extract-gemspec 'strip-version-requirements
                 (lambda _
                   (delete-file "Gemfile") ;do not use Bundler
                   (substitute* "cucumber.gemspec"
                     ;; The dependency specifications are often trailing
                     ;; behind and appear stricter than necessary, since the
                     ;; test suite passes with the newer component versions.
                     (("(.*add_.*dependency '[_A-Za-z0-9-]+')(.*)"
                       _ stripped rest)
                      (string-append stripped "   # " rest "\n")))))
               (add-before 'check 'set-home
                 (lambda _
                   (setenv "HOME" (getcwd)))))))
    (propagated-inputs
     (list ruby-builder
           ruby-cucumber-ci-environment
           ruby-cucumber-core
           ruby-cucumber-gherkin
           ruby-cucumber-html-formatter
           ruby-cucumber-messages
           ruby-cucumber-wire
           ruby-diff-lcs
           ruby-mime-types
           ruby-multi-test
           ruby-sys-uname))
    (native-inputs
     (list ruby-cucumber-compatibility-kit
           ruby-nokogiri
           ruby-pry
           ruby-rspec))
    (synopsis "Describe automated tests in plain language")
    (description "Cucumber is a tool for running automated tests written in
plain language.  It's designed to support a Behaviour Driven Development (BDD)
software development workflow.")
    (home-page "https://cucumber.io/")
    (license license:expat)))

(define ruby-cucumber-without-tests
  (package (inherit ruby-cucumber)
    (arguments
     '(#:tests? #f))
    (native-inputs
     '())))

(define-public ruby-covered
  (package
    (name "ruby-covered")
    (version "0.20.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "covered" version))
              (sha256
               (base32
                "04fpj493jn23ah5fq93956a5h2xj3z0hrckvc26fxcfsg5pbwypa"))))
    (build-system ruby-build-system)
    (arguments
    ;; XXX: The test suite is disabled to avoid dependency cycles with
    ;; ruby-samovar, through ruby-bake.
     (list #:tests? #f
           #:phases
           #~(modify-phases %standard-phases
               (add-after 'extract-gemspec 'relax-requirements
                 (lambda _
                   (substitute* ".gemspec"
                     (("\">= 3.2\"")
                      "\">= 2.7\"")))))))
    (propagated-inputs (list ruby-console ruby-msgpack))
    (synopsis "Modern approach to code coverage in Ruby")
    (description "Covered uses modern Ruby features to generate comprehensive
coverage, including support for templates which are compiled into Ruby.  It
has the following features:
@itemize
@item
Incremental coverage -- if you run your full test suite, and the run a subset,
it will still report the correct coverage - so you can incrementally work on
improving coverage.
@item
Integration with RSpec, Minitest, Travis & Coveralls - no need to configure
anything - out of the box support for these platforms.
@item
It supports coverage of views -- templates compiled to Ruby code can be
tracked for coverage reporting.
@end itemize")
    (home-page "https://github.com/ioquatix/covered")
    (license license:expat)))

(define-public ruby-coveralls
  (package
    (name "ruby-coveralls")
    (version "0.8.23")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "coveralls" version))
       (sha256
        (base32
         "1mv4fn5lfxhy7bc2f1lpnc5yp9mvv97az77j4r7jgrxcqwn8fqxc"))))
    (build-system ruby-build-system)
    (arguments
     (list #:test-target "default"
           #:phases #~(modify-phases %standard-phases
                        (add-after 'extract-gemspec 'disable-problematic-tests
                          (lambda _
                            (substitute* "spec/coveralls/coveralls_spec.rb"
                              ;; This test fails for unknown reasons (perhaps
                              ;; networking); skip it.
                              (("it \"sends existing test results\"" all)
                               (string-append "x" all)))
                            ;; 3 simplecov tests fail, perhaps due to using a
                            ;; newer simplecov version.
                            (delete-file "spec/coveralls/simplecov_spec.rb")
                            (substitute* "coveralls-ruby.gemspec"
                              (("\"spec/coveralls/simplecov_spec.rb\".freeze, ")
                               ""))))
                        (add-after 'extract-gemspec 'relax-requirements
                          (lambda _
                            (substitute* "coveralls-ruby.gemspec"
                              (("%q<simplecov>.freeze, \\[\"~> 0.16.1\"]")
                               "%q<simplecov>.freeze")))))))
    (native-inputs
     (list git-minimal/pinned
           ruby-pry
           ruby-rspec
           ruby-truthy
           ruby-vcr-expat
           ruby-webmock))
    (propagated-inputs
     (list ruby-json
           ruby-term-ansicolor
           ruby-thor
           ruby-tins
           ruby-simplecov))
    (synopsis "Ruby implementation of the Coveralls API")
    (description "This package provides a Ruby implementation of the Coveralls
API.")
    (home-page "https://coveralls.io")
    (license license:expat)))

(define-public ruby-unindent
  (package
  (name "ruby-unindent")
  (version "1.0")
  (source
    (origin
      (method url-fetch)
      (uri (rubygems-uri "unindent" version))
      (sha256
        (base32
          "1wqh3rzv8589yzibigminxx3qpmj2nqj28f90xy1sczk1pijmcrd"))))
  (build-system ruby-build-system)
  (synopsis "Ruby method to unindent strings")
  (description "This module provides a @code{String#unindent} Ruby method to
unindent strings, which can be useful to unindent multiline strings embedded
in already-indented code.")
  (home-page "https://github.com/mynyml/unindent")
  (license license:expat)))

(define-public ruby-cucumber-core
  (package
    (name "ruby-cucumber-core")
    (version "11.1.0")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/cucumber/cucumber-ruby-core")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0lf2inlam0951djc2qz81x0nkffmw2dpj44iadw1fw31m7r8wqvh"))))
    (build-system ruby-build-system)
    (arguments (list #:test-target "spec"
                     #:phases
                     #~(modify-phases %standard-phases
                         (add-after 'extract-gemspec 'relax-version-requirements
                           (lambda _
                             (substitute* "cucumber-core.gemspec"
                               (("'cucumber-tag-expressions',.*")
                                "'cucumber-tag-expressions', '>=4.1.0'\n")))))))
    (native-inputs
     (list ruby-rspec
           ruby-coveralls
           ruby-rubocop
           ruby-simplecov
           ruby-unindent))
    (propagated-inputs
     (list ruby-cucumber-gherkin
           ruby-cucumber-messages
           ruby-cucumber-tag-expressions))
    (synopsis "Core library for the Cucumber BDD app")
    (description "Cucumber is a tool for running automated tests
written in plain language.  Because they're written in plain language,
they can be read by anyone on your team.  Because they can be read by
anyone, you can use them to help improve communication, collaboration
and trust on your team.")
    (home-page "https://cucumber.io/")
    (license license:expat)))

(define-public ruby-cucumber-expressions
  (package
    (name "ruby-cucumber-expressions")
    (version "16.1.2")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/cucumber/cucumber-expressions")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "1dhq88k9x2x8svam5bc7rrcd166fqymda8wxryqkbkffhnzla0id"))))
    (build-system ruby-build-system)
    (arguments
     (list #:test-target "spec"
           #:phases #~(modify-phases %standard-phases
                        (add-after 'unpack 'chdir
                          (lambda _
                            (chdir "ruby"))))))
    (native-inputs (list ruby-rspec ruby-simplecov))
    (synopsis "Simpler alternative to Regular Expressions")
    (description "Cucumber Expressions offer similar functionality to Regular
Expressions, with a syntax that is easier to read and write.  Cucumber
Expressions are extensible with parameter types.")
    (home-page "https://github.com/cucumber/cucumber-expressions/")
    (license license:expat)))

(define-public ruby-cucumber-wire
  (package
    (name "ruby-cucumber-wire")
    (version "6.2.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "cucumber-wire" version))
       (sha256
        (base32
         "1pmydrh9lcckj7p0cn67jw7msxdkgr9zir86cs19h3mf2zlcv7b9"))))
    (build-system ruby-build-system)
    (arguments
     (list #:tests? #f))                ;tests use cucumber, causing a cycle
    (propagated-inputs
     (list ruby-cucumber-core ruby-cucumber-expressions
           ruby-cucumber-messages))
    (synopsis "Cucumber wire protocol plugin")
    (description "Cucumber's wire protocol allows step definitions to be
implemented and invoked on any platform.")
    (home-page "https://github.com/cucumber/cucumber-ruby-wire")
    (license license:expat)))

(define-public ruby-cucumber-tag-expressions
  (package
    (name "ruby-cucumber-tag-expressions")
    (version "5.0.1")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/cucumber/tag-expressions")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "1ziq30szn8m5y29hsdpx4dn1a8sy29h01nvcldm8nr1mx4b7dj1w"))))
    (build-system ruby-build-system)
    (arguments
     (list #:test-target "spec"
           #:phases #~(modify-phases %standard-phases
                        (add-after 'unpack 'chdir
                          (lambda _
                            (chdir "ruby"))))))
    (native-inputs (list ruby-rspec))
    (synopsis "Cucumber tag expressions for Ruby")
    (description "Cucumber tag expression parser for Ruby.  A tag expression
is an infix boolean expression used by Cucumber.")
    (home-page "https://github.com/cucumber/tag-expressions")
    (license license:expat)))

(define-public ruby-bindex
  (package
    (name "ruby-bindex")
    (version "0.5.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "bindex" version))
       (sha256
        (base32
         "1wvhf4v8sk5x8li03pcc0v0wglmyv7ikvvg05bnms83dfy7s4k8i"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "default"))
    (native-inputs
     (list bundler ruby-rake-compiler))
    (synopsis "Provides access for bindings relating to Ruby exceptions")
    (description
     "@code{bindex} provides a way to access the bindings that relate to
exceptions in Ruby, providing more information about the context in which the
exception occurred.")
    (home-page "https://github.com/gsamokovarov/bindex")
    (license license:expat)))

(define-public ruby-bio-logger
  (package
    (name "ruby-bio-logger")
    (version "1.0.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "bio-logger" version))
       (sha256
        (base32
         "02pylfy8nkdqzyzplvnhn1crzmfkj1zmi3qjhrj2f2imlxvycd28"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f)) ; rake errors, missing shoulda
    (propagated-inputs
     (list ruby-log4r))
    (synopsis "Log4r wrapper for Ruby")
    (description "Bio-logger is a wrapper around Log4r adding extra logging
features such as filtering and fine grained logging.")
    (home-page "https://github.com/pjotrp/bioruby-logger-plugin")
    (license license:expat)))

(define-public ruby-yajl-ruby
  (package
    (name "ruby-yajl-ruby")
    (version "1.4.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "yajl-ruby" version))
       (sha256
        (base32
         "16v0w5749qjp13xhjgr2gcsvjv6mf35br7iqwycix1n2h7kfcckf"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "spec"
       #:phases
       (modify-phases %standard-phases
         (add-before 'check 'patch-test-to-update-load-path
           (lambda _
             (substitute* "spec/parsing/large_number_spec.rb"
               (("require \"yajl\"")
                "$LOAD_PATH << 'lib'; require 'yajl'"))
             #t)))))
     (native-inputs
      (list ruby-rake-compiler ruby-rspec))
     (synopsis "Streaming JSON parsing and encoding library for Ruby")
     (description
      "Ruby C bindings to the Yajl JSON stream-based parser library.  The API
is compatible with the JSON gem, so yajl-ruby can act as a drop in
replacement.

A modified copy of yajl is used, and included in the package.")
     (home-page "https://github.com/brianmario/yajl-ruby")
     (license (list license:expat     ; Ruby code, yajl_ext.c and yajl_ext.h
                    license:bsd-3)))) ; Included, modified copy of yajl

(define-public ruby-yard
  (package
    (name "ruby-yard")
    (version "0.9.25")
    (source
     (origin
       (method git-fetch)
       ;; Tests do not pass if we build from the distributed gem.
       (uri (git-reference
             (url "https://github.com/lsegal/yard")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "1x7y4s557hrnq439lih7nqg1y7ximardw75jx9i92x3yzpviqqwa"))))
    (build-system ruby-build-system)
    (arguments
     ;; Note: Tests are willfully disabled to alleviate dependency cycle
     ;; problems.
     `(#:tests? #f
       #:phases (modify-phases %standard-phases
                  (add-after 'unpack 'do-not-set-date-in-gemspec
                    ;; Fix a reproducibility issue (see:
                    ;; https://github.com/lsegal/yard/issues/1343).
                    (lambda _
                      (substitute* "yard.gemspec"
                        ((".*s\\.date.*") ""))
                      #t)))))
    (synopsis "Documentation generation tool for Ruby")
    (description "YARD is a documentation generation tool for the Ruby
programming language.  It enables the user to generate consistent, usable
documentation that can be exported to a number of formats very easily, and
also supports extending for custom Ruby constructs such as custom class level
definitions.")
    (home-page "https://yardoc.org")
    (license license:expat)))

(define-public ruby-yard-with-tests
  (package
    (inherit ruby-yard)
    (name "ruby-yard-with-tests")
    (arguments
     (substitute-keyword-arguments
         (strip-keyword-arguments '(#:tests?) (package-arguments ruby-yard))
       ((#:test-target _ "default") "default")
       ((#:phases phases '%standard-phases)
        `(modify-phases ,phases
           (add-before 'check 'prepare-for-tests
             (lambda* (#:key tests? #:allow-other-keys)
               (when tests?
                 (substitute* "Rakefile"
                   ((".*[Ss]amus.*") ""))
                 ;; Delete the Gemfile to avoid errors relating to it.
                 (delete-file "Gemfile")
                 ;; $HOME needs to be set to somewhere writeable for tests to
                 ;; run.
                 (setenv "HOME" "/tmp"))))))))
    (native-inputs (list ruby-rspec ruby-rack ruby-redcloth ruby-asciidoctor))))

(define-public ruby-spectroscope
  (package
    (name "ruby-spectroscope")
    (version "0.1.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "spectroscope" version))
       (sha256
        (base32
         "0iiid9sm110qhx0i1zkds710cvsnmhd308wbqa7slkzbq2akrb3y"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             (with-output-to-file ".test"
               (lambda _
                 (display
                  "\
require 'ae/should'
require 'rspec'

include RSpec

Test.run :default do |run|
  run.files << 'spec/*_spec.rb'
end")))
             (invoke "ruby" "-Ilib" "-rrubytest" ".test"))))))
    (native-inputs
     (list ruby-ae ruby-rspec))
    (propagated-inputs
     (list ruby-rubytest))
    (synopsis "Behavior-Driven Development (BDD) framework built on RubyTest")
    (description "Spectroscope is a Behavior-Driven Development (BDD)
framework built on RubyTest, designed to emulate RSpec in most respects.  It
is assertion framework independent so any number of assertion systems can be
used, such as Assay or AE.")
    (home-page "http://rubyworks.github.com/spectroscope/")
    (license license:bsd-2)))

(define-public ruby-tomparse
  (package
    (name "ruby-tomparse")
    (version "0.4.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "tomparse" version))
       (sha256
        (base32
         "06xakk41f1kgj6j1ahkwn4r6cvidixvm4phhlrvmwb7c3pr8ygc8"))))
    (build-system ruby-build-system)
    ;; TODO: Tests require citron and rulebow, not yet packaged.
    (arguments '(#:tests? #f))
    (synopsis "TomDoc parser for Ruby")
    (description "TomParse is a TomDoc parser for Ruby.  It takes a code
comment as input and parses it into a convenient object-oriented structure in
accordance with the TomDoc standard.  See
@url{https://github.com/mojombo/tomdoc, TomDoc} for more information about the
TomDoc format.")
    (home-page "http://rubyworks.github.com/tomparse/")
    (license license:bsd-2)))

(define-public ruby-yard-tomdoc
  (package
    (name "ruby-yard-tomdoc")
    (version "0.7.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "yard-tomdoc" version))
       (sha256
        (base32
         "1725gs8b8klpwhrvnf2wwp7dw3zxs9vz2la983l2d8c4r4fn1j2z"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases (modify-phases %standard-phases
                  (replace 'check
                    (lambda _
                      (invoke "rubytest" "-Ilib" "-Itest" "test/"))))))
    (native-inputs
     (list ruby-rubytest-cli ruby-spectroscope ruby-ae))
    (propagated-inputs
     (list ruby-tomparse ruby-yard))
    (synopsis "TomDoc syntax for YARD")
    (description "This module adds support for the TomDoc documentation format
to YARD, a documentation generation tool for Ruby.")
    (home-page "http://rubyworks.github.com/yard-tomdoc/")
    (license license:expat)))

(define-public ruby-clap
  (package
    (name "ruby-clap")
    (version "1.0.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "clap" version))
              (sha256
               (base32
                "190m05k3pca72c1h8k0fnvby15m303zi0lpb9c478ad19wqawa5q"))))
    (build-system ruby-build-system)
    ;; Clap needs cutest for running tests, but cutest needs clap.
    (arguments `(#:tests? #f))
    (synopsis "Command line argument parsing for simple applications")
    (description
     "Clap provides command line argument parsing features.  It covers the
simple case of executing code based on the flags or parameters passed.")
    (home-page "https://github.com/djanowski/cutest")
    (license license:expat)))

(define-public ruby-cutest
  (package
    (name "ruby-cutest")
    (version "1.2.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "cutest" version))
              (sha256
               (base32
                "1mldhjn62g53vx4gq2qdqg2lgjvyrqxa8d0khf8347bbfgi16d32"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-clap))
    (synopsis "Run tests in separate processes")
    (description
     "Cutest runs tests in separate processes to avoid shared state.")
    (home-page "https://github.com/djanowski/cutest")
    (license license:expat)))

(define-public ruby-pygmentize
  (package
    (name "ruby-pygmentize")
    (version "0.0.3")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "pygmentize" version))
              (sha256
               (base32
                "1pxryhkiwvsz6xzda3bvqwz5z8ggzl1cdglf8qbcf4bb7akirdpb"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'fix-pygmentize-path
          (lambda _
            (substitute* "lib/pygmentize.rb"
              (("\"/usr/bin/env python.*")
               (string-append "\"" (which "pygmentize") "\"\n")))
            #t))
         (add-after 'build 'do-not-use-vendor-directory
          (lambda _
            ;; Remove bundled pygments sources
            ;; FIXME: ruby-build-system does not support snippets.
            (delete-file-recursively "vendor")
            (substitute* "pygmentize.gemspec"
              (("\"vendor/\\*\\*/\\*\",") ""))
            #t)))))
    (inputs
     `(("pygments" ,python-pygments)))
    (native-inputs
     (list ruby-cutest ruby-nokogiri))
    (synopsis "Thin Ruby wrapper around pygmentize")
    (description
     "Pygmentize provides a simple way to call pygmentize from within a Ruby
application.")
    (home-page "https://github.com/djanowski/pygmentize")
    (license license:expat)))

(define-public ruby-event-emitter
  (package
    (name "ruby-event-emitter")
    (version "0.2.6")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "event_emitter" version))
              (sha256
               (base32
                "148k9qv8102l3m6klc24dwip79f9y4bjr5z19dckd7ffbjyrf9n7"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases #~(modify-phases %standard-phases
                        (add-after 'extract-gemspec 'relax-requirements
                          (lambda _
                            (substitute* "event_emitter.gemspec"
                              (("~> 1.15") ">= 1.15")))))))
    (synopsis "Ruby port of EventEmitter from Node.js")
    (description
     "This package provides a Ruby port of EventEmitter from Node.js.")
    (home-page "https://shokai.github.io/event_emitter/")
    (license license:expat)))

(define-public ruby-eventmachine
  (package
    (name "ruby-eventmachine")
    (version "1.2.7")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "eventmachine" version))
       (sha256
        (base32
         "0wh9aqb0skz80fhfn66lbpr4f86ya2z5rx6gm5xlfhd05bj1ch4r"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f))               ; test suite tries to connect to google.com
    (inputs
     (list openssl))
    (native-inputs
     (list ruby-rake-compiler))
    (synopsis "Single-threaded network event framework for Ruby")
    (description
     "EventMachine implements a single-threaded engine for arbitrary network
communications.  EventMachine wraps all interactions with sockets, allowing
programs to concentrate on the implementation of network protocols.  It can be
used to create both network servers and clients.")
    ;; The ‘official’ rubyeventmachine.com domain is now registrar-squatted.
    (home-page "https://github.com/eventmachine/eventmachine")
    (license (list license:ruby license:gpl3)))) ; GPLv3 only AFAICT

(define-public ruby-ruby-engine
  (package
    (name "ruby-ruby-engine")
    (version "2.0.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "ruby_engine" version))
       (sha256
        (base32
         "0wqdcv8gxybp1y7kjhh18g3r9dczacs62d4ahcvyhz32bih8c9fm"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'extract-gemspec 'clean-up
           (lambda _
             (delete-file "Gemfile.lock")
             (substitute* "ruby_engine.gemspec"
               ;; Remove unnecessary imports that would entail further
               ;; dependencies.
               ((".*<rdoc.*") "")
               ((".*<rubygems-tasks.*") "")
               ;; Remove extraneous .gem file
               (("\"pkg/ruby_engine-[0-9.]+\\.gem\".freeze, ") "")
               (("\"Gemfile.lock\".freeze, ") "")
               ;; Soften rake dependency
               (("%q<rake>.freeze, \\[\"~> 10.0\"\\]")
                "%q<rake>.freeze, [\">= 10.0\"]")
               ;; Soften the rspec dependency
               (("%q<rspec>.freeze, \\[\"~> 2.4\"\\]")
                "%q<rspec>.freeze, [\">= 2.4\"]"))
             (substitute* "Rakefile"
               (("require 'rubygems/tasks'") "")
               (("Gem::Tasks.new") ""))
             ;; Remove extraneous .gem file that otherwise gets installed.
             (delete-file-recursively "pkg")
             #t)))))
    (native-inputs
     (list bundler ruby-rake ruby-rspec))
    (synopsis "Simplifies checking for Ruby implementation")
    (description
     "@code{ruby_engine} provides an RubyEngine class that can be used to
check which implementation of Ruby is in use.  It can provide the interpreter
name and provides query methods such as @{RubyEngine.mri?}.")
    (home-page "https://github.com/janlelis/ruby_engine")
    (license license:expat)))

(define-public ruby-turn
  (package
    (name "ruby-turn")
    (version "0.9.7")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "turn" version))
       (sha256
        (base32
         "1691rc2sq04cw8mxxh340k2j04ll90kwgcy8ddrp6rligmfrf8fw"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         ;; Tests fail because turn changes its environment so can no longer
         ;; find test/unit.  Instead simply test if the executable runs
         ;; without issue.
         (replace 'check
           (lambda _
             (invoke "ruby" "-Ilib" "bin/turn" "-h"))))))
    (propagated-inputs
     (list ruby-ansi ruby-minitest-4))
    (synopsis "Alternate set of alternative runners for MiniTest")
    (description
     "TURN provides a set of alternative runners for MiniTest which are both
colorful and informative.  TURN displays each test on a separate line with
failures being displayed immediately instead of at the end of the tests.  Note
that TURN is no longer being maintained.")
    (home-page "https://rubygems.org/gems/turn")
    (license license:expat)))

(define-public ruby-mimemagic
  (package
    (name "ruby-mimemagic")
    (version "0.3.3")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "mimemagic" version))
       (sha256
        (base32 "04cp5sfbh1qx82yqxn0q75c7hlcx8y1dr5g3kyzwm4mx6wi2gifw"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         ;; This phase breaks the tests, as it patches some of the test data.
         (delete 'patch-source-shebangs))))
    (native-inputs
     (list ruby-bacon))
    (synopsis "Ruby library for MIME detection by extension or content")
    (description
     "@acronym{MIME, Multipurpose Internet Mail Extensions} detection by
extension or content, using the freedesktop.org.xml shared-mime-info
database.")
    (home-page "https://github.com/minad/mimemagic")
    (license license:expat)))

(define-public ruby-mime-types-data
  (package
    (name "ruby-mime-types-data")
    (version "3.2016.0521")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "mime-types-data" version))
       (sha256
        (base32
         "04my3746hwa4yvbx1ranhfaqkgf6vavi1kyijjnw8w3dy37vqhkm"))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-hoe))
    (synopsis "Registry for information about MIME media type definitions")
    (description
     "@code{mime-types-data} provides a registry for information about
Multipurpose Internet Mail Extensions (MIME) media type definitions.  It can
be used with the Ruby mime-types library or other software to determine
defined filename extensions for MIME types, or to use filename extensions to
look up the likely MIME type definitions.")
    (home-page "https://github.com/mime-types/mime-types-data/")
    (license license:expat)))

(define-public ruby-mime-types
  (package
    (name "ruby-mime-types")
    (version "3.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "mime-types" version))
       (sha256
        (base32
         "0087z9kbnlqhci7fxh9f6il63hj1k02icq2rs0c6cppmqchr753m"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-mime-types-data))
    (native-inputs
     (list ruby-hoe
           ruby-fivemat
           ruby-minitest-focus
           ruby-minitest-rg
           ruby-minitest-bonus-assertions
           ruby-minitest-hooks))
    (synopsis "Library and registry for MIME content type definitions")
    (description "The mime-types library provides a library and registry for
information about Multipurpose Internet Mail Extensions (MIME) content type
definitions.  It can be used to determine defined filename extensions for MIME
types, or to use filename extensions to look up the likely MIME type
definitions.")
    (home-page "https://github.com/mime-types/ruby-mime-types")
    (license license:expat)))

(define-public ruby-mini-mime
  (package
    (name "ruby-mini-mime")
    (version "1.1.2")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "mini_mime" version))
        (sha256
         (base32
          "0lbim375gw2dk6383qirz13hgdmxlan0vc5da2l072j3qw6fqjm5"))))
    (build-system ruby-build-system)
    (synopsis "Lightweight mime type lookup toy")
    (description "This package provides a lightweight mime type lookup toy.")
    (home-page "https://github.com/discourse/mini_mime")
    (license license:expat)))

(define-public ruby-fileutils
  (package
    (name "ruby-fileutils")
    (version "1.7.0")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/ruby/fileutils")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0m68gaqclnc2wflilmrnr19kky2gr6fjf6k3yq02sf9scs281kid"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-before 'check 'disable-problematic-tests
            (lambda _
              (substitute* "test/fileutils/test_fileutils.rb"
                ;; The 'test_chown' tests depends on /etc/groups, which
                ;; doesn't exist in the build environment.
                (("def test_chown.*" all)
                 (string-append all "    return true\n"))
                ;; The 'test_cp_r_dev' expects a RuntimeError to be raised
                ;; when copying a char device to a directory, but this is not
                ;; triggered in the build environment, for reasons unknown.
                (("def test_cp_r_dev.*" all)
                 (string-append all "    return true\n"))))))))
    (synopsis "Ruby utility libray to manipulate files")
    (description "The FileUtils Ruby library includes Several file utility
methods for copying, moving, removing, etc.")
    (home-page "https://github.com/ruby/fileutils")
    (license license:bsd-2)))

(define-public ruby-fivemat
  (package
    (name "ruby-fivemat")
    (version "1.3.7")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "fivemat" version))
       (sha256
        (base32
         "0pzlycasvwmg4bbx7plllpqnhd9zlmmff8l2w3yii86nrm2nvf9n"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f)) ; no tests
    (synopsis "Each test file given its own line of dots")
    (description
     "Fivemat is a MiniTest/RSpec/Cucumber formatter that gives each test file
its own line of dots during testing.  It aims to provide test output that is
neither too verbose nor too minimal.")
    (home-page "https://github.com/tpope/fivemat")
    (license license:expat)))

(define-public ruby-sqlite3
  (package
    (name "ruby-sqlite3")
    (version "1.4.4")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "sqlite3" version))
       (sha256
        (base32
         "1z1wa639c278bsipczn6kv8b13fj85pi8gk7x462chqx6k0wm0ax"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-before 'check 'add-gemtest-file
           ;; This file exists in the repository but is not distributed.
           (lambda _ (invoke "touch" ".gemtest"))))))
    (inputs
     (list sqlite))
    (native-inputs
     (list ruby-hoe ruby-rake-compiler ruby-mini-portile-2))
    (synopsis "Interface with SQLite3 databases")
    (description
     "This module allows Ruby programs to interface with the SQLite3 database
engine.")
    (home-page
     "https://github.com/sparklemotion/sqlite3-ruby")
    (license license:bsd-3)))

(define-public ruby-shoulda-context
  (package
    (name "ruby-shoulda-context")
    (version "2.0.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "shoulda-context" version))
       (sha256
        (base32
         "0d1clcp92jv8756h09kbc55qiqncn666alx0s83za06q5hs4bpvs"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               ;; Do not run tests to avoid circular dependence with rails.
               ;; Instead just import the library to test.
               (invoke "ruby" "-Ilib" "-r" "shoulda-context")))))))
    (synopsis "Test::Unit context framework extracted from Shoulda")
    (description
     "@code{shoulda-context} is the context framework extracted from Shoulda.
Instead of writing Ruby methods with lots_of_underscores, shoulda-context adds
context, setup, and should blocks combine to produce natural test method
names.")
    (home-page "https://github.com/thoughtbot/shoulda-context")
    (license license:expat)))

(define-public ruby-shoulda-matchers
  (package
    (name "ruby-shoulda-matchers")
    (version "5.3.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "shoulda-matchers" version))
       (sha256
        (base32
         "11igjgh16dl5pwqizdmclzlzpv7mbmnh8fx7m9b5kfsjhwxqdfpn"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               ;; Do not run tests to avoid circular dependence with rails.  Instead
               ;; just import the library to test.
               (invoke "ruby" "-Ilib" "-r" "shoulda-matchers")))))))
    (propagated-inputs
     (list ruby-activesupport))
    (synopsis "Collection of testing matchers extracted from Shoulda")
    (description
     "Shoulda Matchers provides RSpec- and Minitest-compatible one-liners that
test common Rails functionality.  These tests would otherwise be much longer,
more complex, and error-prone.")
    (home-page "https://github.com/thoughtbot/shoulda-matchers")
    (license license:expat)))

(define-public ruby-shoulda
  (package
    (name "ruby-shoulda")
    (version "4.0.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "shoulda" version))
       (sha256
        (base32
         "02lww34kn1g6lidp4rx4rs6bqvirrzxlfw1y2wm11aif8f622xz6"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               ;; Don't run tests to avoid circular dependence with rails.
               ;; Instead just import the library to test.
               (invoke "ruby" "-Ilib" "-r" "shoulda"))))
         (add-after 'extract-gemspec 'relax-requirements
           (lambda _
             (substitute* "shoulda.gemspec"
               ;; An older version of shoulda-matchers (4.0) is used, out of
               ;; little maintenance rather than because of an real
               ;; incompatibility (see:
               ;; https://github.com/thoughtbot/shoulda/issues/275).
               ((", \\[\"~> 4.0\"]") "")))))))
    (propagated-inputs
     (list ruby-shoulda-context ruby-shoulda-matchers))
    (synopsis "Context framework and matchers for testing")
    (description
     "@code{shoulda} is a meta-package combining @code{shoulda-context} and
@code{shoulda-matchers} providing tools for writing tests.")
    (home-page "https://github.com/thoughtbot/shoulda")
    (license license:expat)))

(define-public ruby-unf
  (package
    (name "ruby-unf")
    (version "0.1.4")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "unf" version))
       (sha256
        (base32
         "0bh2cf73i2ffh4fcpdn9ir4mhq8zi50ik0zqa1braahzadx536a9"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-before 'check 'add-dependency-to-bundler
           (lambda _
             ;; test-unit is required but not provided by the bundler
             ;; environment.  This is fixed in the upstream repository but fix
             ;; has not been released.
             (substitute* "Gemfile"
               (("^gemspec") "gem 'test-unit'\ngemspec"))
             #t)))))
    (propagated-inputs
     (list ruby-unf-ext))
    (native-inputs
     (list ruby-shoulda bundler ruby-test-unit))
    (synopsis "Unicode Normalization Form support to Ruby and JRuby")
    (description
     "@code{ruby-unf} is a wrapper library to bring Unicode Normalization Form
support to both Ruby and JRuby.  It uses @code{unf_ext} on CRuby and
@code{java.text.Normalizer} on JRuby.")
    (home-page "https://github.com/knu/ruby-unf")
    (license license:bsd-2)))

(define-public ruby-warden
  (package
    (name "ruby-warden")
    (version "1.2.8")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "warden" version))
       (sha256
        (base32
         "1fr9n9i9r82xb6i61fdw4xgc7zjv7fsdrr4k0njchy87iw9fl454"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; No included tests
    (propagated-inputs
     (list ruby-rack))
    (synopsis "Rack middleware providing authentication")
    (description
     "Warden is a Rack-based middleware that provides a mechanism for
authentication in Ruby web applications.")
    (home-page "https://github.com/wardencommunity/warden")
    (license license:expat)))

(define-public ruby-warden-oauth2
  (package
    (name "ruby-warden-oauth2")
    (version "0.0.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "warden-oauth2" version))
       (sha256
        (base32
         "1z9154lvzrnnfjbjkmirh4n811nygp6pm2fa6ikr7y1ysa4zv3cz"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "spec"
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'remove-unnecessary-dependencies
           (lambda _
             (substitute* "Gemfile"
               ;; All of these gems relate to development, and are unnecessary
               ;; when running the tests
               (("gem 'guard-bundler'") "")
               (("gem 'guard'") "")
               (("gem 'guard-rspec'") "")
               (("gem 'rb-fsevent'") "")
               (("gem 'pry'") "")
               (("gem 'growl'") ""))
             #t))
         ;; The test suite doesn't work with rspec@2, and this is incompatible
         ;; with the current version of Rake, so invoke Rspec directly
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (invoke "bundle" "exec" "rspec"))
             #t)))))
    (propagated-inputs
     (list ruby-warden))
    (native-inputs
     (list bundler ruby-rspec-2 ruby-rack-test))
    (synopsis "OAuth 2.0 strategies for Warden")
    (description
     "This library extends Warden to support OAuth 2.0 authorized API
requests.")
    (home-page "https://github.com/opperator/warden-oauth2")
    (license license:expat)))

(define-public ruby-webmock
  (package
    (name "ruby-webmock")
    (version "3.11.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "webmock" version))
       (sha256
        (base32
         "1hdlbvfw316lkz251qnfk79drmaay7l51kidvicz41nhvw12xz8v"))))
    (build-system ruby-build-system)
    (native-inputs
     (list bundler ruby-rspec))
    (propagated-inputs
     (list ruby-addressable ruby-crack ruby-hashdiff))
    (synopsis "Allows stubbing and setting expectations on HTTP requests")
    (description
     "WebMock allows stubbing HTTP requests and setting expectations on HTTP
requests.  This is useful when testing software.")
    (home-page "https://github.com/bblimke/webmock")
    (license license:expat)))

(define-public ruby-webmock-2
  (package
    (inherit ruby-webmock)
    (name "ruby-webmock")
    (version "2.3.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "webmock" version))
       (sha256
        (base32
         "04hkcqsmbfnp8g237pisnc834vpgildklicbjbyikqg0bg1rwcy5"))))))

(define-public ruby-unicode-display-width
  (package
    (name "ruby-unicode-display-width")
    (version "2.4.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "unicode-display_width" version))
       (sha256
        (base32
         "1gi82k102q7bkmfi7ggn9ciypn897ylln1jk9q67kjhr39fj043a"))))
    (build-system ruby-build-system)
    (arguments
     '(;; Test data not included.
       #:tests? #f))
    (synopsis "Determine the monospace display width of Ruby strings")
    (description
     "@code{Unicode::DisplayWidth} is a Ruby library which can determine the
display width of strings in Ruby.")
    (home-page "https://github.com/janlelis/unicode-display_width")
    (license license:expat)))

;; There is another gem called 'ruby-version' so we use an underscore in this
;; name
(define-public ruby_version
  (package
    (name "ruby_version")
    (version "1.0.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "ruby_version" version))
       (sha256
        (base32
         "0lvc7bd5ps3w2vq2wb02i0pi3vfcx2rnckx2ix4rjym1qf52kb2j"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-before 'check 'fix-dependencies
           (lambda _
             ;; Remove the Gemfile.lock, as we want to use Guix packages at
             ;; whatever versions.
             (delete-file "Gemfile.lock")
             ;; Remove the included gem files as they unnecessary.
             (delete-file-recursively "pkg/")
             ;; Accept any version of rake, rdoc and rspec
             (substitute* "ruby_version.gemspec"
               (("%q<rake.*") "%q<rake>)\n")
               (("%q<rdoc.*") "%q<rdoc>)\n")
               (("%q<rspec.*") "%q<rspec>)\n"))
             ;; Do not use bundler.
             (substitute* "Rakefile"
               (("Bundler\\.setup.*") "nil\n"))
             #t)))))
    (native-inputs
     (list ruby-rdoc ruby-rspec ruby-rubygems-tasks))
    (synopsis "Ruby library to help check the Ruby version")
    (description "@code{ruby_version} provides a @code{RubyVersion} module to simplify
checking for the right Ruby version in software.")
    (home-page "https://github.com/janlelis/ruby_version")
    (license license:expat)))

(define-public ruby-websocket-client-simple
  (package
    (name "ruby-websocket-client-simple")
    (version "0.6.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "websocket-client-simple" version))
              (sha256
               (base32
                "1ypl4xvlh5c99zbn20sifv7gv04zi20ly464vsgikfrpn5f37bid"))))
    (build-system ruby-build-system)
    (arguments (list #:test-target "default"))
    (native-inputs (list ruby-eventmachine ruby-websocket-eventmachine-server))
    (propagated-inputs (list ruby-event-emitter ruby-websocket))
    (synopsis "Simple WebSocket client for Ruby")
    (description "This package provides a simple WebSocket client for Ruby.")
    (home-page "https://github.com/ruby-jp/websocket-client-simple")
    (license license:expat)))

(define-public ruby-websocket-eventmachine-base
  (package
    (name "ruby-websocket-eventmachine-base")
    (version "1.2.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "websocket-eventmachine-base" version))
              (sha256
               (base32
                "0wiz61mcwgs3k21cdr5l9b4jpg29gl6mflfampww2v525yc3hr1r"))))
    (build-system ruby-build-system)
    (arguments
     (list #:tests? #f)) ;no test suite
    (propagated-inputs (list ruby-eventmachine ruby-websocket
                             ruby-websocket-native))
    (synopsis "WebSocket base for Ruby client and server")
    (description "This package provides a WebSocket base for a Ruby client and
server.")
    (home-page "https://github.com/imanel/websocket-eventmachine-base")
    (license license:expat)))

(define-public ruby-websocket-eventmachine-server
  (package
    (name "ruby-websocket-eventmachine-server")
    (version "1.0.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "websocket-eventmachine-server" version))
              (sha256
               (base32
                "0iqpzc8s028nck1flqaj784gvyn64wy1h3svpa4y2847wklg8sms"))))
    (build-system ruby-build-system)
    ;; TODO: The test suite requires Autobahn, not yet packaged in Guix.
    (arguments (list #:tests? #f))
    (propagated-inputs (list ruby-websocket-eventmachine-base))
    (synopsis "WebSocket server for Ruby")
    (description "This package provides a WebSocket server for Ruby.")
    (home-page "https://github.com/imanel/websocket-eventmachine-server")
    (license license:expat)))

(define-public ruby-websocket-native
  (package
    (name "ruby-websocket-native")
    (version "1.0.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "websocket-native" version))
              (sha256
               (base32
                "1kgvd3gyzh7hk0ddzn85jrs4csxm54qnvla95ldyn6rzgfbjchdn"))))
    (build-system ruby-build-system)
    (arguments
     (list #:test-target "spec"
           #:phases #~(modify-phases %standard-phases
                        (add-before 'check 'disable-problematic-tests
                          (lambda _
                            (substitute* "spec/websocket_spec.rb"
                              (("it \"should have mask_native defined\"" all)
                               (string-append "x" all)))))
                        (add-after 'build 'compile
                          (lambda _
                            (invoke "rake" "compile"))))))
    (native-inputs (list ruby-rake-compiler ruby-rspec))
    (synopsis "Native Ruby extension for the WebSocket gem")
    (description "This package provides a native extension that can increase
performance by about 25% compared to the pure Ruby WebSocket implementation.")
    (home-page "https://github.com/imanel/websocket-ruby-native")
    (license license:expat)))

(define-public ruby-websocket-driver
  (package
   (name "ruby-websocket-driver")
   (version "0.7.1")
   (source
    (origin
     (method url-fetch)
     (uri (rubygems-uri "websocket-driver" version))
     (sha256
      (base32 "1bxamwqldmy98hxs5pqby3andws14hl36ch78g0s81gaz9b91nj2"))))
   (build-system ruby-build-system)
   (arguments
    '(#:tests? #f))                     ; no included tests
   (propagated-inputs
    (list ruby-websocket-extensions))
   (synopsis "WebSocket protocol handler with pluggable I/O")
   (description
    "@code{websocket-driver} provides a complete implementation of the
WebSocket protocols that can be hooked up to any TCP library")
   (home-page "https://github.com/faye/websocket-driver-ruby")
   (license license:expat)))

(define-public ruby-websocket-extensions
  (package
    (name "ruby-websocket-extensions")
    (version "0.1.3")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "websocket-extensions" version))
       (sha256
        (base32
         "034sdr7fd34yag5l6y156rkbhiqgmy395m231dwhlpcswhs6d270"))))
    (build-system ruby-build-system)
    (arguments
     '(;; No included tests
       #:tests? #f))
    (synopsis "Generic extension manager for WebSocket connections")
    (description
     "@code{websocket-extensions} provides a container for registering
extension plugins.")
    (home-page "https://github.com/faye/websocket-extensions-ruby")
    (license license:expat)))

(define-public ruby-domain-name
  (package
    (name "ruby-domain-name")
    (version "0.5.20190701")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "domain_name" version))
       (sha256
        (base32 "0lcqjsmixjp52bnlgzh4lg9ppsk52x9hpwdjd53k8jnbah2602h0"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-before 'check 'fix-versions
           (lambda _
             ;; Fix NameError that appears to already be fixed upstream.
             (substitute* "Rakefile"
               (("DomainName::VERSION")
                "Bundler::GemHelper.gemspec.version"))
             ;; Loosen unnecessarily strict test-unit version specification.
             (substitute* "domain_name.gemspec"
               (("<test-unit>.freeze, \\[\\\"~> 2.5.5") "<test-unit>, [\">0"))
             #t)))))
    (propagated-inputs
     (list ruby-unf))
    (native-inputs
     (list ruby-shoulda bundler ruby-test-unit))
    (synopsis "Domain name manipulation library")
    (description
     "@code{domain_name} is a Domain name manipulation library.  It parses a
domain name ready for extracting the registered domain and TLD (Top Level
Domain).  It can also be used for cookie domain validation based on the Public
Suffix List.")
    (home-page "https://github.com/knu/ruby-domain_name")
    (license license:bsd-2)))

(define-public ruby-dotenv
  (package
    (name "ruby-dotenv")
    (version "2.8.1")
    (source (origin
              (method git-fetch)        ;for the tests
              (uri (git-reference
                    (url "https://github.com/bkeepers/dotenv")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0s1a71jxppa20fsm2rd1vym099ib48m039rmhggmz99hc3z1fvvr"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:test-target "spec"
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'do-not-build-dotenv-rails
            (lambda _
              ;; The repository includes the definitions of two packages,
              ;; 'dotenv' and 'dotenv-rails'.  Since we want to package them
              ;; separately, remove the dotenv-rails and associated Rake
              ;; tasks.
              (delete-file "dotenv-rails.gemspec")
              (delete-file "spec/dotenv/rails_spec.rb")
              (substitute* "Rakefile"
                (("DotenvRailsGemHelper.install_tasks name: \"dotenv-rails\"")
                 "")
                ((", \"dotenv-rails:.*\"")
                 ""))))
          (replace 'replace-git-ls-files
            (lambda _
              (substitute* "dotenv.gemspec"
                (("`git ls-files README.md LICENSE lib bin \\| grep -v rails`")
                 "`find README.md LICENSE lib bin -type f | sort | \
grep -v rails`")))))))
    (native-inputs (list ruby-standard ruby-rspec))
    (synopsis "Ruby library for setting environment variables")
    (description "Dotenv is a Ruby library for setting environment variables
defined in a @file{.env} file.")
    (home-page "https://github.com/bkeepers/dotenv")
    (license license:expat)))

(define-public ruby-dotenv-rails
  (package
    (inherit ruby-dotenv)
    (name "ruby-dotenv-rails")
    (arguments
     (substitute-keyword-arguments (package-arguments ruby-dotenv)
       ((#:phases phases '%standard-phases)
        #~(modify-phases #$phases
            (delete 'do-not-build-dotenv-rails)
            (add-after 'unpack 'delete-Gemfile
              (lambda _
                ;; It defines extraneous dependencies; remove it.
                (delete-file "Gemfile")))
            (add-after 'unpack 'remove-extraneous-gemspec
              (lambda _
                (delete-file "dotenv.gemspec")
                (substitute* "Gemfile"
                  ((".*\"dotenv\".*") ""))
                (substitute* "Rakefile"
                  ;; Remove the dotenv-related Rake tasks.
                  (("Bundler::GemHelper.install_tasks name: \"dotenv\"")
                   "")
                  (("\"dotenv:[^\"]*\", ")
                   ""))))
            (replace 'replace-git-ls-files
              (lambda _
                (substitute* "dotenv-rails.gemspec"
                  (("`git ls-files lib \\| grep rails`")
                   "`find lib -type f | sort | grep rails`"))))))))
    (native-inputs (list ruby-rspec ruby-spring ruby-standard))
    (propagated-inputs (list ruby-dotenv ruby-railties))
    (synopsis "Ruby library for setting environment variables in Rails project")
    (description "Dotenv is a Ruby library for setting environment variables
defined in a @file{.env} file.  This is the Rails variant, adapted for use
with Ruby on Rails projects.")))

(define-public ruby-http-cookie
  (package
    (name "ruby-http-cookie")
    (version "1.0.3")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "http-cookie" version))
       (sha256
        (base32
         "004cgs4xg5n6byjs7qld0xhsjq3n6ydfh897myr2mibvh6fjc49g"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-before 'check 'add-dependency-to-bundler
           (lambda _
             ;; Fix NameError
             (substitute* "Rakefile"
               (("HTTP::Cookie::VERSION")
                "Bundler::GemHelper.gemspec.version"))
             #t)))))
    (propagated-inputs
     (list ruby-domain-name))
    (native-inputs
     `(("rubysimplecov" ,ruby-simplecov)
       ("bundler" ,bundler)
       ("ruby-sqlite3" ,ruby-sqlite3)
       ("ruby-test-unit" ,ruby-test-unit)))
    (synopsis "Handle HTTP Cookies based on RFC 6265")
    (description
     "@code{HTTP::Cookie} is a Ruby library to handle HTTP Cookies based on
RFC 6265.  It has been designed with security, standards compliance and
compatibility in mind, to behave just the same as today's major web browsers.
It has built-in support for the legacy @code{cookies.txt} and
@code{cookies.sqlite} formats of Mozilla Firefox.")
    (home-page "https://github.com/sparklemotion/http-cookie")
    (license license:expat)))

(define-public ruby-httpclient
  (package
    (name "ruby-httpclient")
    (version "2.8.3")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "httpclient" version))
       (sha256
        (base32
         "19mxmvghp7ki3klsxwrlwr431li7hm1lczhhj8z4qihl2acy8l99"))))
    (build-system ruby-build-system)
    (arguments
     '(;; TODO: Some tests currently fail
       ;; ------
       ;; 211 tests, 729 assertions, 13 failures, 4 errors, 0 pendings,
       ;; 2 omissions, 0 notifications
       ;; 91.866% passed
       ;; ------
       ;; 6.49 tests/s, 22.41 assertions/s
       #:tests? #f
       #:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (if tests?
                 (invoke "ruby"
                         "-Ilib"
                         "test/runner.rb")
                 #t))))))
    (native-inputs
     (list ruby-rack))
    (synopsis
     "Make HTTP requests with support for HTTPS, Cookies, authentication and more")
    (description
     "The @code{httpclient} ruby library provides functionality related to
HTTP.  Compared to the @code{net/http} library, @{httpclient} also provides
Cookie, multithreading and authentication (digest, NTLM) support.

Also provided is a @command{httpclient} command, which can perform HTTP
requests either using arguments or with an interactive prompt.")
    (home-page "https://github.com/nahi/httpclient")
    (license license:ruby)))

(define-public ruby-ansi
  (package
    (name "ruby-ansi")
    (version "1.5.0")
    (source
     (origin
       (method git-fetch)
       ;; Fetch from GitHub as the gem does not contain testing code.
       (uri (git-reference
              (url "https://github.com/rubyworks/ansi")
              (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "1wsz7xxwl3vkh277jb7fd7akqnqqgbvalxzpjwniiqk8ghfprbi5"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         ;; Disable testing to break the cycle ansi, ae, ansi, as well as the
         ;; cycle ansi, qed, ansi.  Instead simply test that the library can
         ;; be require'd.
         (replace 'check
           (lambda _
             (invoke "ruby" "-Ilib" "-r" "ansi")))
         (add-before 'validate-runpath 'replace-broken-symlink
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (file (string-append
                           out "/lib/ruby/vendor_ruby/gems/ansi-"
                           ,version "/lib/ansi.yml")))
               ;; XXX: This symlink is broken since ruby 2.4.
               ;; https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00034.html
               (delete-file file)
               (symlink "../.index" file)
               #t))))))
    (synopsis "ANSI escape code related libraries")
    (description
     "This package is a collection of ANSI escape code related libraries
enabling ANSI colorization and stylization of console output.  Included in the
library are the @code{Code} module, which defines ANSI codes as constants and
methods, a @code{Mixin} module for including color methods, a @code{Logger}, a
@code{ProgressBar}, and a @code{String} subclass.  The library also includes a
@code{Terminal} module which provides information about the current output
device.")
    (home-page "https://rubyworks.github.io/ansi/")
    (license license:bsd-2)))

(define-public ruby-systemu
  (package
    (name "ruby-systemu")
    (version "2.6.5")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "systemu" version))
       (sha256
        (base32
         "0gmkbakhfci5wnmbfx5i54f25j9zsvbw858yg3jjhfs5n4ad1xq1"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-before 'check 'set-version
           (lambda _
             (setenv "VERSION" ,version)
             #t)))))
    (synopsis "Capture of stdout/stderr and handling of child processes")
    (description
     "Systemu can be used on any platform to return status, stdout, and stderr
of any command.  Unlike other methods like @code{open3} and @code{popen4}
there is no danger of full pipes or threading issues hanging your process or
subprocess.")
    (home-page "https://github.com/ahoward/systemu")
    (license license:ruby)))

(define-public ruby-bcrypt
  (package
    (name "ruby-bcrypt")
    (version "3.1.18")
    ;; FIXME: Unbundle the bcrypt library used.
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "bcrypt" version))
              (sha256
               (base32
                "048z3fvcknqx7ikkhrcrykxlqmf9bzc7l0y5h1cnvrc9n2qf0k8m"))))
    (build-system ruby-build-system)
    (arguments (list #:test-target "default")) ;compile + spec
    (native-inputs (list ruby-rake-compiler ruby-rspec))
    (synopsis  "Ruby bcrypt wrapper")
    (description "This Ruby library provides a simple wrapper to bcrypt, a
secure hash algorithm for hashing passwords.")
    (home-page "https://github.com/bcrypt-ruby/bcrypt-ruby")
    (license license:expat)))

(define-public ruby-bio-commandeer
  (package
    (name "ruby-bio-commandeer")
    (version "0.4.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "bio-commandeer" version))
       (sha256
        (base32
         "0khpfw1yl5l3d2m8nxpkk32ybc4c3pa5hic3agd160jdfjjjnlni"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           ;; Run test without calling 'rake' so that jeweler is
           ;; not required as an input.
           (lambda _
             (invoke "rspec" "spec/bio-commandeer_spec.rb"))))))
    (propagated-inputs
     (list ruby-bio-logger ruby-systemu))
    (native-inputs
     (list bundler ruby-rspec))
    (synopsis "Simplified running of shell commands from within Ruby")
    (description
     "Bio-commandeer provides an opinionated method of running shell commands
from within Ruby.  The advantage of bio-commandeer over other methods of
running external commands is that when something goes wrong, messages printed
to the @code{STDOUT} and @code{STDERR} streams are reported, giving extra
detail to ease debugging.")
    (home-page "https://github.com/wwood/bioruby-commandeer")
    (license license:expat)))

(define-public ruby-rubytest
  (package
    (name "ruby-rubytest")
    (version "0.8.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "rubytest" version))
       (sha256
        (base32
         "19jydsdnkl81i9dhdcr4dc34j0ilm68ff2ngnka1hi38xiw4p5qz"))))
    (build-system ruby-build-system)
    (arguments
     ;; Disable regular testing to break the cycle rubytest, qed, brass,
     ;; rubytest, as well as the cycle rubytest, qed, ansi, rubytest.  Instead
     ;; simply test that the library can be require'd.
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             (invoke "ruby" "-Ilib" "-r" "rubytest"))))))
    (propagated-inputs
     (list ruby-ansi))
    (synopsis "Universal test harness for Ruby")
    (description
     "Rubytest is a testing meta-framework for Ruby.  It can handle any
compliant test framework and can run tests from multiple frameworks in a
single pass.")
    (home-page "https://rubyworks.github.io/rubytest")
    (license license:bsd-2)))

(define-public ruby-brass
  (package
    (name "ruby-brass")
    (version "1.2.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "brass" version))
       (sha256
        (base32
         "154lp8rp1vmg60ri1j4cb8hqlw37z7bn575h899v8hzxwi11sxka"))))
    (build-system ruby-build-system)
    (arguments
     ;; Disable tests to break the cycle brass, lemon, ae, qed, brass.
     ;; Instead simply test that the library can be require'd.
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             (invoke "ruby" "-Ilib" "-r" "brass"))))))
    (synopsis "Basic foundational assertions framework")
    (description
     "BRASS (Bare-Metal Ruby Assertion System Standard) is a basic
foundational assertions framework for other assertion and test frameworks to
make use of.")
    (home-page "https://rubyworks.github.io/brass")
    (license license:bsd-2)))

(define-public ruby-qed
  (package
    (name "ruby-qed")
    (version "2.9.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "qed" version))
       (sha256
        (base32
         "03h4lmlxpcya8j7s2cnyscqlx8v3xl1xgsw5y1wk1scxcgz2vbmr"))))
    (build-system ruby-build-system)
    (arguments
     ;; Disable testing to break the cycle qed, ansi, qed, among others.
     ;; Instead simply test that the executable runs using --copyright.
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             (invoke "ruby" "-Ilib" "bin/qed" "--copyright"))))))
    (propagated-inputs
     (list ruby-ansi ruby-brass))
    (synopsis "Test framework utilizing literate programming techniques")
    (description
     "@dfn{Quality Ensured Demonstrations} (QED) is a test framework for
@dfn{Test Driven Development} (TDD) and @dfn{Behaviour Driven
Development} (BDD) utilizing Literate Programming techniques.  QED sits
somewhere between lower-level testing tools like @code{Test::Unit} and
requirement specifications systems like Cucumber.")
    (home-page "https://rubyworks.github.io/qed")
    (license license:bsd-2)))

(define-public ruby-que
  (package
    (name "ruby-que")
    (version "1.0.0.beta3")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "que" version))
       (sha256
        (base32
         "0gr9pb814d4qj3ds98g6cjrdk7wv0yg8aqbm7c1lmgl87jkg8q04"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; No included tests
    (synopsis "Job queue using PostgreSQL written in Ruby")
    (description
     "This package provides a job queue that uses PostgreSQL for storing jobs
and locking between worker processes.")
    (home-page "https://github.com/chanks/que")
    (license license:expat)))

(define-public ruby-queue-classic
  (package
    (name "ruby-queue-classic")
    (version "4.0.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "queue_classic" version))
              (sha256
               (base32
                "0npyhajf2fc80apkw9s2kj0n254w5lcl4xpjidg5d5w1fb19abh6"))))
    (build-system ruby-build-system)
    (arguments (list #:tests? #f))      ;tests require a postgresql server
    (native-inputs (list ruby-activerecord ruby-minitest-reporters))
    (propagated-inputs (list ruby-pg))
    (synopsis "Queuing library for Ruby")
    (description "@code{queue_classic} is a queuing library for Ruby
applications (Rails, Sinatra, etc.)  @code{queue_classic} features
asynchronous job polling, database maintained locks and has a single
dependency, @code{pg}.")
    (home-page "https://github.com/QueueClassic/queue_classic")
    (license license:expat)))

(define-public ruby-ae
  (package
    (name "ruby-ae")
    (version "1.8.2")
    (source
     (origin
       (method git-fetch)
       ;; Fetch from github so tests are included.
       (uri (git-reference
              (url "https://github.com/rubyworks/ae")
              (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "11299jj5ma8mi7b4majkyjy70y6zlqpgl8aql1c5lvfjavlpwmlp"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _ (invoke "qed")))
         (add-before 'validate-runpath 'replace-broken-symlink
           (lambda* (#:key outputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (file (string-append
                           out "/lib/ruby/vendor_ruby/gems/ae-"
                           ,version "/lib/ae.yml")))
               ;; XXX: This symlink is broken since ruby 2.4.
               ;; https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00034.html
               (delete-file file)
               (symlink "../.index" file)
               #t))))))
    (propagated-inputs
     (list ruby-ansi))
    (native-inputs
     (list ruby-qed))
    (synopsis "Assertions library")
    (description
     "Assertive Expressive (AE) is an assertions library specifically designed
for reuse by other test frameworks.")
    (home-page "https://rubyworks.github.io/ae/")
    (license license:bsd-2)))

(define-public ruby-lemon
  (package
    (name "ruby-lemon")
    (version "0.9.1")
    (source
    (origin
      (method url-fetch)
      (uri (rubygems-uri "lemon" version))
      (sha256
       (base32
        "0gqhpgjavgpvx23rqpfqcv3d5bs8gc7lr9yvj8kxgp7mfbdc2jcm"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check (lambda _ (invoke "qed"))))))
    (propagated-inputs
     (list ruby-ae ruby-ansi ruby-rubytest))
    (native-inputs
     (list ruby-qed))
    (synopsis "Test framework correlating code structure and test unit")
    (description
     "Lemon is a unit testing framework that enforces highly formal
case-to-class and unit-to-method test construction.  This enforcement can help
focus concern on individual units of behavior.")
    (home-page "https://rubyworks.github.io/lemon")
    (license license:bsd-2)))

(define-public ruby-rubytest-cli
  (package
    (name "ruby-rubytest-cli")
    (version "0.2.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "rubytest-cli" version))
       (sha256
        (base32
         "0n7hv4k1ba4fm3i98c6ydbsqhkxgbp52mhi70ba1x3mqzfvk438p"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f)) ; no tests
    (propagated-inputs
     (list ruby-ansi ruby-rubytest))
    (synopsis "Command-line interface for rubytest")
    (description
     "Rubytest CLI is a command-line interface for running tests for
Rubytest-based test frameworks.  It provides the @code{rubytest} executable.")
    (home-page "https://rubyworks.github.io/rubytest-cli")
    (license license:bsd-2)))

(define-public ruby-hashery
  (package
    (name "ruby-hashery")
    (version "2.1.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "hashery" version))
       (sha256
        (base32
         "0qj8815bf7q6q7llm5rzdz279gzmpqmqqicxnzv066a020iwqffj"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             (invoke "qed")
             (invoke "rubytest" "-Ilib" "-Itest" "test/"))))))
    (native-inputs
     (list ruby-rubytest-cli ruby-qed ruby-lemon))
    (synopsis "Hash-like classes with extra features")
    (description
     "The Hashery is a tight collection of @code{Hash}-like classes.
Included are the auto-sorting @code{Dictionary} class, the efficient
@code{LRUHash}, the flexible @code{OpenHash} and the convenient
@code{KeyHash}.  Nearly every class is a subclass of the @code{CRUDHash} which
defines a CRUD (Create, Read, Update and Delete) model on top of Ruby's
standard @code{Hash} making it possible to subclass and augment to fit any
specific use case.")
    (home-page "https://rubyworks.github.io/hashery")
    (license license:bsd-2)))

(define-public ruby-rc4
  (package
    (name "ruby-rc4")
    (version "0.1.5")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "ruby-rc4" version))
       (sha256
        (base32
         "00vci475258mmbvsdqkmqadlwn6gj9m01sp7b5a3zd90knil1k00"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             (invoke "rspec" "spec/rc4_spec.rb"))))))
    (native-inputs
     (list ruby-rspec-2))
    (synopsis "Implementation of the RC4 algorithm")
    (description
     "RubyRC4 is a pure Ruby implementation of the RC4 algorithm.")
    (home-page "https://github.com/caiges/Ruby-RC4")
    (license license:expat)))

(define-public ruby-afm
  (package
    (name "ruby-afm")
    (version "0.2.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "afm" version))
       (sha256
        (base32
         "06kj9hgd0z8pj27bxp2diwqh6fv7qhwwm17z64rhdc4sfn76jgn8"))))
    (build-system ruby-build-system)
    (native-inputs
     (list bundler))
    (synopsis "Read Adobe Font Metrics (afm) files")
    (description
     "This library provides methods to read @dfn{Adobe Font Metrics} (afm)
files and use the data therein.")
    (home-page "https://github.com/halfbyte/afm")
    (license license:expat)))

(define-public ruby-ascii85
  (package
    (name "ruby-ascii85")
    (version "1.0.3")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "Ascii85" version))
       (sha256
        (base32
         "0658m37jjjn6drzqg1gk4p6c205mgp7g1jh2d00n4ngghgmz5qvs"))))
    (build-system ruby-build-system)
    (native-inputs
     (list bundler))
    (synopsis "Encode and decode Ascii85 binary-to-text encoding")
    (description
     "This library provides methods to encode and decode Ascii85
binary-to-text encoding.  The main modern use of Ascii85 is in PostScript and
@dfn{Portable Document Format} (PDF) file formats.")
    (home-page "https://github.com/datawraith/ascii85gem")
    (license license:expat)))

(define-public ruby-ttfunk
  (package
    (name "ruby-ttfunk")
    (version "1.7.0")
    (source
     (origin
       (method git-fetch)
       ;; Fetch from github as the gem does not contain testing code.
       (uri (git-reference
             (url "https://github.com/prawnpdf/ttfunk")
             (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "1jyxn928mpyb1sikjd93s3v8fmh33232pq41ziaph513j7am6fi5"))))
    (build-system ruby-build-system)
    (arguments
     (list #:test-target "spec"         ;avoid the rubocop target
           #:phases
           #~(modify-phases %standard-phases
               (add-after 'unpack 'remove-missing-key-directive
                 ;; This seem to be a common problem in Ruby projects (see:
                 ;; https://github.com/prawnpdf/ttfunk/issues/99).
                 (lambda _
                   (substitute* "ttfunk.gemspec"
                     ((".*spec.signing_key.*") "")))))))
    (native-inputs (list ruby-prawn-dev))
    (synopsis "Font metrics parser for the Prawn PDF generator")
    (description
     "TTFunk is a TrueType font parser written in pure Ruby.  It is used as
part of the Prawn PDF generator.")
    (home-page "https://github.com/prawnpdf/ttfunk")
    ;; From the README: "Matz's terms for Ruby, GPLv2, or GPLv3. See LICENSE
    ;; for details."
    (license %prawn-project-licenses)))

(define-public ruby-puma
  (package
    (name "ruby-puma")
    (version "6.2.0")
    (source
     (origin
       (method git-fetch)               ;for tests
       (uri (git-reference
             (url "https://github.com/puma/puma")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0d71h5ggvfgnxq9msd1hmcz3s8mspzf7kqas1hzr0w9pfafddyv3"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'disable-rubocop
            (lambda _
              (setenv "PUMA_NO_RUBOCOP" "1")))
          (add-after 'unpack 'use-rack-2
            (lambda _
              (setenv "PUMA_CI_RACK_2" "1")))
          (add-before 'build 'increase-resource-limits
            (lambda _
              ;; The test suite requires a higher number of open files.  Try
              ;; increasing the soft resource limit of max open files to 2048,
              ;; or equal to the hard limit, whichever is lower.
              (call-with-values (lambda () (getrlimit 'nofile))
                (lambda (soft hard)
                  (when (and soft (< soft 2048))
                    (if hard
                        (setrlimit 'nofile (min hard 2048) hard)
                        (setrlimit 'nofile 2048 #f))
                    (format
                     #t "increased maximum number of open files from ~d to ~d~%"
                     soft (if hard (min hard 2048) 2048)))))))
          (add-before 'build 'fix-gemspec
            (lambda _
              (substitute* "puma.gemspec"
                (("`git ls-files -- bin docs ext lib tools`")
                 "`find bin docs ext lib tools -type f |sort`"))))
          (delete 'check)               ;moved after install
          (add-after 'install 'check
            (lambda* (#:key tests? #:allow-other-keys)
              (when tests?
                (invoke "bundle" "exec" "rake" "test"))))
          (add-after 'install 'delete-mkmf.log
            (lambda _
              ;; Rubygems installs build log files that embed volatile file
              ;; names (see:
              ;; https://github.com/rubygems/rubygems/issues/6259).
              (for-each delete-file (find-files #$output "^mkmf\\.log$"))))
          (add-before 'check 'disable-problematic-tests
            (lambda _
              (let-syntax ((skip-tests
                            (syntax-rules ()
                              ((_ file test ...)
                               (substitute* file
                                 (((string-append "def " test ".*") all)
                                  (string-append
                                   all "    skip('fails on guix')\n")) ...)))))
                ;; The test failures were reported at:
                ;; https://github.com/puma/puma/issues/3093, but appear to be
                ;; caused by the Guix build container, perhaps the lack of
                ;; zombie process reaping (see:
                ;; https://issues.guix.gnu.org/30948).
                ;;  All the tests in the 'test_worker_gem_independence.rb'
                ;;  module fail with "Expected false to be truthy.".
                (delete-file "test/test_worker_gem_independence.rb")
                (skip-tests "test/test_integration_ssl_session.rb"
                            ;; The TLS 1.2 test fails for unknown reasons.
                            "test_off_tls1_2")
                (skip-tests "test/test_integration_cluster.rb"
                            "test_fork_worker_on_refork"
                            "test_hot_restart_does_not_drop_connections"
                            "test_culling_strategy_oldest_fork_worker"
                            "test_usr1_fork_worker")
                (skip-tests "test/test_integration_pumactl.rb"
                            "test_refork_cluster"))))
          (add-before 'check 'relax-test-case-timeout
            (lambda _
              ;; The default value is 45 s and easily causes timeouts.
              (setenv "TEST_CASE_TIMEOUT" "600")))
          (add-before 'check 'set-home
            (lambda _
              ;; Some tests fail if the cannot write to HOME.
              (setenv "HOME" "/tmp")))
          (add-before 'check 'set-paths
            (lambda _
              ;; The test suite requires the 'puma' command to be on PATH.
              (setenv "PATH" (string-append (getenv "PATH") ":"
                                            #$output "/bin"))
              (setenv "GEM_PATH" (string-append
                                  (getenv "GEM_PATH") ":"
                                  #$output "/lib/ruby/vendor_ruby")))))))
    (native-inputs
     (list bundler
           curl
           ruby-json
           ruby-localhost
           ruby-m
           ruby-minitest-proveit
           ruby-minitest-retry
           ruby-minitest-stub-const
           ruby-rack
           ruby-rake-compiler
           ruby-webrick))
    (inputs
     (list openssl
           ruby-nio4r))
    (synopsis "Simple, concurrent HTTP server for Ruby/Rack")
    (description
     "Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server
for Ruby/Rack applications.  Puma is intended for use in both development and
production environments.  In order to get the best throughput, it is highly
recommended that you use a Ruby implementation with real threads like Rubinius
or JRuby.")
    (home-page "https://puma.io/")
    (license license:expat)))

(define-public ruby-hoe-git
  (package
    (name "ruby-hoe-git")
    (version "1.6.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "hoe-git" version))
       (sha256
        (base32
         "10jmmbjm0lkglwxbn4rpqghgg1ipjxrswm117n50adhmy8yij650"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-hoe))
    (synopsis "Hoe plugins for tighter Git integration")
    (description
     "This package provides a set of Hoe plugins for tighter Git integration.
It provides tasks to automate release tagging and pushing and changelog
generation.")
    (home-page "https://github.com/jbarnette/hoe-git")
    (license license:expat)))

(define-public ruby-hoe-markdown
  (package
    (name "ruby-hoe-markdown")
    (version "1.4.0")
    (home-page "https://github.com/flavorjones/hoe-markdown")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url home-page)
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "0wb0yjdx9gx9r0cahpx42pblvglgh1i9pdfxjavq7f40nan2g076"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "spec"
       #:phases (modify-phases %standard-phases
                  (add-before 'check 'disable-bundler-dependency
                    (lambda _
                      (substitute* "spec/spec_helper.rb"
                        (("require.*bundler/setup.*")
                         "")))))))
    (native-inputs
     (list ruby-rspec))
    (propagated-inputs
     (list ruby-rake))
    (synopsis "Hoe plugin with Markdown helpers")
    (description
     "This package provides a Hoe plugin with various Markdown helpers, which
can be used to e.g. hyperlink Markdown documentation between project files.")
    (license license:expat)))

(define-public ruby-sequel
  (package
    (name "ruby-sequel")
    (version "5.47.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "sequel" version))
       (sha256
        (base32
         "03pmhj4kc3ga75wy397l57bvd18jxxmrk3qsznjw93b993qgvj3z"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; Avoid dependency loop with ruby-minitest-hooks.
    (synopsis "Database toolkit for Ruby")
    (description "Sequel provides thread safety, connection pooling and a
concise DSL for constructing SQL queries and table schemas.  It includes a
comprehensive ORM layer for mapping records to Ruby objects and handling
associated records.")
    (home-page "https://sequel.jeremyevans.net")
    (license license:expat)))

(define-public ruby-timecop
  (package
    (name "ruby-timecop")
    (version "0.9.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "timecop" version))
       (sha256
        (base32
         "0d7mm786180v4kzvn1f77rhfppsg5n0sq2bdx63x9nv114zm8jrp"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-before 'check 'set-check-rubylib
           (lambda _
             ;; Set RUBYLIB so timecop tests finds its own lib.
             (setenv "RUBYLIB" "lib")
             #t)))))
    (native-inputs
     (list bundler ruby-minitest-rg ruby-mocha ruby-activesupport))
    (synopsis "Test mocks for time-dependent functions")
    (description
     "Timecop provides \"time travel\" and \"time freezing\" capabilities,
making it easier to test time-dependent code.  It provides a unified method to
mock @code{Time.now}, @code{Date.today}, and @code{DateTime.now} in a single
call.")
    (home-page "https://github.com/travisjeffery/timecop")
    (license license:expat)))

(define-public ruby-concurrent-ruby
  (package
    (name "ruby-concurrent-ruby")
    (version "1.2.2")
    (source (origin
              (method git-fetch)
              (uri (git-reference       ;for tests
                    (url "https://github.com/ruby-concurrency/concurrent-ruby")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1vz4rl0nplq14dk9nx45g59i1sk2h53w1mjlrdiyjf780q4a1i38"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:tests? #f  ;the test suite is run in ruby-concurrent-ruby-edge
      #:phases #~(modify-phases %standard-phases
                   (add-after 'unpack 'delete-unwanted-gemspecs
                     (lambda _
                       (for-each delete-file
                                 '("concurrent-ruby-ext.gemspec"
                                   "concurrent-ruby-edge.gemspec"))))
                   (add-after 'unpack 'do-not-install-concurrent_ruby.jar
                     (lambda _
                       ;; This file is only built when building the Java
                       ;; extension.
                       (substitute* "concurrent-ruby.gemspec"
                         (("'lib/concurrent-ruby/concurrent/concurrent_ruby.jar'")
                          "")))))))
    (synopsis "Concurrency library for Ruby")
    (description "Concurrent Ruby includes concurrency tools such as agents,
futures, promises, thread pools, actors, supervisors, and more.  It is
inspired by Erlang, Clojure, Go, JavaScript, actors, and classic concurrency
patterns.")
    (home-page "https://github.com/ruby-concurrency/concurrent-ruby")
    (license license:expat)))

;;; The 'gem' is called 'concurrent-ruby'; reversing its name was confusing
;;; and failed to be picked by the gem importer (which led to this newer
;;; package).
(define-public ruby-concurrent
  (deprecated-package "ruby-concurrent" ruby-concurrent-ruby))

(define-public ruby-concurrent-ruby-ext
  (package
    (inherit ruby-concurrent-ruby)
    (name "ruby-concurrent-ruby-ext")
    (arguments
     (list
      #:tests? #f                      ;tested as part of concurrent-ruby-edge
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'delete-unwanted-gemspecs
            (lambda _
              (for-each delete-file
                        '("concurrent-ruby.gemspec"
                          "concurrent-ruby-edge.gemspec")))))))
    (native-inputs (list ruby-rake-compiler))
    (propagated-inputs (list ruby-concurrent-ruby))
    (synopsis "C extensions for concurrent-ruby")
    (description "This package provides C extensions to optimize the
concurrent-ruby gem when running under the Matz's Ruby Interpreter (MRI, also
known as CRuby).")))

(define-public ruby-concurrent-ruby-edge
  (package
    (inherit ruby-concurrent-ruby)
    (name "ruby-concurrent-ruby-edge")
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'delete-unwanted-gemspecs
            (lambda _
              (for-each delete-file
                        '("concurrent-ruby.gemspec"
                          "concurrent-ruby-ext.gemspec"))))
          ;; The tests rely on the Gem being installed, so move the check
          ;; phase after the install phase.
          (delete 'check)
          (add-after 'install 'check
            (lambda* (#:key tests? #:allow-other-keys)
              (setenv "GEM_PATH" (string-append
                                  (getenv "GEM_PATH") ":"
                                  #$output "/lib/ruby/vendor_ruby"))
              (when tests?
                (invoke "rake" "ci")))))))
    (native-inputs
     (list ruby-rake-compiler
           ruby-rake-compiler-dock
           ruby-rspec
           ruby-timecop
           ruby-yard))
    (propagated-inputs
     (list ruby-concurrent-ruby ruby-concurrent-ruby-ext))
    (synopsis "Edge features and additions to the @code{concurrent-ruby} gem")
    (description "The @code{concurrent-ruby-edge} gem includes
@code{concurrent-ruby} features that are under active development and may
change frequently.  They are expected not to keep backward
compatibility (there may also lack tests and documentation), although semantic
versions are obeyed though.  Features developed in @code{concurrent-ruby-edge}
are expected to move to @code{concurrent-ruby} when final.")))

(define-public ruby-pkg-config
  (package
    (name "ruby-pkg-config")
    (version "1.2.5")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "pkg-config" version))
       (sha256
        (base32
         "056mzqdh4yjznsg36fi0xiq76f24vxlhzh2n4az919l3x5k318ar"))))
    (build-system ruby-build-system)
    (arguments
     ;; Tests require extra files not included in the gem.
     `(#:tests? #f))
    (synopsis "Detect libraries for compiling Ruby native extensions")
    (description
     "@code{pkg-config} can be used in your extconf.rb to properly detect need
libraries for compiling Ruby native extensions.")
    (home-page "https://github.com/ruby-gnome2/pkg-config")
    (license license:lgpl2.0+)))

(define-public ruby-net-http-digest-auth
  (package
    (name "ruby-net-http-digest-auth")
    (version "1.4.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "net-http-digest_auth" version))
       (sha256
        (base32
         "1nq859b0gh2vjhvl1qh1zrk09pc7p54r9i6nnn6sb06iv07db2jb"))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-hoe))
    (synopsis "RFC 2617 HTTP digest authentication library")
    (description
     "This library implements HTTP's digest authentication scheme based on
RFC 2617.  This enables the use of the digest authentication scheme instead
of the more insecure basic authentication scheme.")
    (home-page "https://github.com/drbrain/net-http-digest_auth")
    (license license:expat)))

(define-public ruby-mail
  (package
    (name "ruby-mail")
    (version "2.7.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "mail" version))
       (sha256
        (base32
         "00wwz6ys0502dpk8xprwcqfwyf3hmnx6lgxaiq6vj43mkx43sapc"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-mini-mime))
    (arguments
     '(#:tests? #f)) ; no rakefile
    (synopsis "Mail library for Ruby")
    (description
     "Mail is an internet library for Ruby that is designed to handle email
generation, parsing and sending.  The purpose of this library is to provide
a single point of access to handle all email functions, including sending
and receiving emails.  All network type actions are done through proxy
methods to @code{Net::SMTP}, @code{Net::POP3} etc.

Mail has been designed with a very simple object oriented system that
really opens up the email messages you are parsing, if you know what you
are doing, you can fiddle with every last bit of your email directly.")
    (home-page "https://github.com/mikel/mail")
    (license license:expat)))

(define-public ruby-net-protocol
  (package
    (name "ruby-net-protocol")
    (version "0.2.1")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/ruby/net-protocol")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0niivmjx7bc6vsylc1ag17mw6mnvjxw02s7cin1f0422xyr8msq9"))))
    (build-system ruby-build-system)
    (propagated-inputs (list ruby-timeout))
    (synopsis "Abstract interface for Ruby network clients")
    (description "This Ruby library provides an abstract interface for network
clients.")
    (home-page "https://github.com/ruby/net-protocol")
    (license (list license:bsd-2))))

(define-public ruby-email-reply-trimmer
  (package
    (name "ruby-email-reply-trimmer")
    (version "0.1.13")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "email_reply_trimmer" version))
        (sha256
         (base32
          "1jgcxifm48xq5dz9k47q43pqm5bfnf14l62l3bqhmv8f6z8dw4ki"))))
    (build-system ruby-build-system)
    (synopsis "Trim replies from plain text email")
    (description "EmailReplyTrimmer is a Ruby small library to trim replies
from plain text email.")
    (home-page "https://github.com/discourse/email_reply_trimmer")
    (license license:expat)))

(define-public ruby-mathn
  (package
    (name "ruby-mathn")
    (version "0.1.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "mathn" version))
       (sha256
        (base32
         "1wn812llln9jzgybz2d7536q39z3gi99i6fi0j1dapcpzvhgrr0p"))))
    (build-system ruby-build-system)
    (native-inputs
     (list bundler ruby-rake-compiler))
    (synopsis "Extends math operations for increased precision")
    (description
     "This gem makes mathematical operations more precise in Ruby and
integrates other mathematical standard libraries.  Prior to Ruby 2.5,
@code{mathn} was part of the Ruby standard library.")
    (home-page "https://github.com/ruby/mathn")
    (license license:bsd-2)))

(define-public ruby-code-statistics
  (package
    (name "ruby-code-statistics")
    (version "0.2.13")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "code_statistics" version))
       (sha256
        (base32
         "07rdpsbwbmh4vp8nxyh308cj7am2pbrfhv9v5xr2d5gq8hnnsm93"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f)) ; Not all test code is included in gem.
    (synopsis "Port of the rails 'rake stats' method")
    (description
     "This gem is a port of the rails 'rake stats' method so it can be made
more robust and work for non rails projects.")
    (home-page "https://github.com/danmayer/code_statistics")
    (license license:expat)))

(define-public ruby-ruby2-keywords
  (package
    (name "ruby-ruby2-keywords")
    (version "0.0.5")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/ruby/ruby2_keywords")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1jhqb152zfr2yrxj6j8rzakkwdkg5viggwnnqrrfxwwy63msdi97"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'delete-extraneous-rake-files
            (lambda _
              (for-each delete-file '("rakelib/changelogs.rake"
                                      "rakelib/epoch.rake"
                                      "rakelib/version.rake"))))
          (add-after 'extract-gemspec 'adjust-files
            (lambda _
              (substitute* "ruby2_keywords.gemspec"
                ;; This file is not present in the git checkout.
                ((".*\"ChangeLog\",.*") "")))))))
    (synopsis "Shim library for Module#ruby2_keywords")
    (description "Provides empty @code{Module#ruby2_keywords} method, for the
forward source-level compatibility against @command{ruby2.7} and
@command{ruby3}.")
    (home-page "https://github.com/ruby/ruby2_keywords")
    (license license:bsd-2)))

(define-public ruby-rubypants
  (package
    (name "ruby-rubypants")
    (version "0.6.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "rubypants" version))
              (sha256
               (base32
                "0xpqkslan2wkyal2h9qhplkr5d4sdn7q6csigrhnljjpp8j4qfsh"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; need Codecov
    (synopsis "Port of the smart-quotes library SmartyPants")
    (description
     "RubyPants is a Ruby port of the smart-quotes library SmartyPants.  The
original SmartyPants is a web publishing plug-in for Movable Type, Blosxom,
and BBEdit that easily translates plain ASCII punctuation characters into
smart typographic punctuation HTML entities.")
    (home-page "https://github.com/jmcnevin/rubypants")
    (license license:bsd-2)))

(define-public ruby-org-ruby
  (package
    (name "ruby-org-ruby")
    (version "0.9.12")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "org-ruby" version))
              (sha256
               (base32
                "0x69s7aysfiwlcpd9hkvksfyld34d8kxr62adb59vjvh8hxfrjwk"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; no rakefile
    (propagated-inputs
     (list ruby-rubypants))
    (synopsis "Org-mode parser written in Ruby")
    (description
     "Org-ruby is an org-mode parser written in Ruby.  The most significant
thing this library does today is convert org-mode files to HTML or Textile or
Markdown.")
    (home-page "https://github.com/wallyqs/org-ruby")
    (license license:expat)))

(define-public ruby-rake
  (package
    (name "ruby-rake")
    (version "13.0.6")
    (source
     (origin
       (method git-fetch)               ;for tests
       (uri (git-reference
             (url "https://github.com/ruby/rake")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0c77xyl677s966f8yvk8yv7l31c1ffa1yl4kcwiram219h0s76in"))))
    (build-system ruby-build-system)
    (native-inputs
     (list bundler))
    (synopsis "Rake is a Make-like program implemented in Ruby")
    (description
     "Rake is a Make-like program where tasks and dependencies are specified
in standard Ruby syntax.")
    (home-page "https://github.com/ruby/rake")
    (license license:expat)))

(define-public ruby-rake-manifest
  (package
    (name "ruby-rake-manifest")
    (version "0.2.3")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/mvz/rake-manifest")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "16k2yvg773c25kp2vhzhp01rhf53k0nhrcmpv34k1fridw90r2k8"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:test-target "default"
      #:phases
      #~(modify-phases %standard-phases
          (delete 'check)               ;moved after the install phase
          (add-after 'install 'check
            (assoc-ref %standard-phases 'check))
          (add-before 'check 'set-GEM_PATH
            (lambda _
              (setenv "GEM_PATH" (string-append
                                  (getenv "GEM_PATH") ":"
                                  #$output "/lib/ruby/vendor_ruby")))))))
    (native-inputs (list ruby-rspec ruby-simplecov))
    (synopsis "Rake tasks to generate and check a manifest file")
    (description "This package provides Rake tasks to generate and check a
manifest file.")
    (home-page "https://github.com/mvz/rake-manifest")
    (license license:expat)))

(define-public ruby-childprocess
  (package
    (name "ruby-childprocess")
    (version "3.0.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "childprocess" version))
       (sha256
        (base32
         "1ic028k8xgm2dds9mqnvwwx3ibaz32j8455zxr9f4bcnviyahya5"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (native-inputs
     (list bundler ruby-rspec))
    (propagated-inputs
     (list ruby-ffi))
    (synopsis "Control external programs running in the background, in Ruby")
    (description "@code{childprocess} provides a gem to control external
programs running in the background, in Ruby.")
    (home-page "https://github.com/enkessler/childprocess")
    (license license:expat)))

(define-public ruby-public-suffix
  (package
    (name "ruby-public-suffix")
    (version "4.0.5")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "public_suffix" version))
              (sha256
               (base32
                "0vywld400fzi17cszwrchrzcqys4qm6sshbv73wy5mwcixmrgg7g"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         ;; Remove the requirement on Rubocop, as it isn't useful to run, and
         ;; including it as an input can lead to circular dependencies.
         (add-after 'unpack 'remove-rubocop-from-Rakefile
           (lambda _
             (substitute* "Rakefile"
               (("require \"rubocop/rake\\_task\"") "")
               (("RuboCop::RakeTask\\.new") ""))
             #t)))))
    (native-inputs
     (list bundler ruby-yard ruby-mocha ruby-minitest-reporters))
    (home-page "https://simonecarletti.com/code/publicsuffix-ruby/")
    (synopsis "Domain name parser")
    (description "The gem @code{public_suffix} is a domain name parser,
written in Ruby, and based on the @dfn{Public Suffix List}.  A public suffix
is one under which Internet users can (or historically could) directly
register names.  Some examples of public suffixes are @code{.com},
@code{.co.uk} and @code{pvt.k12.ma.us}.  The Public Suffix List is a list of
all known public suffixes.")
    (license license:expat)))

(define-public ruby-addressable
  (package
    (name "ruby-addressable")
    (version "2.8.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "addressable" version))
              (sha256
               (base32
                "1ypdmpdn20hxp5vwxz3zc04r5xcwqc25qszdlg41h8ghdqbllwmw"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "spec"
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'disable-bundler
           (lambda _
             (substitute* "spec/spec_helper.rb"
               (("require 'bundler/setup'") ""))))
         (add-after 'unpack 'remove-unnecessary-dependencies-from-Gemfile
           (lambda _
             (substitute* "Gemfile"
               (("git: 'https://github.com/sporkmonger/rack-mount.git',") "")
               ((".*launchy.*") "")
               ((".*rake.*") "gem 'rake'\n")
               ((".*redcarpet.*") ""))))
         (add-before 'check 'delete-network-dependent-test
           (lambda _
             (delete-file "spec/addressable/net_http_compat_spec.rb"))))))
    (native-inputs
     (list bundler
           ruby-idn-ruby
           ruby-rspec
           ruby-rspec-its-minimal
           ruby-simplecov
           ruby-sporkmonger-rack-mount
           ruby-yard))
    (propagated-inputs
     (list ruby-public-suffix))
    (home-page "https://github.com/sporkmonger/addressable")
    (synopsis "Alternative URI implementation")
    (description "Addressable is a replacement for the URI implementation that
is part of Ruby's standard library.  It more closely conforms to RFC 3986,
RFC 3987, and RFC 6570 (level 4), providing support for IRIs and URI templates.")
    (license license:asl2.0)))

(define-public ruby-colorize
  (package
    (name "ruby-colorize")
    (version "0.8.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "colorize" version))
              (sha256
               (base32
                "133rqj85n400qk6g3dhf2bmfws34mak1wqihvh3bgy9jhajw580b"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases (modify-phases %standard-phases
                  (add-before 'check 'remove-codeclimate-dependency
                    (lambda _
                      (substitute* "test/test_colorize.rb"
                        ;; Do not hook the tests into the online CodeClimate
                        ;; service which is unnecessary for these tests.
                        (("require 'codeclimate-test-reporter'")
                         "")
                        (("CodeClimate.*") ""))
                      #t)))))
    (synopsis "Add color effects to the @code{String} class")
    (description
     "This package extends the @code{String} class and adds a
@code{ColorizedString} with methods to set text color, background color,
and text effects.")
    (home-page "https://github.com/fazibear/colorize")
    (license license:gpl2+)))

(define-public ruby-colorator
  (package
    (name "ruby-colorator")
    (version "1.1.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "colorator" version))
              (sha256
               (base32
                "0f7wvpam948cglrciyqd798gdc6z3cfijciavd0dfixgaypmvy72"))))
    (build-system ruby-build-system)
    (arguments
     ;; No test target
     `(#:tests? #f))
    (home-page "http://octopress.org/colorator/")
    (synopsis "Terminal color library")
    (description "Colorator is a Ruby gem that helps you colorize your text
for the terminal.")
    (license license:expat)))

(define-public ruby-command-line-reporter
  (package
    (name "ruby-command-line-reporter")
    (version "4.0.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "command_line_reporter" version))
              (sha256
               (base32
                "1l0zxkh5n9dxfw46lpkg416ljpldlq1bgdhqh0d118dk338nz4ll"))))
    (build-system ruby-build-system)
    (arguments
     ;; No Rakefile
     `(#:tests? #f
       #:phases
       (modify-phases %standard-phases
         (add-before 'build 'fix-dependencies
           (lambda _
             (substitute* ".gemspec"
               ;; colored is unmaintained
               (("colored") "colorator")
               ;; colorator version
               (("= 1.2") "= 1.1"))
             #t)))))
    (propagated-inputs (list ruby-colorator))
    (home-page "https://github.com/wbailey/command_line_reporter")
    (synopsis "Report production while executing Ruby scripts")
    (description "This gem provides a DSL that makes it easy to write reports
of various types in ruby.  It eliminates the need to litter your source with
puts statements, instead providing a more readable, expressive interface to
your application.")
    (license license:asl2.0)))

(define-public ruby-command-line-reporter-3
  (package
    (inherit ruby-command-line-reporter)
    (version "3.3.6")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "command_line_reporter" version))
              (sha256
               (base32
                "1h39zqqxp3k4qk49ajpx0jps1vmvxgkh43mqkb6znk583bl0fv71"))))))

(define-public ruby-kpeg
  (package
  (name "ruby-kpeg")
  (version "1.1.0")
  (source
    (origin
      (method url-fetch)
      (uri (rubygems-uri "kpeg" version))
      (sha256
        (base32
          "0x2kpfrcagj931masm5y1kwbnc6nxl60cqdcd3lyd1d2hz7kzlia"))))
  (build-system ruby-build-system)
  (native-inputs
   (list ruby-hoe))
  (synopsis "PEG library for Ruby")
  (description "KPeg is a simple PEG library for Ruby.  It provides an API as
well as native grammar to build the grammar.  KPeg supports direct left
recursion of rules via the
@uref{http://www.vpri.org/pdf/tr2008003_experimenting.pdf,OMeta memoization}
technique.")
  (home-page "https://github.com/evanphx/kpeg")
  (license license:expat)))

(define-public ruby-rdoc
  (package
    (name "ruby-rdoc")
    (version "6.2.0")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/ruby/rdoc")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0dhk29nidv93b5vnjvlm9gcixgn4i0jcyzrgxdk6pdg019bw4cj6"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'patch-gemspec
           ;; TODO: Remove after next release is tagged.
           (lambda _
             (substitute* "rdoc.gemspec"
               (("\"lib/rdoc/generator/template/darkfish/js/\
jquery\\.js\", ") ""))
             #t))
         (add-before 'build 'generate
           ;; 'gem build' doesn't honor Rakefile dependencies (see:
           ;; https://github.com/ruby/rdoc/issues/432#issuecomment-650808977).
           (lambda _
             (invoke "rake" "generate"))))))
    (native-inputs
     (list bundler ruby-kpeg ruby-racc ruby-rubocop))
    (home-page "https://ruby.github.io/rdoc/")
    (synopsis "HTML and command-line documentation utility")
    (description "RDoc produces HTML and command-line documentation for Ruby
projects.  RDoc includes the +rdoc+ and +ri+ tools for generating and displaying
documentation from the command-line.")
    (license license:gpl2+)))

(define-public ruby-sass-listen
  (package
    (name "ruby-sass-listen")
    (version "4.0.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "sass-listen" version))
              (sha256
               (base32
                "0xw3q46cmahkgyldid5hwyiwacp590zj2vmswlll68ryvmvcp7df"))))
    (build-system ruby-build-system)
    (arguments
     ;; No test target
     `(#:tests? #f))
    (propagated-inputs
     (list ruby-rb-fsevent ruby-rb-inotify))
    (home-page "https://github.com/sass/listen")
    (synopsis "File modification notification library")
    (description "The Listen gem listens to file modifications and notifies you
about the changes.")
    (license license:expat)))

(define-public ruby-terminfo
  (package
    (name "ruby-terminfo")
    (version "0.1.1")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "ruby-terminfo" version))
        (sha256
          (base32
            "0rl4ic5pzvrpgd42z0c1s2n3j39c9znksblxxvmhkzrc0ckyg2cm"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "test"
       ;; Rakefile requires old packages and would need modification to
       ;; work with current software.
       #:tests? #f))
    (inputs
     (list ncurses))
    (native-inputs
     (list ruby-rubygems-tasks ruby-rdoc))
    (home-page "http://www.a-k-r.org/ruby-terminfo/")
    (synopsis "Terminfo binding for Ruby")
    (description "Ruby-terminfo provides terminfo binding for Ruby.")
    (license license:bsd-3)))

(define-public ruby-diffy
  (package
    (name "ruby-diffy")
    (version "3.2.1")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "diffy" version))
        (sha256
          (base32
            "119imrkn01agwhx5raxhknsi331y5i4yda7r0ws0an6905ximzjg"))))
    (build-system ruby-build-system)
    (arguments
     ;; No tests
     `(#:tests? #f))
    (native-inputs
     (list ruby-rspec))
    (home-page "https://github.com/samg/diffy")
    (synopsis "Convenient diffing in ruby")
    (description "Diffy provides a convenient way to generate a diff from two
strings or files.")
    (license license:expat)))

(define-public ruby-sass-spec
  (package
    (name "ruby-sass-spec")
    (version "3.5.4")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/sass/sass-spec")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "1zsw66830w0xlc7kxz6fm4b5nyb44vdsdgm9mgy06s5aixx83pwr"))))
    (build-system ruby-build-system)
    (propagated-inputs
     `(("ruby-command-line-reporter-3" ,ruby-command-line-reporter-3)
       ("ruby-diffy" ,ruby-diffy)
       ("ruby-terminfo" ,ruby-terminfo)))
    (arguments
     `(;; This package contains tests for a sass implementation, and the to
       ;; avoid any circular dependencies, the tests are not run here
       #:tests? #f
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'patch-test
           (lambda _
             (delete-file "spec/values/colors/alpha_hex-3.5/error")
             (substitute* "spec/values/colors/alpha_hex-3.5/expected_output.css"
               (("string") "color")))))))
    (home-page "https://github.com/sass/sass-spec")
    (synopsis "Test suite for Sass")
    (description "Sass Spec is a test suite for Sass.  Test cases are all in
the @file{spec} directory.")
    (license license:expat)))

(define-public ruby-sass
  (package
    (name "ruby-sass")
    (version "3.6.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "sass" version))
              (sha256
               (base32
                "18c6prbw9wl8bqhb2435pd9s0lzarl3g7xf8pmyla28zblvwxmyh"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-sass-listen))
    (native-inputs
     (list ruby-sass-spec ruby-mathn ruby-cmath))
    (home-page "https://sass-lang.com/")
    (synopsis "CSS extension language")
    (description "Sass is a CSS extension language.  It extends CSS with
features that don't exist yet like variables, nesting, mixins and inheritance.")
    (license license:expat)))

(define-public ruby-sassc
  (package
    (name "ruby-sassc")
    (version "2.4.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "sassc" version))
       (sha256
        (base32
         "0gpqv48xhl8mb8qqhcifcp0pixn206a7imc07g48armklfqa4q2c"))))
    (build-system ruby-build-system)
    (arguments
     '(#:modules ((guix build ruby-build-system)
                  (guix build utils)
                  (ice-9 textual-ports))
       #:phases
       (modify-phases %standard-phases
         ;; TODO: This would be better as a snippet, but the ruby-build-system
         ;; doesn't seem to support that
         (add-after 'unpack 'remove-libsass
           (lambda _
             (delete-file-recursively "ext")
             (with-atomic-file-replacement "sassc.gemspec"
               (lambda (in out)
                 (let* ((gemspec (get-string-all in))
                        (index (string-contains gemspec "libsass_dir")))
                   (display (string-append
                             (string-take gemspec index)
                             "\nend\n")
                            out))))
             #t))
         (add-after 'unpack 'dont-check-the-libsass-version
           (lambda _
             (substitute* "test/native_test.rb"
               (("assert_equal.*Native\\.version") ""))
             #t))
         (add-after 'unpack 'remove-git-from-gemspec
           (lambda _
             (substitute* "sassc.gemspec"
               (("`git ls-files -z`") "`find . -type f -print0 |sort -z`"))
             #t))
         (add-after 'unpack 'remove-extensions-from-gemspec
           (lambda _
             (substitute* "sassc.gemspec"
               (("\\[\"ext/extconf.rb\"\\]") "[]"))
             #t))
         (add-after 'unpack 'fix-Rakefile
           (lambda _
             (substitute* "Rakefile"
               (("test: 'compile:libsass'") ":test"))
             #t))
         (add-after 'unpack 'remove-unnecessary-dependencies
           (lambda _
             (substitute* "test/test_helper.rb"
               (("require \"pry\"") ""))
             #t))
         (add-before 'build 'patch-native.rb
           (lambda* (#:key inputs #:allow-other-keys)
             (substitute* "lib/sassc/native.rb"
               ((".*gem_root = spec.gem_dir") "")
               (("ffi_lib .*\n")
                (string-append
                 "ffi_lib '" (assoc-ref inputs "libsass") "/lib/libsass.so'")))
             #t))
         ;; The gemspec still references the libsass files, so just keep the
         ;; one in the gem.
         (delete 'extract-gemspec))))
    (propagated-inputs
     (list ruby-ffi ruby-rake))
    (inputs
     (list libsass))
    (native-inputs
     (list bundler ruby-rake-compiler ruby-minitest-around
           ruby-test-construct))
    (synopsis "Use libsss from Ruby")
    (description
     "This library provides Ruby q@acronym{FFI, Foreign Function Interface}
bindings to the libsass library.  This enables rendering
@acronym{SASS,Syntactically awesome style sheets} from Ruby code.")
    (home-page "https://github.com/sass/sassc-ruby")
    (license license:expat)))

(define-public ruby-jekyll-sass-converter
  (package
    (name "ruby-jekyll-sass-converter")
    (version "2.1.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "jekyll-sass-converter" version))
              (sha256
               (base32
                "04ncr44wrilz26ayqwlg7379yjnkb29mvx4j04i62b7czmdrc9dv"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-sass))
    (arguments
     ;; No rakefile
     `(#:tests? #f))
    (home-page "https://github.com/jekyll/jekyll-sass-converter")
    (synopsis "Sass converter for Jekyll")
    (description "This gem provide built-in support for the Sass converter
in Jekyll.")
    (license license:expat)))

(define-public ruby-jekyll-watch
  (package
    (name "ruby-jekyll-watch")
    (version "2.1.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "jekyll-watch" version))
              (sha256
               (base32
                "1s9ly83sp8albvgdff12xy2h4xd8lm6z2fah4lzmk2yvp85jzdzv"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-listen))
    (arguments
     ;; No rakefile
     `(#:tests? #f))
    (home-page "https://github.com/jekyll/jekyll-watch")
    (synopsis "Jekyll auto-rebuild support")
    (description "This gems add the @code{--watch} switch to the jekyll CLI
interface.  It allows Jekyll to rebuild your site when a file changes.")
    (license license:expat)))

(define-public ruby-parallel
  (package
    (name "ruby-parallel")
    (version "1.21.0")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/grosser/parallel")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "1xqjcvl3gq3shvrqp8wc3fbqibzh4mf1yczq6np9gd79558dwj3w"))))
    (build-system ruby-build-system)
    (arguments
     `(;; TODO 3 test failures
       ;; rspec ./spec/parallel_spec.rb:190 # Parallel.in_processes does not
       ;; open unnecessary pipes
       ;; rspec './spec/parallel_spec.rb[1:9:7]' # Parallel.each works with
       ;; SQLite in processes
       ;; rspec './spec/parallel_spec.rb[1:9:16]' # Parallel.each works with
       ;; SQLite in threads
       #:tests? #f
       #:test-target "rspec-rerun:spec"
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'patch-Gemfile
           (lambda _
             (substitute* "Gemfile"
               (("gem 'rspec-legacy_formatters'") "")
               (("gem 'activerecord.*$") "gem 'activerecord'\n"))))
         (add-before 'check 'delete-Gemfile.lock
           (lambda _
             ;; Bundler isn't being used for fetching dependendencies, so
             ;; delete the Gemfile.lock
             (delete-file "Gemfile.lock")
             #t))
         (add-before 'build 'patch-gemspec
           (lambda _
             (substitute* "parallel.gemspec"
               (("git ls-files") "find"))
             #t)))))
    (native-inputs
     (list ruby-rspec
           ruby-rspec-rerun
           bundler
           ruby-activerecord
           ruby-progressbar
           ruby-bump
           procps
           lsof
           ruby-mysql2
           ruby-sqlite3
           ruby-i18n))
    (home-page "https://github.com/grosser/parallel")
    (synopsis "Parallel processing in Ruby")
    (description "Parallel allows you to run any code in parallel Processes
(to use all CPUs) or Threads(to speedup blocking operations).  It is best
suited for map-reduce or e.g. parallel downloads/uploads.")
    (license license:expat)))

(define-public ruby-cabin
  (package
    (name "ruby-cabin")
    (version "0.9.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "cabin" version))
              (sha256
               (base32
                "0b3b8j3iqnagjfn1261b9ncaac9g44zrx1kcg81yg4z9i513kici"))))
    (build-system ruby-build-system)
    (arguments (list #:tests? #f))      ;no Rakefile in released gem
    (synopsis "Structured and contextual logging experiments in Ruby")
    (description "This Ruby library provides an experimental logging system
that tries to make logging more flexible and more consumable than plain-text
logging.")
    (home-page "https://github.com/jordansissel/ruby-cabin")
    (license license:asl2.0)))

(define-public ruby-capybara
  (package
    (name "ruby-capybara")
    (version "3.38.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "capybara" version))
              (sha256
               (base32
                "123198zk2ak8mziwa5jc3ckgpmsg08zn064n3aywnqm9s1bwjv3v"))))
    (build-system ruby-build-system)
    (arguments
     (list #:tests? #f                ;sinatra is currently broken with rack 3
           #:phases
           #~(modify-phases %standard-phases
               (add-after 'extract-gemspec 'remove-extraneous-requirements
                 (lambda _
                   (substitute* "spec/spec_helper.rb"
                     ((".*require 'selenium_statistics'.*") "")
                     ((".*SeleniumStatistics.print_results.*") ""))))
               (replace 'check
                 (lambda* (#:key tests? #:allow-other-keys)
                   (when tests?
                     (invoke "rspec" "spec")))))))
    (native-inputs
     (list ruby-puma
           ruby-rspec
           ruby-selenium-webdriver
           ruby-sinatra))
    (propagated-inputs
     (list ruby-addressable
           ruby-launchy
           ruby-matrix
           ruby-mini-mime
           ruby-nokogiri
           ruby-rack
           ruby-rack-test
           ruby-regexp-parser
           ruby-xpath))
    (synopsis "Integration testing tool for rack-based web applications")
    (description "Capybara is an integration testing tool for rack based web
applications.  It simulates how a user would interact with a website.")
    (home-page "https://github.com/teamcapybara/capybara")
    (license license:expat)))

(define-public ruby-cane
  (package
    (name "ruby-cane")
    (version "3.0.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "cane" version))
              (sha256
               (base32
                "0yf5za3l7lhrqa3g56sah73wh33lbxy5y3cb7ij0a2bp1b4kwhih"))))
    (build-system ruby-build-system)
    (arguments `(#:tests? #f)); No rakefile
    (home-page "https://github.com/square/cane")
    (propagated-inputs
     (list ruby-parallel))
    (synopsis "Code quality threshold checking")
    (description "Cane fails your build if code quality thresholds are not met.")
    (license license:asl2.0)))

(define-public ruby-morecane
  (package
    (name "ruby-morecane")
    (version "0.2.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "morecane" version))
              (sha256
               (base32
                "0w70vb8z5bdhvr21h660aa43m5948pv0bd27z7ngai2iwdvqd771"))))
    (build-system ruby-build-system)
    (home-page "https://github.com/yob/morecane")
    (arguments `(#:tests? #f)); No rakefile
    (propagated-inputs
     (list ruby-parallel))
    (synopsis "Extra checks for cane")
    (description "The cane gem provides a great framework for running quality
checks over your ruby project as part of continuous integration build.  It
comes with a few checks out of the box, but also provides an API for loading
custom checks.  This gem provides a set of additional checks.")
    (license license:expat)))

(define-public ruby-pdf-reader
  (package
    (name "ruby-pdf-reader")
    (version "2.4.0")
    (source (origin
              (method git-fetch)        ;no test in distributed gem archive
              (uri (git-reference
                    (url "https://github.com/yob/pdf-reader")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1yh8yrlssf5ppnkvk4m78vmh5r5vqwdcd0gm3lqipw162llz0rai"))))
    (build-system ruby-build-system)
    (arguments `(#:test-target "spec"
                 #:phases (modify-phases %standard-phases
                            (add-after 'unpack 'do-not-use-bundler
                              (lambda _
                                (substitute* "spec/spec_helper.rb"
                                  ((".*[Bb]undler.*") ""))
                                #t)))))
    (native-inputs
     (list ruby-rspec ruby-cane ruby-morecane))
    (propagated-inputs
     (list ruby-afm ruby-ascii85 ruby-hashery ruby-rc4 ruby-ttfunk))
    (home-page "https://github.com/yob/pdf-reader")
    (synopsis "PDF parser in Ruby")
    (description "The PDF::Reader library implements a PDF parser conforming as
much as possible to the PDF specification from Adobe.  It provides programmatic
access to the contents of a PDF file with a high degree of flexibility.")
    (license license:gpl3+)))

(define-public ruby-pdf-inspector
  (let ((revision "1")
        (commit "00ee4c92ff917118785ebec188e81effc968abeb"))
    (package
      (name "ruby-pdf-inspector")
      (version (git-version "1.3.0" revision commit))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/prawnpdf/pdf-inspector")
                      (commit commit)))
                (file-name (git-file-name name version))
                (sha256
                 (base32
                  "0h9w81ddd0gvkh5n2cvny9ddb5qiac1si0dhinkk0xxh5382qs0m"))))
      (build-system ruby-build-system)
      (arguments
       `(#:test-target "spec"
         #:phases (modify-phases %standard-phases
                    (add-before 'build 'drop-signing-key-requirement
                      (lambda _
                        (substitute* "pdf-inspector.gemspec"
                          (("spec.signing_key =.*")
                           "spec.signing_key = nil"))
                        #t))
                    (replace 'check
                      (lambda _
                        (substitute* "pdf-inspector.gemspec"
                          ((".*rubocop.*") "")
                          ((".*yard.*") ""))
                        (invoke "rspec"))))))
      (native-inputs
       (list ruby-rspec))
      (propagated-inputs
       (list ruby-pdf-reader))
      (home-page "https://github.com/prawnpdf/pdf-inspector")
      (synopsis "Analysis classes for inspecting PDF output")
      (description "This library provides a number of PDF::Reader based tools for
use in testing PDF output.  Presently, the primary purpose of this tool is to
support the tests found in Prawn, a pure Ruby PDF generation library.")
      (license %prawn-project-licenses))))

(define-public ruby-pdf-core
  (package
    (name "ruby-pdf-core")
    (version "0.9.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "pdf-core" version))
              (sha256
               (base32
                "1fz0yj4zrlii2j08kaw11j769s373ayz8jrdhxwwjzmm28pqndjg"))))
    (build-system ruby-build-system)
    (arguments
     ; No test target
     `(#:tests? #f))
    (home-page "https://github.com/prawnpdf/pdf-core")
    (synopsis "Low level PDF features for Prawn")
    (description "This is an experimental gem that extracts low-level PDF
functionality from Prawn.")
    (license license:gpl3+)))

(define-public ruby-prawn-dev
  (package
    (name "ruby-prawn-dev")
    (version "0.3.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "prawn-dev" version))
              (sha256
               (base32
                "1hbzzgm0nwc6h8pyv8h9xx068bf676rispxcz4a0sm8nykz54z4x"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:tests? #f                       ;no test suite
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'extract-gemspec 'drop-rubocop-dependency
            ;; Rubocop depends on Prawn.  Remove it to avoid the
            ;; dependency cycle when using this tool to build
            ;; Prawn components.
            (lambda _
              (substitute* "lib/prawn/dev/tasks.rb"
                (("require 'rubocop/rake_task'")
                 "")
                (("RuboCop::RakeTask.new")
                 ""))
              (substitute* ".gemspec"
                ((".*add.*dependency.*(rubocop|simplecov).*")
                 "")))))))
    (propagated-inputs (list ruby-rake ruby-rspec ruby-yard))
    (synopsis "Shared tools for Prawn projects development")
    (description "Prawn-dev contains tools to aid the development of the
various Prawn projects.")
    (home-page "https://prawnpdf.org/")
    (license license:expat)))

(define-public ruby-prawn
  ;; There hasn't been a new release since 2017/03/17.
  (package
    (name "ruby-prawn")
    (version "2.4.0")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/prawnpdf/prawn")
                    (commit version)))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1h1gww12wcdscij0lnd21p9zcbwrwc3miini5ppannc2birmj9ja"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-before 'build 'drop-signing-key-requirement
            (lambda _
              (substitute* "prawn.gemspec"
                (("spec.signing_key =.*")
                 "spec.signing_key = nil"))))
          (replace 'check
            (lambda* (#:key tests? #:allow-other-keys)
              (when tests?
                ;; The Prawn manual test fails (see:
                ;; https://github.com/prawnpdf/prawn/issues/1163), so exclude
                ;; it.
                (invoke "rspec"
                        "--exclude-pattern" "prawn_manual_spec.rb")))))))
    (propagated-inputs
     (list ruby-matrix
           ruby-pdf-core
           ruby-ttfunk))
    (native-inputs
     (list ruby-pdf-inspector
           ruby-prawn-manual-builder
           ruby-prawn-dev))
    (home-page "https://prawnpdf.org/api-docs/2.0/")
    (synopsis "PDF generation for Ruby")
    (description "Prawn is a pure Ruby PDF generation library.")
    (license %prawn-project-licenses)))

(define-public ruby-prawn-table
  (package
    (name "ruby-prawn-table")
    (version "0.2.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "prawn-table" version))
              (sha256
               (base32
                "1nxd6qmxqwl850icp18wjh5k0s3amxcajdrkjyzpfgq0kvilcv9k"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-prawn ruby-pdf-inspector))
    (native-inputs
     `(("bundler" ,bundler)
       ("ruby-yard" ,ruby-yard)
       ("ruby-mocha" ,ruby-mocha)
       ("ruby-coderay" ,ruby-coderay)
       ("ruby-prawn-manual-builder" ,ruby-prawn-manual-builder)
       ("ruby-simplecov" ,ruby-simplecov)
       ("ruby-rspec-2" ,ruby-rspec-2)))
    (arguments
     '(;; TODO: 1 test fails
       ;; Failure/Error: pdf.page_count.should == 1
       ;;   expected: 1
       ;;        got: 2 (using ==)
       ;; # ./spec/table_spec.rb:1308
       ;;
       ;; 225 examples, 1 failure
       #:tests? #f
       #:phases
       (modify-phases %standard-phases
         (add-before 'check 'patch-gemspec
           (lambda _
             (substitute* "prawn-table.gemspec"
               ;; Loosen the requirement for pdf-inspector
               (("~> 1\\.1\\.0") ">= 0")
               ;; Loosen the requirement for pdf-reader
               (("~> 1\\.2") ">= 0"))))
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (invoke "rspec"))
             #t)))))
    (home-page "https://github.com/prawnpdf/prawn-table")
    (synopsis "Tables support for Prawn")
    (description "This gem provides tables support for Prawn.")
    (license license:gpl3+)))

(define-public ruby-kramdown
  (package
    (name "ruby-kramdown")
    (version "2.3.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "kramdown" version))
              (sha256
               (base32
                "0jdbcjv4v7sj888bv3vc6d1dg4ackkh7ywlmn9ln2g9alk7kisar"))))
    (build-system ruby-build-system)
    (arguments `(#:tests? #f)); FIXME: some test failures
    (native-inputs
     (list ruby-prawn ruby-prawn-table))
    (home-page "https://kramdown.gettalong.org/")
    (synopsis "Markdown parsing and converting library")
    (description "Kramdown is a library for parsing and converting a superset
of Markdown.  It is completely written in Ruby, supports standard Markdown
(with some minor modifications) and various extensions that have been made
popular by the PHP @code{Markdown Extra} package and @code{Maruku}.")
    (license license:expat)))

(define-public ruby-kramdown-parser-gfm
  (package
    (name "ruby-kramdown-parser-gfm")
    (version "1.1.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "kramdown-parser-gfm" version))
       (sha256
        (base32 "0a8pb3v951f4x7h968rqfsa19c8arz21zw1vaj42jza22rap8fgv"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))                    ;no rakefile
    (propagated-inputs
     (list ruby-kramdown))
    (synopsis "Kramdown parser for the GFM dialect of Markdown")
    (description
     "This is a parser for kramdown that converts Markdown documents in the
GFM dialect to HTML.")
    (home-page "https://github.com/kramdown/parser-gfm")
    (license license:expat)))

(define-public ruby-http-parser.rb
  (package
    (name "ruby-http-parser.rb")
    (version "0.6.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "http_parser.rb" version))
        (sha256
          (base32
            "15nidriy0v5yqfjsgsra51wmknxci2n2grliz78sf9pga3n0l7gi"))))
    (build-system ruby-build-system)
    (arguments
     ;; No tests
     `(#:tests? #f))
    (native-inputs
     (list ruby-rake-compiler ruby-rspec))
    (home-page "https://github.com/tmm1/http_parser.rb")
    (synopsis "HTTP parser un Ruby")
    (description "This gem is a simple callback-based HTTP request/response
parser for writing http servers, clients and proxies.")
    (license license:expat)))

(define-public ruby-em-websocket
  (package
    (name "ruby-em-websocket")
    (version "0.5.1")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "em-websocket" version))
        (sha256
          (base32
            "1bsw8vjz0z267j40nhbmrvfz7dvacq4p0pagvyp17jif6mj6v7n3"))))
    (build-system ruby-build-system)
    (arguments
     ;; No tests
     `(#:tests? #f))
    (propagated-inputs
      (list ruby-eventmachine ruby-http-parser.rb))
    (native-inputs
     (list bundler ruby-rspec))
    (home-page "https://github.com/igrigorik/em-websocket")
    (synopsis "EventMachine based WebSocket server")
    (description "Em-websocket is an EventMachine based WebSocket server
implementation.")
    (license license:expat)))

(define-public ruby-rouge
  (package
    (name "ruby-rouge")
    (version "3.26.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "rouge" version))
              (sha256
               (base32
                "197k0vskf72wxx0gzwld2jzg27bb7982xlvnzy9adlvkzp7nh8vf"))))
    (build-system ruby-build-system)
    (arguments `(#:tests? #f)); No rakefile
    (home-page "http://rouge.jneen.net/")
    (synopsis "Code highlighter")
    (description "Rouge is a code highlighter written in Ruby.  It supports more
than 100 languages and outputs HTML or ANSI 256-color text.  Its HTML output
is compatible with stylesheets designed for pygments.")
    (license (list
               ;; rouge is licensed under expat
               license:expat
               ;; pygments is licensed under bsd-2
               license:bsd-2))))

(define-public ruby-hashie
  (package
    (name "ruby-hashie")
    (version "5.0.0")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/hashie/hashie")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0ihami0cdn71cvwzwgr3vxqvqi0ifqsna0vlyqiqlhsnf93w0cm8"))))
    (build-system ruby-build-system)
    (arguments
     (list #:test-target "spec"
           #:phases #~(modify-phases %standard-phases
                        (add-after 'unpack 'disable-bundler
                          (lambda _
                            (substitute* "Rakefile"
                              ((".*require 'bundler'.*") "")
                              ((".*Bundler.setup.*") "")
                              (("Bundler::GemHelper\\.install_tasks") ""))))
                        (add-after 'unpack 'disable-rubocop
                          (lambda _
                            (substitute* "Rakefile"
                              (("require 'rubocop/rake_task'") "")
                              (("RuboCop::RakeTask.new") ""))))
                        (add-after 'unpack 'relax-requirements
                          (lambda _
                            ;; Contains multiple extraneous dependencies.
                            (delete-file "Gemfile"))))))
    (native-inputs (list ruby-json ruby-pry ruby-rspec ruby-rspec-pending-for))
    (home-page "https://github.com/hashie/hashie")
    (synopsis "Extensions to Ruby Hashes")
    (description "Hashie is a collection of classes and mixins that make Ruby
hashes more powerful.")
    (license license:expat)))

(define-public ruby-heredoc-unindent
  (package
    (name "ruby-heredoc-unindent")
    (version "1.2.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "heredoc_unindent" version))
              (sha256
               (base32
                "14ijr2fsjwhrkjkcaz81d5xnfa4vvgvcflrff83avqw9klm011yw"))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-hoe))
    (home-page "https://github.com/adrianomitre/heredoc_unindent")
    (synopsis "Heredoc indentation cleaner")
    (description "This gem removes common margin from indented strings, such
as the ones produced by indented heredocs.  In other words, it strips out
leading whitespace chars at the beginning of each line, but only as much as
the line with the smallest margin.

It is acknowledged that many strings defined by heredocs are just code and
fact is that most parsers are insensitive to indentation.  If, however, the
strings are to be used otherwise, be it for printing or testing, the extra
indentation will probably be an issue and hence this gem.")
    (license license:expat)))

(define-public ruby-safe-yaml
  (package
    (name "ruby-safe-yaml")
    (version "1.0.5")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/dtao/safe_yaml")
             (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "1a0wh7y3va2m7bjza95na2snw0vrdh9syz40mpjvjphbc4ph3pzg"))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-rspec ruby-hashie ruby-heredoc-unindent))
    (arguments
     '(#:test-target "spec"
       #:phases
       (modify-phases %standard-phases
         (add-before 'check 'set-TZ
           (lambda _
             ;; This test is dependent on the timezone
             ;; spec/transform/to_date_spec.rb:35
             ;; # SafeYAML::Transform::ToDate converts times to the local
             ;; timezone
             (setenv "TZ" "UTC-11")
             #t)))))
    (home-page "https://github.com/dtao/safe_yaml")
    (synopsis "YAML parser")
    (description "The SafeYAML gem provides an alternative implementation of
YAML.load suitable for accepting user input in Ruby applications.")
    (license license:expat)))

(define-public ruby-yaml-lint
  (package
    (name "ruby-yaml-lint")
    (version "0.0.10")
    (source
      (origin
        (method git-fetch)
        (uri (git-reference
               (url "https://github.com/Pryz/yaml-lint")
               (commit version)))
        (file-name (git-file-name name version))
        (sha256
         (base32
          "1jz26mxjkdyjbgqp7f9isnzd1i6vkizsswyj1v639nmq31hwfh0d"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (invoke "rspec"))
             #t)))))
    (native-inputs
     (list ruby-coveralls ruby-rspec ruby-simplecov))
    (synopsis "Simple YAML check tool")
    (description
     "@code{yaml-lint} will simply try to load the YAML file with the built-in
Ruby yaml library.")
    (home-page "https://github.com/Pryz/yaml-lint")
    (license license:expat)))

(define-public ruby-matrix
  (package
    (name "ruby-matrix")
    (version "0.4.2")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/ruby/matrix")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1asxr0jzh39lk5f8a9wm5avykrcy0v2wgd1bl3cszjczh99xy5k2"))))
    (build-system ruby-build-system)
    (synopsis "@code{Matrix} and @code{Vector} classes implementation for Ruby")
    (description "This Ruby library provides an implementation of the
@code{Matrix} and @code{Vector} classes.  The @code{Matrix} class represents a
mathematical matrix.  It provides methods for creating matrices, operating on
them arithmetically and algebraically, and determining their mathematical
properties (trace, rank, inverse, determinant, eigensystem, etc.).  The
@code{Vector} class represents a mathematical vector, which is useful in its
own right, and also constitutes a row or column of a @code{Matrix}.")
    (home-page "https://github.com/ruby/matrix")
    (license license:bsd-2)))

(define-public ruby-m
  (package
    (name "ruby-m")
    (version "1.6.1")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/qrush/m")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1aycfc8l1bsln1y300fv75fknn4amjcvc4rm2kd8hb6cqivjq5rg"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'sanitize-dependencies
            (lambda _
              (delete-file "Gemfile")
              (delete-file "Gemfile.lock")
              ;; Rocco is unmaintained as of 2023/01/08; avoid depending on
              ;; it.
              (substitute* "m.gemspec"
                ;; The rdiscount and rocco dependencies are used for
                ;; generating the documentation.
                ((".*rdiscount.*") "")
                ((".*rocco.*") "")
                ((".*appraisal.*") "")
                ((".*coveralls.*") ""))
              (substitute* "Rakefile"
                ;; ruby-appraisal is not packaged, and is used to test against
                ;; various dependencies; circumvent its use.
                ((".*require 'appraisal'.*") "")
                ((".*require 'coveralls'.*") "")
                (("appraisal [:graphic:]+ rake")
                 "rake")
                (("Coveralls.push!") ""))))
          (add-before 'replace-git-ls-files 'pre-replace-git-ls-files
            (lambda _
              (substitute* "m.gemspec"
                (("git ls-files -- bin/\\*")
                 "find bin -type f -not -regex '.*\\.gem$' | sort")
                (("git ls-files -- \\{test,spec,features}/\\*")
                 "find test -type f -not -regex '.*\\.gem$' | sort"))))
          (delete 'check)
          (add-after 'install 'check
            (lambda* (#:key tests? #:allow-other-keys)
              (setenv "GEM_PATH" (string-append
                                  (getenv "GEM_PATH") ":"
                                  #$output "/lib/ruby/vendor_ruby"))
              (when tests?
                (invoke "rake" "test")))))))
    (native-inputs (list ruby-activesupport))
    (propagated-inputs (list ruby-method-source ruby-rake))
    (synopsis "Ruby test runner that can run tests by line number")
    (description "@code{m} stands for metal, a better test/unit and
@code{minitest} test runner that can run tests by line number.")
    (home-page "https://github.com/qrush/m")
    (license license:expat)))

(define-public ruby-mercenary
  (package
    (name "ruby-mercenary")
    (version "0.4.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "mercenary" version))
              (sha256
               (base32
                "0f2i827w4lmsizrxixsrv2ssa3gk1b7lmqh8brk8ijmdb551wnmj"))))
    (build-system ruby-build-system)
    (arguments `(#:test-target "spec"))
    (native-inputs
     (list bundler))
    (home-page "https://github.com/jekyll/mercenary")
    (synopsis "Command-line apps library in Ruby")
    (description "Mercenary is a lightweight and flexible library for writing
command-line apps in Ruby.")
    (license license:expat)))

(define-public ruby-launchy
  (package
    (name "ruby-launchy")
    (version "2.5.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "launchy" version))
              (sha256
               (base32
                "06r43899384das2bkbrpsdxsafyyqa94il7111053idfalb4984a"))))
    (build-system ruby-build-system)
    (native-inputs (list curl links ruby-simplecov))
    (propagated-inputs (list ruby-addressable))
    (synopsis "Ruby helper class for launching applications")
    (description
     "Launchy is helper class for launching applications in a fire and forget
manner.  The aim of Launchy is to provide a common approach to launching
external applications from within Ruby programs.")
    (home-page "https://github.com/copiousfreetime/launchy")
    (license license:isc)))

(define-public ruby-liquid
  (package
    (name "ruby-liquid")
    (version "5.4.0")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/Shopify/liquid")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1qdnvd1f9zs6wyilcgxyh93wis7ikbpimjxfpbkpk2ngr1m2c8la"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (delete 'check)               ;moved after the install phase
          (add-after 'install 'check
            (assoc-ref %standard-phases 'check))
          (add-before 'check 'set-GEM_PATH
            (lambda _
              (setenv "GEM_PATH" (string-append
                                  (getenv "GEM_PATH") ":"
                                  #$output "/lib/ruby/vendor_ruby"))))
          (add-before 'check 'delete-problematic-tests
            (lambda _
              ;; The following test fails with 'Unknown tag' errors (see:
              ;; https://github.com/Shopify/liquid/issues/1699).
              (delete-file "test/integration/tags/inline_comment_test.rb"))))))
    (native-inputs (list ruby-liquid-c-bootstrap ruby-rspec ruby-stackprof))
    (home-page "https://shopify.github.io/liquid/")
    (synopsis "Template language")
    (description "Liquid is a template language written in Ruby.  It is used
to load dynamic content on storefronts.")
    (license license:expat)))

(define-public ruby-liquid-4
  (package
    (inherit ruby-liquid)
    (name "ruby-liquid")
    (version "4.0.4")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/Shopify/liquid")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0cr321nd0zkbxirgdfmz37xx7j26zfnicjh585fi20vx60frry83"))))
    (arguments (list #:tests? #f))))    ;avoid required an older ruby-liquid-c

;;; This variant is purposefully incomplete, lacking ruby-liquid so that it
;;; can be used for ruby-liquid's test suite.
(define ruby-liquid-c-bootstrap
  (package
    (name "ruby-liquid-c-bootstrap")
    (version "4.1.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "liquid-c" version))
              (sha256
               (base32
                "0jl37jz9hbfbhknryx4myxqx4n1f5dzyzmf1sapkcbw93xyrmkch"))))
    (build-system ruby-build-system)
    (arguments (list #:tests? #f))
    (native-inputs (list ruby-rake-compiler))
    (synopsis "Liquid performance extension in C")
    (description "This package provides a Partial native implementation of the
liquid ruby gem in C that makes it operate about three times faster.")
    (home-page "https://github.com/shopify/liquid-c")
    (license license:expat)))

(define-public ruby-liquid-c
  (package/inherit ruby-liquid-c-bootstrap
    (name "ruby-liquid-c")
    (arguments
     (list
      ;; Only run the unit tests, because the test:integration target fails
      ;; with "File does not exist: test_helper" (see:
      ;; https://github.com/Shopify/liquid-c/issues/188).
      #:test-target "test:unit"
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'extract-gemspec 'relax-requirements
            (lambda _
              (substitute* "Gemfile"
                ;; Do not attempt to fetch a gem from git.
                (("git_source\\(:github) do \\|repo_name\\|")
                 "if false")
                ((", github: \"Shopify/liquid\", ref: \"master\"")
                 "")
                ;; Remove extraneous dependencies.
                ((".*byebug.*") "")
                ((".*rubocop.*") "")
                ;; Relax spy version specification.
                (("gem \"spy\", \"0.4.1\"")
                 "gem \"spy\", \">= 0.4.1\"")))))))
    (native-inputs
     (list ruby-benchmark-ips
           ruby-rake-compiler
           ruby-ruby-memcheck
           ruby-spy
           ruby-stackprof))
    (propagated-inputs
     (list ruby-liquid))))

(define-public ruby-localhost
  (package
    (name "ruby-localhost")
    (version "1.1.10")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/socketry/localhost")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1yp70w15wpfk613ap5f4y15yx4n2qqwa67vqc2f4lv7npf3llcz0"))))
    (build-system ruby-build-system)
    (arguments
     ;; XXX: The test suite requires sus-fixtures-async, which requires async,
     ;; only available for Ruby 3.0.
     (list #:tests? #f
           #:phases
           #~(modify-phases %standard-phases
               (add-before 'build 'remove-missing-signing-key
                 (lambda _
                   ;; Otherwise, the build fails with ENOENT.
                   (substitute* "localhost.gemspec"
                     ((".*spec.signing_key.*") "")))))))
    (synopsis "API for generating per-user self-signed root certificates")
    (description "This package provides @code{localhost}, a Ruby library for
Managing a local certificate authority for self-signed, localhost development
servers.")
    (home-page "https://github.com/socketry/localhost")
    (license license:expat)))

(define-public ruby-forwardable-extended
  (package
    (name "ruby-forwardable-extended")
    (version "2.6.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "forwardable-extended" version))
              (sha256
               (base32
                "15zcqfxfvsnprwm8agia85x64vjzr2w0xn9vxfnxzgcv8s699v0v"))))
    (build-system ruby-build-system)
    (arguments `(#:tests? #f)); Cyclic dependency on luna-rspec-formatters
    (home-page "https://github.com/envygeeks/forwardable-extended")
    (synopsis "Delegation to hashes and instance variables in Forwardable")
    (description "Forwardable Extended provides more @code{Forwardable}
methods for your source as @code{Forwardable::Extended}.")
    (license license:expat)))

(define-public ruby-pathutil
  (package
    (name "ruby-pathutil")
    (version "0.16.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "pathutil" version))
              (sha256
               (base32
                "12fm93ljw9fbxmv2krki5k5wkvr7560qy8p4spvb9jiiaqv78fz4"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-forwardable-extended))
    (native-inputs
     (list bundler ruby-rspec))
    ;; Fails with: cannot load such file --
    ;; /tmp/guix-build-ruby-pathutil-0.16.0.drv-0/gem/benchmark/support/task
    (arguments `(#:tests? #f))
    (home-page "https://github.com/envygeeks/pathutil")
    (synopsis "Extended implementation of Pathname")
    (description "Pathutil tries to be a faster pure Ruby implementation of
Pathname.")
    (license license:expat)))

(define-public ruby-terminal-table
  (package
    (name "ruby-terminal-table")
    (version "3.0.2")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/tj/terminal-table")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1c3f7ng3lxq962n8sbmlsvjx6srh5i801wzsyhxmfz2g880f5jps"))))
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (add-before 'check 'remove-unnecessary-dependencies
           (lambda _
             (substitute* "terminal-table.gemspec"
               (("s.add_runtime_dependency.*") "\n")
               (("s.add_development_dependency.*") "\n"))
             (substitute* "Gemfile"
               ((".*tins.*") "\n"))))
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (invoke "rspec")))))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-unicode-display-width))
    (native-inputs
     (list ruby-rspec ruby-term-ansicolor))
    (home-page "https://github.com/tj/terminal-table")
    (synopsis "Simple, feature rich ASCII table generation library")
    (description
     "Terminal Table is a fast and simple, yet feature rich
table generator written in Ruby.  It supports ASCII and
Unicode formatted tables.")
    (license license:expat)))

(define-public jekyll
  (package
    (name "jekyll")
    (version "4.3.2")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/jekyll/jekyll")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1d588d7zhp526r21f9mnm204m8qy0c8h3lq3ghyg6qp8mj6hnwj4"))))
    (build-system ruby-build-system)
    (arguments
     (list #:modules '((guix build ruby-build-system)
                       (guix build utils)
                       (ice-9 ftw)
                       (srfi srfi-26))
           ;; The cucumber acceptance suite is not run as it depends on an old
           ;; version (5).
           #:test-target "spec"
           #:phases
           #~(modify-phases %standard-phases
               (add-before 'check 'disable-problematic-tests
                 ;; TODO: Package the missing test inputs.
                 (lambda _
                   (with-directory-excursion "test"
                     ;; Requires 'jekyll-coffeescript'.
                     (delete-file "test_coffeescript.rb")
                     ;; Requires 'tomlrb'.
                     (delete-file "test_configuration.rb")
                     (substitute* "test_filters.rb"
                       ;; The sassify tests fail due to white space
                       ;; differences (see:
                       ;; https://github.com/jekyll/jekyll/issues/9322).
                       ((".*s?ssify with simple string.*" all)
                        (string-append all
                                       "      skip('fails on guix')\n")))
                     ;; Requires kramdown-syntax-coderay.
                     (delete-file "test_kramdown.rb")
                     ;; Requires 'test-theme', usually made available from the
                     ;; local checkout via Bundler (not used here).
                     (delete-file "test_layout_reader.rb")
                     ;; Requires a large amount of un-packaged dependencies.
                     (delete-file "test_plugin_manager.rb")
                     ;; Requires 'classifier-reborn'.
                     (delete-file "test_related_posts.rb")
                     ;; This one causes a test failure similar to the ones for
                     ;; sassify above.
                     (delete-file "test_sass.rb")
                     ;; This would require running the tests via 'bundle
                     ;; exec', but the Gemfile contains too many (extraneous)
                     ;; dependencies.
                     (delete-file "test_site.rb")
                     ;; Delete the theme tests, as they require 'test-theme',
                     ;; usually made available from the local checkout via the
                     ;; Gemfile/bundler (not used here).
                     (for-each delete-file
                               (scandir
                                "." (cut string-prefix? "test_theme" <>)))
                     ;; This one also relies on 'test-theme'.
                     (delete-file "test_liquid_renderer.rb")
                     ;; This test assumes internet connectivity, negate it, as
                     ;; there's no Internet in the build container.
                     (substitute* "test_utils.rb"
                       (("assert Utils::Internet\\.connected\\?")
                        "refute Utils::Internet.connected?"))
                     ;; These tests fail non-deterministically (see:
                     ;; https://github.com/jekyll/jekyll/issues/9323).
                     (delete-file "test_new_command.rb")
                     (delete-file "test_collections.rb"))))
               (replace 'check
                 (lambda* (#:key tests? #:allow-other-keys)
                   (when tests?
                     ;; Invoke the test scripts manually, as 'rake test'
                     ;; doesn't show any failure details, making debugging
                     ;; needlessly difficult.
                     (for-each (lambda (f)
                                 (invoke "ruby" "-I" "test" f))
                               (find-files "test" "^test_.*\\.rb$"))))))))
    (native-inputs
     (list bundler
           ruby-httpclient
           ruby-minitest-profile
           ruby-minitest-reporters
           ruby-nokogiri
           ruby-rspec
           ruby-rspec-mocks
           ruby-shoulda
           ruby-simplecov))
    (propagated-inputs
     (list ruby-addressable
           ruby-colorator
           ruby-em-websocket
           ruby-i18n
           ruby-jekyll-sass-converter
           ruby-jekyll-watch
           ruby-kramdown-parser-gfm
           ruby-liquid-4
           ruby-mercenary
           ruby-pathutil
           ruby-rouge
           ruby-safe-yaml
           ruby-sassc
           ruby-terminal-table
           ruby-webrick))
    (home-page "https://jekyllrb.com/")
    (synopsis "Static site generator")
    (description "Jekyll is a simple, blog aware, static site generator.")
    (license license:expat)))

(define-public ruby-jekyll-paginate-v2
  (package
    (name "ruby-jekyll-paginate-v2")
    (version "3.0.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "jekyll-paginate-v2" version))
              (sha256
               (base32
                "1qzlqhpiqz28624fp0ak76hfy7908w6kpx62v7z43aiwjv0yc6q0"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list jekyll))
    (home-page "https://github.com/sverrirs/jekyll-paginate-v2")
    (synopsis "Pagination Generator for Jekyll 3")
    (description "The Pagination Generator forms the core of the pagination
logic in Jekyll.  It calculates and generates the pagination pages.")
    (license license:expat)))

(define-public ruby-faraday-net-http
  (package
    (name "ruby-faraday-net-http")
    (version "3.0.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "faraday-net_http" version))
              (sha256
               (base32
                "13byv3mp1gsjyv8k0ih4612y6vw5kqva6i03wcg4w2fqpsd950k8"))))
    (build-system ruby-build-system)
    ;; Do not run the test suite here as it would introduce a dependency cycle
    ;; with ruby-faraday, which uses it as part of its test suite.
    (arguments (list #:tests? #f))
    (synopsis "Faraday adapter for Net::HTTP")
    (description "This gem is a Faraday adapter for the @code{Net::HTTP}
library.  Faraday is an HTTP client library that provides a common interface
over many adapters.")
    (home-page "https://github.com/lostisland/faraday-net_http")
    (license license:expat)))

(define-public ruby-faraday
  (package
    (name "ruby-faraday")
    (version "2.7.4")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/lostisland/faraday")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0ya6jqa7ryr4i62mmzjjxzd8i8y0pyw0cbhifd758rs6lvkzmxa3"))))
    (build-system ruby-build-system)
    (arguments (list #:test-target "spec"))
    (native-inputs
     (list ruby-coveralls
           ruby-pry
           ruby-rack
           ruby-rspec
           ruby-simplecov
           ruby-webmock))
    ;; Propagate faraday-net-http as this is the default adapter used, and
    ;; many Ruby projects assumes it is available.
    (propagated-inputs (list ruby-ruby2-keywords ruby-faraday-net-http))
    (synopsis "Ruby HTTP/REST API client library")
    (description "Faraday is a HTTP/REST API client library which provides a
common interface over different adapters.")
    (home-page "https://github.com/lostisland/faraday")
    (license license:expat)))

(define-public ruby-nio4r
  (package
   (name "ruby-nio4r")
   (version "2.5.2")
   (source
    (origin
     (method url-fetch)
     (uri (rubygems-uri "nio4r" version))
     (sha256
      (base32
       "0gnmvbryr521r135yz5bv8354m7xn6miiapfgpg1bnwsvxz8xj6c"))))
   (build-system ruby-build-system)
   (arguments
    '(#:phases
      (modify-phases %standard-phases
        (add-after 'unpack 'remove-unnecessary-dependencies
          (lambda _
            (substitute* "spec/spec_helper.rb"
              ;; Coveralls is for uploading test coverage information to an
              ;; online service, and thus unnecessary for building the Guix
              ;; package
              (("require \"coveralls\"") "")
              (("Coveralls\\.wear!") "")
              ;; Remove rspec/retry as we are not retrying the tests
              (("require \"rspec/retry\"") "")
              (("config\\.display_try_failure_messages = true") "")
              (("config\\.verbose_retry = true") ""))
            #t))
        (add-before 'check 'compile
          (lambda _
            (invoke "rake" "compile")
            #t))
        (replace 'check
          (lambda* (#:key tests? #:allow-other-keys)
            (when tests?
              (invoke "rspec"))
            #t)))))
   (native-inputs
    (list bundler ruby-rake-compiler ruby-rspec ruby-rubocop))
   (synopsis "New I/O for Ruby")
   (description
    "@code{nio} provides cross-platform asynchronous I/O primitives in Ruby
for scalable network clients and servers.")
   (home-page "https://github.com/socketry/nio4r")
   (license license:expat)))

(define-public ruby-language-server-protocol
  (package
    (name "ruby-language-server-protocol")
    (version "3.17.0.3")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/mtsmfm/language_server-protocol-ruby")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0f2g301fz99c6nkca39s9227brlycznv8a9r4b4i99rg25m91lc6"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (replace 'replace-git-ls-files
            (lambda _
              (substitute* "language_server-protocol.gemspec"
                (("git ls-files -z([^`]*)" _ files)
                 (string-append "find " files
                                " -type f -not -regex '.*\\.gem$'"
                                " -print0 | sort -z"))))))))
    (native-inputs
     (list ruby-activesupport
           ruby-benchmark-ips
           ruby-m
           ruby-minitest
           ruby-minitest-power-assert
           ruby-pry-byebug))
    (synopsis "Language Server Protocol (LSP) development kit for Ruby")
    (description "This package provides a Language Server Protocol (LSP)
development kit for Ruby.")
    (home-page "https://github.com/mtsmfm/language_server-protocol-ruby")
    (license license:expat)))

(define-public ruby-spy
  (package
    (name "ruby-spy")
    (version "1.0.5")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "spy" version))
              (sha256
               (base32
                "0g2mma8q17m26k5s864ndlvvqllhcivwg2wdigjvb7z06iw17gds"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases #~(modify-phases %standard-phases
                        (add-after 'extract-gemspec 'relax-requirements
                          (lambda _
                            (substitute* "Gemfile"
                              ((".*redcarpet.*") "")
                              ((".*yard.*") "")))))))
    (native-inputs
     (list ruby-coveralls
           ruby-minitest-reporters
           ruby-pry
           ruby-pry-byebug
           ruby-rspec-core
           ruby-rspec-expectations))
    (synopsis "Mocking library for Ruby")
    (description "Spy is a mocking library.  By default, it will raise an
error if you attempt to stub a method that doesn't exist or call the stubbed
method with the wrong arity.")
    (home-page "https://github.com/ryanong/spy")
    (license license:expat)))

(define-public ruby-subprocess
  (package
    (name "ruby-subprocess")
    (version "1.5.6")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "subprocess" version))
              (sha256
               (base32
                "0v49ahfx9b75qg42sl8a3l367g2vihc16g8z5f2raxpxjl1wh2s2"))))
    (build-system ruby-build-system)
    ;; Do not run the test suite, as there its test dependency ruby-sord would
    ;; introduce a cycle with ruby-sorbet-runtime.
    (arguments (list #:tests? #f))
    (native-inputs (list ruby-minitest ruby-pry))
    (synopsis "Ruby library to control and communicate with spawned processes")
    (description "This Ruby library is controlling and communicating with
spawned processes.  It is designed after Python's @code{subprocess} module.")
    (home-page "https://github.com/stripe/subprocess")
    (license license:expat)))

(define-public ruby-sus
  (package
    (name "ruby-sus")
    (version "0.20.3")
    (source (origin
              (method git-fetch)        ;for gems.rb
              (uri (git-reference
                    (url "https://github.com/ioquatix/sus")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0j4rkh9li79674h3lfkxlcdygscmb22l77i7hwhxl3gw103gkpdr"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases
           #~(modify-phases %standard-phases
               (add-before 'build 'prune-gems.rb
                 (lambda _
                   (substitute* "gems.rb"
                     (("gem \"bake-modernize\"") "")
                     (("gem \"bake-gem\"") "")
                     (("gem \"utopia-project\"") ""))))
               (add-before 'build 'remove-missing-signing-key
                 (lambda _
                   ;; Otherwise, the build fails with ENOENT.
                   (substitute* "sus.gemspec"
                     ((".*spec.signing_key.*") ""))))
               (delete 'check)          ;moved after install
               (add-after 'install 'check
                 (lambda* (#:key tests? #:allow-other-keys)
                   (when tests?
                     (setenv "CONSOLE_LEVEL" "debug")
                     (setenv "HOME" "/tmp")
                     ;; 'bundle exec' must be used to workaround a problem
                     ;; when using bake test and GEM_PATH (see:
                     ;; https://github.com/ioquatix/bake/issues/11).
                     (invoke "bundle" "exec" "bake" "test"))))
               (add-before 'check 'set-paths
                 (lambda _
                   (setenv "PATH" (string-append (getenv "PATH") ":"
                                                 #$output "/bin"))
                   (setenv "GEM_PATH" (string-append
                                       (getenv "GEM_PATH") ":"
                                       #$output "/lib/ruby/vendor_ruby")))))))
    (native-inputs (list ruby-bake-test ruby-bake-test-external ruby-covered))
    (synopsis "Fast and scalable test runner for Ruby")
    (description "This package provides a fast and scalable test runner for Ruby.")
    (home-page "https://github.com/ioquatix/sus")
    (license license:expat)))

(define-public ruby-syntax-tree
  (package
    (name "ruby-syntax-tree")
    (version "6.1.1")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/ruby-syntax-tree/syntax_tree")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0356lgvqp22nkqlrgszf7myfdg4arclg278awh34zyby1cx6hb2k"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          ;; The tests rely on the Gem being installed, so move the check
          ;; phase after the install phase.
          (delete 'check)
          (add-after 'install 'check
            (lambda* (#:key tests? #:allow-other-keys)
              (setenv "GEM_PATH" (string-append
                                  #$output "/lib/ruby/vendor_ruby:"
                                  (getenv "GEM_PATH")))
              (when tests?
                (invoke "rake" "test")))))))
    (native-inputs (list ruby-rubocop-ast ruby-simplecov))
    (propagated-inputs (list ruby-prettier-print))
    (synopsis "Fast Ruby parser and formatter")
    (description "Syntax Tree is a suite of tools built on top of the internal
CRuby parser.  It provides the ability to generate a syntax tree from source,
as well as the tools necessary to inspect and manipulate that syntax tree.  It
can be used to build formatters, linters, language servers, and more.")
    (home-page "https://github.com/ruby-syntax-tree/syntax_tree")
    (license license:expat)))

(define sorbet-version "0.5.10610.20230106174520-1fa668010")

(define sorbet-monorepo
  (origin
    (method git-fetch)
    (uri (git-reference
          (url "https://github.com/sorbet/sorbet")
          (commit sorbet-version)))
    (file-name (string-append "sorbet-" sorbet-version "-checkout"))
    (sha256
     (base32
      "0f21dl06alxwn6xgdxyrkd58plmmsv04z2bcls9ld4cfzsrs5537"))))

(define (make-sorbet-gem-source gem)
  "Return the source of GEM, a sub-directory."
  (computed-file
   (string-append "ruby-sorbet-" gem "-" sorbet-version "-checkout")
   (with-imported-modules (source-module-closure '((guix build utils)))
     #~(begin
         (use-modules (guix build utils))
         (copy-recursively (string-append #$sorbet-monorepo
                                          "/gems/sorbet-" #$gem)
                           #$output)))))

(define-public ruby-sorbet-runtime
  (package
    (name "ruby-sorbet-runtime")
    (version sorbet-version)
    (source (make-sorbet-gem-source "runtime"))
    (build-system ruby-build-system)
    ;; 25 out of 841 tests currently fail, seemingly due to invalid
    ;; assumptions about file names in the build environment (see:
    ;; https://github.com/sorbet/sorbet/issues/6650).
    (arguments (list #:tests? #f))
    (native-inputs
     (list ruby-minitest
           ruby-mocha
           ruby-rubocop
           ruby-rubocop-performance
           ruby-concurrent-ruby
           ruby-pry
           ruby-pry-byebug
           ruby-parser
           ruby-subprocess))
    (synopsis "Runtime type checking component for Sorbet")
    (description "Sorbet's runtime type checking component.  Sorbet is a
powerful type checker for Ruby.")
    (home-page "https://sorbet.org")
    (license license:asl2.0)))

(define-public ruby-mustache
  (package
    (name "ruby-mustache")
    (version "1.1.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "mustache" version))
       (sha256
        (base32 "1l0p4wx15mi3wnamfv92ipkia4nsx8qi132c6g51jfdma3fiz2ch"))))
    (build-system ruby-build-system)
    (native-inputs
     `(("ruby-simplecov" ,ruby-simplecov)
       ("test-patch"
        ,(search-patch "ruby-mustache-1.1.1-fix-race-condition-tests.patch"))))
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'patch-tests
           (lambda* (#:key inputs #:allow-other-keys)
             (invoke "patch" "-p1" "--batch" "-i"
                     (assoc-ref inputs "test-patch")))))))
    (synopsis "Framework-agnostic way to render logic-free views")
    (description
     "Mustache is a framework-agnostic way to render logic-free views.
Think of Mustache as a replacement for your views.  Instead of views
consisting of ERB or HAML with random helpers and arbitrary logic,
your views are broken into two parts: a Ruby class and an HTML
template.")
    (home-page "https://github.com/mustache/mustache")
    (license license:expat)))

(define-public ruby-mustermann
  (package
    (name "ruby-mustermann")
    (version "3.0.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "mustermann" version))
       (sha256
        (base32
         "0rwbq20s2gdh8dljjsgj5s6wqqfmnbclhvv2c2608brv7jm6jdbd"))))
    (build-system ruby-build-system)
    (arguments
     ;; No tests.
     '(#:tests? #f))
    (synopsis "Library implementing patterns that behave like regular expressions")
    (description "Given a string pattern, Mustermann will turn it into an
object that behaves like a regular expression and has comparable performance
characteristics.")
    (home-page "https://github.com/sinatra/mustermann")
    (license license:expat)))

(define-public ruby-prettier-print
  (package
    (name "ruby-prettier-print")
    (version "1.2.1")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/ruby-syntax-tree/prettier_print")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "00cg40jc0il1hpsrpsrqwhsxmx7day9lxp1ksrm08zxzsrz9ykqz"))))
    (build-system ruby-build-system)
    (native-inputs (list ruby-simplecov))
    (synopsis "Compatible and featureful implementation of @code{prettyprint}")
    (description "This package provides a drop-in replacement for the
@code{prettyprint} gem, with more functionality.")
    (home-page "https://github.com/ruby-syntax-tree/prettier_print")
    (license license:expat)))

(define-public ruby-html-proofer
  (package
    (name "ruby-html-proofer")
    (version "5.0.3")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/gjtorikian/html-proofer")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "01ksss3ikppc45z2q33bx8bb9785bqlp1rdqascaqg9mhs392adk"))))
    (build-system ruby-build-system)
    (arguments
     (list
      ;; Tests require vcr, which is under the Hippocratic license, which is
      ;; not a free software license (see:
      ;; https://www.gnu.org/licenses/license-list.html#hippocratic).
      #:tests? #f
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'extract-gemspec 'relax-requirements
            (lambda _
              (substitute* "html-proofer.gemspec"
                (("required_ruby_version = \\[\">= 3.1\"")
                 "required_ruby_version = [\">= 2.6\""))))
          (replace 'replace-git-ls-files
            (lambda _
              ;; The html-proofer.gemspec file contains 'all_files = %x(git
              ;; ls-files -z).split("\x0")', but the original phase matches on
              ;; `git ls-files -z`.
              ;; TODO: Improve ruby-build-system patterns on core-updates.
              (substitute* "html-proofer.gemspec"
                (("git ls-files -z")
                 "find . -type f -not -regex '.*\\.gem$' -print0 \
| sort -z | cut -zc3-")))))))
    (propagated-inputs
     (list ruby-addressable
           ruby-mercenary
           ruby-nokogiri
           ruby-parallel
           ruby-rainbow
           ruby-typhoeus
           ruby-yell))
    (synopsis "Test your rendered HTML files to make sure they're accurate")
    (description
     "HTMLProofer is a set of tests to validate your HTML output.  These
tests check if your image references are legitimate, if they have alt tags,
if your internal links are working, and so on.  It's intended to be an
all-in-one checker for your output.")
    (home-page "https://github.com/gjtorikian/html-proofer")
    (license license:expat)))

(define-public ruby-htmlentities
  (package
    (name "ruby-htmlentities")
    (version "4.3.4")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "htmlentities" version))
       (sha256
        (base32
         "1nkklqsn8ir8wizzlakncfv42i32wc0w9hxp00hvdlgjr7376nhj"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             (map (lambda (file)
                    (invoke "ruby" "-Itest" file))
                  (find-files "./test" ".*_test\\.rb")))))))
    (synopsis "Encode and decode (X)HTML entities")
    (description
     "This package provides a module for encoding and decoding (X)HTML
entities.")
    (home-page "https://github.com/threedaymonk/htmlentities")
    (license license:expat)))

;;; FIXME: Currently broken with rack 3, awaiting the merge for
;;; https://github.com/sinatra/sinatra/pull/1857 and a new release.
(define-public ruby-sinatra
  (package
    (name "ruby-sinatra")
    (version "3.0.5")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "sinatra" version))
       (sha256
        (base32
         "1ryfja9yd3fq8n1p5yi3qnd0pjk7bkycmxxmbb1bj0axlr1pdv20"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-mustermann ruby-rack ruby-rack-protection ruby-tilt))
    (synopsis "DSL for quick web applications creation in Ruby")
    (description
     "Sinatra is a DSL for quickly creating web applications in Ruby with
minimal effort.")
    (home-page "https://sinatrarb.com/")
    (license license:expat)))

(define-public ruby-timeout
  (package
    (name "ruby-timeout")
    (version "0.3.2")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/ruby/timeout")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0lzhs2c4znzg781w146dhvczhbx7h3wkb90i4v6h68zvm2zfylgj"))))
    (build-system ruby-build-system)
    (synopsis "Timeout library for Ruby")
    (description "Timeout provides a way to auto-terminate a potentially
long-running operation if it hasn't finished in a fixed amount of time.")
    (home-page "https://github.com/ruby/timeout")
    (license (list license:bsd-2))))

(define-public ruby-thin
  (package
    (name "ruby-thin")
    (version "1.7.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "thin" version))
       (sha256
        (base32
         "0nagbf9pwy1vg09k6j4xqhbjjzrg5dwzvkn4ffvlj76fsn6vv61f"))))
    (build-system ruby-build-system)
    (arguments
     ;; No tests.
     '(#:tests? #f))
    (propagated-inputs
     (list ruby-daemons ruby-eventmachine ruby-rack))
    (synopsis "Thin and fast web server for Ruby")
    (description "Thin is a Ruby web server that glues together 3 Ruby libraries:
@itemize
@item the Mongrel parser,
@item Event Machine, a network I/O library with high scalability, performance
and stability,
@item Rack, a minimal interface between webservers and Ruby frameworks.
@end itemize\n")
    (home-page "https://github.com/macournoyer/thin")
    (license license:ruby)))

(define-public ruby-truthy
  (package
    (name "ruby-truthy")
    (version "1.0.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "truthy" version))
              (sha256
               (base32
                "19silgd65j3qwfk5w891p9wcmzdmi9ddm2kg5zbvvqn2h9lkfzmd"))))
    (build-system ruby-build-system)
    (arguments (list #:phases #~(modify-phases %standard-phases
                                  (replace 'check
                                    (lambda* (#:key tests? #:allow-other-keys)
                                      (when tests?
                                        (substitute* "spec/spec_helper.rb"
                                          (("require 'spec'")
                                           "require 'rspec'"))
                                        (invoke "rspec")))))))
    (native-inputs (list ruby-rspec))
    (synopsis "Object truthiness-related Ruby library")
    (description "This library makes it easier to discover the truth values of
various Ruby objects.")
    (home-page "https://github.com/ymendel/truthy")
    (license license:expat)))

(define-public ruby-skinny
  (package
    (name "ruby-skinny")
    (version "0.2.4")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "skinny" version))
       (sha256
        (base32
         "1y3yvx88ylgz4d2s1wskjk5rkmrcr15q3ibzp1q88qwzr5y493a9"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f ; No included tests
       #:phases
       (modify-phases %standard-phases
         (add-before 'build 'patch-gemspec
           (lambda _
             (substitute* ".gemspec"
               (("<eventmachine>.freeze, \\[\\\"~> 1.0.0\"")
                "<eventmachine>, [\">= 1.0.0\"")
               (("<thin>.freeze, \\[\\\"< 1.7\", ") "<thin>, ["))
             #t)))))
    (propagated-inputs
     (list ruby-eventmachine ruby-thin))
    (synopsis "Simple, upgradable WebSockets for Ruby Thin")
    (description "Skinny is a simple, upgradable WebSockets for Ruby, using
the Thin library.")
    (home-page "https://github.com/sj26/skinny")
    (license license:expat)))

(define-public ruby-sys-filesystem
  (package
    (name "ruby-sys-filesystem")
    (version "1.3.4")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "sys-filesystem" version))
              (sha256
               (base32
                "0mizqnsiagagmracadr16s5na2ks2j3ih1w0f3gp4ssrda6szl01"))))
    (build-system ruby-build-system)
    (arguments
     '(#:phases (modify-phases %standard-phases
                  (add-before 'check 'set-HOME
                    (lambda _
                      ;; Some tests attempt to stat $HOME.  Let them.
                      (setenv "HOME" "/tmp")
                      #t)))))
    (propagated-inputs
     (list ruby-ffi))
    (native-inputs
     (list ruby-mkmf-lite))
    (synopsis "Gather file system information")
    (description
     "The @code{sys-filesystem} library provides a cross-platform interface
for gathering file system information, such as disk space and mount points.")
    (home-page "https://github.com/djberg96/sys-filesystem")
    (license license:asl2.0)))

(define-public mailcatcher
  (package
    (name "mailcatcher")
    (version "0.7.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "mailcatcher" version))
       (sha256
        (base32
         "02w1ycyfv7x0sh9799lz7xa65p5qvl5z4pa8a7prb68h2zwkfq0n"))))
    (build-system ruby-build-system)
    (arguments
     ;; Tests require web/assets which is not included in the output.  We
     ;; might be able to fix this by adding the Git repository to the GEM_PATH
     ;; of the tests.  See ruby-mysql2.
     '(#:tests? #f
       #:phases
       (modify-phases %standard-phases
         (add-before 'build 'patch-gemspec
           (lambda _
             (substitute* ".gemspec"
               (("<eventmachine>.freeze, \\[\\\"= 1.0.9.1")
                "<eventmachine>, [\">= 1.0.9.1")
               (("<rack>.freeze, \\[\\\"~> 1.5") "<rack>, [\">= 1.5")
               (("<thin>.freeze, \\[\\\"~> 1.5.0") "<thin>, [\">= 1.5.0")
               (("<sinatra>.freeze, \\[\\\"~> 1.2") "<sinatra>, [\">= 1.2"))
             #t))
         (add-before 'build 'loosen-dependency-contraint
             (lambda _
               (substitute* "lib/mail_catcher.rb"
                 (("\"eventmachine\", \"1.0.9.1\"") "\"eventmachine\", \">= 1.0.9.1\"")
                 (("\"rack\", \"~> 1.5\"") "\"rack\", \">= 1.5\"")
                 (("\"thin\", \"~> 1.5.0\"") "\"thin\", \">= 1.5.0\"")
                 (("\"sinatra\", \"~> 1.2\"") "\"sinatra\", \">= 1.2\""))
               #t)))))
    (inputs
     (list ruby-eventmachine
           ruby-mail
           ruby-rack
           ruby-sinatra
           ruby-skinny
           ruby-sqlite3
           ruby-thin))
    (synopsis "SMTP server which catches messages to display them a browser")
    (description
     "MailCatcher runs a super simple SMTP server which catches any message
sent to it to display in a web interface.  Run mailcatcher, set your favourite
app to deliver to smtp://127.0.0.1:1025 instead of your default SMTP server,
then check out http://127.0.0.1:1080 to see the mail.")
    (home-page "https://mailcatcher.me")
    (license license:expat)))

(define-public ruby-backport
  (package
    (name "ruby-backport")
    (version "1.1.2")
    (source
     (origin
       ;; The gem does not include test code, so fetch from the Git repository.
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/castwide/backport")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "18fpg1n7n2z02ykz9v1x1q0cqa2lvivf8ygka768s01q1r9wfwv2"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "spec"))
    (native-inputs
     (list bundler ruby-rspec))
    (inputs
     (list ruby-simplecov))
    (synopsis "Pure Ruby library for event-driven IO")
    (description
     "This package provides a pure Ruby library for event-driven IO.")
    (home-page "https://github.com/castwide/backport")
    (license license:expat)))

(define-public ruby-json-schema
  (package
    (name "ruby-json-schema")
    (version "2.8.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "json-schema" version))
       (sha256
        (base32
         "1yv5lfmr2nzd14af498xqd5p89f3g080q8wk0klr3vxgypsikkb5"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f ; no tests
       #:phases
       (modify-phases %standard-phases
         (replace 'build
           (lambda _
             (invoke "gem" "build" ".gemspec"))))))
    (propagated-inputs
     (list ruby-addressable))
    (synopsis "Ruby JSON Schema Validator")
    (description "This library provides Ruby with an interface for validating
JSON objects against a JSON schema conforming to JSON Schema Draft 4.  Legacy
support for JSON Schema Draft 3, JSON Schema Draft 2, and JSON Schema Draft 1
is also included.")
    (home-page "https://github.com/ruby-json-schema/json-schema")
    (license license:expat)))

(define-public swagger-diff
  (package
    (name "swagger-diff")
    (version "1.1.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "swagger-diff" version))
       (sha256
        (base32
         "1hxx50nga1bqn254iqjcdwkc9c72364ks9lyjyw10ajz0l0ly7sn"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "spec"
       #:phases
       (modify-phases %standard-phases
         ;; Don't run or require rubocop, the code linting tool, as this is a
         ;; bit unnecessary.
         (add-after 'unpack 'dont-run-rubocop
           (lambda _
             (substitute* "Rakefile"
               ((".*rubocop.*") "")
               ((".*RuboCop.*") ""))
             #t)))))
    (propagated-inputs
     (list ruby-json-schema))
    (native-inputs
     (list bundler ruby-rspec-core ruby-rspec-expectations))
    (synopsis
     "Compare Open API Initiative specification files")
    (description
     "Swagger::Diff is a utility for comparing two different Open API
Initiative (OAI) specifications (formerly known as Swagger specifications).
It is intended to determine whether a newer API specification is
backwards-compatible with an older API specification.")
    (home-page "https://github.com/civisanalytics/swagger-diff")
    (license license:bsd-3)))

(define-public ruby-reverse-markdown
  (package
    (name "ruby-reverse-markdown")
    (version "1.1.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "reverse_markdown" version))
       (sha256
        (base32
         "0w7y5n74daajvl9gixr91nh8670d7mkgspkk3ql71m8azq3nffbg"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-nokogiri))
    (native-inputs
     (list bundler ruby-rspec ruby-kramdown ruby-simplecov))
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (invoke "rspec"))
             #t)))))
    (synopsis "Convert HTML into Markdown")
    (description
     "This Ruby module allows you to map simple HTML back into
Markdown---e.g., if you want to import existing HTML data in your
application.")
    (home-page "https://github.com/xijo/reverse_markdown")
    (license license:wtfpl2)))

(define-public ruby-solargraph
  (package
    (name "ruby-solargraph")
    (version "0.40.3")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "solargraph" version))
       (sha256
        (base32
         "1gf049rm0yvw4r8r5yyi890idbfg8qh0dikqx5prvkh11srl73bz"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-backport
           bundler
           ruby-benchmark
           ruby-e2mmap
           ruby-jaro-winkler
           ruby-kramdown
           ruby-kramdown-parser-gfm
           ruby-maruku
           ruby-nokogiri
           ruby-parser
           ruby-reverse-markdown
           ruby-rubocop
           ruby-thor
           ruby-tilt
           ruby-yard))
    (native-inputs
     (list ruby-rspec ruby-pry ruby-simplecov ruby-webmock))
    ;; FIXME: can't figure out how to run the tests properly:

    ;; An error occurred while loading spec_helper.
    ;; Failure/Error: return gem_original_require(path)
    ;; LoadError:
    ;; cannot load such file -- spec_helper
    (arguments
     '(#:tests? #f
       #:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (invoke "rspec"))
             #t)))))
    (synopsis
     "IDE tools for code completion, inline documentation, and static analysis")
    (description
     "Solargraph provides a comprehensive suite of tools for Ruby
programming: intellisense, diagnostics, inline documentation, and type
checking.")
    (home-page "https://solargraph.org/")
    (license license:expat)))

(define-public ruby-wayback-machine-downloader
  (package
    (name "ruby-wayback-machine-downloader")
    (version "2.2.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri
             "wayback_machine_downloader"
             version))
       (sha256
        (base32
         "12kb1qmvmmsaihqab1prn6cmynkn6cgb4vf41mgv22wkcgv5wgk2"))))
    (build-system ruby-build-system)
    (arguments
     '(#:tests? #f)) ; no tests
    (synopsis "Download archived websites from the Wayback Machine")
    (description
     "Wayback Machine Downloader is a command line tool for downloading
websites from the Internet Archive's Wayback Machine (archive.org).
It allows fine grained control over what to download by specifying
which snapshots to consider and what files to include.")
    (home-page
     "https://github.com/hartator/wayback-machine-downloader")
    (license license:expat)))

(define-public ruby-zeitwerk
  (package
    (name "ruby-zeitwerk")
    (version "2.6.7")
    (source
      (origin
        (method git-fetch)              ;for tests
        (uri (git-reference
               (url "https://github.com/fxn/zeitwerk")
               (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
         (base32
          "10p1ycv72yas1fdqrmdyz1aiqf8axj6q1kyllni2wknhk059jvi0"))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-minitest
           ruby-minitest-focus
           ruby-minitest-proveit
           ruby-minitest-reporters))
    (synopsis "Efficient and thread-safe code loader for Ruby")
    (description
     "Zeitwerk implements constant autoloading with Ruby semantics.  Each gem
and application may have their own independent autoloader, with its own
configuration, inflector, and logger.  Supports autoloading, reloading, and
eager loading.")
    (home-page "https://github.com/fxn/zeitwerk")
    (license license:expat)))

(define-public ruby-wwtd
  (package
    (name "ruby-wwtd")
    (version "1.4.1")
    (home-page "https://github.com/grosser/wwtd")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url home-page)
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0gw7vfnbb41cy67yw82zji3jkhfsgmzcgzaszm99ax77y18wclf2"))
              (modules '((guix build utils)))
              (snippet
               '(begin
                  ;; Remove bundled library.
                  (delete-file "spec/rake-12.3.0.gem")
                  #t))))
    (build-system ruby-build-system)
    (arguments
     '(;; XXX: Tests need multiple versions of ruby, wants to run
       ;; `bundle install`, etc.
       #:tests? #f
       #:phases (modify-phases %standard-phases
                  (replace 'replace-git-ls-files
                    (lambda _
                      (substitute* "wwtd.gemspec"
                        (("git ls-files lib/ bin/`")
                         "find lib/ bin/ -type f |sort`"))
                      #t))
                  (add-before 'check 'remove-version-constraints
                    (lambda _
                      (delete-file "Gemfile.lock")
                      #t))
                  (replace 'check
                    (lambda* (#:key tests? #:allow-other-keys)
                      (if tests?
                          (invoke "rspec" "spec/")
                          (format #t "test suite not run~%"))
                      #t)))))
    (native-inputs
     (list ruby-bump ruby-rspec))
    (synopsis "Run @file{.travis.yml} files locally")
    (description
     "WWTD is a @dfn{Travis Simulator} that lets you run test matrices
defined in @file{.travis.yml} on your local machine, using @code{rvm},
@code{rbenv}, or @code{chruby} to test different versions of Ruby.")
    (license license:expat)))

(define-public ruby-rugged
  ;; The last release is old and doesn't build anymore (see:
  ;; https://github.com/libgit2/rugged/issues/951).
  (let ((commit "6379f23cedd5f527cf6a5c229627e366b590a22d")
        (revision "0"))
    (package
      (name "ruby-rugged")
      (version (git-version "1.6.2" revision commit))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/libgit2/rugged")
                      (commit commit)))
                (file-name (git-file-name name version))
                (sha256
                 (base32
                  "0yac7vm0l2jsdsxf2k7xbny4iyzsy8fhiy2g5sphhffp7xgynny8"))))
      (build-system ruby-build-system)
      (arguments
       (list #:gem-flags
             #~(list "--" "--use-system-libraries")
             #:phases
             #~(modify-phases %standard-phases
                 (add-after 'unpack 'adjust-extconf.rb
                   (lambda _
                     ;; Neither using --with-git2-dir=$prefix nor providing
                     ;; pkg-config allows locating the libgit2 prefix (see:
                     ;; https://github.com/libgit2/rugged/issues/955).
                     (substitute* "ext/rugged/extconf.rb"
                       (("LIBGIT2_DIR = File.join.*'vendor', 'libgit2'.*")
                        (format #f "LIBGIT2_DIR = ~s~%"
                                #$(this-package-input "libgit2"))))))
                 (delete 'check)        ;moved after the install phase
                 (add-after 'install 'check
                   (assoc-ref %standard-phases 'check))
                 (add-before 'check 'set-GEM_PATH
                   (lambda _
                     (setenv "GEM_PATH" (string-append
                                         (getenv "GEM_PATH") ":"
                                         #$output "/lib/ruby/vendor_ruby"))))
                 (add-before 'check 'disable-problematic-tests
                   (lambda _
                     (with-directory-excursion "test"
                       (for-each delete-file
                                 ;; These tests require an actual libgit2 git
                                 ;; repository checkout.
                                 '("blame_test.rb"
                                   "blob_test.rb"
                                   "cherrypick_test.rb"
                                   "config_test.rb"
                                   "commit_test.rb"
                                   "diff_test.rb"
                                   "index_test.rb"
                                   "merge_test.rb"
                                   "note_test.rb"
                                   "object_test.rb"
                                   "patch_test.rb"
                                   "rebase_test.rb"
                                   "reference_test.rb"
                                   "remote_test.rb"
                                   "repo_apply_test.rb"
                                   "repo_ignore_test.rb"
                                   "repo_pack_test.rb"
                                   "repo_reset_test.rb"
                                   "repo_test.rb"
                                   "revert_test.rb"
                                   "settings_test.rb"
                                   "status_test.rb"
                                   "submodule_test.rb"
                                   "tag_test.rb"
                                   "tree_test.rb"
                                   "walker_test.rb"))
                       (delete-file-recursively "online")))))))
      (native-inputs (list git-minimal/pinned ruby-rake-compiler))
      (inputs (list libgit2))
      (synopsis "Ruby bindings to the libgit2 linkable C Git library")
      (description "Rugged is a library for accessing libgit2 in Ruby.  It gives
you the speed and portability of libgit2 with the beauty of the Ruby
language.")
      (home-page "https://www.rubydoc.info/gems/rugged")
      (license license:expat))))

(define-public ruby-yell
  (package
    (name "ruby-yell")
    (version "2.2.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "yell" version))
       (sha256
        (base32
         "1g16kcdhdfvczn7x81jiq6afg3bdxmb73skqjyjlkp5nqcy6y5hx"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             (invoke "rake" "examples")))))) ; there is no test target.
    (synopsis
     "Extensible logging library for Ruby")
    (description
     "Yell is a comprehensive logging replacement for Ruby.  It defines
multiple adapters, various log level combinations and message formatting
options.")
    (home-page "https://github.com/rudionrails/yell")
    (license license:expat)))

(define-public ruby-e2mmap
  (package
    (name "ruby-e2mmap")
    (version "0.1.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "e2mmap" version))
       (sha256
        (base32
         "0n8gxjb63dck3vrmsdcqqll7xs7f3wk78mw8w0gdk9wp5nx6pvj5"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f)) ;; There is a rakefile but no tests
    (synopsis
     "Module for defining custom exceptions with specific messages")
    (description
     "Exception2MessageMapper (e2mmap) is a helper module for easily defining
exceptions with predefined messages.")
    (home-page "https://github.com/ruby/e2mmap")
    (license license:bsd-2)))

(define-public ruby-benchmark
  (package
    (name "ruby-benchmark")
    (version "0.1.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "benchmark" version))
       (sha256
        (base32
         "1jvrl7400fv7v2jjri1r7ilj3sri36hzipwwgpn5psib4c9c59c6"))))
    (build-system ruby-build-system)
    (synopsis "Performance benchmarking library")
    (description "This package provides methods for benchmarking Ruby code,
giving detailed reports on the time taken for each task.")
    (home-page "https://github.com/ruby/benchmark")
    (license license:bsd-2)))

(define-public ruby-jekyll-feed
  (package
    (name "ruby-jekyll-feed")
    (version "0.15.1")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "jekyll-feed" version))
        (sha256
          (base32
            "1zxqkrnix0xiw98531h5ga6h69jhzlx2jh9qhvcl67p8nq3sgza9"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #false))     ;there are none
    (propagated-inputs
      (list jekyll))
    (synopsis
      "Jekyll plugin to generate an Atom feed of your Jekyll posts")
    (description
      "This package provides a Jekyll plugin to generate an Atom feed
of your Jekyll posts.")
    (home-page
      "https://github.com/jekyll/jekyll-feed")
    (license license:expat)))

(define-public ruby-jekyll-sitemap
  (package
    (name "ruby-jekyll-sitemap")
    (version "1.4.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "jekyll-sitemap" version))
        (sha256
          (base32
            "0622rwsn5i0m5xcyzdn86l68wgydqwji03lqixdfm1f1xdfqrq0d"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #false))     ;there are none
    (propagated-inputs
      (list jekyll))
    (synopsis
      "Automatically generate a sitemap.xml for your Jekyll site")
    (description
      "This package provides a Jekyll plugin to silently generate
a sitemaps.org compliant sitemap for your Jekyll site.")
    (home-page
      "https://github.com/jekyll/jekyll-sitemap")
    (license license:expat)))

(define-public ruby-jekyll-seo-tag
  (package
   (name "ruby-jekyll-seo-tag")
   (version "2.7.1")
   (source
    (origin
     (method url-fetch)
     (uri (rubygems-uri "jekyll-seo-tag" version))
     (sha256
      (base32
       "0fsi75hymk2wswy216fs224p5ycrzjw1kshw1bsl5czhv42wr2w3"))))
   (build-system ruby-build-system)
   (arguments
    `(#:tests? #false))
   (propagated-inputs
    (list jekyll))
   (synopsis
    "Jekyll plugin to add metadata tags for search engines and social networks")
   (description
    "This package provides a Jekyll plugin to add metadata tags for search engines
and social networks to better index and display your site's content.")
   (home-page
    "https://github.com/jekyll/jekyll-seo-tag")
   (license license:expat)))

(define-public ruby-taskjuggler
  (package
    (name "ruby-taskjuggler")
    (version "3.7.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "taskjuggler" version))
       (sha256
        (base32
         "1jrsajzhzpnfa8hj6lbf7adn8hls56dz3yw1gvzgz9y4zkka3k9v"))))
    (build-system ruby-build-system)
    (native-inputs (list tzdata-for-tests))
    (propagated-inputs
     (list ruby-mail ruby-term-ansicolor))
    (arguments
     '(#:phases (modify-phases %standard-phases
                  (replace 'replace-git-ls-files
                    (lambda _
                      (substitute* "tasks/rdoc.rake"
                        (("`git ls-files -- lib`")
                         "`find lib/ -type f |sort`"))
                      #t))
                  (add-before 'check 'tzdir-setup
                    (lambda* (#:key inputs #:allow-other-keys)
                      (setenv "TZDIR"
                              (string-append (assoc-ref inputs "tzdata")
                                             "/share/zoneinfo"))
                      #t))
                  (add-before 'check 'delete-test-BatchProcessor
                    ;; test_BatchProcessor fails with exeption:
                    ;; run> terminated with exception (report_on_exception is true)
                    (lambda _
                      (delete-file "test/test_BatchProcessor.rb")
                      #t)))))
    (synopsis
     "Project management command line tool with a domain specific language")
    (description
     "TaskJuggler (tj3) is a project management tool for project planning and
tracking using a domain specific language; projects are plain text files
written using your favourite text editor.  It includes reporting in HTML, CSV
or iCalendar format and an email based status tracking system to send and
receive time sheets from collaborators.

It covers the complete spectrum of project management tasks from the first
idea to the completion of the project.  It assists you during project scoping,
resource assignment, cost and revenue planning, risk and communication
management, status tracking and reporting.")
    (home-page "https://taskjuggler.org")
    (license license:gpl2)))

(define-public ruby-cmath
  (package
    (name "ruby-cmath")
    (version "1.0.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "cmath" version))
       (sha256
        (base32
         "1xkz6xyhpkjbdvpdib8450w62rls1mjryz0gzbbnadxkxn82nb8m"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #false))
    (native-inputs
     (list bundler ruby-rake-compiler))
    (synopsis "Trigonometric functions for complex numbers")
    (description
     "This gem is a library that provides trigonometric and transcendental
functions for complex numbers.  The functions in this module accept integers,
floating-point numbers or complex numbers as arguments.")
    (home-page "https://github.com/ruby/cmath")
    (license license:bsd-2)))

(define-public ruby-sucker-punch
  (package
    (name "ruby-sucker-punch")
    (version "3.0.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "sucker_punch" version))
       (sha256
        (base32 "0yams24wndpj7dzdysvm4z1w6ggg4xvj4snxba66prahhxvik4xl"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'extract-gemspec 'less-strict-dependencies
           (lambda _
             (substitute* "sucker_punch.gemspec"
               (("1.0.0") "1.0")))))))
    (native-inputs
     (list
      ruby-pry))
    (propagated-inputs
     (list
      ruby-concurrent))
    (home-page "https://github.com/brandonhilkert/sucker_punch")
    (synopsis "Asynchronous processing library for Ruby")
    (description "Sucker Punch is a single-process Ruby asynchronous processing
library.  It is perfect for asynchronous processes like emailing, data crunching
or social platform manipulation; and generally recommended for jobs that are
fast and non-mission critical like logs, emails, etc.")
    (license license:expat)))

(define-public ruby-countdownlatch
  (package
    (name "ruby-countdownlatch")
    (version "1.0.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "countdownlatch" version))
        (sha256
          (base32 "1v6pbay6z07fp7yvnba1hmyacbicvmjndd8rn2h1b5rmpcb5s0j3"))))
    (build-system ruby-build-system)
    (home-page "https://github.com/benlangfeld/countdownlatch")
    (synopsis "Thread synchronization aid Ruby")
    (description "CountDownLatch is a synchronization aid that allows one or
more threads to wait until a set of operations being performed in other threads
completes.")
    (license license:expat)))

(define-public ruby-value-semantics
  (package
    (name "ruby-value-semantics")
    (version "3.6.1")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "value_semantics" version))
        (sha256
          (base32 "1vdwai8wf6r1fkvdpyz1vzxm89q7ghjvb3pqpg2kvwibwzd99dnx"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda* (#:key tests? #:allow-other-keys)
             (when tests?
               (invoke "rspec")))))))
    (native-inputs
     (list
      ruby-rspec))
    (home-page "https://github.com/tomdalling/value_semantics")
    (synopsis "Ruby gem for making value classes")
    (description "ValueSemantics generates modules that provide conventional
value semantics for a given set of attributes.  The behaviour is similar to an
immutable Struct class, plus extensible, lightweight validation and coercion.")
    (license license:expat)))

(define-public ruby-promise
  (package
    (name "ruby-promise")
    (version "0.7.4")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "promise.rb" version))
        (sha256
          (base32 "0a819sikcqvhi8hck1y10d1nv2qkjvmmm553626fmrh51h2i089d"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "spec"
       #:phases
       (modify-phases %standard-phases
         (add-after 'extract-gemspec 'less-strict-dependencies
           (lambda _
             (substitute* "Rakefile"
               (("if Gem.ruby_version.*") "if false\n"))
             (substitute* "spec/spec_helper.rb"
               ((".*devtools/spec_helper.*") "\n")))))))
    (native-inputs
     (list
      ruby-rspec
      ruby-rspec-its
      ruby-awesome-print
      ruby-fuubar))
    (home-page "https://github.com/lgierth/promise.rb")
    (synopsis "Asynchronous operation library for Ruby")
    (description "Promise is a Ruby implementation of the Promises/A+
specification.  It provides 100% mutation coverage, tested on MRI 1.9, 2.0, 2.1,
2.2, Rubinius, and JRuby.")
    (license license:unlicense)))

(define-public ruby-multicodecs
  (package
    (name "ruby-multicodecs")
    (version "0.2.1")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "multicodecs" version))
        (sha256
          (base32 "0drq267di57l9zqw6zvqqimilz42rbc8z7392dwkk8wslq30s7v8"))))
    (build-system ruby-build-system)
    (home-page "https://github.com/SleeplessByte/ruby-multicodec")
    (synopsis "Ruby implementation of multiformats/multicodec")
    (description "Multicodecs is the ruby implementation of
multiformats/multicodec, a canonical table of of codecs used by various
multiformats.")
    (license license:expat)))

(define-public ruby-multihashes
  (package
    (name "ruby-multihashes")
    (version "0.2.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "multihashes" version))
        (sha256
          (base32 "17wiyy3fiv8rpgdv9ca01yncsmaaf8yg15bg18wc7m9frss1vgqg"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list
      ruby-multicodecs))
    (home-page "https://github.com/multiformats/ruby-multihash")
    (synopsis "Multihash implementation for Ruby")
    (description "Multihashes provides a simple, low-level multihash
implementation for Ruby.  A multihash is a digest with an embedded hash function
code")
    (license license:expat)))

(define-public ruby-lazy-object
  (package
    (name "ruby-lazy-object")
    (version "0.0.3")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "lazy_object" version))
        (sha256
          (base32 "08px15lahc28ik9smvw1hgamf792gd6gq0s4k94yq1h7jq25wjn8"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "spec"))
    (home-page "https://github.com/HornsAndHooves/lazy_object")
    (synopsis "Object wrapper that forwards all calls to the reference object")
    (description "LazyObject is an object wrapper that forwards all calls to the
reference object.  This object is not created until the first method dispatch.")
    (license license:expat)))

(define-public ruby-citrus
  (package
    (name "ruby-citrus")
    (version "3.0.2")
    (source
     (origin
       (method git-fetch)
       ;; Download from GitHub because the rubygems version does not contain
       ;; files needed for tests.
       (uri (git-reference
             (url "https://github.com/mjackson/citrus")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "197wrgqrddgm1xs3yvjvd8vkvil4h4mdrcp16jmd4b57rxrrr769"))))
    (build-system ruby-build-system)
    (home-page "https://mjackson.github.io/citrus/")
    (synopsis "Parsing Expressions for Ruby")
    (description "Citrus is a parsing library for Ruby that combines the
expressiveness of the language with the parsing expressions.")
    (license license:expat)))

(define-public ruby-cbor
  (package
    (name "ruby-cbor")
    (version "0.5.9.6")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "cbor" version))
        (sha256
          (base32 "0511idr8xps9625nh3kxr68sdy6l3xy2kcz7r57g47fxb1v18jj3"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "spec"))
    (native-inputs
     (list
      ruby-rspec
      ruby-rake-compiler
      ruby-yard))
    (home-page "https://cbor.io/")
    (synopsis "Concise Binary Object Representation")
    (description "CBOR is a library for the
@acronym{CBOR, Concise Binary Object Representation} format, based on
Sadayuki Furuhashi's MessagePack library.")
    (license license:asl2.0)))

(define-public ruby-gem-release
  (package
    (name "ruby-gem-release")
    (version "2.2.2")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "gem-release" version))
        (sha256
          (base32 "108rrfaiayi14zrqbb6z0cbwcxh8n15am5ry2a86v7c8c3niysq9"))))
    (build-system ruby-build-system)
    (arguments
     ;; No rakefile
     `(#:tests? #f))
    (home-page "https://github.com/svenfuchs/gem-release")
    (synopsis "Ruby gem plugin for release management")
    (description "GemRelease is a gem plugin that aims at making gem development
easier by automating repetitive work based on conventions, configuration, and
templates.")
    (license license:expat)))

(define-public ruby-base32
  (package
    (name "ruby-base32")
    (version "0.3.4")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "base32" version))
        (sha256
          (base32 "1fjs0l3c5g9qxwp43kcnhc45slx29yjb6m6jxbb2x1krgjmi166b"))))
    (build-system ruby-build-system)
    (native-inputs
     (list
      ruby-gem-release))
    (home-page "https://github.com/stesla/base32")
    (synopsis "Ruby extension for base32 encoding and decoding")
    (description "Base32 is a library which provides base32 decoding and
encoding.")
    (license license:expat)))

(define-public ruby-dhall
  (package
    (name "ruby-dhall")
    (version "0.5.2")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "dhall" version))
        (sha256
          (base32 "09wcq8xc1ynld04r2f332bx8cn7rjc4afaq8hm1dr2fc35jlpn6m"))))
    (build-system ruby-build-system)
    (arguments
     ;; No test in gem archive
     `(#:tests? #f))
    (propagated-inputs
      (list
       ruby-base32
       ruby-cbor
       ruby-citrus
       ruby-lazy-object
       ruby-multihashes
       ruby-promise
       ruby-value-semantics))
    (home-page "https://git.sr.ht/~singpolyma/dhall-ruby")
    (synopsis "Ruby implementation of the Dhall configuration language")
    (description "Dhall.rb is a Ruby implementation of the Dhall configuration
language.  Dhall is a memory safe and non-Turing-complete configuration
language.")
    (license license:gpl3+)))

(define-public ruby-money
  (package
    (name "ruby-money")
    (version "6.16.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "money" version))
        (sha256
          (base32 "0jkmsj5ymadik7bvl670bqwmvhsdyv7hjr8gq9z293hq35gnyiyg"))))
    (build-system ruby-build-system)
    (arguments
     ;; No rakefile.
     `(#:tests? #f))
    (propagated-inputs
     (list
      ruby-i18n))
    (home-page "https://rubymoney.github.io/money/")
    (synopsis "Currency conversion library for Ruby")
    (description "RubyMoney provides a library for dealing with money and
currency conversion.  Its features are:
@itemize
@item
Provides a Money class which encapsulates all information about a certain
amount of money, such as its value and its currency.
@item
Provides a Money::Currency class which encapsulates all information about a
monetary unit.
@item
Represents monetary values as integers, in cents; so avoids floating point
rounding errors.
@item
Represents currency as Money::Currency instances providing a high level of
flexibility.
@item Provides APIs for exchanging money from one currency to another.
@end itemize")
    (license license:expat)))

(define-public ruby-monetize
  (package
    (name "ruby-monetize")
    (version "1.11.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "monetize" version))
        (sha256
          (base32 "0cna2myxdbwfq0gn6k2hgrh368dq7wld3jklm96443ysykd0difn"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "spec"))
    (native-inputs
     (list
      ruby-rspec))
    (propagated-inputs
     (list
      ruby-money))
    (home-page "https://github.com/RubyMoney/monetize")
    (synopsis "Convert various objects into Money objects")
    (description "Monetize provides a library for converting various objects
into Money objects.")
    (license license:expat)))

(define-public ruby-money-open-exchange-rates
  (package
    (name "ruby-money-open-exchange-rates")
    (version "1.4.0")
    (source
     (origin
       (method git-fetch)
       ;; Download from GitHub because the rubygems version does not contain
       ;; Rakefile.
       (uri (git-reference
             (url "https://github.com/spk/money-open-exchange-rates")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "11xwqli8snr19k48yh8h77sal5vxd4snzq9gxg08v61f0574m3gw"))))
    (build-system ruby-build-system)
    (native-inputs
     (list
      ruby-minitest
      ruby-mocha
      ruby-monetize
      ruby-rake
      ruby-rubocop
      ruby-timecop
      ruby-webmock))
    (propagated-inputs
     (list
      ruby-money))
    (home-page "https://spk.github.io/money-open-exchange-rates/")
    (synopsis "Money open exchange rates for Ruby")
    (description "This package provides a gem that calculates the exchange rate
using published rates from open-exchange-rates.  Compatible with the money gem.")
    (license license:expat)))

(define-public ruby-roda
  (package
    (name "ruby-roda")
    (version "3.57.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "roda" version))
        (sha256
          (base32 "0nkfxnbcfnriywvx9kpamp850cwjmqv8ssajc95d0aiyjr4kdrfy"))))
    (build-system ruby-build-system)
    (arguments
     ;; No rakefile
     `(#:tests? #f))
    (propagated-inputs (list ruby-rack))
    (home-page "https://roda.jeremyevans.net")
    (synopsis "Routing Tree Web Toolkit")
    (description "Roda is a routing tree web toolkit, designed for building fast
and maintainable web applications in ruby.")
    (license license:expat)))

(define-public ruby-nori
  (package
    (name "ruby-nori")
    (version "2.6.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "nori" version))
        (sha256
          (base32 "066wc774a2zp4vrq3k7k8p0fhv30ymqmxma1jj7yg5735zls8agn"))))
    (build-system ruby-build-system)
    (arguments
     ;; Tests require too old version of rspec
     `(#:tests? #f))
    (native-inputs
     (list ruby-nokogiri
            ruby-rake
            ruby-rspec))
    (home-page "https://github.com/savonrb/nori")
    (synopsis "XML to Hash translator")
    (description "Nori is a simple XML parsing ripped from Crack which in-turn
ripped from Merb.  It supports pluggable parsers and ships with both REXML and
Nokogiri implementations.")
    (license license:expat)))

;; This package is deprecated per upstream and should be phased out.
(define-public ruby-faraday-middleware
  (package
    (name "ruby-faraday-middleware")
    (version "1.2.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "faraday_middleware" version))
       (sha256
        (base32 "1bw8mfh4yin2xk7138rg3fhb2p5g2dlmdma88k82psah9mbmvlfy"))))
    (build-system ruby-build-system)
    (arguments `(#:tests? #f))
    (propagated-inputs (list ruby-faraday))
    (home-page "https://github.com/lostisland/faraday_middleware")
    (synopsis "Various middleware for Faraday")
    (description "Faraday_Middleware is a collection of middleware for the
Faraday-based API wrappers.")
    (license license:expat)))

(define-public ruby-faraday-multipart
  (package
    (name "ruby-faraday-multipart")
    (version "1.0.4")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/lostisland/faraday-multipart")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0ywxhff40a688n50lxrn4d8y096l8sbrwp1jfz4zd3kdiiygclka"))))
    (build-system ruby-build-system)
    (arguments (list #:test-target "spec"))
    (native-inputs (list ruby-faraday ruby-multipart-parser ruby-rspec))
    (propagated-inputs (list ruby-multipart-post))
    (synopsis "Multipart-post requests extension for Faraday")
    (description "This Ruby gem extends Faraday to perform multipart-post
requests.")
    (home-page "https://github.com/lostisland/faraday-multipart")
    (license license:expat)))

(define-public ruby-bandwidth-iris
  (package
    (name "ruby-bandwidth-iris")
    (version "7.0.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "ruby-bandwidth-iris" version))
       (sha256
        (base32 "131c4jhyvnrwbhizkks17fi9g85cwsq5f1p8zi408zyf63n7230d"))))
    (build-system ruby-build-system)
    (arguments
     ;; XXX: Tests don't require helper for some reason, so all fail.
     `(#:tests? #f))
    (native-inputs
     (list ruby-rspec
           ruby-yard))
    (propagated-inputs
     (list ruby-activesupport
           ruby-builder
           ruby-faraday
           ruby-faraday-middleware
           ruby-nori))
    (home-page "https://github.com/Bandwidth/ruby-bandwidth-iris")
    (synopsis "Gem for integrating to Bandwidth's Iris API")
    (description "Bandwidth IRIS is a Ruby SDK for Bandwidth Phone Number
Dashboard.  It is a Ruby Client library for IRIS / BBS API.")
    (license license:expat)))

(define-public ruby-selenium-webdriver
  (package
    (name "ruby-selenium-webdriver")
    (version "4.8.5")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "selenium-webdriver" version))
              (sha256
               (base32
                "0wh44vpsyz4mgyq4h482prgiv7hqa5jsj4i7i5hnvv39jb0rfiwm"))))
    (build-system ruby-build-system)
    ;; FIXME: The gem release lacks test files, and the git checkout lacks
    ;; JavaScript source that is generated using Bazel, which isn't available
    ;; in Guix yet, so disable the test suite for now.
    (arguments (list #:tests? #f))
    (propagated-inputs (list ruby-rexml ruby-rubyzip ruby-websocket))
    (synopsis "Selenium browser automation bindings for Ruby")
    (description "Selenium implements the W3C WebDriver protocol to automate
popular browsers.  It aims to mimic the behaviour of a real user as it
interacts with the application's HTML.  It's primarily intended for web
application testing, but any web-based task can be automated.  This package
provides the Ruby bindings of Selenium.")
    (home-page "https://www.selenium.dev/")
    (license license:asl2.0)))

(define-public ruby-sentry-core
  (package
    (name "ruby-sentry-core")
    (version "5.3.1")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "sentry-ruby-core" version))
        (sha256
          (base32 "141mrw8wghhsjvln9m6ld3hap3xc5v901jjiz007xywy25725hyd"))))
    (build-system ruby-build-system)
    (arguments
     ;; No rakefile in gem.
     `(#:tests? #f))
    (propagated-inputs
      (list ruby-concurrent
             ruby-faraday))
    (home-page "https://sentry.io/for/ruby/")
    (synopsis "Client interface for the Sentry error logger")
    (description "Sentry-Core provides a gem that provides a client
interface for the Sentry error logger.")
    (license license:expat)))

(define-public ruby-sentry
  (package
    (name "ruby-sentry")
    (version "5.3.1")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "sentry-ruby" version))
        (sha256
          (base32 "0by9mvw8rklzpyx59vfija8h3ssfvxvf5nbqxfmygfy6lm1vdngz"))))
    (build-system ruby-build-system)
    (arguments
     ;; No rakefile in gem
     `(#:tests? #f))
    (propagated-inputs
      (list ruby-concurrent
             ruby-faraday
             ruby-sentry-core))
    (home-page "https://sentry.io/for/ruby/")
    (synopsis "Client interface for the Sentry error logger")
    (description "Sentry provides a gem that provides a client
interface for the Sentry error logger.")
    (license license:expat)))

(define-public ruby-webrick
  (package
    (name "ruby-webrick")
    (version "1.8.1")
    (source (origin
              (method git-fetch)        ;for tests
              (uri (git-reference
                    (url "https://github.com/ruby/webrick")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1xb0mk3cghdir65nmj0mblprbf21blli7267b6yyvxclh307yp6s"))))
    (build-system ruby-build-system)
    (arguments
     (list #:phases
           #~(modify-phases %standard-phases
               (add-after 'extract-gemspec 'delete-problematic-tests
                 (lambda _
                   ;; The httresponse tests fail for
                   ;; unknown reasons (see:
                   ;; https://github.com/ruby/webrick/issues/112).
                   (delete-file "test/webrick/test_httpresponse.rb"))))))
    (home-page "https://github.com/ruby/webrick")
    (synopsis "HTTP server toolkit")
    (description "WEBrick is an HTTP server toolkit that can be configured as an
HTTPS server, a proxy server, and a virtual-host server.")
    (license license:bsd-2)))

(define-public ruby-websocket
  (package
    (name "ruby-websocket")
    (version "1.2.9")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "websocket" version))
              (sha256
               (base32
                "0dib6p55sl606qb4vpwrvj5wh881kk4aqn2zpfapf8ckx7g14jw8"))))
    (build-system ruby-build-system)
    (arguments (list #:test-target "spec"
                     #:phases #~(modify-phases %standard-phases
                                  (add-after 'unpack 'disable-rubocop
                                    (lambda _
                                      (substitute* "Rakefile"
                                        (("require 'rubocop/rake_task'") "")
                                        (("RuboCop::RakeTask.new") "")))))))
    (native-inputs (list ruby-rspec))
    (synopsis "WebSocket protocol Ruby library")
    (description "This package provides a Ruby library to handle the WebSocket
protocol.")
    (home-page "https://github.com/imanel/websocket-ruby")
    (license license:expat)))

(define-public ruby-interception
  (package
    (name "ruby-interception")
    (version "0.5")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "interception" version))
        (sha256
          (base32 "01vrkn28psdx1ysh5js3hn17nfp1nvvv46wc1pwqsakm6vb1hf55"))))
    (build-system ruby-build-system)
    (native-inputs (list ruby-rspec))
    (home-page "https://github.com/ConradIrwin/interception")
    (synopsis "Listen to raise in Ruby")
    (description "Interception provides a cross-platform ability to intercept all
exceptions as they are raised.")
    (license license:expat)))

(define-public ruby-pry-rescue
  (package
    (name "ruby-pry-rescue")
    (version "1.5.2")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "pry-rescue" version))
        (sha256
          (base32 "1wn72y8y3d3g0ng350ld92nyjln012432q2z2iy9lhwzjc4dwi65"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'nuke-bad-test
           (lambda _
             (substitute* "spec/source_location_spec.rb"
               (("time = Time.now") "skip")))))))
    (native-inputs
     (list ruby-rspec
            ruby-pry-stack-explorer))
    (propagated-inputs
     (list ruby-interception
            ruby-pry))
    (home-page
      "https://github.com/ConradIrwin/pry-rescue")
    (synopsis "Start Pry session for rescue")
    (description "Pry-Rescue allows you to wrap code, to open a pry session at
any unhandled exceptions.")
    (license license:expat)))

(define-public ruby-braintree
  (package
    (name "ruby-braintree")
    (version "4.10.0")
    (source
     (origin
       (method git-fetch)               ;for tests
       (uri (git-reference
             (url "https://github.com/braintree/braintree_ruby")
             (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32 "01b5bp8q038ray5wwg3qhg4hj3r5a48vnfzs3gxkdjm5ky6bmn4p"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "test:unit"
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'disable-rubocop
           (lambda _
             (substitute* "Rakefile"
               (("sh \"rubocop\"") ""))))
         (add-after 'unpack 'relax-requirements
           (lambda _
             (substitute* "Gemfile"
               (("gem \"libxml-ruby\", \"3.2.0\"")
                "gem \"libxml-ruby\", \"~> 3.0.0\"")
               (("gem \"rspec\", \"3.9.0\"")
                "gem \"rspec\", \">= 3.9.0\"")
               (("gem \"webrick\", \"~>1.7.0\"")
                "gem \"webrick\", \">=1.7.0\"")
               ((".*gem \"rubocop\".*") "")
               ((".*gem \"rspec_junit_formatter\".*") "")))))))
    (native-inputs
     (list ruby-libxml
           ruby-pry
           ruby-rake
           ruby-rspec
           ruby-webrick))
    (propagated-inputs
     (list ruby-builder
           ruby-rexml))
    (home-page "https://www.braintreepayments.com/")
    (synopsis "Integration access to the Braintree Gateway")
    (description "Braintree provides resources and tools for developers to
integrate Braintree's global payments platform.")
    (license license:expat)))

(define-public ruby-niceogiri
  (package
   (name "ruby-niceogiri")
   (version "1.1.2")
   (source
    (origin
     (method url-fetch)
     (uri (rubygems-uri "niceogiri" version))
     (sha256
      (base32 "1ha93211bc9cvh23s9w89zz7rq8irpf64ccd9arvg8v1sxg2798a"))))
   (build-system ruby-build-system)
   (arguments
    `(#:test-target "spec"
      #:phases
      (modify-phases %standard-phases
        (add-after 'extract-gemspec 'less-strict-dependencies
          (lambda _
            (substitute* "niceogiri.gemspec"
              (("2\\.7") "3.8")      ;rspec
              ((".*dependency.*bundler.*") "\n")
              ((".*dependency.*guard-rspec.*") "\n")))))))
   (native-inputs
    (list ruby-rspec
           ruby-yard))
   (propagated-inputs (list ruby-nokogiri))
   (home-page "https://github.com/benlangfeld/Niceogiri")
   (synopsis "Supplement for Nokogiri")
   (description "Niceogiri provides wrappers and helpers for XML manipulation
using Nokogiri.")
   (license license:expat)))

(define-public ruby-blather
  (package
    (name "ruby-blather")
    (version "2.0.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "blather" version))
        (sha256
          (base32 "05ry2x835fj4pzk61282pcz86n018cr39zbgwbi213md74i90s7c"))))
    (build-system ruby-build-system)
    (arguments
     ;; XXX: Tests require too old version of rspec.
     `(#:tests? #f))
    (native-inputs
     (list ruby-countdownlatch
            ruby-mocha
            ruby-rb-fsevent
            ruby-rspec
            ruby-yard))
    (propagated-inputs
     (list ruby-activesupport
            ruby-eventmachine
            ruby-niceogiri
            ruby-nokogiri
            ruby-sucker-punch))
    (home-page "https://github.com/adhearsion/blather")
    (synopsis "XMPP Domain Specific Language for Ruby")
    (description "Blather is a XMPP DSL for Ruby written on top of EventMachine
and Nokogiri.")
    (license license:expat)))

(define-public ruby-wapiti
  (package
    (name "ruby-wapiti")
    (version "2.0.0")
    ;; the gem archive lacks tests
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/inukshuk/wapiti-ruby")
                    (commit version)))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1kawqw45j7mqk5zmwbn67x1vxiapdgm2ypqqz2bs9l5s7nglzr5b"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-builder
           ruby-rexml))
    (native-inputs
     (list ruby-byebug
           ruby-pry
           ruby-rake-compiler
           ruby-rspec
           ruby-simplecov))
    (arguments
     (list
      #:test-target "spec"
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'replace-git-ls-files 'replace-another-git-ls-files
            (lambda args
              (substitute* "wapiti.gemspec"
                (("`git ls-files spec`")
                 "`find spec -type f | sort`"))))
          (add-before 'build 'compile
            (lambda args
              (invoke "rake" "compile"))))))
    (home-page "https://github.com/inukshuk/wapiti-ruby")
    (synopsis "Wicked fast Conditional Random Fields for Ruby")
    (description
     "The Wapiti-Ruby gem provides a wicked fast linear-chain @acronym{CRF,
Conditional Random Fields} API for sequence segmentation and labelling.  It is
based on the codebase of @url{https://wapiti.limsi.fr, Wapiti}.")
    (license license:bsd-2)))

(define-public ruby-namae
  (package
    (name "ruby-namae")
    (version "1.1.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "namae" version))
              (sha256
               (base32
                "1j3nl1klkx3gymrdxfc1hlq4a8qlvhhl9aj5v1v08b9fz27sky0l"))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-cucumber
           ruby-rspec
           ruby-simplecov))
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'extract-gemspec 'allow-newer-cucumber
            (lambda args
              (substitute* "Gemfile"
                (("'cucumber', '[^']*'")
                 "'cucumber'"))))
          (replace 'check
            ;; Avoid 'rake' so we don't need jeweler.
            (lambda* (#:key tests? #:allow-other-keys)
              (when tests?
                (apply invoke
                       "rspec"
                       (find-files "spec" "_spec\\.rb$"))))))))
    (home-page "https://github.com/berkmancenter/namae")
    (synopsis "Parser for human names")
    (description
     "Namae (名前) is a parser for human names.  It recognizes personal names
of various cultural backgrounds and tries to split them into their component
parts (e.g., given and family names, honorifics etc.).")
    (license (list license:bsd-2 license:agpl3+))))

(define-public ruby-ritex
  (package
    (name "ruby-ritex")
    (version "1.0.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "ritex" version))
              (sha256
               (base32
                "07rlm3nyz9sxzy1srxs6a31hw81r6w7swrb85fiwi393z8npwc3a"))))
    (build-system ruby-build-system)
    (native-inputs
     (list itex2mml))
    (arguments
     ;; thanks to the Gentoo packagers for figuring this out
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'extract-gemspec 'fix-tests
            (lambda* (#:key native-inputs inputs #:allow-other-keys)
              (substitute* "test/mathml.rb"
                (("\\./itex2MML")
                 ;; don't use the absolute path to avoid keeping a reference
                 "itex2MML")
                (("cmp ',\\\\,\\\\,,,\\\\,'" orig)
                 (string-append "# " orig " # patched for Guix")))
              (substitute* "test/answer-key.yaml"
                (("- ,\\\\,\\\\,,,\\\\," orig)
                 (string-append "# " orig " # patched for Guix")))))
          (replace 'check
            (lambda* (#:key tests? #:allow-other-keys)
              (when tests?
                (invoke "ruby" "-Ilib:." "test/all.rb")))))))
    (home-page "https://rubygems.org/gems/ritex")
    (synopsis "Convert expressions from WebTeX into MathML")
    (description
     "Ritex converts expressions from WebTeX into MathML.  WebTeX is an
adaptation of TeX math syntax for web display.  Ritex makes inserting math
into HTML pages easy.  It supports most TeX math syntax as well as macros.")
    ;; doesn't clearly state -only vs -or-later
    (license license:gpl2)))

(define-public ruby-latex-decode
  (package
    (name "ruby-latex-decode")
    (version "0.4.0")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/inukshuk/latex-decode")
                    (commit (string-append "v" version))))
              (sha256
               (base32
                "1f5j67ayd04pjkmzvn0hk7cr8yqvn0gyg9ns6a0vhzj2gwna9ihy"))
              (file-name (git-file-name name version))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-cucumber
           ruby-ritex
           ruby-rspec))
    (arguments
     (list
      #:test-target "cucumber"
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'extract-gemspec 'avoid-bundler
            (lambda args
              (substitute* "Rakefile"
                (("require 'bundler" orig)
                 (string-append "# " orig " # patched for Guix"))
                (("Cucumber::Rake::Task\\.new[(]:cucumber[)]" orig)
                 (string-append orig " do |c|\n"
                                "  c.bundler = false # patched for Guix\n"
                                "end"))
                (("Bundler\\.setup" orig)
                 (string-append "true # " orig " # patched for Guix")))
              (substitute* "cucumber.yml"
                ;; thanks to avoiding bundler, we can't use this option
                ((" --publish-quiet")
                 ""))))
          (add-after 'replace-git-ls-files 'replace-another-git-ls-files
            (lambda args
              (substitute* "latex-decode.gemspec"
                (("`git ls-files -- [{]test,spec,features[}]/\\*`")
                 "`find {test,spec,features} -type f | sort`")))))))
    (home-page "https://github.com/inukshuk/latex-decode")
    (synopsis "Convert LaTeX to Unicode")
    (description
     "This package provides a gem to convert LaTeX input to Unicode.  Its
original use was as an input filter for BibTeX-Ruby, but it can be used
independently to decode LaTeX.  Many of the patterns used by this Ruby gem are
based on François Charette's equivalent Perl module @code{LaTeX::Decode}.")
    (license license:gpl3+)))

(define-public ruby-link-header
  (package
    (name "ruby-link-header")
    (version "0.0.8")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "link_header" version))
              (sha256
               (base32
                "1yamrdq4rywmnpdhbygnkkl9fdy249fg5r851nrkkxr97gj5rihm"))))
    (build-system ruby-build-system)
    (home-page "https://github.com/asplake/link_header")
    (synopsis "Parse and format HTTP @code{Link} headers")
    (description
     "This gem provides the classes @code{LinkHeader} and
@code{LinkHeader::Link}, which represent HTTP @code{Link} headers conforming
to RFC 5988.  Objects can be constructed from and converted to text or a
JSON-friendly @code{Array} representation.  They can also be used to generate
corresponding HTML @code{link} elements.")
    (license license:expat)))

(define-public ruby-rdf
  (package
    (name "ruby-rdf")
    (version "3.2.8")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "rdf" version))
              (sha256
               (base32
                "1cj0k8ryd8hgbkgqb5swvy6fiygxny3y5bln0my5gv6dbfv3gm20"))))
    (build-system ruby-build-system)
    (propagated-inputs (list ruby-link-header))
    (arguments
     (list #:tests? #f)) ;; tests have many cyclic dependencies
    (home-page "https://ruby-rdf.github.io/")
    (synopsis "Linked Data for Ruby")
    (description
     "This gem contains the core algorithms and classes used for doing basic
programming with @acronym{RDF, Resource Description Framework} data,
implemented in pure Ruby.")
    (license license:unlicense)))

(define-public ruby-rdf-vocab
  (package
    (name "ruby-rdf-vocab")
    (version "3.2.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "rdf-vocab" version))
              (sha256
               (base32
                "1bqmp9rfjvd56ajjz68ij6jla1wjf1fqg7bi4dpnjrsmn4pwaq7l"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-rdf))
    (arguments
     (list #:tests? #f)) ;; tests have many cyclic dependencies
    (home-page "https://github.com/ruby-rdf/rdf-vocab")
    (synopsis "Common RDF vocabularies")
    (description
     "This gem extends @code{ruby-rdf} with several common @acronym{RDF,
Resource Description Framework} vocabularies.")
    (license license:unlicense)))

(define-public ruby-rdiscount
  (package
    (name "ruby-rdiscount")
    (version "2.2.7")
    (source (origin
              (method git-fetch)        ;for the full test suite
              (uri (git-reference
                    (url "https://github.com/davidfstr/rdiscount")
                    (commit version)))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1lpfxq3gv0dgmnki9jgfnc8n9k4x9vyq9miqdxv6g4kp90qyfifc"))))
    (build-system ruby-build-system)
    (native-inputs (list perl))
    (synopsis "Discount Markdown Processor for Ruby")
    (description "Discount is an implementation of John Gruber's Markdown
markup language in C.  It implements all of the language described in the
markdown syntax document and passes the Markdown 1.0 test suite.")
    (home-page "https://dafoster.net/projects/rdiscount/")
    (license license:bsd-3)))

(define-public ruby-bibtex-ruby
  (package
    (name "ruby-bibtex-ruby")
    (version "6.0.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "bibtex-ruby" version))
              (sha256
               (base32
                "0vynqa8q9hwghw6sdljr304b5gh11nqzy5nwqqwxmgy7pqyf7qw5"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-latex-decode
           ruby-rdf
           ruby-rdf-vocab))
    (native-inputs
     (list ruby-byebug
           ruby-cucumber
           ruby-minitest
           ruby-yard))
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'extract-gemspec 'avoid-bundler
            (lambda args
              (substitute* "Rakefile"
                (("require 'bundler" orig)
                 (string-append "# " orig " # patched for Guix"))
                (("Bundler\\.setup" orig)
                 (string-append "true # " orig " # patched for Guix"))))))))
    (home-page "https://github.com/inukshuk/bibtex-ruby")
    (synopsis "Rubyist's Swiss Army knife for all things BibTeX")
    (description
     "BibTeX-Ruby is the Rubyist's Swiss Army knife for all things BibTeX.
It includes a parser for all common BibTeX objects and a sophisticated name
parser that tokenizes correctly formatted names.  BibTeX-Ruby recognizes
BibTeX string replacements, joins values containing multiple strings or
variables, supports cross-references, and decodes common LaTeX formatting
instructions to unicode.  If you are in a hurry, it also allows for easy
export/conversion to formats such as YAML, JSON, CSL, and XML (BibTeXML).")
    (license license:gpl3+)))

(define-public ruby-unicode-scripts
  (package
    (name "ruby-unicode-scripts")
    (version "1.8.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "unicode-scripts" version))
              (sha256
               (base32
                "0rl6mn908yryhrg8j3mmna54gnrid2nph2kym00lbz6jwdih2a1b"))))
    (build-system ruby-build-system)
    (native-inputs (list ruby-minitest))
    (arguments (list #:test-target "spec"))
    (home-page "https://github.com/janlelis/unicode-scripts")
    (synopsis "Unicode script classification library")
    (description "This gem provides a simple interface for classifying Ruby
strings using the Unicode @code{Script} and @code{Script_Extensions}
properties.")
    (license license:expat)))

(define-public ruby-citeproc
  (package
    (name "ruby-citeproc")
    (version "1.0.10")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "citeproc" version))
              (sha256
               (base32
                "13vl5sjmksk5a8kjcqnjxh7kn9gn1n4f9p1rvqfgsfhs54p0m6l2"))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-namae))
    (arguments
     (list #:tests? #f)) ;; tests have a cyclic dependency
    (home-page "https://github.com/inukshuk/citeproc")
    (synopsis "Interface for Ruby citation processors")
    (description
     "CiteProc is a citation processor interface and citation data API based
on the @acronym{CSL, Citation Style Language} specifications.  To actually
process citations, a dedicated processor engine is required: a pure Ruby
engine is available in the @code{citeproc-ruby} gem.")
    (license (list license:agpl3+ license:bsd-2))))

(define-public ruby-edtf
  (package
    (name "ruby-edtf")
    (version "3.1.0")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/inukshuk/edtf-ruby")
                    (commit (string-append "v" version))))
              (sha256
               (base32
                "18j8xq8zmrn41cs2gpd1i87agi9905asvnjqndky2cqb5zg3q14g"))
              (snippet
               ;; remove generated file
               #~(delete-file "lib/edtf/parser.rb"))
              (file-name (git-file-name name version))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-activesupport))
    (native-inputs
     (list ruby-cucumber
           ruby-rspec))
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'extract-gemspec 'avoid-bundler
            (lambda args
              (substitute* "Rakefile"
                (("require 'bundler" orig)
                 (string-append "# " orig " # patched for Guix"))
                (("bundle exec racc")
                 "racc")
                (("Cucumber::Rake::Task\\.new[(]:cucumber[)]" orig)
                 (string-append orig " do |c|\n"
                                "  c.bundler = false # patched for Guix\n"
                                "end"))
                (("Bundler\\.setup" orig)
                 (string-append "true # " orig " # patched for Guix")))))
          (add-after 'avoid-bundler 'patch-cucumber-options
            (lambda args
              (substitute* "cucumber.yml"
                ;; this option is not supported, at least in our configuration
                ((" --publish-quiet")
                 ""))))
          (add-before 'build 'compile
            (lambda args
              (invoke "rake" "racc")))
          (replace 'check
            (lambda* (#:key tests? #:allow-other-keys)
              (when tests?
                (invoke "rake")))))))
    (home-page "https://github.com/inukshuk/edtf-ruby")
    (synopsis "Ruby implementation of Extended Date/Time Format")
    (description
     "EDTF-Ruby provides a parser and an API for the @acronym{EDTF, Extended
Date/Time Format} standard, implemented as an extension to Ruby's @code{Date}
class.")
    (license license:bsd-2)))

(define-public ruby-gli
  (package
    (name "ruby-gli")
    (version "2.21.0")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/davetron5000/gli")
                    (commit (string-append "v" version))))
              (sha256
               (base32
                "09b1r9hlx4dy2yq036nk7hc2nbswhia6q3na9v11z94yibc8mgja"))
              (file-name (git-file-name name version))))
    (build-system ruby-build-system)
    (native-inputs
     (list ruby-minitest
           ruby-rainbow
           ruby-rdoc
           ruby-sdoc))
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'extract-gemspec 'patch-gemspec-version
            (lambda args
              (substitute* "gli.gemspec"
                ;; this trick fails in our build environment
                (("require File\\.join[(]\\[" orig)
                 (string-append "# patched for Guix # " orig))
                (("s\\.version = GLI::VERSION")
                 #$(string-append "s.version = '"
                                  (package-version this-package)
                                  "' # patched for Guix")))))
          (add-after 'replace-git-ls-files 'replace-another-git-ls-files
            (lambda args
              (substitute* "gli.gemspec"
                (("`git ls-files -- [{]test,spec,features[}]/\\*`")
                 "`find {test,spec,features} -type f | sort`"))))
          (add-after 'replace-another-git-ls-files 'fix-rubyopt
            (lambda args
              (substitute* "Rakefile"
                (("ENV\\[\"RUBYOPT\"]")
                 "(ENV['RUBYOPT'] || '')")))))))
    (home-page "https://davetron5000.github.io/gli/")
    (synopsis "Git-Like Interface command-line parser")
    (description
     "GLI allows you to create command-line applications in Ruby with Git-Like
Interfaces: that is, they take subcommands in the style of @command{git} and
@command{gem}.  GLI uses a simple domain-specific language, but retains all
the power of the built-in @code{OptionParser}.")
    (license license:asl2.0)))

(define-public ruby-anystyle-data
  (package
    (name "ruby-anystyle-data")
    (version "1.2.0")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/inukshuk/anystyle-data")
                    (commit version)))
              (sha256
               (base32
                "025mxa7r9d7izqn6bc1wr40ijp64da0jh211prlpjl6svilgd6rm"))
              (snippet
               ;; remove pre-built file
               #~(delete-file "lib/anystyle/data/dict.txt.gz"))
              (patches
               (search-patches "ruby-anystyle-data-immutable-install.patch"))
              (file-name (git-file-name name version))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:tests? #f ;; there are none
      #:modules
      `((guix build ruby-build-system)
        (guix build utils)
        (srfi srfi-26))
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'replace-git-ls-files 'replace-another-git-ls-files
            (lambda args
              (substitute* "anystyle-data.gemspec"
                (("`git ls-files lib README\\.md LICENSE`\\.split[(][^)]*[)]")
                 (string-append
                  "["
                  (string-join
                   (map (cut string-append "\"" <> "\"")
                        `("README.md"
                          "LICENSE"
                          "lib/anystyle/data.rb"
                          "lib/anystyle/data/dict.txt.gz"
                          "lib/anystyle/data/setup.rb"
                          "lib/anystyle/data/version.rb"))
                   ", ")
                  "]")))))
          (add-before 'build 'compile-dict
            (lambda args
              (invoke "rake" "compile"))))))
    (home-page "https://anystyle.io")
    (synopsis "AnyStyle parser dictionary data")
    (description
     "This gem provides parser dictionary data for AnyStyle.")
    (license license:bsd-2)))

(define-public ruby-anystyle
  (let ((commit "50f1dd547d28ab4b830e45d70e840cb1898a37b0")
        (revision "1"))
    ;; Releases point to specific commits, but recent releases haven't been
    ;; tagged in Git.  Meanwhile, the rubygems archive lacks tests.
    (package
      (name "ruby-anystyle")
      (version (git-version "1.3.14" revision commit))
      (source (origin
                (method git-fetch)
                (uri (git-reference
                      (url "https://github.com/inukshuk/anystyle")
                      (commit commit)))
                (sha256
                 (base32
                  "0f4qcrywl1kl6qysn24lj3yp85ln4i7za7b7ld2fglyzwcggxwb0"))
                (snippet
                 ;; There is an optional dependency on
                 ;; <https://github.com/feedbackmine/language_detector>, which
                 ;; seems like it was intended to be free software, but
                 ;; doesn't have a clear license statement.  Maybe someone can
                 ;; do more sleuthing, or else find a replacement?  See also
                 ;; <https://github.com/inukshuk/anystyle/issues/186>.  For
                 ;; now, patch it out, but leave a pointer to follow up.
                 #~(begin
                     (use-modules (guix build utils))
                     (substitute* "Gemfile"
                       (("gem 'language_detector', github: '[^']*'" orig)
                        (string-append "# " orig " # unclear license")))
                     (substitute* "spec/anystyle/parser_spec.rb"
                       (("language: 'en'," orig)
                        (string-append "# " orig " # no lanugage_detector")))))
                (patches
                 (search-patches
                  "ruby-anystyle-fix-dictionary-populate.patch"))
                (file-name (git-file-name name version))))
      (build-system ruby-build-system)
      (propagated-inputs
       (list ruby-anystyle-data
             ruby-bibtex-ruby
             ruby-namae
             ruby-wapiti))
      (native-inputs
       (list ruby-byebug
             ruby-citeproc
             ruby-edtf
             ruby-rspec
             ruby-unicode-scripts))
      (arguments
       (list
        #:test-target "spec"
        #:phases
        #~(modify-phases %standard-phases
            (add-after 'extract-gemspec 'avoid-bundler
              (lambda args
                (substitute* "Rakefile"
                  (("require 'bundler" orig)
                   (string-append "# " orig " # patched for Guix"))
                  (("Bundler\\.setup" orig)
                   (string-append "true # " orig " # patched for Guix")))))
            (add-after 'replace-git-ls-files 'replace-another-git-ls-files
              (lambda args
                (substitute* "anystyle.gemspec"
                  (("`git ls-files spec`")
                   "`find spec -type f | sort`"))))
            (add-after 'wrap 'populate-dictionaries
              (lambda args
                ;; We must initiallize these files here, or they will never be
                ;; usable with the default settings. A more flexible approach
                ;; might use something like `Gem.find_files()` or
                ;; XDG_DATA_DIRS.
                (with-output-to-file "initialize-dictionaries.rb"
                  (lambda ()
                    (display "
require 'anystyle/dictionary' # must come before 'anystyle/data'
require 'anystyle/data'
[:marshal, :gdbm].each do |adapter|
  AnyStyle::Dictionary.create({adapter: adapter}).open().close()
end
")))
                (let* ((old-gems (getenv "GEM_PATH"))
                       (new-gems (string-append #$output
                                                "/lib/ruby/vendor_ruby:"
                                                old-gems)))
                  (dynamic-wind
                    (lambda ()
                      (setenv "GEM_PATH" new-gems))
                    (lambda ()
                      (invoke "ruby" "initialize-dictionaries.rb"))
                    (lambda ()
                      (setenv "GEM_PATH" old-gems)))))))))
      (home-page "https://anystyle.io")
      (synopsis "Fast and smart citation reference parsing (Ruby library)")
      (description
       "AnyStyle is a very fast and smart parser for academic reference lists
and bibliographies.  AnyStyle uses powerful machine learning heuristics based
on Conditional Random Fields and aims to make it easy to train the model with
data that is relevant to your parsing needs.

This package provides the Ruby module @code{AnyStyle}.  AnyStyle can also be
used via the @command{anystyle} command-line utility or a web application,
though the later has not yet been packaged for Guix.")
      (license license:bsd-2))))

(define-public anystyle
  (package
    (name "anystyle")
    (version "1.3.2")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/inukshuk/anystyle-cli")
                    (commit (string-append "v" version))))
              (sha256
               (base32
                "0yigfyn0n255nc53nx40yqak11dm4fva46hx5db177jh7mnksjd6"))
              (file-name (git-file-name name version))))
    (build-system ruby-build-system)
    (propagated-inputs
     (list ruby-anystyle
           ruby-bibtex-ruby
           ruby-gli))
    (native-inputs
     (list txt2man))
    (arguments
     (list
      #:modules
      `((guix build ruby-build-system)
        (ice-9 popen)
        (srfi srfi-1)
        (guix build utils))
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'extract-gemspec 'less-strict-dependencies
            (lambda args
              (substitute* "anystyle-cli.gemspec"
                (("'bibtex-ruby', '[^']*'")
                 "'bibtex-ruby'"))))
          (add-before 'build 'change-default-dictionary-adapter
            (lambda args
              ;; Since we always have gdbm available, using it will give a
              ;; faster startup time, which is particularly worth-while for
              ;; a command-line tool.
              (substitute* "bin/anystyle"
                (("default_value: 'ruby',")
                 "default_value: 'gdbm', # patched for Guix"))))
          (replace 'check
            (lambda* (#:key tests? #:allow-other-keys)
              ;; There are no tests, but let's use this opportunity to do a
              ;; basic test of our own that things run ok. It works especially
              ;; well to test this here since we know the 'ruby-anystile'
              ;; package is in its final, immutable installed form.
              (when tests?
                (let ((common
                       `("require 'anystyle'"
                         ,(string-append
                           "pp AnyStyle.parse 'Derrida, J. (1967). L’écriture"
                           " et la différence (1 éd.). Paris: Éditions du"
                           " Seuil.'"))))
                  (for-each
                   (lambda (lines)
                     (apply invoke "ruby"
                            (fold-right (lambda (line lst)
                                          (cons* "-e" line lst))
                                        '()
                                        lines)))
                   `(,common
                     ("require 'anystyle/dictionary'"
                      "AnyStyle::Dictionary.defaults[:adapter] = :gdbm"
                      ,@common)))))))
          (add-after 'wrap 'check-cli
            (lambda* (#:key tests? outputs #:allow-other-keys)
              (when tests?
                (with-output-to-file "check-cli.in"
                  (lambda ()
                    (for-each
                     display
                     '("Derrida, J. (1967). L’écriture et la différence "
                       "(1 éd.). Paris: Éditions du Seuil.\n"))))
                (invoke (search-input-file outputs "/bin/anystyle")
                        "parse"
                        "check-cli.in"))))
          (add-after 'wrap 'generate-man-page
            ;; generating a man page also tests that the command actually runs
            (lambda args
              (define (run-with-output-file file command . args)
                (format (current-output-port)
                        "running: ~s\nwith output to: ~s\n"
                        (cons command args)
                        file)
                (unless (zero?
                         (with-output-to-file file
                           (lambda ()
                             (status:exit-val
                              (close-pipe
                               (apply open-pipe* OPEN_WRITE command args))))))
                  (error "command failed")))
              (let ((anystyle (string-append #$output "/bin/anystyle")))
                (run-with-output-file "intro.txt"
                                      anystyle "--help")
                (for-each (lambda (cmd)
                            (let ((file (string-append cmd ".txt")))
                              (run-with-output-file file
                                                    anystyle cmd "--help")
                              ;; indent headings to create subsections
                              (substitute* file
                                (("^[A-Z]" orig)
                                 (string-append " " orig)))
                              ;; generate a section heading
                              (call-with-output-file
                                  (string-append "section-" file)
                                (lambda (out)
                                  (format out "\n\n~a COMMAND\n\n"
                                          (string-upcase cmd))))))
                          '("check" "find" "parse" "train"))
                (substitute* `("intro.txt"
                               "check.txt" "find.txt" "parse.txt" "train.txt")
                  ;; format "tag list" for txt2man"
                  ((" - ")
                   "    ")
                  ;; restore formatting of the "name" sections
                  (("(anystyle|check|find|parse|train)    ([A-Z])" _ cmd post)
                   (string-append cmd " - " post)))
                (run-with-output-file "anystyle.txt"
                                      "cat"
                                      "intro.txt"
                                      "section-check.txt" "check.txt"
                                      "section-find.txt" "find.txt"
                                      "section-parse.txt" "parse.txt"
                                      "section-train.txt" "train.txt")
                (run-with-output-file
                 "anystyle.1"
                 "txt2man"
                 "-v" "General Commands Manual" "-t" "anystyle" "-s" "1"
                 "-r" #$(string-append "anystyle-cli "
                                       (package-version this-package))
                 "-B" "check" "-B" "find" "-B" "parse" "-B" "train"
                 "anystyle.txt")
                (install-file "anystyle.1"
                              (string-append #$output "/share/man/man1"))))))))
    (home-page "https://anystyle.io")
    (synopsis "Fast and smart citation reference parsing")
    (description
     "AnyStyle is a very fast and smart parser for academic reference lists
and bibliographies.  AnyStyle uses powerful machine learning heuristics based
on Conditional Random Fields and aims to make it easy to train the model with
data that is relevant to your parsing needs.

This package provides the @command{anystyle} command-line utility.  AnyStyle
can also be used as a Ruby library or as a web application, though the later
has not yet been packaged for Guix.")
    (license license:bsd-2)
    (properties `((upstream-name . "anystyle-cli")))))

;;;
;;; Avoid adding new packages to the end of this file. To reduce the chances
;;; of a merge conflict, place them above by existing packages with similar
;;; functionality or similar names.
;;;