togostanza 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de2bb4688cc93399337e9abecabae51456ab1403
4
- data.tar.gz: 55a3943993b9773f9e06cd5f46728fa951cfeb6a
3
+ metadata.gz: ad8284aaab2b0604b36ee5a2858c066b896753d4
4
+ data.tar.gz: 0343e25731993482fa2003415b8c8e3e08e60615
5
5
  SHA512:
6
- metadata.gz: 2cb8e3171ae7b79e7418fe627a522058579dc70c403df1e1ff765cf02b083b6407cdd5cdbea8dc8b13870f9e03f5ff362018c630a801c6228f91d179150b26a1
7
- data.tar.gz: 5f310e6972a9fee2ec33ba2466a1655602b651e9d780565afa33f800b4eff2b4223db6f326bf8b172af1e0265dea327d652e36bdc0883d3c19e9216670e15df2
6
+ metadata.gz: 990335cf29dc0b02a7b328d5196d7e3144480b7927451188677659f63ce9a9f84d154feb8b1588d23daa2493a6e2605df3666c32b9370bc1287121a9926bb037
7
+ data.tar.gz: 270231cda593aedc812633513c6e654a33939ae00a7e4d53df5d2027b8bc91139b11fa950e1dbb6d9f6ade44674cb19c71c377ea6d4183a8e9aa190630c7f07a
@@ -75,10 +75,134 @@ module TogoStanza
75
75
  end
76
76
  end
77
77
 
