xezat 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +57 -12
  3. data/lib/xezat.rb +1 -0
  4. data/lib/xezat/command/bump.rb +22 -10
  5. data/lib/xezat/command/create.rb +2 -2
  6. data/lib/xezat/command/port.rb +60 -0
  7. data/lib/xezat/cygchangelog.rb +2 -2
  8. data/lib/xezat/cygversion.rb +27 -0
  9. data/lib/xezat/detector/python-docutils.rb +20 -0
  10. data/lib/xezat/validator/pkgconfig.rb +15 -3
  11. data/lib/xezat/version.rb +1 -1
  12. data/share/xezat/compilers.json +4 -1
  13. data/share/xezat/show_cygport_description.sh +1 -1
  14. data/share/xezat/template/README.erb +0 -4
  15. data/test/xezat/command/test_bump.rb +24 -0
  16. data/test/xezat/detector/fixture/python-docutils/no/configure.ac +1 -0
  17. data/test/xezat/detector/fixture/python-docutils/yes/configure.ac +1 -0
  18. data/test/xezat/detector/test_autoconf.rb +1 -1
  19. data/test/xezat/detector/test_automake.rb +1 -1
  20. data/test/xezat/detector/test_boost.m4.rb +1 -1
  21. data/test/xezat/detector/test_cmake.rb +1 -1
  22. data/test/xezat/detector/test_gengetopt.rb +1 -1
  23. data/test/xezat/detector/test_python-docutils.rb +19 -0
  24. data/test/xezat/test_cygversion.rb +46 -0
  25. data/test/xezat/validator/fixture/pkgconfig/no_at/usr/lib/pkgconfig/xezat.pc +11 -0
  26. data/test/xezat/validator/fixture/pkgconfig/no_link/usr/lib/pkgconfig/xezat.pc +11 -0
  27. data/test/xezat/validator/fixture/{m4/skip/usr/share/aclocal → pkgconfig/skip/usr/lib/pkgconfig}/.gitkeep +0 -0
  28. data/test/xezat/validator/fixture/pkgconfig/yes/usr/lib/pkgconfig/xezat.pc +10 -0
  29. data/test/xezat/validator/test_pkgconfig.rb +30 -0
  30. data/xezat.gemspec +5 -3
  31. metadata +59 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 434544489f11dad9eb18797864e6c479b23cb880
4
- data.tar.gz: 091d9668f15f5fe5081f5198d939a4504b4d97f1
3
+ metadata.gz: ed2c44e72ce46695edf8b725d890d0b56670c023
4
+ data.tar.gz: 21e444b65fde66b0538a85c7c6628baf1fe0466f
5
5
  SHA512:
6
- metadata.gz: 0e64e0ac2fec95c6aa030c854eb943efef16ed8327318dcbfffaafdfa3eadfa807ddcffd1383d59a9148a76c306e3cc874c71faf21feb54e9c7701e05200c17f
7
- data.tar.gz: 1d79d6d8c4be0ff6c265678c3bce99f3250bb05b14411adc8307f1e25a7e3d9a7831bacf3bbb01bce5c9919e234808a68315fff7c4df4f99995996805ad27184
6
+ metadata.gz: 317b2be1714e348aa9b656a9a45cc5aeea09d9f8b20aac7874a877eb129d8a2b970e52f703bc3a5d2bc3f02e192c4b24d880e5dd0b3e671b555ec31d55f9877b
7
+ data.tar.gz: f3c859dcf772f2da6b90ef7e14a11665657eaef4ef78bd2814bdfbf722ea49279ec0ca1d2040bc60c84c8089fa5f1dbbab544d50acf2f5c170199dee81c78131
data/README.md CHANGED
@@ -20,7 +20,7 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
- xezat 0.0.1 -- Xezat is the complement of cygport
23
+ xezat 0.0.2 -- Xezat is the complement of cygport
24
24
 
25
25
  Usage:
26
26
 
@@ -37,8 +37,10 @@ Or install it yourself as:
37
37
  debug show cygport variables
38
38
  doctor diagnose installed packages
39
39
  generate generate additional files
40
+ port copy cygport to git repository
40
41
  validate validate package contents
41
42
 
43
+
42
44
  ### create
43
45
 
44
46
  xezat create -- create new cygport
@@ -50,10 +52,10 @@ Or install it yourself as:
50
52
  Options:
51
53
  -a, --app-only application only
52
54
  -c, --category category specify category
53
- --description description specify description
55
+ -d, --description description specify description
54
56
  -i, --inherit cygclass inherit cygclasses
55
57
  -o, --overwrite overwrite cygport
56
- --repository repository specify repository (github, google, sourceforge)
58
+ -r, --repository repository specify repository (github, google, sourceforge)
57
59
  -s, --summary summary specify summary
