scrapework 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 99162c48b7c56efe773986525ab22b1b524dbf378292da8c65ad10bc2eaff7e3
4
+ data.tar.gz: 279bc3e53a095c2bb76029885fe3fcdb148aea7ac88e068cd81d2b2c3ae3ffd8
5
+ SHA512:
6
+ metadata.gz: 59c7d151995fdef2f5d20284f463db50023ad8d61bdbd94c97ce31ee20242501d5b60bf3b4cff88bd911f51a4b16b401c2c243635ca6419a01c9016a89190395
7
+ data.tar.gz: bb532285ff601a004070b1c6419745a292a058e83fcc39dc126bccadfa9f3e413daad33d00dea11d6e0cbc3b3db6b563368d9ae1c805c0c0e97bbc9389279a17
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,2 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.5
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.5
7
+ before_install: gem install bundler -v 1.17.3
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ # 0.1.0
2
+
3
+ * Initial version
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at jphager2@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in scrapework.gemspec
8
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,76 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ scrapework (0.1.0)
5
+ active_attr
6
+ activesupport
7
+ nokogiri
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ active_attr (0.13.0)
13
+ activemodel (>= 3.0.2, < 6.0)
14
+ activesupport (>= 3.0.2, < 6.0)
15
+ activemodel (5.2.3)
16
+ activesupport (= 5.2.3)
17
+ activesupport (5.2.3)
18
+ concurrent-ruby (~> 1.0, >= 1.0.2)
19
+ i18n (>= 0.7, < 2)
20
+ minitest (~> 5.1)
21
+ tzinfo (~> 1.1)
22
+ ast (2.4.0)
23
+ concurrent-ruby (1.1.5)
24
+ diff-lcs (1.3)
25
+ i18n (1.6.0)
26
+ concurrent-ruby (~> 1.0)
27
+ jaro_winkler (1.5.2)
28
+ mini_portile2 (2.4.0)
29
+ minitest (5.11.3)
30
+ nokogiri (1.10.2)
31
+ mini_portile2 (~> 2.4.0)
32
+ parallel (1.17.0)
33
+ parser (2.6.2.1)
34
+ ast (~> 2.4.0)
35
+ psych (3.1.0)
36
+ rainbow (3.0.0)
37
+ rake (10.5.0)
38
+ rspec (3.8.0)
39
+ rspec-core (~> 3.8.0)
40
+ rspec-expectations (~> 3.8.0)
41
+ rspec-mocks (~> 3.8.0)
42
+ rspec-core (3.8.0)
43
+ rspec-support (~> 3.8.0)
44
+ rspec-expectations (3.8.2)
45
+ diff-lcs (>= 1.2.0, < 2.0)
46
+ rspec-support (~> 3.8.0)
47
+ rspec-mocks (3.8.0)
48
+ diff-lcs (>= 1.2.0, < 2.0)
49
+ rspec-support (~> 3.8.0)
50
+ rspec-support (3.8.0)
51
+ rubocop (0.67.2)
52
+ jaro_winkler (~> 1.5.1)
53
+ parallel (~> 1.10)
54
+ parser (>= 2.5, != 2.5.1.1)
55
+ psych (>= 3.1.0)
56
+ rainbow (>= 2.2.2, < 4.0)
57
+ ruby-progressbar (~> 1.7)
58
+ unicode-display_width (>= 1.4.0, < 1.6)
59
+ ruby-progressbar (1.10.0)
60
+ thread_safe (0.3.6)
61
+ tzinfo (1.2.5)
62
+ thread_safe (~> 0.1)
63
+ unicode-display_width (1.5.0)
64
+
65
+ PLATFORMS
66
+ ruby
67
+
68
+ DEPENDENCIES
69
+ bundler (~> 1.17)
70
+ rake (~> 10.0)
71
+ rspec (~> 3.0)
72
+ rubocop
73
+ scrapework!
74
+
75
+ BUNDLED WITH
76
+ 1.17.3
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 jphager2
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Scrapework
2
+
3
+ Framework for mapping ruby objects to web resources, which you can then manipulate.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'scrapework'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install scrapework
20
+
21
+ ## Usage
22
+
23
+ See the examples.
24
+
25
+ ## Development
26
+
27
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
28
+
29
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
30
+
31
+ ## Contributing
32
+
33
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/scrapework. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
34
+
35
+ ## License
36
+
37
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
38
+
39
+ ## Code of Conduct
40
+
41
+ Everyone interacting in the Scrapework project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/scrapework/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'scrapework'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'scrapework'
4
+
5
+ # Mapping for repo tab (paginated
6
+ class RepositoryTabPage < Scrapework::Object
7
+ has_many :repositories
8
+
9
+ map :repositories do |html|
10
+ html.css('a[itemprop="name codeRepository"]').map do |a|
11
+ { url: URI.join(url, a['href']), name: a.text.strip }
12
+ end
13
+ end
14
+
15
+ paginate do |html|
16
+ pages = html.css('.paginate-container .btn')
17
+
18
+ pages.map do |page|
19
+ { url: page['href'] } if page && page['href'].present?
20
+ end
21
+ end
22
+ end
23
+
24
+ # Mapping for repository
25
+ class Repository < Scrapework::Object
26
+ attribute :name
27
+ end
28
+
29
+ page = RepositoryTabPage.new(url: 'https://github.com/jphager2?tab=repositories')
30
+
31
+ i = 0
32
+ until page.nil?
33
+ page.load
34
+ page.repositories.each do |repo|
35
+ i += 1
36
+ puts "#{i})\t#{repo.name} (#{repo.url})"
37
+ end
38
+
39
+ page = page.next_page
40
+ end
data/examples/ma3.rb ADDED
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'scrapework'
4
+
5
+ # The archive web page
6
+ class Archive < Scrapework::Object
7
+ ROOT = 'http://www.ma3comic.com/strips-ma3/'
8
+
9
+ has_many :pages
10
+
11
+ def self.load(*)
12
+ super(ROOT + 'archive/')
13
+ end
14
+
15
+ map :pages do |html|
16
+ html.css('select[name=comic] option').drop(1).map.with_index do |page, i|
17
+ { url: ROOT + page['value'], number: i + 1 }
18
+ end
19
+ end
20
+ end
21
+
22
+ # The page web page
23
+ class Page < Scrapework::Object
24
+ attribute :src
25
+ attribute :number, type: Integer
26
+
27
+ map :src do |html|
28
+ img(html)['src']
29
+ end
30
+
31
+ map :number do |html|
32
+ img(html)['title'].slice(/\d+/).to_i
33
+ end
34
+
35
+ def filename
36
+ "#{number.to_s.rjust(3, '0')}.png"
37
+ end
38
+
39
+ def img(html)
40
+ html.css('img#cc-comic').first
41
+ end
42
+ end
43
+
44
+ require 'open-uri'
45
+
46
+ archive = Archive.load
47
+
48
+ Dir.mkdir('ma3') unless Dir.exist?('ma3')
49
+ Dir.chdir('ma3') do
50
+ archive.pages.each_slice(20) do |pages|
51
+ threads = []
52
+ pages.each do |page|
53
+ next if File.exist?(page.filename)
54
+
55
+ threads << Thread.new(page) do |this_page|
56
+ begin
57
+ this_page.load
58
+ rescue StandardError => e
59
+ puts "error (#{this_page.url}): #{e.message}"
60
+ retry
61
+ end
62
+
63
+ uri = URI.parse(this_page.src)
64
+ File.write(this_page.filename, uri.read)
65
+ end
66
+ end
67
+ threads.each(&:join)
68
+ end
69
+ end
data/examples/manga.rb ADDED
@@ -0,0 +1,82 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'scrapework'
4
+
5
+ # This example sets up several data types and uses them
6
+ # to download every chapter of a manga.
7
+
8
+ # A manga web page
9
+ class Manga < Scrapework::Object
10
+ attribute :title
11
+
12
+ has_many :chapters
13
+
14
+ map :title do |html|
15
+ html.css('h1.entry-title').text.strip
16
+ end
17
+
18
+ map :chapters do |html|
19
+ html.css('.chapter-list .row a').reverse.map.with_index do |chapter, i|
20
+ { url: chapter['href'], title: chapter['title'], number: i + 1 }
21
+ end
22
+ end
23
+ end
24
+
25
+ # A manga chapter web page
26
+ class Chapter < Scrapework::Object
27
+ attribute :title
28
+ attribute :number, type: Integer
29
+
30
+ belongs_to :manga
31
+ has_many :pages
32
+
33
+ map :title do |html|
34
+ html.css('h1.entity-title').text.strip
35
+ end
36
+
37
+ map :manga do |html|
38
+ manga = html.css('.breadcrumbs_doc p span:nth-child(3) a').first
39
+ { url: manga['href'], title: manga.text.strip }
40
+ end
41
+
42
+ map :pages do |html|
43
+ html.css('.vung_doc img').map.with_index do |page, i|
44
+ url = page['src']
45
+ ext = File.extname(url)
46
+ padded_number = i.to_s.rjust(3, '0')
47
+ padded_chapter = number.to_s.rjust(3, '0')
48
+ filename = "#{manga.title} #{padded_chapter}-#{padded_number}#{ext}"
49
+
50
+ { url: url, filename: filename, number: i + 1 }
51
+ end
52
+ end
53
+ end
54
+
55
+ # A manga page image
56
+ class Page < Scrapework::Object
57
+ attribute :filename
58
+ attribute :number, type: Integer
59
+
60
+ belongs_to :chapter
61
+ end
62
+
63
+ require 'open-uri'
64
+
65
+ manga = Manga.load('https://mangabat.com/manga/serie-1088909590')
66
+
67
+ Dir.mkdir(manga.title) unless Dir.exist?(manga.title)
68
+ Dir.chdir(manga.title) do
69
+ manga.chapters.each do |chapter|
70
+ Dir.mkdir(chapter.title) unless Dir.exist?(chapter.title)
71
+ Dir.chdir(chapter.title) do
72
+ chapter.pages.each do |page|
73
+ next if File.exist?(page.filename)
74
+
75
+ File.open(page.filename, 'w') do |f|
76
+ uri = URI.parse(page.url)
77
+ f.write(uri.read)
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
data/lib/scrapework.rb ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'scrapework/version'
4
+ require 'scrapework/object'
5
+
6
+ module Scrapework
7
+ class Error < StandardError; end
8
+ # Your code goes here...
9
+ end
@@ -0,0 +1,154 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'open-uri'
4
+ require 'nokogiri'
5
+ require 'active_attr'
6
+ require 'active_support/all'
7
+
8
+ module Scrapework
9
+ # Base class for web data type
10
+ class Object
11
+ include ActiveAttr::Model
12
+
13
+ attribute :url
14
+
15
+ def self.reflections
16
+ @reflections ||= {}
17
+ end
18
+
19
+ # rubocop:disable Metrics/MethodLength
20
+ def self.belongs_to(object, options = {})
21
+ ivar = "@#{object}"
22
+ mapped_method = "_mapped_#{object}"
23
+ reflection_class = options.fetch(:class) { object.to_s.classify }.to_s
24
+
25
+ attr_writer object
26
+
27
+ define_method(object) do
28
+ return instance_variable_get(ivar) if instance_variable_defined?(ivar)
29
+
30
+ attributes = __send__(mapped_method)
31
+ return if attributes.nil?
32
+
33
+ instance = reflection_class.constantize.new(attributes)
34
+ instance_variable_set(ivar, instance)
35
+ end
36
+
37
+ reflections[object] = { type: 'belongs_to', class: reflection_class }
38
+ end
39
+ # rubocop:enable Metrics/MethodLength
40
+
41
+ # rubocop:disable Naming/PredicateName
42
+ # rubocop:disable Metrics/MethodLength
43
+ # rubocop:disable Metrics/AbcSize
44
+ def self.has_many(objects, options = {})
45
+ ivar = "@#{objects}"
46
+ reflection_class = options.fetch(:class) do
47
+ objects.to_s.singularize.classify
48
+ end.to_s
49
+ inverse_reflection = self.class.name.underscore
50
+
51
+ attr_writer objects
52
+
53
+ define_method(objects) do
54
+ return instance_variable_get(ivar) if instance_variable_defined?(ivar)
55
+
56
+ instances = __send__("_mapped_#{objects}").map do |attributes|
57
+ next if attributes.nil?
58
+
59
+ instance = reflection_class.constantize.new(attributes)
60
+ if instance.class.reflections.include?(inverse_reflection)
61
+ instance.public_send("#{inverse_reflection}=", self)
62
+ end
63
+ instance
64
+ end
65
+ instance_variable_set(ivar, instances.compact)
66
+ end
67
+
68
+ reflections[objects] = { type: 'has_many', class: reflection_class }
69
+ end
70
+ # rubocop:enable Naming/PredicateName
71
+ # rubocop:enable Metrics/MethodLength
72
+ # rubocop:enable Metrics/AbcSize
73
+
74
+ # rubocop:disable Naming/PredicateName
75
+ # rubocop:disable Metrics/MethodLength
76
+ # rubocop:disable Metrics/AbcSize
77
+ def self.has_one(object, options = {})
78
+ ivar = "@#{object}"
79
+ mapped_method = "_mapped_#{object}"
80
+ reflection_class = options.fetch(:class) { object.to_s.classify }.to_s
81
+ inverse_reflection = self.class.name.underscore
82
+
83
+ attr_writer object
84
+
85
+ define_method(object) do
86
+ return instance_variable_get(ivar) if instance_variable_defined?(ivar)
87
+
88
+ attributes = __send__(mapped_method)
89
+ return if attributes.nil?
90
+
91
+ instance = reflection_class.constantize.new(attributes)
92
+ if instance.class.reflections.include?(inverse_reflection)
93
+ instance.public_send("#{inverse_reflection}=", self)
94
+ end
95
+ instance_variable_set(ivar, instance)
96
+ end
97
+
98
+ reflections[object] = { type: 'has_one', class: reflection_class }
99
+ end
100
+ # rubocop:enable Naming/PredicateName
101
+ # rubocop:enable Metrics/MethodLength
102
+ # rubocop:enable Metrics/AbcSize
103
+
104
+ def self.paginate(&block)
105
+ mapped_method = :_pagination
106
+
107
+ define_method(mapped_method) do
108
+ @_pagination ||= block.call(_document)
109
+ end
110
+
111
+ define_method(:prev_page) do
112
+ pages = __send__(mapped_method)
113
+ self.class.new(pages[0]) if pages[0]
114
+ end
115
+
116
+ define_method(:next_page) do
117
+ pages = __send__(mapped_method)
118
+ self.class.new(pages[1]) if pages[1]
119
+ end
120
+ end
121
+
122
+ def self.map(name, &block)
123
+ mapped_method = :"_mapped_#{name}"
124
+
125
+ define_method(mapped_method) do
126
+ value = instance_exec(_document, &block)
127
+
128
+ public_send("#{name}=", value)
129
+ end
130
+ private mapped_method
131
+ end
132
+
133
+ def self.load(url)
134
+ instance = new(url: url)
135
+ instance.load
136
+ instance
137
+ end
138
+
139
+ def _document
140
+ @_document ||= Nokogiri::HTML(html)
141
+ end
142
+
143
+ def html
144
+ uri = URI.parse(url)
145
+ uri.read
146
+ end
147
+
148
+ def load
149
+ attributes.except('url').each do |attribute, value|
150
+ __send__("_mapped_#{attribute}") if value.nil?
151
+ end
152
+ end
153
+ end
154
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Scrapework
4
+ VERSION = '0.1.0'
5
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'scrapework/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'scrapework'
9
+ spec.version = Scrapework::VERSION
10
+ spec.authors = ['jphager2']
11
+ spec.email = ['jphager2@gmail.com']
12
+
13
+ spec.summary = <<~SUMMARY.tr("\n", '')
14
+ Framework for mapping ruby objects to web resources,
15
+ which you can then manipulate.
16
+ SUMMARY
17
+ spec.description = <<~DESCRIPTION.tr("\n", '')
18
+ Framework for mapping ruby objects to web resources,
19
+ which you can then manipulate.
20
+ DESCRIPTION
21
+ spec.homepage = 'https://www.github.com/jphager2/scrapework'
22
+ spec.license = 'MIT'
23
+
24
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either
25
+ # set the 'allowed_push_host' to allow pushing to a single host or
26
+ # delete this section to allow pushing to any host.
27
+ if spec.respond_to?(:metadata)
28
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
29
+
30
+ spec.metadata['homepage_uri'] = spec.homepage
31
+ spec.metadata['source_code_uri'] = spec.homepage
32
+ spec.metadata['changelog_uri'] = spec.homepage + '/blob/master/CHANGELOG.md'
33
+ else
34
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
35
+ 'public gem pushes.'
36
+ end
37
+
38
+ # Specify which files should be added to the gem when it is released.
39
+ # The `git ls-files -z` loads the files in the RubyGem that have been
40
+ # added into git.
41
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
42
+ `git ls-files -z`
43
+ .split("\x0")
44
+ .reject { |f| f.match(%r{^(test|spec|features)/}) }
45
+ end
46
+ spec.bindir = 'exe'
47
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
48
+ spec.require_paths = ['lib']
49
+
50
+ spec.add_dependency 'active_attr'
51
+ spec.add_dependency 'activesupport'
52
+ spec.add_dependency 'nokogiri'
53
+
54
+ spec.add_development_dependency 'bundler', '~> 1.17'
55
+ spec.add_development_dependency 'rake', '~> 10.0'
56
+ spec.add_development_dependency 'rspec', '~> 3.0'
57
+ spec.add_development_dependency 'rubocop'
58
+ end
metadata ADDED
@@ -0,0 +1,166 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scrapework
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - jphager2
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-04-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: active_attr
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: nokogiri
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.17'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.17'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Framework for mapping ruby objects to web resources,which you can then
112
+ manipulate.
113
+ email:
114
+ - jphager2@gmail.com
115
+ executables: []
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - ".gitignore"
120
+ - ".rspec"
121
+ - ".rubocop.yml"
122
+ - ".travis.yml"
123
+ - CHANGELOG.md
124
+ - CODE_OF_CONDUCT.md
125
+ - Gemfile
126
+ - Gemfile.lock
127
+ - LICENSE.txt
128
+ - README.md
129
+ - Rakefile
130
+ - bin/console
131
+ - bin/setup
132
+ - examples/github.rb
133
+ - examples/ma3.rb
134
+ - examples/manga.rb
135
+ - lib/scrapework.rb
136
+ - lib/scrapework/object.rb
137
+ - lib/scrapework/version.rb
138
+ - scrapework.gemspec
139
+ homepage: https://www.github.com/jphager2/scrapework
140
+ licenses:
141
+ - MIT
142
+ metadata:
143
+ allowed_push_host: https://rubygems.org
144
+ homepage_uri: https://www.github.com/jphager2/scrapework
145
+ source_code_uri: https://www.github.com/jphager2/scrapework
146
+ changelog_uri: https://www.github.com/jphager2/scrapework/blob/master/CHANGELOG.md
147
+ post_install_message:
148
+ rdoc_options: []
149
+ require_paths:
150
+ - lib
151
+ required_ruby_version: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ required_rubygems_version: !ruby/object:Gem::Requirement
157
+ requirements:
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ requirements: []
162
+ rubygems_version: 3.0.3
163
+ signing_key:
164
+ specification_version: 4
165
+ summary: Framework for mapping ruby objects to web resources,which you can then manipulate.
166
+ test_files: []