78
+ class NameModifier < Thor::Group
79
+ include Thor::Actions
80
+
81
+ argument :name1, type: :string
82
+ argument :name2, type: :string
83
+
84
+ def self.source_root
85
+ File.expand_path('../../../templates/stanza', __FILE__)
86
+ end
87
+
88
+ def replace_description
89
+ name1_chopped = chop_slash(name1)
90
+ name2_chopped = chop_slash(name2)
91
+
92
+ gsub_file("#{files_name(name1_chopped)}/help.md", titles(name1_chopped), titles(name2_chopped))
93
+ gsub_file("#{files_name(name1_chopped)}/help.md", stanzas_id(name1_chopped), stanzas_id(name2_chopped))
94
+ gsub_file("#{files_name(name1_chopped)}/#{files_name(name1_chopped)}.gemspec", files_name(name1_chopped), files_name(name2_chopped))
95
+ gsub_file("#{files_name(name1_chopped)}/lib/#{files_name(name1_chopped)}.rb", classes_name(name1_chopped), classes_name(name2_chopped))
96
+
97
+ unless File.exist?("#{files_name(name1_chopped)}/metadata.json")
98
+ template 'metadata.json.erb', "#{file_name}/metadata.json"
99
+ end
100
+
101
+ gsub_file("#{files_name(name1_chopped)}/metadata.json", stanzas_id(name1_chopped), stanzas_id(name2_chopped))
102
+ gsub_file("#{files_name(name1_chopped)}/stanza.rb", classes_name(name1_chopped), classes_name(name2_chopped))
103
+ gsub_file("#{files_name(name1_chopped)}/template.hbs", titles(name1_chopped), titles(name2_chopped))
104
+ gsub_file("#{files_name(name1_chopped)}/template.hbs", "assets/#{stanzas_id(name1_chopped)}","assets/#{stanzas_id(name2_chopped)}")
105
+ gsub_file("#{files_name(name1_chopped)}/template.hbs", "#{stanzas_id(name1_chopped)}/resources", "#{stanzas_id(name2_chopped)}/resources")
106
+ gsub_file('Gemfile', /\'#{files_name(name1_chopped)}\'/, "\'#{files_name(name2_chopped)}\'")
107
+ gsub_file('Gemfile', /\'\.\/#{files_name(name1_chopped)}\'/, "\'\.\/#{files_name(name2_chopped)}\'")
108
+ end
109
+
110
+ def rename_directory
111
+ name1_chopped = chop_slash(name1)
112
+ name2_chopped = chop_slash(name2)
113
+
114
+ unless File.exist?("#{files_name(name1_chopped)}/assets/#{stanzas_id(name1_chopped)}")
115
+ Dir.mkdir("#{files_name(name1_chopped)}/assets/#{stanzas_id(name1_chopped)}")
116
+ end
117
+
118
+ File.rename("#{files_name(name1_chopped)}/assets/#{stanzas_id(name1_chopped)}", "#{files_name(name1_chopped)}/assets/#{stanzas_id(name2_chopped)}")
119
+ File.rename("#{files_name(name1_chopped)}/lib/#{files_name(name1_chopped)}.rb", "#{files_name(name1_chopped)}/lib/#{files_name(name2_chopped)}.rb")
120
+ File.rename("#{files_name(name1_chopped)}/#{files_name(name1_chopped)}.gemspec", "#{files_name(name1_chopped)}/#{files_name(name2_chopped)}.gemspec")
121
+ File.rename(files_name(name1_chopped), files_name(name2_chopped))
122
+ end
123
+
124
+ private
125
+
126
+ def chop_slash(name)
127
+ if name[-1] == '/'
128
+ name.chop
129
+ else
130
+ name
131
+ end
132
+ end
133
+
134
+ def stanza_id
135
+ name1_chopped = chop_slash(name1)
136
+ name1_chopped.underscore.sub(/_stanza$/, '')
137
+ end
138
+
139
+ def file_name
140
+ stanza_id + '_stanza'
141
+ end
142
+
143
+ def stanzas_id(name)
144
+ name.underscore.sub(/_stanza$/, '')
145
+ end
146
+
147
+ def files_name(name)
148
+ stanzas_id(name) + '_stanza'
149
+ end
150
+
151
+ def classes_name(name)
152
+ files_name(name).classify
153
+ end
154
+
155
+ def titles(name)
156
+ stanzas_id(name).titleize
157
+ end
158
+ end
159
+
160
+ class NameRegister < Thor::Group
161
+ include Thor::Actions
162
+
163
+ argument :name
164
+
165
+ def template_dir
166
+ File.expand_path('../../../templates/stanza', __FILE__)
167
+ end
168
+
169
+ def replace_author
170
+ gsub_file("#{template_dir}/gemspec.erb", /spec.authors\s*=\s\[\'.*\'\]/, "spec.authors = ['#{name}']")
171
+ gsub_file("#{template_dir}/metadata.json.erb", /author":\s".*"/, "author\": \"#{name}\"")
172
+ end
173
+ end
174
+
175
+ class MailRegister < Thor::Group
176
+ include Thor::Actions
177
+
178
+ argument :addr
179
+
180
+ def template_dir
181
+ File.expand_path('../../../templates/stanza', __FILE__)
182
+ end
183
+
184
+ def replace_author
185
+ gsub_file("#{template_dir}/gemspec.erb", /spec.email\s*=\s\[\'.*\'\]/, "spec.email = ['#{addr}']")
186
+ gsub_file("#{template_dir}/metadata.json.erb", /address":\s".*"/, "address\": \"#{addr}\"")
187
+ end
188
+ end
189
+
78
190
  class Stanza < Thor
79
191
  register StanzaGenerator, 'new', 'new NAME', 'Creates a new stanza'
80
192
  end
81
193
 
194
+ class Stanza < Thor
195
+ register NameModifier, 'modify', 'modify OLD_NAME NEW_NAME', 'Modify a name of stanza'
196
+ end
197
+
198
+ class Root < Thor
199
+ register NameRegister, 'name' , 'name NAME' , 'register your name'
200
+ end
201
+
202
+ class Root < Thor
203
+ register MailRegister, 'mail' , 'mail ADDRESS' , 'register your mail'
204
+ end
205
+
82
206
  class Root < Thor
83
207
  register ProviderGenerator, 'init', 'init NAME', 'Creates a new provider'
84
208
 
@@ -1,3 +1,3 @@
1
1
  module TogoStanza
2
- VERSION = '1.3.0'
2
+ VERSION = '1.3.1'
3
3
  end
@@ -6,8 +6,8 @@ Gem::Specification.new do |spec|
6
6
  spec.version = '0.0.1'
7
7
  spec.authors = ['TODO: Write your name']
8
8
  spec.email = ['TODO: Write your email address']
9
- spec.summary = %q{TODO: Write a short summary. Required.}
10
- spec.description = %q{TODO: Write a longer description. Optional.}
9
+ spec.summary = %q{Data visualization, analysis and searching tool for semantic web.}
10
+ spec.description = %q{<%= file_name %>.}
11
11
  spec.homepage = ''
12
12
  spec.license = 'MIT'
13
13
 
@@ -1,20 +1,18 @@
1
1
  {
2
- "@context": {
3
- "stanza": "http://togostanza.org/resource/stanza#"
4
- },
5
2
  "@id": "http://togogenome.org/stanza/<%= stanza_id %>",
6
3
  "stanza:label": "",
7
4
  "stanza:definition": "",
8
- "stanza:parameters": [
5
+ "stanza:parameter": [
9
6
  ],
10
7
  "stanza:usage": "<div data-stanza=\"http://togogenome.org/stanza/<%= stanza_id %>\"></div>",
11
- "stanza:type": "stanza:Stanza",
8
+ "stanza:type": "Stanza",
12
9
  "stanza:context": "",
13
10
  "stanza:display": "",
14
11
  "stanza:provider": "provider of this stanza",
15
12
  "stanza:license": "",
16
13
  "stanza:author": "author name",
17
14
  "stanza:address": "name@example.org",
15
+ "stanza:contributor": [ "Taro Stanza", "Hanako Stanza" ],
18
16
  "stanza:created": "<%= Date.today %>",
19
17
  "stanza:updated": "<%= Date.today %>"
20
18
  }
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: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keita Urashima
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-16 00:00:00.000000000 Z
11
+ date: 2015-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -344,7 +344,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
344
344
  version: '0'
345
345
  requirements: []
346
346
  rubyforge_project:
347
- rubygems_version: 2.2.2
347
+ rubygems_version: 2.4.5.1
348
348
  signing_key:
349
349
  specification_version: 4
350
350
  summary: Development tools of TogoStanza
@@ -369,4 +369,3 @@ test_files:
369
369
  - spec/lib/togostanza/stanza/base_spec.rb
370
370
  - spec/lib/togostanza/stanza/grouping_spec.rb
371
371
  - spec/spec_helper.rb
372
- has_rdoc: