xezat 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -5
  3. data/.gitmodules +3 -3
  4. data/.rspec +2 -0
  5. data/.travis.yml +5 -3
  6. data/Gemfile +3 -1
  7. data/LICENSE.txt +17 -18
  8. data/README.md +9 -236
  9. data/Rakefile +4 -0
  10. data/bin/console +14 -0
  11. data/bin/setup +8 -0
  12. data/exe/xezat +16 -0
  13. data/lib/xezat.rb +9 -5
  14. data/lib/xezat/command/bump.rb +89 -110
  15. data/lib/xezat/command/debug.rb +13 -20
  16. data/lib/xezat/command/doctor.rb +9 -19
  17. data/lib/xezat/command/generate.rb +7 -111
  18. data/lib/xezat/command/init.rb +77 -0
  19. data/lib/xezat/command/port.rb +25 -44
  20. data/lib/xezat/config.rb +14 -0
  21. data/lib/xezat/cygchangelog.rb +7 -6
  22. data/lib/xezat/cygclasses.rb +10 -15
  23. data/lib/xezat/cygversion.rb +2 -3
  24. data/lib/xezat/debugger/linguist.rb +31 -0
  25. data/lib/xezat/debugger/variable.rb +18 -0
  26. data/lib/xezat/detector/autoconf.rb +1 -4
  27. data/lib/xezat/detector/automake.rb +1 -4
  28. data/lib/xezat/detector/boost.m4.rb +4 -8
  29. data/lib/xezat/detector/cmake.rb +2 -5
  30. data/lib/xezat/detector/gengetopt.rb +1 -4
  31. data/lib/xezat/detector/gnulib.rb +14 -0
  32. data/lib/xezat/detector/gobject-introspection.rb +2 -12
  33. data/lib/xezat/detector/halibut.rb +1 -4
  34. data/lib/xezat/detector/libQt5Core-devel.rb +1 -12
  35. data/lib/xezat/detector/libtool.rb +1 -4
  36. data/lib/xezat/detector/make.rb +4 -6
  37. data/lib/xezat/detector/meson.rb +9 -0
  38. data/lib/xezat/detector/ninja.rb +14 -0
  39. data/lib/xezat/detector/python-docutils.rb +4 -8
  40. data/lib/xezat/detector/roundup.rb +14 -0
  41. data/lib/xezat/detector/waf.rb +9 -0
  42. data/lib/xezat/detectors.rb +6 -23
  43. data/lib/xezat/ext/linguist/file_blob.rb +13 -0
  44. data/lib/xezat/generator/pkgconfig.rb +90 -0
  45. data/lib/xezat/main.rb +59 -9
  46. data/lib/xezat/packages.rb +8 -17
  47. data/lib/xezat/variables.rb +10 -37
  48. data/lib/xezat/version.rb +1 -1
  49. data/share/xezat/compilers.json +13 -1
  50. data/share/xezat/languages.json +12 -0
  51. data/share/xezat/repository/bitbucket.json +3 -3
  52. data/share/xezat/repository/github.json +3 -3
  53. data/share/xezat/repository/savannah.json +1 -1
  54. data/share/xezat/repository/sourceforge.json +1 -1
  55. data/share/xezat/template/cmake.erb +7 -0
  56. data/share/xezat/template/cygport.erb +12 -12
  57. data/share/xezat/template/pkgconfig.erb +1 -1
  58. data/xezat.gemspec +25 -21
  59. metadata +70 -171
  60. data/bin/xezat +0 -14
  61. data/lib/xezat/command/create.rb +0 -105
  62. data/lib/xezat/command/validate.rb +0 -43
  63. data/lib/xezat/commands.rb +0 -32
  64. data/lib/xezat/refine/linguist/file_blob.rb +0 -14
  65. data/lib/xezat/validator/m4.rb +0 -31
  66. data/lib/xezat/validator/pkgconfig.rb +0 -36
  67. data/lib/xezat/validators.rb +0 -38
  68. data/share/xezat/repository/google.json +0 -7
  69. data/share/xezat/show_cygport_description.sh +0 -8
  70. data/share/xezat/template/pkgconfig.cmake +0 -8
  71. data/share/xezat/template/setup.erb +0 -17
  72. data/test/test.rb +0 -25
  73. data/test/xezat/command/fixture/doctor/a.lst.gz +0 -0
  74. data/test/xezat/command/fixture/doctor/b1.lst.gz +0 -0
  75. data/test/xezat/command/fixture/doctor/b2.lst.gz +0 -0
  76. data/test/xezat/command/test_bump.rb +0 -25
  77. data/test/xezat/command/test_create.rb +0 -48
  78. data/test/xezat/command/test_doctor.rb +0 -17
  79. data/test/xezat/detector/fixture/autoconf/no/configure.scan +0 -1
  80. data/test/xezat/detector/fixture/autoconf/yes_root/configure.ac +0 -1
  81. data/test/xezat/detector/fixture/autoconf/yes_subdir/subdir/configure.ac +0 -1
  82. data/test/xezat/detector/fixture/automake/no/Makefile.in +0 -1
  83. data/test/xezat/detector/fixture/automake/yes_root/Makefile.am +0 -1
  84. data/test/xezat/detector/fixture/automake/yes_subdir/subdir/Makefile.am +0 -1
  85. data/test/xezat/detector/fixture/boost.m4/no/configure.ac +0 -1
  86. data/test/xezat/detector/fixture/boost.m4/yes/configure.ac +0 -1
  87. data/test/xezat/detector/fixture/cmake/no/CMakeList.txt +0 -1
  88. data/test/xezat/detector/fixture/cmake/yes_root/CMakeLists.txt +0 -1
  89. data/test/xezat/detector/fixture/cmake/yes_subdir/subdir/CMakeLists.txt +0 -1
  90. data/test/xezat/detector/fixture/gengetopt/no/xezat.log +0 -1
  91. data/test/xezat/detector/fixture/gengetopt/yes_root/xezat.ggo +0 -1
  92. data/test/xezat/detector/fixture/gengetopt/yes_subdir/subdir/xezat.ggo +0 -1
  93. data/test/xezat/detector/fixture/gobject-introspection/no/configure.ac +0 -1
  94. data/test/xezat/detector/fixture/gobject-introspection/yes/configure.ac +0 -1
  95. data/test/xezat/detector/fixture/halibut/no/halibut.txt +0 -1
  96. data/test/xezat/detector/fixture/halibut/yes_root/halibut.but +0 -1
  97. data/test/xezat/detector/fixture/halibut/yes_subdir/subdir/halibut.but +0 -1
  98. data/test/xezat/detector/fixture/libQt5Core-devel/no/foo.cygport +0 -1
  99. data/test/xezat/detector/fixture/libQt5Core-devel/yes_cygport/foo.cygport +0 -1
  100. data/test/xezat/detector/fixture/libQt5Core-devel/yes_dir/foo.cygport +0 -1
  101. data/test/xezat/detector/fixture/libQt5Core-devel/yes_dir/foo.pro +0 -1
  102. data/test/xezat/detector/fixture/python-docutils/no/configure.ac +0 -1
  103. data/test/xezat/detector/fixture/python-docutils/yes/configure.ac +0 -1
  104. data/test/xezat/detector/test_autoconf.rb +0 -24
  105. data/test/xezat/detector/test_automake.rb +0 -24
  106. data/test/xezat/detector/test_boost.m4.rb +0 -20
  107. data/test/xezat/detector/test_cmake.rb +0 -24
  108. data/test/xezat/detector/test_gengetopt.rb +0 -24
  109. data/test/xezat/detector/test_gobject-introspection.rb +0 -20
  110. data/test/xezat/detector/test_halibut.rb +0 -24
  111. data/test/xezat/detector/test_libQt5Core-devel.rb +0 -30
  112. data/test/xezat/detector/test_python-docutils.rb +0 -20
  113. data/test/xezat/test_cygchangelog.rb +0 -26
  114. data/test/xezat/test_cygclasses.rb +0 -32
  115. data/test/xezat/test_cygversion.rb +0 -47
  116. data/test/xezat/test_variables.rb +0 -16
  117. data/test/xezat/validator/fixture/m4/no/usr/share/aclocal/.gitkeep +0 -0
  118. data/test/xezat/validator/fixture/m4/yes/usr/share/aclocal/test.m4 +0 -1
  119. data/test/xezat/validator/fixture/pkgconfig/no_at/usr/lib/pkgconfig/xezat.pc +0 -11
  120. data/test/xezat/validator/fixture/pkgconfig/no_link/usr/lib/pkgconfig/xezat.pc +0 -11
  121. data/test/xezat/validator/fixture/pkgconfig/skip/usr/lib/pkgconfig/.gitkeep +0 -0
  122. data/test/xezat/validator/fixture/pkgconfig/yes/usr/lib/pkgconfig/xezat.pc +0 -10
  123. data/test/xezat/validator/test_m4.rb +0 -24
  124. data/test/xezat/validator/test_pkgconfig.rb +0 -31
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37e5c3e340fd440548e19f1c141f7e98098007a4
4
- data.tar.gz: 2beec1b142223c633dc6ba867115d9eda5c20c3e
3
+ metadata.gz: 232d133a72ddf6d202df40c66764960972d57c45
4
+ data.tar.gz: 58bc0d8f834b0ea48eb71f49ae1085a0cb6643e9
5
5
  SHA512:
6
- metadata.gz: 886a4a0057fd8afb3d4ccb99f0afc2e622377b580a1b1bb571b38937520741e555797fcc71c76625ec2d5479351b88afe51c5ff7218c617fbe74b28c2ec9c074
7
- data.tar.gz: 65b2630f54a628da9158d7dabf10995b8a1cef7625e90271e2809aee5f9962c8f48a14fa9c3e09831d795b33e00fb720c3543e33d6c94626c5ef2e3c14c7f311
6
+ metadata.gz: 47fd5be715978a678b9030ac424f7dedba6a4c13745535e06e4feba5300de6e14dc7b91e42b69c3234be1ed68dcb0e5785ac4ef01acbf06eca05f0db95d25082
7
+ data.tar.gz: 2bca806c8f4b0aea539d130ba5cfe585fc86addf7b06920adbcb9640ad0a5149115268eb445bf6b0bdb5a64b0f10f59964b5c6ff98f217a4996a1729d8581c24
data/.gitignore CHANGED
@@ -7,8 +7,6 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
@@ -1,3 +1,3 @@
1
- [submodule "test/cygport"]
2
- path = test/cygport
3
- url = git://git.code.sf.net/p/cygwin-ports/cygport
1
+ [submodule "spec/cygport"]
2
+ path = spec/cygport
3
+ url = https://github.com/cygwinports/cygport.git
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -1,4 +1,6 @@
1
+ sudo: false
1
2
  language: ruby
