|
1 |
| ---- !ruby/object:Gem::Specification |
2 |
| -name: dnote |
3 |
| -version: !ruby/object:Gem::Version |
4 |
| - hash: 13 |
5 |
| - prerelease: false |
6 |
| - segments: |
7 |
| - - 1 |
8 |
| - - 6 |
9 |
| - - 1 |
10 |
| - version: 1.6.1 |
11 |
| -platform: ruby |
12 |
| -authors: |
13 |
| -- Thomas Sawyer |
14 |
| -autorequire: |
15 |
| -bindir: bin |
16 |
| -cert_chain: [] |
17 |
| - |
18 |
| -date: 2011-05-17 00:00:00 -04:00 |
19 |
| -default_executable: |
20 |
| -dependencies: |
21 |
| -- !ruby/object:Gem::Dependency |
22 |
| - name: lemon |
23 |
| - prerelease: false |
24 |
| - requirement: &id001 !ruby/object:Gem::Requirement |
25 |
| - none: false |
26 |
| - requirements: |
27 |
| - - - ">=" |
28 |
| - - !ruby/object:Gem::Version |
29 |
| - hash: 3 |
30 |
| - segments: |
31 |
| - - 0 |
32 |
| - version: "0" |
33 |
| - type: :development |
34 |
| - version_requirements: *id001 |
35 |
| -- !ruby/object:Gem::Dependency |
36 |
| - name: redline |
37 |
| - prerelease: false |
38 |
| - requirement: &id002 !ruby/object:Gem::Requirement |
39 |
| - none: false |
40 |
| - requirements: |
41 |
| - - - ">=" |
42 |
| - - !ruby/object:Gem::Version |
43 |
| - hash: 3 |
44 |
| - segments: |
45 |
| - - 0 |
46 |
| - version: "0" |
47 |
| - type: :development |
48 |
| - version_requirements: *id002 |
49 |
| -- !ruby/object:Gem::Dependency |
50 |
| - name: reap |
51 |
| - prerelease: false |
52 |
| - requirement: &id003 !ruby/object:Gem::Requirement |
53 |
| - none: false |
54 |
| - requirements: |
55 |
| - - - ">=" |
56 |
| - - !ruby/object:Gem::Version |
57 |
| - hash: 3 |
58 |
| - segments: |
59 |
| - - 0 |
60 |
| - version: "0" |
61 |
| - type: :development |
62 |
| - version_requirements: *id003 |
63 |
| -description: DNote makes it easy to extract developer's notes from source code, and supports almost any language. |
64 |
| - |
65 |
| -executables: |
66 |
| -- dnote |
67 |
| -extensions: [] |
68 |
| -
|
69 |
| -extra_rdoc_files: |
70 |
| -- README.rdoc |
71 |
| -files: |
72 |
| -- .ruby |
73 |
| -- bin/dnote |
74 |
| -- lib/dnote/core_ext.rb |
75 |
| -- lib/dnote/format.rb |
76 |
| -- lib/dnote/note.rb |
77 |
| -- lib/dnote/notes.rb |
78 |
| -- lib/dnote/session.rb |
79 |
| -- lib/dnote/string.rb |
80 |
| -- lib/dnote/templates/html/file.erb |
81 |
| -- lib/dnote/templates/html/label.erb |
82 |
| -- lib/dnote/templates/html/list.erb |
83 |
| -- lib/dnote/templates/html.erb |
84 |
| -- lib/dnote/templates/json/file.erb |
85 |
| -- lib/dnote/templates/json/label.erb |
86 |
| -- lib/dnote/templates/json/list.erb |
87 |
| -- lib/dnote/templates/json.erb |
88 |
| -- lib/dnote/templates/md/file.erb |
89 |
| -- lib/dnote/templates/md/label.erb |
90 |
| -- lib/dnote/templates/md/list.erb |
91 |
| -- lib/dnote/templates/md.erb |
92 |
| -- lib/dnote/templates/rdoc/file.erb |
93 |
| -- lib/dnote/templates/rdoc/label.erb |
94 |
| -- lib/dnote/templates/rdoc/list.erb |
95 |
| -- lib/dnote/templates/rdoc.erb |
96 |
| -- lib/dnote/templates/soap/file.erb |
97 |
| -- lib/dnote/templates/soap/label.erb |
98 |
| -- lib/dnote/templates/soap/list.erb |
99 |
| -- lib/dnote/templates/soap.erb |
100 |
| -- lib/dnote/templates/text/file.erb |
101 |
| -- lib/dnote/templates/text/label.erb |
102 |
| -- lib/dnote/templates/text/list.erb |
103 |
| -- lib/dnote/templates/text.erb |
104 |
| -- lib/dnote/templates/xml/file.erb |
105 |
| -- lib/dnote/templates/xml/label.erb |
106 |
| -- lib/dnote/templates/xml/list.erb |
107 |
| -- lib/dnote/templates/xml.erb |
108 |
| -- lib/dnote/templates/xoxo/file.erb |
109 |
| -- lib/dnote/templates/xoxo/label.erb |
110 |
| -- lib/dnote/templates/xoxo/list.erb |
111 |
| -- lib/dnote/templates/xoxo.erb |
112 |
| -- lib/dnote/templates/yaml/file.erb |
113 |
| -- lib/dnote/templates/yaml/label.erb |
114 |
| -- lib/dnote/templates/yaml/list.erb |
115 |
| -- lib/dnote/templates/yaml.erb |
116 |
| -- lib/dnote/version.rb |
117 |
| -- lib/dnote.rb |
118 |
| -- lib/plugins/rake/task.rb |
119 |
| -- lib/plugins/redline/dnote.rb |
120 |
| -- test/notes_case.rb |
121 |
| -- try/sample.bas |
122 |
| -- try/sample.js |
123 |
| -- try/sample.rb |
124 |
| -- HISTORY.rdoc |
125 |
| -- APACHE2.txt |
126 |
| -- README.rdoc |
127 |
| -has_rdoc: true |
128 |
| -homepage: http://rubyworks.github.com/dnote |
129 |
| -licenses: [] |
130 |
| -
|
131 |
| -post_install_message: |
132 |
| -rdoc_options: |
133 |
| -- --title |
134 |
| -- DNote API |
135 |
| -- --main |
136 |
| -- README.rdoc |
137 |
| -require_paths: |
138 |
| -- lib |
139 |
| -required_ruby_version: !ruby/object:Gem::Requirement |
140 |
| - none: false |
141 |
| - requirements: |
142 |
| - - - ">=" |
143 |
| - - !ruby/object:Gem::Version |
144 |
| - hash: 3 |
145 |
| - segments: |
146 |
| - - 0 |
147 |
| - version: "0" |
148 |
| -required_rubygems_version: !ruby/object:Gem::Requirement |
149 |
| - none: false |
150 |
| - requirements: |
151 |
| - - - ">=" |
152 |
| - - !ruby/object:Gem::Version |
153 |
| - hash: 3 |
154 |
| - segments: |
155 |
| - - 0 |
156 |
| - version: "0" |
157 |
| -requirements: [] |
158 |
| -
|
159 |
| -rubyforge_project: dnote |
160 |
| -rubygems_version: 1.3.7 |
161 |
| -signing_key: |
162 |
| -specification_version: 3 |
163 |
| -summary: Extract developer's notes from source code |
164 |
| -test_files: [] |
| 1 | +# encoding: utf-8 |
165 | 2 |
|
| 3 | +require 'yaml' |
| 4 | + |
| 5 | +metadata = YAML.load_file('.ruby') |
| 6 | + |
| 7 | +manifest = Dir.glob('manifest{,.txt}', File::FNM_CASEFOLD).first |
| 8 | + |
| 9 | + |
| 10 | +Gem::Specification.new do |gemspec| |
| 11 | + |
| 12 | + scm = case |
| 13 | + when File.directory?('.git') |
| 14 | + :git |
| 15 | + end |
| 16 | + |
| 17 | + files = case |
| 18 | + when manifest |
| 19 | + File.readlines(manifest). |
| 20 | + map{ |line| line.strip }. |
| 21 | + reject{ |line| line.empty? || line[0,1] == '#' } |
| 22 | + when scm == :git |
| 23 | + `git ls-files -z`.split("\0") |
| 24 | + else |
| 25 | + Dir.glob('{**/}{.*,*}') # TODO: be more specific using standard locations ? |
| 26 | + end.select{ |path| File.file?(path) } |
| 27 | + |
| 28 | + patterns = { |
| 29 | + :bin_files => 'bin/*', |
| 30 | + :lib_files => 'lib/{**/}*.rb', |
| 31 | + :ext_files => 'ext/{**/}extconf.rb', |
| 32 | + :doc_files => '*.{txt,rdoc,md,markdown,tt,textile}', |
| 33 | + :test_files => '{test/{**/}*_test.rb,spec/{**/}*_spec.rb}' |
| 34 | + } |
| 35 | + |
| 36 | + glob_files = lambda { |pattern| |
| 37 | + Dir.glob(pattern).select { |path| |
| 38 | + File.file?(path) && files.include?(path) |
| 39 | + } |
| 40 | + } |
| 41 | + |
| 42 | + #files = glob_files[patterns[:files]] |
| 43 | + |
| 44 | + executables = glob_files[patterns[:bin_files]].map do |path| |
| 45 | + File.basename(path) |
| 46 | + end |
| 47 | + |
| 48 | + extensions = glob_files[patterns[:ext_files]].map do |path| |
| 49 | + File.basename(path) |
| 50 | + end |
| 51 | + |
| 52 | + # build-out the gemspec |
| 53 | + |
| 54 | + case metadata['revision'] |
| 55 | + when 0 |
| 56 | + gemspec.name = metadata['name'] |
| 57 | + gemspec.version = metadata['version'] |
| 58 | + gemspec.summary = metadata['summary'] |
| 59 | + gemspec.description = metadata['description'] |
| 60 | + |
| 61 | + metadata['authors'].each do |author| |
| 62 | + gemspec.authors << author['name'] |
| 63 | + |
| 64 | + if author.has_key?('email') |
| 65 | + if gemspec.email |
| 66 | + gemspec.email << author['email'] |
| 67 | + else |
| 68 | + gemspec.email = [author['email']] |
| 69 | + end |
| 70 | + end |
| 71 | + end |
| 72 | + |
| 73 | + gemspec.licenses = metadata['copyrights'].map{ |c| c['license'] }.compact |
| 74 | + |
| 75 | + metadata['requirements'].each do |req| |
| 76 | + name = req['name'] |
| 77 | + version = req['version'] |
| 78 | + groups = req['groups'] || [] |
| 79 | + |
| 80 | + case version |
| 81 | + when /^(.*?)\+$/ |
| 82 | + version = ">= #{$1}" |
| 83 | + when /^(.*?)\-$/ |
| 84 | + version = "< #{$1}" |
| 85 | + when /^(.*?)\~$/ |
| 86 | + version = "~> #{$1}" |
| 87 | + end |
| 88 | + |
| 89 | + if groups.empty? or groups.include?('runtime') |
| 90 | + # populate runtime dependencies |
| 91 | + if gemspec.respond_to?(:add_runtime_dependency) |
| 92 | + gemspec.add_runtime_dependency(name,*version) |
| 93 | + else |
| 94 | + gemspec.add_dependency(name,*version) |
| 95 | + end |
| 96 | + else |
| 97 | + # populate development dependencies |
| 98 | + if gemspec.respond_to?(:add_development_dependency) |
| 99 | + gemspec.add_development_dependency(name,*version) |
| 100 | + else |
| 101 | + gemspec.add_dependency(name,*version) |
| 102 | + end |
| 103 | + end |
| 104 | + end |
| 105 | + |
| 106 | + # convert external dependencies into a requirements |
| 107 | + if metadata['external_dependencies'] |
| 108 | + ##gemspec.requirements = [] unless metadata['external_dependencies'].empty? |
| 109 | + metadata['external_dependencies'].each do |req| |
| 110 | + gemspec.requirements << req.to_s |
| 111 | + end |
| 112 | + end |
| 113 | + |
| 114 | + # determine homepage from resources |
| 115 | + homepage = metadata['resources'].find{ |key, url| key =~ /^home/ } |
| 116 | + gemspec.homepage = homepage.last if homepage |
| 117 | + |
| 118 | + gemspec.require_paths = metadata['load_path'] || ['lib'] |
| 119 | + gemspec.post_install_message = metadata['install_message'] |
| 120 | + |
| 121 | + # RubyGems specific metadata |
| 122 | + gemspec.files = files |
| 123 | + gemspec.extensions = extensions |
| 124 | + gemspec.executables = executables |
| 125 | + |
| 126 | + if Gem::VERSION < '1.7.' |
| 127 | + gemspec.default_executable = gemspec.executables.first |
| 128 | + end |
| 129 | + |
| 130 | + gemspec.test_files = glob_files[patterns[:test_files]] |
| 131 | + |
| 132 | + unless gemspec.files.include?('.document') |
| 133 | + gemspec.extra_rdoc_files = glob_files[patterns[:doc_files]] |
| 134 | + end |
| 135 | + end |
| 136 | +end |
0 commit comments