togostanza 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/togostanza/cli.rb +57 -1
- data/lib/togostanza/stanza/base.rb +3 -0
- data/lib/togostanza/version.rb +1 -1
- data/templates/stanza/gemspec.erb +5 -5
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f18bc192e76ceb3d9d3561e68b2a350d709ff580
|
4
|
+
data.tar.gz: e71c040dffc26b952c905801c412acd81bb92e99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53d607d8e374a3b84cab083a20da2c66117eaf1f75335c8bc9c806a5e59211b014f3ea2ff58ad2dcef229533ab531dec74955313ae169602415c23b5ee31e2ca
|
7
|
+
data.tar.gz: e220b5cb227711b36bdbe51032908bc52963592541bd6c7e6551415c6be6667143c6bf97ae5296300512c9d3f2035affe642149e5951040e43f9020549127739
|
data/lib/togostanza/cli.rb
CHANGED
@@ -140,7 +140,6 @@ module TogoStanza
|
|
140
140
|
def replace_description
|
141
141
|
name1_chopped = chop_slash(name1)
|
142
142
|
name2_chopped = chop_slash(name2)
|
143
|
-
|
144
143
|
gsub_file("#{files_name(name1_chopped)}/#{files_name(name1_chopped)}.gemspec", files_name(name1_chopped), files_name(name2_chopped))
|
145
144
|
gsub_file("#{files_name(name1_chopped)}/lib/#{files_name(name1_chopped)}.rb", classes_name(name1_chopped), classes_name(name2_chopped))
|
146
145
|
|
@@ -198,6 +197,59 @@ module TogoStanza
|
|
198
197
|
end
|
199
198
|
end
|
200
199
|
|
200
|
+
class GenspecUpdater < Thor::Group
|
201
|
+
include Thor::Actions
|
202
|
+
include Thor::Shell
|
203
|
+
|
204
|
+
argument :name, type: :string
|
205
|
+
|
206
|
+
def self.source_root
|
207
|
+
File.expand_path('../../../templates/stanza', __FILE__)
|
208
|
+
end
|
209
|
+
|
210
|
+
def check_exist
|
211
|
+
unless File.exist?("#{file_name}")
|
212
|
+
say("This provider doesn't have #{file_name}")
|
213
|
+
exit
|
214
|
+
end
|
215
|
+
unless File.exist?("#{file_name}/metadata.json")
|
216
|
+
template 'metadata.json.erb', "#{file_name}/metadata.json"
|
217
|
+
say("metadata.json has just made.")
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
def replace_description
|
222
|
+
unless File.read("#{file_name}/#{file_name}.gemspec").include?("require\s'json'")
|
223
|
+
insert_into_file("#{file_name}/#{file_name}.gemspec", "\nrequire\s'json'\n", :after=>"$LOAD_PATH.unshift(lib)\sunless\s$LOAD_PATH.include?(lib)\n")
|
224
|
+
insert_into_file("#{file_name}/#{file_name}.gemspec", "metadata\s=\sopen('./metadata.json')\sdo\s|io|\n", :after=>"\nrequire\s'json'\n")
|
225
|
+
insert_into_file("#{file_name}/#{file_name}.gemspec", "\s\sJSON.load\(io\)\nend\n", :after=>"metadata\s=\sopen('./metadata.json')\sdo\s|io|\n")
|
226
|
+
end
|
227
|
+
gsub_file("#{file_name}/#{file_name}.gemspec", /spec\.authors.*\n/, "spec.authors = Array(metadata['author'])\n")
|
228
|
+
gsub_file("#{file_name}/#{file_name}.gemspec", /spec\.email.*\n/, "spec.email = Array(metadata['address'])\n")
|
229
|
+
gsub_file("#{file_name}/#{file_name}.gemspec", /spec\.summary.*\n/, "spec.summary = metadata['label']\n")
|
230
|
+
gsub_file("#{file_name}/#{file_name}.gemspec", /spec\.description.*\n/, "spec.description = metadata['definition']\n")
|
231
|
+
gsub_file("#{file_name}/#{file_name}.gemspec", /spec\.license.*\n/, "spec.license = metadata['license']\n")
|
232
|
+
end
|
233
|
+
|
234
|
+
private
|
235
|
+
|
236
|
+
def chop_slash
|
237
|
+
if name[-1] == '/'
|
238
|
+
name.chop
|
239
|
+
else
|
240
|
+
name
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
def stanza_id
|
245
|
+
chop_slash.underscore.sub(/_stanza$/, '')
|
246
|
+
end
|
247
|
+
|
248
|
+
def file_name
|
249
|
+
stanza_id + '_stanza'
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
201
253
|
class NameRegister < Thor::Group
|
202
254
|
include Thor::Actions
|
203
255
|
|
@@ -238,6 +290,10 @@ module TogoStanza
|
|
238
290
|
register StanzaRemover, 'remove', 'remove NAME', 'Remove the stanza'
|
239
291
|
end
|
240
292
|
|
293
|
+
class Stanza < Thor
|
294
|
+
register GenspecUpdater, 'genspec_update', 'genspec_update NAME', 'Update genspec format for togostanza ver 2.0.0'
|
295
|
+
end
|
296
|
+
|
241
297
|
class Root < Thor
|
242
298
|
register NameRegister, 'name' , 'name NAME' , 'register your name'
|
243
299
|
end
|
@@ -221,6 +221,9 @@ module TogoStanza::Stanza
|
|
221
221
|
stanza_uri = "#{server_url}/#{orig['id']}"
|
222
222
|
|
223
223
|
usage_attrs = orig['parameter'].map {|hash|
|
224
|
+
unless hash['key'].start_with?("data-stanza-") then
|
225
|
+
hash['key'] = "data-stanza-" << hash['key']
|
226
|
+
end
|
224
227
|
"#{hash['key']}=\"#{hash['example']}\""
|
225
228
|
}.push("data-stanza=\"#{stanza_uri}\"").join(' ')
|
226
229
|
|
data/lib/togostanza/version.rb
CHANGED
@@ -9,12 +9,12 @@ end
|
|
9
9
|
Gem::Specification.new do |spec|
|
10
10
|
spec.name = '<%= file_name %>'
|
11
11
|
spec.version = '0.0.1'
|
12
|
-
spec.authors = Array(metadata["
|
13
|
-
spec.email = Array(metadata["
|
14
|
-
spec.summary = metadata["
|
15
|
-
spec.description = metadata["
|
12
|
+
spec.authors = Array(metadata["author"])
|
13
|
+
spec.email = Array(metadata["address"])
|
14
|
+
spec.summary = metadata["label"]
|
15
|
+
spec.description = metadata["definition"]
|
16
16
|
spec.homepage = ''
|
17
|
-
spec.license = metadata["
|
17
|
+
spec.license = metadata["license"]
|
18
18
|
|
19
19
|
spec.files = Dir.glob('**/*')
|
20
20
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: togostanza
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keita Urashima
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -326,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
326
326
|
version: '0'
|
327
327
|
requirements: []
|
328
328
|
rubyforge_project:
|
329
|
-
rubygems_version: 2.5.1
|
329
|
+
rubygems_version: 2.4.5.1
|
330
330
|
signing_key:
|
331
331
|
specification_version: 4
|
332
332
|
summary: Development tools of TogoStanza
|
@@ -351,4 +351,3 @@ test_files:
|
|
351
351
|
- spec/lib/togostanza/stanza/base_spec.rb
|
352
352
|
- spec/lib/togostanza/stanza/grouping_spec.rb
|
353
353
|
- spec/spec_helper.rb
|
354
|
-
has_rdoc:
|