2
- cache: bundler
3
- rvm: 2.2.0
4
- script: bundle exec ruby ./test/test.rb
3
+ rvm:
4
+ - 2.3.6
5
+ before_install: gem install bundler -v 1.15.3
6
+ script: bundle exec rspec
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
2
4
 
3
5
  # Specify your gem's dependencies in xezat.gemspec
4
6
  gemspec
@@ -1,22 +1,21 @@
1
- Copyright (c) 2015 fd0
1
+ The MIT License (MIT)
2
2
 
3
- MIT License
3
+ Copyright (c) 2017 Daisuke Fujimura (fd0)
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
12
11
 
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
15
14
 
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,9 +1,6 @@
1
- [![Build Status](https://travis-ci.org/fd00/xezat.svg?branch=master)](https://travis-ci.org/fd00/xezat)
2
- [![Coverage Status](https://coveralls.io/repos/fd00/xezat/badge.svg?branch=master)](https://coveralls.io/r/fd00/xezat?branch=master)
3
-
4
1
  # Xezat
5
2
 
6
- Complement of cygport
3
+ xezat helps you win at cygport.
7
4
 
8
5
  ## Installation
9
6
 
@@ -23,242 +20,18 @@ Or install it yourself as:
23
20
 
24
21
  ## Usage
25
22
 
26
- xezat 0.0.3 -- Xezat is the complement of cygport
27
-
28
- Usage:
29
-
30
- xezat <subcommand> [options]
31
-
32
- Options:
33
- -h, --help Show this message
34
- -v, --version Print the name and version
35
- -t, --trace Show the full backtrace when an error occurs
36
-
37
- Subcommands:
38
- bump update CYGWIN-PATCHES/README
39
- create create new cygport
40
- debug show cygport variables
41
- doctor diagnose installed packages
42
- generate generate additional files
43
- port copy cygport to git repository
44
- validate validate package contents
45
-
46
-
47
- ### create
48
-
49
- xezat create -- create new cygport
50
-
51
- Usage:
52
-
53
- xezat create [options] cygport
54
-
55
- Options:
56
- -a, --app-only application only
57
- -c, --category category specify category
58
- -d, --description description specify description
59
- -i, --inherit cygclass inherit cygclasses
60
- -o, --overwrite overwrite cygport
61
- -r, --repository repository specify repository (github, google, sourceforge)
62
- -s, --summary summary specify summary
63
- -h, --help Show this message
64
- -v, --version Print the name and version
65
- -t, --trace Show the full backtrace when an error occurs
66
-
67
- Example.1
68
-
69
- % xezat create xezat-0.0.3-1bl1.cygport
70
- % cat xezat-0.0.3-1bl1.cygport
71
-
72
- ```bash
73
- HOMEPAGE=""
74
- SRC_URI=""
75
-
76
- CATEGORY=""
77
- SUMMARY=""
78
- DESCRIPTION=""
79
-
80
- PKG_NAMES="
81
- ${PN}
82
- lib${PN}0
83
- lib${PN}-devel
84
- "
85
- xezat_CONTENTS="
86
- usr/bin/*.exe
87
- usr/share
88
- "
89
- libxezat0_CONTENTS="
90
- usr/bin/*.dll
91
- "
92
- libxezat_devel_CONTENTS="
93
- usr/include
94
- usr/lib
95
- "
96
- xezat_SUMMARY="${SUMMARY} (licensing & readmes)"
97
- libxezat0_SUMMARY="${SUMMARY} (runtime)"
98
- libxezat_devel_SUMMARY="${SUMMARY} (development)"
99
- ```
100
-
101
- Example.2
102
-
103
- % xezat create -a -c Libs -i git --repository=github -s 'Complement of Cygport' -o xezat-0.0.3-1bl1.cygport
104
- % cat xezat-0.0.3-1bl1.cygport
105
-
106
- ```bash
107
- HOMEPAGE="https://github.com/fd00/${PN}"
108
- GIT_URI="https://github.com/fd00/${PN}.git"
109
-
110
- CATEGORY="Libs"
111
- SUMMARY="Complement of Cygport"
112
- DESCRIPTION=""
113
-
114
- inherit git
115
- ```
116
-
117
- ### debug
118
-
119
- xezat debug -- show cygport variables
120
-
121
- Usage:
122
-
123
- xezat debug cygport
124
-
125
- Options:
126
- -h, --help Show this message
127
- -v, --version Print the name and version
128
- -t, --trace Show the full backtrace when an error occurs
129
-
130
- Example.1
131
-
132
- % xezat debug xezat-0.0.3-1bl1.cygport
133
- #<Xezat::VariableManager:0x000006011ba808
134
- @variables=
135
- {:AR=>"ar",
136
- :ARCH=>"x86_64",
137
- :ARCH_x86_64=>"1",
138
- :B=>"/usr/src/xezat-0.0.3-1bl1.x86_64/build",
139
- :BASH=>"/usr/bin/bash",
140
- (snip)
141
- :mirror_apache=>"http://www.apache.org/dist",
142
- :mirror_berlios=>"http://download.berlios.de http://download2.berlios.de",
143
- :mirror_cpan=>"http://search.cpan.org/CPAN",
144
- :mirror_cran=>"http://cran.r-project.org",
145
- :mirror_ctan=>"http://mirror.ctan.org/",
146
- (snip)
147
- :src_patchfile=>"xezat-0.0.3-1bl1.src.patch",
148
- :srcdir=>"/usr/src/xezat-0.0.3-1bl1.x86_64/src",
149
- :top=>"/usr/src",
150
- :workdir=>"/usr/src/xezat-0.0.3-1bl1.x86_64"}>
151
- %
152
-
153
- ### doctor
154
-
155
- xezat doctor -- diagnose installed packages
156
-
157
- Usage:
158
-
159
- xezat doctor
160
-
161
- Options:
162
- -h, --help Show this message
163
- -v, --version Print the name and version
164
- -t, --trace Show the full backtrace when an error occurs
165
-
166
- Example.1
167
-
168
- % xezat doctor
169
- xezat doctor | Warn: usr/include/attr/xattr.h is in multiple packages: [:"cygwin-devel", :"libattr-devel"]
170
- xezat doctor | Warn: usr/share/man/man1/sha.1.gz is in multiple packages: [:openssl, :sha]
171
- xezat doctor | Warn: usr/share/man/man3/Socket.3pm.gz is in multiple packages: [:"perl-Socket", :perl]
172
- xezat doctor | Warn: usr/share/man/man3/Unicode.Collate.3pm.gz is in multiple packages: [:"perl-Unicode-Collate", :perl]
173
- xezat doctor | Warn: usr/share/man/man3/Unicode.Collate.CJK.Big5.3pm.gz is in multiple packages: [:"perl-Unicode-Collate", :perl]
174
- xezat doctor | Warn: usr/share/man/man3/Unicode.Collate.CJK.GB2312.3pm.gz is in multiple packages: [:"perl-Unicode-Collate", :perl]
175
- xezat doctor | Warn: usr/share/man/man3/Unicode.Collate.CJK.JISX0208.3pm.gz is in multiple packages: [:"perl-Unicode-Collate", :perl]
176
- xezat doctor | Warn: usr/share/man/man3/Unicode.Collate.CJK.Korean.3pm.gz is in multiple packages: [:"perl-Unicode-Collate", :perl]
177
- xezat doctor | Warn: usr/share/man/man3/Unicode.Collate.CJK.Pinyin.3pm.gz is in multiple packages: [:"perl-Unicode-Collate", :perl]
178
- xezat doctor | Warn: usr/share/man/man3/Unicode.Collate.CJK.Stroke.3pm.gz is in multiple packages: [:"perl-Unicode-Collate", :perl]
179
- xezat doctor | Warn: usr/share/man/man3/Unicode.Collate.Locale.3pm.gz is in multiple packages: [:"perl-Unicode-Collate", :perl]
180
- %
181
-
182
- ### generate
183
-
184
- xezat generate -- generate additional files
185
-
186
- Usage:
187
-
188
- xezat generate [options] cygport
189
-
190
- Options:
191
- -o, --overwrite overwrite file
192
- -p, --pkg-config generate *.pc
193
- -h, --help Show this message
194
- -v, --version Print the name and version
195
- -t, --trace Show the full backtrace when an error occurs
196
-
197
- Example.1
198
-
199
- % xezat generate xezat-0.0.3-1bl1.cygport -p
200
- % cat xezat-0.0.3-1bl1.x86_64/src/xezat-0.0.3/xezat.pc
201
- prefix=@prefix@
202
- exec_prefix=@exec_prefix@
203
- libdir=@libdir@
204
- includedir=@includedir@
205
-
206
- Name: xezat
207
- Description: Complement of cygport
208
- Version: @VERSION@
209
- Libs: -L${libdir} -lxezat
210
- Cflags: -I${includedir}
211
- %
212
-
213
- ### validate
214
-
215
- xezat validate -- validate package contents
216
-
217
- Usage:
218
-
219
- xezat validate [options] cygport
220
-
221
- Options:
222
- -h, --help Show this message
223
- -v, --version Print the name and version
224
- -t, --trace Show the full backtrace when an error occurs
225
-
226
- ### bump
227
-
228
- xezat bump -- update CYGWIN-PATCHES/README
229
-
230
- Usage:
231
-
232
- xezat bump cygport
233
-
234
- Options:
235
- -h, --help Show this message
236
- -v, --version Print the name and version
237
- -t, --trace Show the full backtrace when an error occurs
23
+ TODO: Write usage instructions here
238
24
 
239
- ### port
25
+ ## Development
240
26
 
241
- xezat port -- copy cygport to git repository
27
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
242
28
 
243
- Usage:
29
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
244
30
 
245
- xezat port cygport
31
+ ## Contributing
246
32
 
247
- Options:
248
- -V, --verbose print the results verbosely
249
- -n, --no-operation print the results without actually copying any files
250
- -i, --inifile *.ini specify inifile
251
- -t, --target portdir specify git repository directory
252
- -h, --help Show this message
253
- -v, --version Print the name and version
254
- -t, --trace Show the full backtrace when an error occurs
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/fd00/xezat.
255
34
 
256
- Example.1
35
+ ## License
257
36
 
258
- % cat ~/.xezat
259
- [xezat]
260
- distdir = /cygdrive/e/dist
261
- portdir = /cygdrive/e/yacp
262
- % xezat port xezat-0.0.3-1bl1.cygport
263
- % ls /cygdrive/e/yacp/xezat
264
- README xezat-0.0.3-1bl1.cygport xezat-0.0.3-1bl1.src.patch
37
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -1,2 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
2
3
 
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "xezat"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ Encoding.default_external = 'UTF-8'
4
+
5
+ self_file =
6
+ if File.symlink?(__FILE__)
7
+ require 'pathname'
8
+ Pathname.new(__FILE__).realpath
9
+ else
10
+ __FILE__
11
+ end
12
+ $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(self_file), '..', 'lib'))
13
+
14
+ require 'xezat/main'
15
+
16
+ Xezat::Main.start(ARGV)
@@ -1,7 +1,11 @@
1
+ require 'logger'
2
+
1
3
  module Xezat
2
- ROOT_DIR = File::expand_path(File::join(File::dirname(__FILE__), '..'))
3
- DATA_DIR = File::expand_path(File::join(ROOT_DIR, 'share', 'xezat'))
4
- REPOSITORY_DIR = File::expand_path(File::join(DATA_DIR, 'repository'))
5
- TEMPLATE_DIR = File::expand_path(File::join(DATA_DIR, 'template'))
6
- INI_FILE = File::expand_path(File::join(Dir::home, '.xezat'))
4
+ ROOT_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..'))
5
+ DATA_DIR = File.expand_path(File.join(ROOT_DIR, 'share', 'xezat'))
6
+ REPOSITORY_DIR = File.expand_path(File.join(DATA_DIR, 'repository'))
7
+ TEMPLATE_DIR = File.expand_path(File.join(DATA_DIR, 'template'))
8
+ INI_FILE = File.expand_path(File.join(Dir.home, '.xezat'))
9
+
10
+ LOG = Logger.new(STDOUT)
7
11
  end
@@ -1,101 +1,71 @@
1
- require 'erb'
2
1
  require 'facets/file/atomic_write'
3
2
  require 'find'
4
- require 'fileutils'
3
+ require 'json'
5
4
  require 'xezat'
6
- require 'xezat/commands'
7
5
  require 'xezat/cygchangelog'
8
6
  require 'xezat/cygclasses'
9
7
  require 'xezat/detectors'
10
- require 'xezat/refine/linguist/file_blob'
8
+ require 'xezat/ext/linguist/file_blob'
11
9
  require 'xezat/packages'
12
10
  require 'xezat/variables'
13
11
 
14
12
  module Xezat
15
- # ファイルのパーミッションが適切でない場合に投げられる例外
13
+
16
14
  class FilePermissionError < StandardError
17
15
  end
18
16
 
19
- # cygport の他のコマンドが終わっておらずに呼び出すべき状態ではない場合に投げられる例外
20
17
  class IllegalStateError < StandardError
21
18
  end
22
19
 
23
20
  module Command
24
- # README を生成または更新する
25
21
  class Bump
26
- def initialize(program)
27
- program.command(:bump) do |c|
28
- c.syntax 'bump cygport'
29
- c.description 'update CYGWIN-PATCHES/README'
30
- c.option 'message', '-m', '--message message', String, 'specify changelog message'
31
- c.action do |args, options|
32
- execute(c, args, options)
33
- end
34
- end
35
- end
36
-
37
- CommandManager::register(:bump, self)
38
-
39
- def execute(c, args, options)
40
- cygport = args.shift
41
- raise ArgumentError, 'wrong number of arguments (0 for 1)' unless cygport
42
- c.logger.info "ignore extra arguments: #{args.to_s}" unless args.empty?
22
+ include Xezat
43
23
 
44
- variables = VariableManager::get_default_variables(cygport)
45
- packages = PackageManager::get_installed_packages()
46
- readme_file = File::expand_path(File::join(variables[:C], 'README'))
47
-
48
- info = {}
49
- info[:src_uri] = get_src_uri(variables)
50
- info[:runtimes] = get_runtime_packages(cygport)
51
- info[:developments] = get_development_packages(variables, packages)
52
- info[:files] = get_files(variables)
53
- info[:changelog] = get_changelog(variables, options, readme_file)
54
-
55
- File::atomic_write(readme_file) do |f|
56
- f.write(get_embedded_contents(variables, info))
57
- end
24
+ def initialize(options, cygport)
25
+ @options = options
26
+ @cygport = cygport
58
27
  end
59
28
 
60
- # changelog を取得する
61
- def get_changelog(variables, options, readme_file)
62
- current_version = variables[:PVR].intern
63
- if FileTest::exist?(readme_file)
64
- raise FilePermissionError, "Cannot read #{readme_file}" unless FileTest::readable?(readme_file)
65
- raise FilePermissionError, "Cannot write #{readme_file}" unless FileTest::writable?(readme_file)
66
- changelog = Cygchangelog.new(File::read(readme_file))
67
- options['message'] ||= 'Version bump.'
68
- changelog[current_version] = options['message'] unless changelog.key?(current_version)
69
- else
70
- changelog = Cygchangelog.new
71
- changelog[current_version] = 'Initial release by fd0 <https://github.com/fd00/>'
29
+ def execute
30
+ pkgs = packages()
31
+ vars = variables(@cygport)
32
+ readme_file = File.expand_path(File.join(vars[:C], 'README'))
33
+
34
+ info = {
35
+ src_uri: get_src_uri(vars),
36
+ runtimes: get_runtime_packages(@cygport),
37
+ developments: get_development_packages(vars, pkgs),
38
+ files: get_files(vars),
39
+ changelog: get_changelog(vars, @options, readme_file)
40
+ }
41
+
42
+ File.atomic_write(readme_file) do |f|
43
+ f.write(get_embedded_contents(vars, info))
72
44
  end
73
- changelog
74
45
  end
75
46
 
76
- # vcs に対応した SRC_URI を取得する
77
- def get_src_uri(variables, cygclass_manager = CygclassManager.new)
78
- cygclass_manager.vcs.each do |vcs|
47
+
48
+ def get_src_uri(vars, cygclasses = CygclassManager.new)
49
+ cygclasses.vcs.each do |vcs|
50
+ next unless vars.key?("_#{vcs}_CYGCLASS_".intern)
79
51
  src_uri_key = "#{vcs.to_s.upcase}_URI".intern
80
- return variables[src_uri_key].split if variables.key?(src_uri_key)
52
+ return vars[src_uri_key].split if vars.key?(src_uri_key)
81
53
  end
82
- variables[:SRC_URI].split
54
+ vars[:SRC_URI].split
83
55
  end
84
56
 
85
- # package が依存している runtime のリストを取得する
57
+
86
58
  def get_runtime_packages(cygport)
87
59
  command = ['bash', File.expand_path(File.join(DATA_DIR, 'invoke_cygport_dep.sh')), cygport]
88
60
  result, error, status = Open3.capture3(command.join(' '))
89
61
  raise CygportProcessError, error unless status.success?
90
62
  result.gsub!(/^.*\*\*\*.*$/, '')
91
- result.split($/).map! do |runtime|
92
- runtime.lstrip
93
- end
63
+ result.split($INPUT_RECORD_SEPARATOR).map!(&:lstrip)
94
64
  end
95
65
 
96
- # package を build するために必要な development package のリストを取得する
66
+
97
67
  def get_development_packages(variables, packages)
98
- compilers = get_compilers(get_languages(variables))
68
+ compilers = get_compilers(get_languages(variables[:S]), variables)
99
69
  tools = get_tools(variables)
100
70
  development_packages = (compilers + tools + [:cygport]).uniq.sort
101
71
  development_packages.map! do |package|
@@ -103,68 +73,63 @@ module Xezat
103
73
  end
104
74
  end
105
75
 
106
- # source tree に存在するソースコードの言語を特定する
107
- def get_languages(variables)
108
- languages = []
109
- Find::find(variables[:S]) do |path|
110
- unless FileTest::directory?(path)
111
- language = Xezat::Refine::Linguist::FileBlob.new(path).language
112
- unless language.nil?
113
- name = language.name
114
- if name == 'Objective-C' # Objective-C は誤検知があるため suffix で再確認
115
- next unless path.end_with?('.m')
116
- end
117
- if name == 'Ruby' # Ruby は誤検知があるため suffix で再確認
118
- next unless path.end_with?('.rb')
119
- end
120
- if name == 'C++' # C++ は誤検知があるため suffix で再確認
121
- name = 'C' if path.end_with?('.h')
122
- end
123
- if name == 'C' # suffix で再確認
124
- name = 'C++' if path.end_with?('.C')
125
- end
126
- languages << name
127
- end
128
- end
129
- end
130
- languages
131
- end
132
-
133
- # package を build するために必要な compiler package のリストを取得する
134
- def get_compilers(languages)
76
+ def get_compilers(languages, variables)
135
77
  compiler_file = File.expand_path(File.join(DATA_DIR, 'compilers.json'))
136
- compiler_candidates = JSON.parse(File::read(compiler_file))
78
+ compiler_candidates = JSON.parse(File.read(compiler_file))
137
79
  compilers = []
138
80
  languages.uniq.each do |language|
139
- if compiler_candidates.key?(language)
140
- compiler_candidate = compiler_candidates[language]
141
- compilers << compiler_candidate['package'].intern
142
- if compiler_candidate.key?('dependencies')
143
- compiler_candidate['dependencies'].each do |dependency|
144
- compilers << dependency.intern
145
- end
81
+ next unless compiler_candidates.key?(language)
82
+ compiler_candidate = compiler_candidates[language]
83
+ if compiler_candidate['package'] == 'python'
84
+ pkg_names = variables[:PKG_NAMES] || variables[:PN]
85
+ if pkg_names.include?('python3-')
86
+ compilers << :'python3'
87
+ elsif pkg_names.include?('pypi-')
88
+ compilers << :'pypi'
89
+ else
90
+ compilers << compiler_candidate['package'].intern
146
91
  end
92
+ else
93
+ compilers << compiler_candidate['package'].intern
94
+ end
95
+ next unless compiler_candidate.key?('dependencies')
96
+ compiler_candidate['dependencies'].each do |dependency|
97
+ compilers << dependency.intern
147
98
  end
148
99
  end
149
100
  compilers.uniq
150
101
  end
151
102
 
152
- # packages を build するために必要な tool package のリストを取得する
103
+ def get_languages(top_src_dir)
104
+ languages_file = File.expand_path(File.join(DATA_DIR, 'languages.json'))
105
+ languages_candidates = JSON.parse(File.read(languages_file))
106
+ languages = []
107
+ Find.find(top_src_dir) do |path|
108
+ next if FileTest.directory?(path)
109
+ name = languages_candidates[File.extname(path)]
110
+ if name.nil?
111
+ language = Xezat::Linguist::FileBlob.new(path).language
112
+ next if language.nil?
113
+ name = language.name
114
+ end
115
+ languages << name
116
+ end
117
+ languages
118
+ end
119
+
153
120
  def get_tools(variables)
154
- DetectorManager::load_default_detectors
155
- DetectorManager::detect(variables)
121
+ DetectorManager.new().detect(variables)
156
122
  end
157
123
 
158
- # package で生成されるチェック用の *.lst から README に埋め込むファイルのリストを取得する
159
124
  def get_files(variables)
160
125
  pkg2files = {}
161
126
  variables[:pkg_name].each do |pkg_name|
162
- lst_file = File::expand_path(File::join(variables[:T], ".#{pkg_name}.lst"))
163
- raise IllegalStateError, "No such file: #{lst_file}" unless FileTest::readable?(lst_file)
164
- lines = File::readlines(lst_file)
127
+ lst_file = File.expand_path(File.join(variables[:T], ".#{pkg_name}.lst"))
128
+ raise IllegalStateError, "No such file: #{lst_file}" unless FileTest.readable?(lst_file)
129
+ lines = File.readlines(lst_file)
165
130
  lines.delete_if do |path|
166
131
  path.strip!
167
- path[-1] == File::SEPARATOR
132
+ path[-1] == File::SEPARATOR # ignore directory
168
133
  end.map! do |path|
169
134
  File::SEPARATOR + path
170
135
  end
@@ -177,10 +142,24 @@ module Xezat
177
142
  pkg2files
178
143
  end
179
144
 
180
- # テンプレートにデータを埋め込んだ結果の文字列を取得する
145
+ def get_changelog(variables, options, readme_file)
146
+ current_version = variables[:PVR].intern
147
+ if FileTest.exist?(readme_file)
148
+ raise FilePermissionError, "Cannot read #{readme_file}" unless FileTest.readable?(readme_file)
149
+ raise FilePermissionError, "Cannot write #{readme_file}" unless FileTest.writable?(readme_file)
150
+ changelog = Cygchangelog.new(File.read(readme_file))
151
+ message = options['message'] || 'Version bump.'
152
+ changelog[current_version] = message unless changelog.key?(current_version)
153
+ else
154
+ changelog = Cygchangelog.new
155
+ changelog[current_version] = 'Initial release by fd0 <https://github.com/fd00/>'
156
+ end
157
+ changelog
158
+ end
159
+
181
160
  def get_embedded_contents(variables, info)
182
- erb = File::expand_path(File::join(TEMPLATE_DIR, 'README.erb'))
183
- ERB.new(File::readlines(erb).join(nil), nil, '%-').result(binding)
161
+ erb = File.expand_path(File.join(TEMPLATE_DIR, 'README.erb'))
162
+ ERB.new(File.readlines(erb).join(nil), nil, '%-').result(binding).chop # remove redundant new line
184
163
  end
185
164
  end
186
165
  end