marvel_explorer 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +16 -0
  3. data/.rspec +3 -0
  4. data/.travis.yml +7 -0
  5. data/Gemfile +4 -0
  6. data/Guardfile +38 -0
  7. data/LICENSE.md +22 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +48 -0
  10. data/Rakefile +7 -0
  11. data/bin/marvel_explorer +4 -0
  12. data/config/defaults.yml +2 -0
  13. data/config.yml +3 -0
  14. data/lib/marvel_explorer/characters.rb +39 -0
  15. data/lib/marvel_explorer/cli.rb +62 -0
  16. data/lib/marvel_explorer/comic.rb +19 -0
  17. data/lib/marvel_explorer/explorer.rb +23 -0
  18. data/lib/marvel_explorer/git.rb +19 -0
  19. data/lib/marvel_explorer/helpers.rb +17 -0
  20. data/lib/marvel_explorer/rankings.rb +29 -0
  21. data/lib/marvel_explorer/twitter.rb +29 -0
  22. data/lib/marvel_explorer/version.rb +3 -0
  23. data/lib/marvel_explorer/yamlise.rb +76 -0
  24. data/lib/marvel_explorer.rb +19 -0
  25. data/marvel_explorer.gemspec +35 -0
  26. data/spec/cassettes/MarvelExplorer_Explorer/should_extract_the_year_correctly.yml +136 -0
  27. data/spec/cassettes/MarvelExplorer_Explorer/should_generate_a_commit_message.yml +255 -0
  28. data/spec/cassettes/MarvelExplorer_Explorer/should_generate_a_tweet_message.yml +255 -0
  29. data/spec/cassettes/MarvelExplorer_Explorer/should_generate_correct_yaml.yml +255 -0
  30. data/spec/cassettes/MarvelExplorer_Explorer/should_get_the_default_start_character.yml +255 -0
  31. data/spec/cassettes/MarvelExplorer_Explorer/should_get_the_end_character_from_the_comic.yml +255 -0
  32. data/spec/cassettes/MarvelExplorer_Explorer/should_load_the_stored_character.yml +255 -0
  33. data/spec/cassettes/MarvelExplorer_Explorer/should_save_the_end_character.yml +255 -0
  34. data/spec/cassettes/MarvelExplorer_Explorer/should_select_a_comic_for_the_start_character.yml +255 -0
  35. data/spec/characters_spec.rb +52 -0
  36. data/spec/explorer_spec.rb +20 -0
  37. data/spec/fixtures/double-shot-characters.json +2278 -0
  38. data/spec/fixtures/hulk_comics.json +1 -0
  39. data/spec/fixtures/last.character +7 -0
  40. data/spec/fixtures/spider-man.json +1 -0
  41. data/spec/fixtures/viper.json +1 -0
  42. data/spec/git_spec.rb +24 -0
  43. data/spec/rankings_spec.rb +59 -0
  44. data/spec/spec_helper.rb +98 -0
  45. data/spec/support/vcr_setup.rb +18 -0
  46. data/spec/tweet_spec.rb +24 -0
  47. data/spec/yaml_spec.rb +38 -0
  48. metadata +295 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a91887bcc6d75c99bab07490edfd98e2e71c53e1
