githelp 0.2.16 → 0.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
  SHA256:
3
- metadata.gz: 9170af6dd82c78abc8f10dd2bdf76985e9258cb5aa896e62f96b8d7c7634a437
4
- data.tar.gz: fb2629186d59ec4c96500dc272e3a665054b0707fb8074a7b2bd9d32b128a087
3
+ metadata.gz: a3bfb96933272505bb5115d478479ffddc11dfe774e1a5ebe29fd3bb654c5759
4
+ data.tar.gz: fdc29f2a8653af0c840aa012d11c2498a2b74b14f9b95e5f9a4f436fe08b4dab
5
5
  SHA512:
6
- metadata.gz: 7be8932bf705098eede633aacf2afe288563be3fdc31b9b4baacdd456d547c39faed0896eeacec4d48179918b9b65bfe1513bec10e4f57eb9381c440be669dd6
7
- data.tar.gz: 04fd2caa6229ee66ca86d9840037566c27aea3753afb6e54a2022272c5f1228f5072c940ef0d3af11e95577f3315b6726df0905c5d22800f00ab9e831325b11e
6
+ metadata.gz: 9ccc19ef69c5fa8b87a1056b0a4e6e55c82d492f633dcc69012051f83d6259382808f8ab3634e2cd237f84be55b8fc6e7ea645f66dd25db3ed85f56940200174
7
+ data.tar.gz: db455bb525f4c0ea01e3b19cdc6c5ba1f3ec993a6d75a76357ed0b860f4e24daa9d15cb34adeb0bc6dc30d7e822ee9301dcf17fff5f91cab956512102be2b329
data/Gemfile CHANGED
@@ -1,4 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
1
3
  ruby '2.5.0'
2
4
 
3
5
  gem 're_expand'
4
-
6
+ # gem 'scrapbox', :path => '/Users/masui/scrapbox-ruby'
7
+ gem 'scrapbox'
data/exe/githelp CHANGED
@@ -7,11 +7,8 @@ require 'uri'
7
7
  require 'cgi'
8
8
  require 'optparse'
9
9
 
10
+ require 'scrapbox'
10
11
  require 're_expand'
11
- #require '/Users/masui/expand_ruby/lib/re_expand.rb'
12
- #require '/Users/masui/expand_ruby/lib/re_expand/Generator'
13
- #require '/Users/masui/expand_ruby/lib/re_expand/Node'
14
- #require '/Users/masui/expand_ruby/lib/re_expand/Scanner'
15
12
 
16
13
  class GitHelp
17
14
  def datafile
@@ -20,30 +17,7 @@ class GitHelp
20
17
 
21
18
  def initialize
22
19
  @pagedata = {}
23
- end
24
-
25
- def getsbdata(api)
26
- uri = URI.parse("https://scrapbox.io/api#{api}")
27
- http = Net::HTTP.new(uri.host, uri.port)
28
- http.use_ssl = true
29
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
30
- req = Net::HTTP::Get.new(uri.path)
31
- res = http.request(req)
32
- res.body.force_encoding("utf-8")
33
- end
34
-
35
- # ページタイトルのリストを取得
36
- def gettitles
37
- data = getsbdata("/pages/GitHelp")
38
- JSON.parse(data)['pages'].collect { |page|
39
- page['title']
40
- }
41
- end
42
-
43
- # それぞれのページに対して処理
44
- def getpage(title)
45
- text = getsbdata("/pages/GitHelp/#{URI.encode(title).gsub(/\//,'%2f')}/text")
46
- @pagedata[title] = text.split(/\n/)
20
+ @project = Scrapbox::Project.new("GitHelp")
47
21
  end
48
22
 
49
23
  def getdata
@@ -51,9 +25,9 @@ class GitHelp
51
25
  # ページデータ取得
52
26
  #
53
27
  puts "-----------------ページデータを取得"
54
- gettitles.each { |title|
28
+ @project.pages.each { |title,page|
55
29
  puts "...#{title}"
56
- getpage title
30
+ @pagedata[title] = page.text.split(/\n/)
57
31
  }
58
32
 
59
33
  dumpdata = {}
@@ -67,10 +41,11 @@ class GitHelp
67
41
  @pagedata.each { |title,pagedata|
68
42
  puts "...#{title}"
69
43
  pagedata. each { |line|
70
- if line =~ /code:(.*)\.rb$/ then
71
- puts "=========== #{$1}.rb"
72
- text = getsbdata("/code/GitHelp/#{URI.encode(title)}/#{$1}.rb")
73
- dumpdata['codes'] << text
44
+ if line =~ /code:(.*\.rb)$/ then
45
+ src = $1
46
+ puts "=========== #{src}"
47
+ page = Scrapbox::Page.new(@project,title)
48
+ dumpdata['codes'] << page.code(src)
74
49
  end
75
50
  }
76
51
  }
data/githelp.gemspec CHANGED
@@ -24,4 +24,5 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "minitest"
25
25
 
26
26
  spec.add_runtime_dependency "re_expand"
27
+ spec.add_runtime_dependency "scrapbox"
27
28
  end
@@ -1,3 +1,3 @@
1
1
  module GitHelp
2
- VERSION = "0.2.16"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: githelp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.16
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toshiyuki Masui
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: scrapbox
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: GitHelp - lists git commands from user's vague query strings
70
84
  email:
71
85
  - masui@pitecan.com