58
60
  -h, --help Show this message
59
61
  -v, --version Print the name and version
@@ -61,8 +63,8 @@ Or install it yourself as:
61
63
 
62
64
  Example.1
63
65
 
64
- % xezat create xezat-0.0.1-1bl1.cygport
65
- % cat xezat-0.0.1-1bl1.cygport
66
+ % xezat create xezat-0.0.2-1bl1.cygport
67
+ % cat xezat-0.0.2-1bl1.cygport
66
68
 
67
69
  ```bash
68
70
  HOMEPAGE=""
@@ -81,8 +83,8 @@ PKG_NAMES="
81
83
 
82
84
  Example.2
83
85
 
84
- % xezat create -a -c Libs -i git --repository=github -s 'Complement of Cygport' -o xezat-0.0.1-1bl1.cygport
85
- % cat xezat-0.0.1-1bl1.cygport
86
+ % xezat create -a -c Libs -i git --repository=github -s 'Complement of Cygport' -o xezat-0.0.2-1bl1.cygport
87
+ % cat xezat-0.0.2-1bl1.cygport
86
88
 
87
89
  ```bash
88
90
  HOMEPAGE="https://github.com/fd00/${PN}"
@@ -114,13 +116,13 @@ PKG_NAMES="
114
116
 
115
117
  Example.1
116
118
 
117
- % xezat debug xezat-0.0.1-1bl1.cygport
119
+ % xezat debug xezat-0.0.2-1bl1.cygport
118
120
  #<Xezat::VariableManager:0x000006011ba808
119
121
  @variables=
120
122
  {:AR=>"ar",
121
123
  :ARCH=>"x86_64",
122
124
  :ARCH_x86_64=>"1",
123
- :B=>"/usr/src/xezat-0.0.1-1bl1.x86_64/build",
125
+ :B=>"/usr/src/xezat-0.0.2-1bl1.x86_64/build",
124
126
  :BASH=>"/usr/bin/bash",
125
127
  (snip)
126
128
  :mirror_apache=>"http://www.apache.org/dist",
@@ -129,10 +131,10 @@ Example.1
129
131
  :mirror_cran=>"http://cran.r-project.org",
130
132
  :mirror_ctan=>"http://mirror.ctan.org/",
131
133
  (snip)
132
- :src_patchfile=>"xezat-0.0.1-1bl1.src.patch",
133
- :srcdir=>"/usr/src/xezat-0.0.1-1bl1.x86_64/src",
134
+ :src_patchfile=>"xezat-0.0.2-1bl1.src.patch",
135
+ :srcdir=>"/usr/src/xezat-0.0.2-1bl1.x86_64/src",
134
136
  :top=>"/usr/src",
135
- :workdir=>"/usr/src/xezat-0.0.1-1bl1.x86_64"}>
137
+ :workdir=>"/usr/src/xezat-0.0.2-1bl1.x86_64"}>
136
138
  %
137
139
 
138
140
  ### doctor
@@ -180,6 +182,22 @@ Example.1
180
182
  -v, --version Print the name and version
181
183
  -t, --trace Show the full backtrace when an error occurs
182
184
 
185
+ Example.1
186
+
187
+ % xezat generate xezat-0.0.2-1bl1.cygport -p
188
+ % cat xezat-0.0.2-1bl1.x86_64/src/xezat-0.0.2/xezat.pc
189
+ prefix=@prefix@
190
+ exec_prefix=@exec_prefix@
191
+ libdir=@libdir@
192
+ includedir=@includedir@
193
+
194
+ Name: xezat
195
+ Description: Complement of cygport
196
+ Version: @VERSION@
197
+ Libs: -L${libdir} -lxezat
198
+ Cflags: -I${includedir}
199
+ %
200
+
183
201
  ### validate
184
202
 
185
203
  xezat validate -- validate package contents
@@ -205,3 +223,30 @@ Example.1
205
223
  -h, --help Show this message
206
224
  -v, --version Print the name and version
207
225
  -t, --trace Show the full backtrace when an error occurs
226
+
227
+ ### port
228
+
229
+ xezat port -- copy cygport to git repository
230
+
231
+ Usage:
232
+
233
+ xezat port cygport
234
+
235
+ Options:
236
+ -V, --verbose print the results verbosely
237
+ -n, --no-operation print the results without actually copying any files
238
+ -i, --inifile *.ini specify inifile
239
+ -t, --target portdir specify git repository directory
240
+ -h, --help Show this message
241
+ -v, --version Print the name and version
242
+ -t, --trace Show the full backtrace when an error occurs
243
+
244
+ Example.1
245
+
246
+ % cat ~/.xezat
247
+ [xezat]
248
+ distdir = /cygdrive/e/dist
249
+ portdir = /cygdrive/e/yacp
250
+ % xezat port xezat-0.0.2-1bl1.cygport
251
+ % ls /cygdrive/e/yacp/xezat
252
+ README xezat-0.0.2-1bl1.cygport xezat-0.0.2-1bl1.src.patch
@@ -3,4 +3,5 @@ module Xezat
3
3
  DATA_DIR = File::expand_path(File::join(ROOT_DIR, 'share', 'xezat'))
4
4
  REPOSITORY_DIR = File::expand_path(File::join(DATA_DIR, 'repository'))
5
5
  TEMPLATE_DIR = File::expand_path(File::join(DATA_DIR, 'template'))
6
+ INI_FILE = File::expand_path(File::join(Dir::home, '.xezat'))
6
7
  end
@@ -27,6 +27,7 @@ module Xezat
27
27
  program.command(:bump) do |c|
28
28
  c.syntax 'bump cygport'
29
29
  c.description 'update CYGWIN-PATCHES/README'
30
+ c.option 'message', '-m', '--message message', String, 'specify changelog message'
30
31
  c.action do |args, options|
31
32
  execute(c, args, options)
32
33
  end
@@ -76,9 +77,9 @@ module Xezat
76
77
  def get_src_uri(variables, cygclass_manager = CygclassManager.new)
77
78
  cygclass_manager.vcs.each do |vcs|
78
79
  src_uri_key = "#{vcs.to_s.upcase}_URI".intern
79
- return variables[src_uri_key] if variables.key?(src_uri_key)
80
+ return variables[src_uri_key].split if variables.key?(src_uri_key)
80
81
  end
81
- variables[:SRC_URI]
82
+ variables[:SRC_URI].split
82
83
  end
83
84
 
84
85
  # package が依存している runtime のリストを取得する
@@ -93,7 +94,7 @@ module Xezat
93
94
 
94
95
  # package を build するために必要な development package のリストを取得する
95
96
  def get_development_packages(variables, packages)
96
- compilers = get_compilers(variables)
97
+ compilers = get_compilers(get_languages(variables))
97
98
  tools = get_tools(variables)
98
99
  development_packages = (compilers + tools + [:cygport]).uniq.sort
99
100
  development_packages.map! do |package|
@@ -101,24 +102,35 @@ module Xezat
101
102
  end
102
103
  end
103
104
 
104
- # package build するために必要な compiler package のリストを取得する
105
- def get_compilers(variables)
106
-
107
- # ファイルの内容からプログラミング言語を特定する
105
+ # source tree に存在するソースコードの言語を特定する
106
+ def get_languages(variables)
108
107
  languages = []
109
108
  Find::find(variables[:S]) do |path|
110
109
  unless FileTest::directory?(path)
111
110
  language = Xezat::Refine::Linguist::FileBlob.new(path).language
112
111
  unless language.nil?
113
- if language.name == 'Objective-C' # Objective-C は誤検知があるため suffix で再確認
112
+ name = language.name
113
+ if name == 'Objective-C' # Objective-C は誤検知があるため suffix で再確認
114
114
  next unless path.end_with?('.m')
115
115
  end
116
- languages << language.name
116
+ if name == 'Ruby' # Ruby は誤検知があるため suffix で再確認
117
+ next unless path.end_with?('.rb')
118
+ end
119
+ if name == 'C++' # C++ は誤検知があるため suffix で再確認
120
+ name = 'C' if path.end_with?('.h')
121
+ end
122
+ if name == 'C' # suffix で再確認
123
+ name = 'C++' if path.end_with?('.C')
124
+ end
125
+ languages << name
117
126
  end
118
127
  end
119
128
  end
129
+ languages
130
+ end
120
131
 
121
- # 言語から対応する compiler package を取得する
132
+ # package を build するために必要な compiler package のリストを取得する
133
+ def get_compilers(languages)
122
134
  compiler_file = File.expand_path(File.join(DATA_DIR, 'compilers.json'))
123
135
  compiler_candidates = JSON.parse(File::read(compiler_file))
124
136
  compilers = []
@@ -30,10 +30,10 @@ module Xezat
30
30
  c.description 'create new cygport'
31
31
  c.option 'apponly', '-a', '--app-only', 'application only'
32
32
  c.option 'category', '-c', '--category category', String, 'specify category'
33
- c.option 'description', '--description description', String, 'specify description'
33
+ c.option 'description', '-d', '--description description', String, 'specify description'
34
34
  c.option 'inherit', '-i', '--inherit cygclass', Array, 'inherit cygclasses'
35
35
  c.option 'overwrite', '-o', '--overwrite', 'overwrite cygport'
36
- c.option 'repository', '--repository repository', String, 'specify repository (github, google, sourceforge)'
36
+ c.option 'repository', '-r', '--repository repository', String, 'specify repository (github, google, sourceforge)'
37
37
  c.option 'summary', '-s', '--summary summary', String, 'specify summary'
38
38
  c.action do |args, options|
39
39
  execute(c, args, options)
@@ -0,0 +1,60 @@
1
+ require 'fileutils'
2
+ require 'inifile'
3
+ require 'xezat'
4
+ require 'xezat/commands'
5
+ require 'xezat/variables'
6
+
7
+ module Xezat
8
+ # copy 先の git repo が指定されていない場合に投げられる例外
9
+ class NoPortDirectoryError < StandardError
10
+ end
11
+
12
+ module Command
13
+ # cygport を git repo に copy する
14
+ class Port
15
+ def initialize(program)
16
+ program.command(:port) do |c|
17
+ c.syntax 'port cygport'
18
+ c.description 'copy cygport to git repository'
19
+ c.option 'verbose', '-V', '--verbose', 'print the results verbosely'
20
+ c.option 'noop', '-n', '--no-operation', 'print the results without actually copying any files'
21
+ c.option 'inifile', '-i', '--inifile *.ini', String, 'specify inifile'
22
+ c.option 'portdir', '-t', '--target portdir', String, 'specify git repository directory'
23
+ c.action do |args, options|
24
+ execute(c, args, options)
25
+ end
26
+ end
27
+ end
28
+
29
+ CommandManager::register(:port, self)
30
+
31
+ def execute(c, args, options)
32
+ cygport = args.shift
33
+ raise ArgumentError, 'wrong number of arguments (0 for 1)' unless cygport
34
+ c.logger.info "ignore extra arguments: #{args.to_s}" unless args.empty?
35
+
36
+ variables = VariableManager::get_default_variables(cygport)
37
+
38
+ d = File::expand_path(File::join(get_port_directory(options), variables[:PN]))
39
+
40
+ fuo = {noop: options.key?('noop'), verbose: options.key?('noop') || options.key?('verbose')}
41
+
42
+ FileUtils::mkdir_p(d, fuo)
43
+ FileUtils::cp(File::expand_path(File::join(variables[:top], cygport)), d, fuo)
44
+ FileUtils::cp(File::expand_path(File::join(variables[:C], 'README')), d, fuo)
45
+ src_patch = File::expand_path(File::join(variables[:patchdir], "#{variables[:PF]}.src.patch"))
46
+ FileUtils::cp(src_patch, d, fuo) unless FileTest::zero?(src_patch)
47
+ end
48
+
49
+ def get_port_directory(options, xezat_ini_file = INI_FILE)
50
+ d = nil
51
+ inifile = options.key?('inifile') ? options['inifile'] : xezat_ini_file
52
+ ini = IniFile::load(inifile)['xezat']
53
+ d = ini['portdir'] if ini.key?('portdir')
54
+ d = options['portdir'] if options.key?('portdir')
55
+ raise NoPortDirectoryError if d.nil?
56
+ d
57
+ end
58
+ end
59
+ end
60
+ end
@@ -1,4 +1,4 @@
1
- require 'rubygems'
1
+ require 'xezat/cygversion'
2
2
 
3
3
  module Xezat
4
4
  # package の changelog を管理するクラス
@@ -43,7 +43,7 @@ module Xezat
43
43
 
44
44
  def each(&block)
45
45
  @changelogs.sort do |a, b|
46
- - (Gem::Version.new(a[0]) <=> Gem::Version.new(b[0]))
46
+ - (Cygversion.new(a[0].to_s) <=> Cygversion.new(b[0].to_s))
47
47
  end.each do |k, v|
48
48
  block.call(k, v)
49
49
  end
@@ -0,0 +1,27 @@
1
+ require 'rubygems'
2
+
3
+ module Xezat
4
+ # package の version を管理するクラス
5
+ class Cygversion
6
+ def initialize(str)
7
+ matched = str.match(/(.+)-(.+)/)
8
+ version = matched[1]
9
+ @release = matched[2]
10
+ splitted = version.split('+')
11
+ @version = splitted[0]
12
+ @revision = splitted.length >= 2 ? splitted[1].match(/(\d+)/)[0].to_i : Time::at(0).strftime('%Y%m%d').to_i
13
+ end
14
+
15
+ def to_v
16
+ [Gem::Version.new(@version), @revision, @release]
17
+ end
18
+
19
+ def to_a
20
+ [@version, @revision, @release]
21
+ end
22
+
23
+ def <=>(operand)
24
+ to_v <=> operand.to_v
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,20 @@
1
+ require 'find'
2
+ require 'xezat/detectors'
3
+
4
+ module Xezat
5
+ module Detector
6
+ class PythonDocutils
7
+ DetectorManager::register(:'python-docutils', self)
8
+ def detect(variables)
9
+ Find::find(variables[:S]) do |file|
10
+ if file.end_with?(File::SEPARATOR + 'configure.ac') || file.end_with?(File::SEPARATOR + 'configure.in')
11
+ File::foreach(file) do |line|
12
+ return true if line.lstrip.start_with?('AC_CHECK_PROGS') && line.index('rst2man').is_a?(Integer)
13
+ end
14
+ end
15
+ end
16
+ false
17
+ end
18
+ end
19
+ end
20
+ end
@@ -6,17 +6,29 @@ module Xezat
6
6
  ValidatorManager::register(:pkgconfig ,self)
7
7
  def validate(variables)
8
8
  pcdir = File::join(variables[:D], 'usr', 'lib', 'pkgconfig')
9
- result = false
9
+ result = true
10
+ details = []
10
11
  if Dir::exists?(pcdir)
11
12
  Find::find(pcdir) do |file|
12
13
  if file.end_with?('.pc')
13
- result = result || File::open(file).read().index('@').nil?
14
+ File::foreach(file) { |line|
15
+ unless line.index('@').nil?
16
+ result = false
17
+ details << "#{file.gsub(variables[:D], '')}: contains @"
18
+ break
19
+ end
20
+ if line.start_with?('Libs:') && line.index(' -l').nil?
21
+ result = false
22
+ details << "#{file.gsub(variables[:D], '')}: no library flags found"
23
+ break
24
+ end
25
+ }
14
26
  end
15
27
  end
16
28
  else
17
29
  result = nil
18
30
  end
19
- [result, nil]
31
+ [result, details.empty? ? nil : details.join($/)]
20
32
  end
21
33
  end
22
34
  end
@@ -1,3 +1,3 @@
1
1
  module Xezat
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -1,5 +1,5 @@
1
1
  {
2
- "BISON": {
2
+ "Bison": {
3
3
  "package": "bison"
4
4
  },
5
5
  "C": {
@@ -35,5 +35,8 @@
35
35
  "binutils",
36
36
  "gcc-core"
37
37
  ]
38
+ },
39
+ "Ruby": {
40
+ "package": "ruby"
38
41
  }
39
42
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  show_cygport_description()
4
4
  {
5
- declare | grep '^DESCRIPTION=' | sed -e 's/^DESCRIPTION=\$//g' -e 's/\\n/\n/g' -e "s/^'//g" -e "s/'$//" -e "s/\\\//g"
5
+ declare | grep '^DESCRIPTION=' | sed -e 's/^DESCRIPTION=\$\?//g' -e 's/\\n/\n/g' -e "s/^'//g" -e "s/'$//" -e "s/\\\//g"
6
6
  }
7
7
 
8
8
  source ${CYGPORT:-/usr/bin/cygport} $* show_cygport_description
@@ -17,11 +17,7 @@ Canonical website:
17
17
  <%= variables[:HOMEPAGE] %>
18
18
 
19
19
  Canonical download:
20
- <% if info[:src_uri].is_a?(Array) -%>
21
20
  <%= info[:src_uri][0] %>
22
- <% else -%>
23
- <%= info[:src_uri] %>
24
- <% end -%>
25
21
 
26
22
  -------------------------------------------
27
23
 
@@ -0,0 +1,24 @@
1
+ require 'xezat/command/bump'
2
+
3
+ module Xezat::Test::Command
4
+ class BumpTest < Test::Unit::TestCase
5
+ include Xezat::Command
6
+ include Xezat
7
+ def setup
8
+ @command = CommandManager[:bump]
9
+ @cygclass_manager = CygclassManager.new(File.join(File.dirname(__FILE__), '..', '..', 'cygport', 'cygclass'))
10
+ end
11
+
12
+ def test_get_src_uri
13
+ variables = {SRC_URI: 'src1 src2'}
14
+ src_uri = @command.get_src_uri(variables, @cygclass_manager)
15
+ assert_equal(['src1', 'src2'], src_uri)
16
+ end
17
+
18
+ def test_get_src_uri_git
19
+ variables = {SRC_URI: 'src1 src2', GIT_URI: 'git1'}
20
+ src_uri = @command.get_src_uri(variables, @cygclass_manager)
21
+ assert_equal(['git1'], src_uri)
22
+ end
23
+ end
24
+ end
@@ -0,0 +1 @@
1
+ AC_MSG_RESULT([All man pages found. We don't need rst2man!])
@@ -0,0 +1 @@
1
+ AC_CHECK_PROGS([RST2MAN], [rst2man rst2man.py], [])
@@ -1,4 +1,4 @@
1
- require 'xezat/detector/autoconf'
1
+ require 'xezat/detectors'
2
2
 
3
3
  module Xezat::Test::Detector
4
4
  class AutoconfTest < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require 'xezat/detector/autoconf'
1
+ require 'xezat/detectors'
2
2
 
3
3
  module Xezat::Test::Detector
4
4
  class AutomakeTest < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require 'xezat/detector/autoconf'
1
+ require 'xezat/detectors'
2
2
 
3
3
  module Xezat::Test::Detector
4
4
  class BoostM4Test < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require 'xezat/detector/autoconf'
1
+ require 'xezat/detectors'
2
2
 
3
3
  module Xezat::Test::Detector
4
4
  class CmakeTest < Test::Unit::TestCase
@@ -1,4 +1,4 @@
1
- require 'xezat/detector/autoconf'
1
+ require 'xezat/detectors'
2
2
 
3
3
  module Xezat::Test::Detector
4
4
  class GengetoptTest < Test::Unit::TestCase
@@ -0,0 +1,19 @@
1
+ require 'xezat/detectors'
2
+
3
+ module Xezat::Test::Detector
4
+ class PythonDocutilsTest < Test::Unit::TestCase
5
+ include Xezat::Detector
6
+ include Xezat
7
+ def setup
8
+ @detector = DetectorManager[:'python-docutils']
9
+ end
10
+
11
+ def test_yes
12
+ assert_true(@detector.detect({S: File::join(File::dirname(__FILE__), 'fixture', 'python-docutils', 'yes')}))
13
+ end
14
+
15
+ def test_no
16
+ assert_false(@detector.detect({S: File::join(File::dirname(__FILE__), 'fixture', 'python-docutils', 'no')}))
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,46 @@
1
+ require 'xezat/cygversion'
2
+
3
+ module Xezat::Test
4
+ class CygversionTest < Test::Unit::TestCase
5
+ include Xezat
6
+ def test_initialize
7
+ cygversion = Cygversion.new('1.0.0-1bl1')
8
+ assert_equal(['1.0.0', 19700101, '1bl1'] ,cygversion.to_a)
9
+ end
10
+
11
+ def test_initialize_vcs
12
+ cygversion = Cygversion.new('1.0.0+git20150101-1bl1')
13
+ assert_equal(['1.0.0', 20150101, '1bl1'] ,cygversion.to_a)
14
+ end
15
+
16
+ def test_compare
17
+ cygversion_old = Cygversion.new('1.0.0-1bl1')
18
+ cygversion_new = Cygversion.new('1.0.1-1bl1')
19
+ assert_equal(-1, cygversion_old <=> cygversion_new)
20
+ end
21
+
22
+ def test_compare_git
23
+ cygversion_old = Cygversion.new('1.0.0+git20140101-1bl1')
24
+ cygversion_new = Cygversion.new('1.0.0+git20150101-1bl1')
25
+ assert_equal(-1, cygversion_old <=> cygversion_new)
26
+ end
27
+
28
+ def test_compare_svn
29
+ cygversion_old = Cygversion.new('1.0.0+svn999-1bl1')
30
+ cygversion_new = Cygversion.new('1.0.0+svn1000-1bl1')
31
+ assert_equal(-1, cygversion_old <=> cygversion_new)
32
+ end
33
+
34
+ def test_compare_novcs
35
+ cygversion_old = Cygversion.new('1.0.0-1bl1')
36
+ cygversion_new = Cygversion.new('1.0.0+git20150101-1bl1')
37
+ assert_equal(-1, cygversion_old <=> cygversion_new)
38
+ end
39
+
40
+ def test_compare_release
41
+ cygversion_old = Cygversion.new('1.0.0+git20150101-1bl1')
42
+ cygversion_new = Cygversion.new('1.0.0+git20150101-1bl2')
43
+ assert_equal(-1, cygversion_old <=> cygversion_new)
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,11 @@
1
+ prefix=@prefix@
2
+ exec_prefix=@exec_prefix@
3
+ libdir=@libdir@
4
+ includedir=@includedir@
5
+
6
+ Name: xezat
7
+ Description: Complement of cygport
8
+ Version: @VERSION@
9
+ Libs: -L${libdir} -lxezat
10
+ Cflags: -I${includedir}
11
+
@@ -0,0 +1,11 @@
1
+ prefix=/usr
2
+ exec_prefix=/usr
3
+ libdir=/usr/lib
4
+ includedir=/usr/include
5
+
6
+ Name: xezat
7
+ Description: Complement of cygport
8
+ Version: 0.0.1
9
+ Libs: -L${libdir}
10
+ Cflags: -I${includedir}
11
+
@@ -0,0 +1,10 @@
1
+ prefix=/usr
2
+ exec_prefix=/usr
3
+ libdir=/usr/lib
4
+ includedir=/usr/include
5
+
6
+ Name: xezat
7
+ Description: Complement of cygport
8
+ Version: 0.0.1
9
+ Libs: -L${libdir} -lxezat
10
+ Cflags: -I${includedir}
@@ -0,0 +1,30 @@
1
+ require 'xezat/validator/pkgconfig'
2
+
3
+ module Xezat::Test::Validator
4
+ class PkgconfigTest < Test::Unit::TestCase
5
+ include Xezat
6
+ def setup
7
+ @validator = ValidatorManager[:pkgconfig]
8
+ end
9
+
10
+ def test_skip
11
+ variables = {D: Dir.tmpdir}
12
+ assert_equal([nil, nil], @validator.validate(variables))
13
+ end
14
+
15
+ def test_no_at
16
+ variables = {D: File::join(File.dirname(__FILE__), 'fixture', 'pkgconfig', 'no_at')}
17
+ assert_equal([false, '/usr/lib/pkgconfig/xezat.pc: contains @'], @validator.validate(variables))
18
+ end
19
+
20
+ def test_no_link
21
+ variables = {D: File::join(File.dirname(__FILE__), 'fixture', 'pkgconfig', 'no_link')}
22
+ assert_equal([false, '/usr/lib/pkgconfig/xezat.pc: no library flags found'], @validator.validate(variables))
23
+ end
24
+
25
+ def test_yes
26
+ variables = {D: File::join(File.dirname(__FILE__), 'fixture', 'pkgconfig', 'yes')}
27
+ assert_equal([true, nil], @validator.validate(variables))
28
+ end
29
+ end
30
+ end
@@ -18,10 +18,12 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_runtime_dependency "facets", "~> 3.0.0"
22
- spec.add_runtime_dependency "github-linguist", "~> 4.3.0"
23
- spec.add_runtime_dependency "logger-colors", "~> 1.0.0"
21
+ spec.add_runtime_dependency "facets", "~> 3.0"
22
+ spec.add_runtime_dependency "github-linguist", "~> 4.3"
23
+ spec.add_runtime_dependency "inifile", "~> 3.0"
24
+ spec.add_runtime_dependency "logger-colors", "~> 1.0"
24
25
  spec.add_runtime_dependency "mercenary", "~> 0.3.5"
26
+ spec.add_runtime_dependency "string-scrub", "~> 0.0.5"
25
27
 
26
28
  spec.add_development_dependency "bundler", "~> 1.7"
27
29
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xezat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - fd0
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-05 00:00:00.000000000 Z
11
+ date: 2015-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facets
@@ -16,42 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.0.0
19
+ version: '3.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 3.0.0
26
+ version: '3.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: github-linguist
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 4.3.0
33
+ version: '4.3'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 4.3.0
40
+ version: '4.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: inifile
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: logger-colors
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: 1.0.0
61
+ version: '1.0'
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: 1.0.0
68
+ version: '1.0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: mercenary
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +80,20 @@ dependencies:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
82
  version: 0.3.5
83
+ - !ruby/object:Gem::Dependency
84
+ name: string-scrub
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.0.5
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.0.5
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: bundler
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -115,10 +143,12 @@ files:
115
143
  - lib/xezat/command/debug.rb
116
144
  - lib/xezat/command/doctor.rb
117
145
  - lib/xezat/command/generate.rb
146
+ - lib/xezat/command/port.rb
118
147
  - lib/xezat/command/validate.rb
119
148
  - lib/xezat/commands.rb
120
149
  - lib/xezat/cygchangelog.rb
121
150
  - lib/xezat/cygclasses.rb
151
+ - lib/xezat/cygversion.rb
122
152
  - lib/xezat/detector/autoconf.rb
123
153
  - lib/xezat/detector/automake.rb
124
154
  - lib/xezat/detector/boost.m4.rb
@@ -126,6 +156,7 @@ files:
126
156
  - lib/xezat/detector/gengetopt.rb
127
157
  - lib/xezat/detector/libtool.rb
128
158
  - lib/xezat/detector/make.rb
159
+ - lib/xezat/detector/python-docutils.rb
129
160
  - lib/xezat/detectors.rb
130
161
  - lib/xezat/main.rb
131
162
  - lib/xezat/packages.rb
@@ -151,6 +182,7 @@ files:
151
182
  - test/xezat/command/fixture/doctor/a.lst.gz
152
183
  - test/xezat/command/fixture/doctor/b1.lst.gz
153
184
  - test/xezat/command/fixture/doctor/b2.lst.gz
185
+ - test/xezat/command/test_bump.rb
154
186
  - test/xezat/command/test_create.rb
155
187
  - test/xezat/command/test_doctor.rb
156
188
  - test/xezat/detector/fixture/autoconf/no/configure.scan
@@ -167,18 +199,26 @@ files:
167
199
  - test/xezat/detector/fixture/gengetopt/no/xezat.log
168
200
  - test/xezat/detector/fixture/gengetopt/yes_root/xezat.ggo
169
201
  - test/xezat/detector/fixture/gengetopt/yes_subdir/subdir/xezat.ggo
202
+ - test/xezat/detector/fixture/python-docutils/no/configure.ac
203
+ - test/xezat/detector/fixture/python-docutils/yes/configure.ac
170
204
  - test/xezat/detector/test_autoconf.rb
171
205
  - test/xezat/detector/test_automake.rb
172
206
  - test/xezat/detector/test_boost.m4.rb
173
207
  - test/xezat/detector/test_cmake.rb
174
208
  - test/xezat/detector/test_gengetopt.rb
209
+ - test/xezat/detector/test_python-docutils.rb
175
210
  - test/xezat/test_cygchangelog.rb
176
211
  - test/xezat/test_cygclasses.rb
212
+ - test/xezat/test_cygversion.rb
177
213
  - test/xezat/test_variables.rb
178
214
  - test/xezat/validator/fixture/m4/no/usr/share/aclocal/.gitkeep
179
- - test/xezat/validator/fixture/m4/skip/usr/share/aclocal/.gitkeep
180
215
  - test/xezat/validator/fixture/m4/yes/usr/share/aclocal/test.m4
216
+ - test/xezat/validator/fixture/pkgconfig/no_at/usr/lib/pkgconfig/xezat.pc
217
+ - test/xezat/validator/fixture/pkgconfig/no_link/usr/lib/pkgconfig/xezat.pc
218
+ - test/xezat/validator/fixture/pkgconfig/skip/usr/lib/pkgconfig/.gitkeep
219
+ - test/xezat/validator/fixture/pkgconfig/yes/usr/lib/pkgconfig/xezat.pc
181
220
  - test/xezat/validator/test_m4.rb
221
+ - test/xezat/validator/test_pkgconfig.rb
182
222
  - xezat.gemspec
183
223
  homepage: https://github.com/fd00/xezat
184
224
  licenses:
@@ -209,6 +249,7 @@ test_files:
209
249
  - test/xezat/command/fixture/doctor/a.lst.gz
210
250
  - test/xezat/command/fixture/doctor/b1.lst.gz
211
251
  - test/xezat/command/fixture/doctor/b2.lst.gz
252
+ - test/xezat/command/test_bump.rb
212
253
  - test/xezat/command/test_create.rb
213
254
  - test/xezat/command/test_doctor.rb
214
255
  - test/xezat/detector/fixture/autoconf/no/configure.scan
@@ -225,15 +266,23 @@ test_files:
225
266
  - test/xezat/detector/fixture/gengetopt/no/xezat.log
226
267
  - test/xezat/detector/fixture/gengetopt/yes_root/xezat.ggo
227
268
  - test/xezat/detector/fixture/gengetopt/yes_subdir/subdir/xezat.ggo
269
+ - test/xezat/detector/fixture/python-docutils/no/configure.ac
270
+ - test/xezat/detector/fixture/python-docutils/yes/configure.ac
228
271
  - test/xezat/detector/test_autoconf.rb
229
272
  - test/xezat/detector/test_automake.rb
230
273
  - test/xezat/detector/test_boost.m4.rb
231
274
  - test/xezat/detector/test_cmake.rb
232
275
  - test/xezat/detector/test_gengetopt.rb
276
+ - test/xezat/detector/test_python-docutils.rb
233
277
  - test/xezat/test_cygchangelog.rb
234
278
  - test/xezat/test_cygclasses.rb
279
+ - test/xezat/test_cygversion.rb
235
280
  - test/xezat/test_variables.rb
236
281
  - test/xezat/validator/fixture/m4/no/usr/share/aclocal/.gitkeep
237
- - test/xezat/validator/fixture/m4/skip/usr/share/aclocal/.gitkeep
238
282
  - test/xezat/validator/fixture/m4/yes/usr/share/aclocal/test.m4
283
+ - test/xezat/validator/fixture/pkgconfig/no_at/usr/lib/pkgconfig/xezat.pc
284
+ - test/xezat/validator/fixture/pkgconfig/no_link/usr/lib/pkgconfig/xezat.pc
285
+ - test/xezat/validator/fixture/pkgconfig/skip/usr/lib/pkgconfig/.gitkeep
286
+ - test/xezat/validator/fixture/pkgconfig/yes/usr/lib/pkgconfig/xezat.pc
239
287
  - test/xezat/validator/test_m4.rb
288
+ - test/xezat/validator/test_pkgconfig.rb