4
+ data.tar.gz: c1c0f0805b44f255cf071e282097ae5e124a5c37
5
+ SHA512:
6
+ metadata.gz: b58a35a38ea4a0d75eaa0e78e3477ea95ed4909175bec1508dc2d0beb9f8bf50bb9fe79228fed3a6f1c3fcedb66c18f81ef86430bc229d1fc1a615ca9ad3b341
7
+ data.tar.gz: 37e665477ce26413032408f0e4da963831fa1f0b4f77fb315e3790c906948471ac2c86e968ac435a239ee1be36b82c468887b26ba43314590d473bc6704434bb
data/.gitignore ADDED
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ .env*
16
+ config-dev.yml
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --require spec_helper
3
+ --format documentation
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.5
4
+ env:
5
+ global:
6
+ - secure: ee8FFvq5vaDa0lZYgvFn5fZ+w+Rt2dnQcsBz/5daZY4pm42iAyxcESnjfr0ViUNDzRxaiBDz8RkcIoeAKalsr9uzTUrsHY5X/B/gji4tzYkDNjE7uLEaA50NJ+EU3tY9eeuNwLOIKH1jNXt5i7DEwwpmognFCf0wxFsoITM2NOo=
7
+ - secure: VBv4y36Vbkg8RVFxq15xkVrpPk1efCKo24PtW7J4HKoD1MR8isll3/ECI/HmnIJIlpLz/U4Uu2WptUrfjX+d1X5xN/dYwoUewdrBbnG0p5aWggSCIJhS15efLkvoRRAHvm7j4mtwqXwTPT/QBm3wjW1Sea6mfMnYTUZ+VWvSGqE=
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in marvel_explorer.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,38 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %(app lib config test spec feature)
6
+
7
+ ## Uncomment to clear the screen before every task
8
+ # clearing :on
9
+
10
+ # Note: The cmd option is now required due to the increasing number of ways
11
+ # rspec may be run, below are examples of the most common uses.
12
+ # * bundler: 'bundle exec rspec'
13
+ # * bundler binstubs: 'bin/rspec'
14
+ # * spring: 'bin/rsspec' (This will use spring if running and you have
15
+ # installed the spring binstubs per the docs)
16
+ # * zeus: 'zeus rspec' (requires the server to be started separetly)
17
+ # * 'just' rspec: 'rspec'
18
+ guard :rspec, cmd: 'bundle exec rspec' do
19
+ watch(%r{^spec/.+_spec\.rb$})
20
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
21
+ watch('spec/spec_helper.rb') { "spec" }
22
+
23
+ # Rails example
24
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
25
+ watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
26
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
27
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
28
+ watch('config/routes.rb') { "spec/routing" }
29
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
30
+ watch('spec/rails_helper.rb') { "spec" }
31
+
32
+ # Capybara features specs
33
+ watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
34
+
35
+ # Turnip features and steps
36
+ watch(%r{^spec/acceptance/(.+)\.feature$})
37
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
38
+ end
data/LICENSE.md ADDED
@@ -0,0 +1,22 @@
1
+ ##Copyright (c) 2014 Sam Pikesley
2
+
3
+ #MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ ##Copyright (c) 2014 Sam Pikesley
2
+
3
+ #MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,48 @@
1
+ [![Build Status](https://travis-ci.org/marvelexplorer/marvel_explorer.svg)](https://travis-ci.org/marvelexplorer/marvel_explorer)
2
+ [![Dependency Status](http://img.shields.io/gemnasium/marvelexplorer/marvel_explorer.svg)](https://gemnasium.com/marvelexplorer/marvel_explorer)
3
+ [![Code Climate](http://img.shields.io/codeclimate/github/marvelexplorer/marvel_explorer.svg)](https://codeclimate.com/github/marvelexplorer/marvel_explorer)
4
+ [![Gem Version](http://img.shields.io/gem/v/marvel_explorer.svg)](https://rubygems.org/gems/marvel_explorer)
5
+ [![License](http://img.shields.io/:license-mit-blue.svg)](http://marvelexplorer.mit-license.org)
6
+ [![Badges](http://img.shields.io/:badges-6/6-ff6799.svg)](https://github.com/badges/badgerbadgerbadger)
7
+
8
+ # MarvelExplorer
9
+
10
+ Uses my [Ultron](http://pikesley.org/projects/ultron) gem to wander from character to character through the [Marvel Comics Data](http://developer.marvel.com/) and drive the [Twitter stream](https://twitter.com/marvel_explorer) and the [Website](http://marvelexplorer.github.io/). You need to set some things up in `~/.marvel_explorer/config.yml`:
11
+
12
+ twitter:
13
+ consumer:
14
+ key: a_key
15
+ secret: a_secret
16
+ oauth:
17
+ token: a_token
18
+ secret: a_nuvver_secret
19
+
20
+ marshal_file: /home/marvelexplorer/.marvel_explorer/last.character
21
+ jekyll_dir: /home/marvelexplorer/marvelexplorer.github.io/
22
+
23
+ You also need some [Ultron configuration](https://github.com/pikesley/ultron/blob/master/README.md) in `~/.ultronrc`:
24
+
25
+ PUBLIC_KEY: this_r_public_key
26
+ PRIVATE_KEY: this_one_r_private_key
27
+
28
+ Available commands are:
29
+
30
+ marvel_explorer update
31
+
32
+ Gets the next iteration of '_Character A_ appeared in _Comic_ with _Character B_'. Writes YAML into `jekyll_dir` for use by my [Marvel Explorer Jekyll site](https://github.com/marvelexplorer/marvelexplorer.github.io)
33
+
34
+ marvel_explorer tweet
35
+
36
+ Generates and publishes a [Tweet](https://twitter.com/marvel_explorer)
37
+
38
+ marvel_explorer publish
39
+
40
+ Commits and pushes the Jekyll site to Github Pages
41
+
42
+ marvel_explorer ranking
43
+
44
+ Calculates most-featured-characters data, writes YAML for Jekyll site
45
+
46
+ marvel_explorer perform
47
+
48
+ All four of the above tasks
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new
6
+
7
+ task :default => [:spec]
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'marvel_explorer/cli'
4
+ MarvelExplorer::CLI.start
@@ -0,0 +1,2 @@
1
+ default_id: 1009351 # Hulk
2
+ tweet_length: 140
data/config.yml ADDED
@@ -0,0 +1,3 @@
1
+ marshal_file: spec/fixtures/last.character
2
+ cache_dir: 'tmp/cached_characters/'
3
+ jekyll_dir: 'tmp/'
@@ -0,0 +1,39 @@
1
+ module MarvelExplorer
2
+ class Explorer
3
+ def start_character
4
+ @start_character ||= begin
5
+ File.open @config['marshal_file'] do |file|
6
+ Marshal.load file
7
+ end
8
+ rescue
9
+ Ultron::Characters.find @config['default_id']
10
+ ensure
11
+ true
12
+ end
13
+ end
14
+
15
+ def end_character
16
+ @end_character ||= begin
17
+ characters = Ultron::Characters.by_comic comic.id
18
+ end_character = start_character
19
+ # we want a different character for the next iteration, obvs.
20
+ until end_character.id != start_character.id && MarvelExplorer.validate_character(end_character)
21
+ end_character = characters.sample
22
+ end
23
+
24
+ end_character
25
+ end
26
+ end
27
+
28
+ def save
29
+ File.open @config['marshal_file'], 'w' do |file|
30
+ Marshal.dump end_character, file
31
+ end
32
+
33
+ FileUtils.mkdir_p @config['cache_dir']
34
+ File.open '%s/%d' % [ @config['cache_dir'], end_character[:id] ], 'w' do |file|
35
+ Marshal.dump end_character, file
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,62 @@
1
+ require 'marvel_explorer'
2
+
3
+ module MarvelExplorer
4
+ class CLI < Thor
5
+ desc 'version', 'Print marvel_explorer version'
6
+ def version
7
+ puts 'marvel_explorer version %s' % [
8
+ VERSION
9
+ ]
10
+ end
11
+ map %w(-v --version) => :version
12
+
13
+ desc 'update', 'Get the next iteration'
14
+ def update
15
+ @me = Explorer.new
16
+ @me.update
17
+ end
18
+ map %w(-u --update) => :update
19
+
20
+ desc 'tweet', 'Tweet the current iteration'
21
+ def tweet
22
+ @me = Explorer.new
23
+ @me.tweet
24
+ end
25
+ map %w(-t --tweet) => :tweet
26
+
27
+ desc 'publish', 'Publish the current iteration to Github Pages'
28
+ def publish
29
+ @me = Explorer.new
30
+ @me.publish
31
+ end
32
+ map %w(-p --publish) => :publish
33
+
34
+ desc 'ranking', 'Calculate the most-featured-characters data'
35
+ method_option :commits,
36
+ type: :numeric,
37
+ default: 96,
38
+ desc: 'How many commits to rank over; 96 is 24 hours, 672 is 7 days',
39
+ aliases: '-c'
40
+ method_option :limit,
41
+ type: :numeric,
42
+ default: 5,
43
+ desc: 'Get top N rankings',
44
+ aliases: '-l'
45
+
46
+ def ranking
47
+ @me = Explorer.new
48
+ @me.record_rankings commits: options[:commits], limit: options[:limit]
49
+ end
50
+ map %w(-r --ranking) => :ranking
51
+
52
+ desc 'perform', 'Update, publish and tweet'
53
+ def perform
54
+ @me = Explorer.new
55
+ @me.update
56
+ @me.rankings commits: 96
57
+ @me.rankings commits: 672
58
+ @me.publish
59
+ @me.tweet
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,19 @@
1
+ module MarvelExplorer
2
+ class Explorer
3
+ def comic
4
+ @comic ||= begin
5
+ comics = Ultron::Comics.by_character_and_vanilla_comics start_character.id
6
+ @comic = comics.sample
7
+ until MarvelExplorer.validate_comic @comic
8
+ @comic = comics.sample
9
+ end
10
+ @comic
11
+ end
12
+ end
13
+
14
+ def series
15
+ @comic[:title] =~ /(.*) \((.*)\) #(.*)/
16
+ { name: $1, period: $2 }
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,23 @@
1
+ module MarvelExplorer
2
+ class Explorer
3
+ attr_accessor :config
4
+
5
+ def initialize config_file = "#{ENV['HOME']}/.marvel_explorer/config.yml"
6
+ @config = YAML.load(File.open(File.join(File.dirname(__FILE__), '..', '..', 'config/defaults.yml')))
7
+ @config.merge! YAML.load File.open config_file
8
+ end
9
+
10
+ def update
11
+ yamlise
12
+ save
13
+ end
14
+
15
+ def tweet
16
+ twitter_client.update tweet_message
17
+ end
18
+
19
+ def publish
20
+ commit
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,19 @@
1
+ module MarvelExplorer
2
+ class Explorer
3
+ def commit_message
4
+ '%s -> %s -> %s' % [
5
+ yamls['start']['name'],
6
+ yamls['comic']['series']['name'],
7
+ yamls['end']['name']
8
+ ]
9
+ end
10
+
11
+ def commit
12
+ g = Git.open @config['jekyll_dir']
13
+
14
+ g.add '.'
15
+ g.commit commit_message
16
+ g.push(g.remote('origin'))
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,17 @@
1
+ module MarvelExplorer
2
+ def self.get_year comic
3
+ DateTime.parse(comic.dates.select { |d| d['type'] == 'onsaleDate' }[0]['date']).year
4
+ end
5
+
6
+ def self.validate_character character
7
+ character.thumbnail &&
8
+ character.thumbnail['path'] !~ /not_available/
9
+ end
10
+
11
+ def self.validate_comic comic
12
+ comic.characters['available'] > 1 &&
13
+ MarvelExplorer.get_year(comic) > 1900 &&
14
+ comic.thumbnail &&
15
+ comic.thumbnail['path'] !~ /not_available/
16
+ end
17
+ end
@@ -0,0 +1,29 @@
1
+ module MarvelExplorer
2
+ class Explorer
3
+ def calculate_rankings params
4
+ params = { commits: 35040, repo: @config['jekyll_dir'], limit: 5 }.merge params
5
+ g = Git.open params[:repo]
6
+
7
+ counts = Hash.new(0)
8
+
9
+ g.log(params[:commits])
10
+ .select{ |c| c.message =~ /\->/ }
11
+ .map { |c| /(.*) -> (.*) -> (.*)/.match(c.message)[1] }
12
+ .each { |c| counts[c] += 1 }
13
+
14
+ counts.sort_by { |k, v| v }.reverse
15
+ .map { |k, v| { 'name' => k, 'score' => v } }[0...params[:limit]]
16
+ end
17
+
18
+ def rankings params = {}
19
+ FileUtils.mkdir_p '%s/_data/' % @config['jekyll_dir']
20
+ y = File.open '%s/_data/rankings_%d.yml' % [
21
+ @config['jekyll_dir'],
22
+ params[:commits],
23
+ ], 'w'
24
+
25
+ y.write calculate_rankings(params).to_yaml
26
+ y.close
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ module MarvelExplorer
2
+ class Explorer
3
+ def twitter_client
4
+ twitter_config = {
5
+ consumer_key: @config['twitter']['consumer']['key'],
6
+ consumer_secret: @config['twitter']['consumer']['secret'],
7
+ access_token: @config['twitter']['oauth']['token'],
8
+ access_token_secret: @config['twitter']['oauth']['secret']
9
+ }
10
+ Twitter::REST::Client.new(twitter_config)
11
+ end
12
+
13
+ def tweet_message
14
+ tm = 'In %s, %s appeared in %s #%s with %s' % [
15
+ yamls['comic']['year'],
16
+ yamls['start']['name'],
17
+ yamls['comic']['series']['name'],
18
+ yamls['comic']['issue'],
19
+ yamls['end']['name']
20
+ ]
21
+
22
+ if tm.length > @config['tweet_length'].to_i
23
+ tm = '%s…' % s[0, @config['tweet_length'].to_i - 1]
24
+ end
25
+
26
+ tm
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,3 @@
1
+ module MarvelExplorer
2
+ VERSION = '0.2.2'
3
+ end
@@ -0,0 +1,76 @@
1
+ module MarvelExplorer
2
+ class Explorer
3
+ def yamlise_characters
4
+ [
5
+ 'start',
6
+ 'end'
7
+ ].each do |c|
8
+ h = {
9
+ 'name' => eval("#{c}_character[:name]"),
10
+ 'description' => eval("#{c}_character[:description]"),
11
+ 'url' => eval("#{c}_character[:urls][1]['url']"),
12
+ 'image' => eval("#{c}_character[:thumbnail]")
13
+ }
14
+
15
+ write_yaml h, c
16
+ end
17
+ end
18
+
19
+ def yamlise_comic
20
+ h = {
21
+ 'date' => comic[:dates][0]['date'],
22
+ 'year' => Date.parse(comic[:dates][0]['date']).strftime('%Y'),
23
+ 'title' => comic[:title],
24
+ 'issue' => comic[:issueNumber],
25
+ 'series' => {
26
+ 'period' => series[:period],
27
+ 'name' => series[:name]
28
+ },
29
+ 'url' => comic[:urls][0]['url'],
30
+ 'image' => comic[:thumbnail]
31
+ }
32
+
33
+ write_yaml h, 'comic'
34
+ end
35
+
36
+ def write_yaml h, path
37
+ FileUtils.mkdir_p '%s/_data/' % @config['jekyll_dir']
38
+ y = File.open '%s/_data/%s.yml' % [
39
+ @config['jekyll_dir'],
40
+ path
41
+ ], 'w'
42
+ y.write h.to_yaml
43
+ y.close
44
+ end
45
+
46
+ def yamlise
47
+ FileUtils.mkdir_p '%s/_data' % @config['jekyll_dir']
48
+ %w{ comic characters }.each do |item|
49
+ eval "yamlise_#{item}"
50
+ end
51
+ end
52
+
53
+ def yamls
54
+ @yamls ||= begin
55
+ yamls = {}
56
+ %w{ start end comic }.each do |thing|
57
+ begin
58
+ file = File.open '%s/_data/%s.yml' % [
59
+ @config['jekyll_dir'],
60
+ thing
61
+ ]
62
+ rescue Exception
63
+ update
64
+ file = File.open '%s/_data/%s.yml' % [
65
+ @config['jekyll_dir'],
66
+ thing
67
+ ]
68
+ end
69
+ y = YAML.load file
70
+ yamls[thing] = y
71
+ end
72
+ yamls
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,19 @@
1
+ require 'date'
2
+ require 'twitter'
3
+ require 'ultron'
4
+ require 'yaml'
5
+ require 'dotenv'
6
+ require 'fileutils'
7
+ require 'date'
8
+ require 'thor'
9
+ require 'git'
10
+
11
+ require 'marvel_explorer/helpers'
12
+ require 'marvel_explorer/characters'
13
+ require 'marvel_explorer/comic'
14
+ require 'marvel_explorer/explorer'
15
+ require 'marvel_explorer/twitter'
16
+ require 'marvel_explorer/rankings'
17
+ require 'marvel_explorer/git'
18
+ require 'marvel_explorer/yamlise'
19
+ require 'marvel_explorer/version'
@@ -0,0 +1,35 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'marvel_explorer/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'marvel_explorer'
8
+ spec.version = MarvelExplorer::VERSION
9
+ spec.authors = ['pikesley']
10
+ spec.email = ['sam@pikesley.org']
11
+ spec.summary = %q{Wander around the Marvel Comics data}
12
+ spec.description = %q{}
13
+ spec.homepage = 'http://sam.pikesley.org/projects/marvel-explorer/'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = 'marvel_explorer'
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'ultron', '~> 0.2'
22
+ spec.add_dependency 'twitter', '~> 5.13'
23
+ spec.add_dependency 'dotenv', '~> 0.11'
24
+ spec.add_dependency 'git', '~> 1.2'
25
+ spec.add_dependency 'thor', '~> 0.19m '
26
+
27
+ spec.add_development_dependency 'bundler', '~> 1.7'
28
+ spec.add_development_dependency 'rake', '~> 10.0'
29
+ spec.add_development_dependency 'rspec', '~> 3.1'
30
+ spec.add_development_dependency 'guard-rspec', '~> 4.4'
31
+ spec.add_development_dependency 'terminal-notifier-guard'
32
+ spec.add_development_dependency 'vcr', '~> 2.9'
33
+ spec.add_development_dependency 'webmock', '~> 1.20'
34
+ spec.add_development_dependency 'timecop', '~> 0.7'
35
+ end