rubyscholar 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md ADDED
@@ -0,0 +1,6 @@
1
+ ## Changelog
2
+
3
+ version 0.0.4
4
+
5
+ * Support for custom config files and output file in commands.
6
+ * Command for creating a config.yml file using `rubyscholar init`.
data/README.md CHANGED
@@ -13,6 +13,13 @@ Some features:
13
13
 
14
14
  # How to use:
15
15
 
16
+ ### As a Ruby Gem:
17
+ 1. Install the gem using: `[sudo] gem install rubyscholar`
18
+ 2. Create and configure a `config.yml` file.
19
+ 3. Run as `rubyscholar scrape`.
20
+ 4. A `scholar.html` file is created.
21
+ 5. Done!
22
+
16
23
  ### As a ruby script:
17
24
  1. Configure "config.yml"
18
25
  If you want DOI retreival to work (including Altmetrics), you need to be
data/bin/rubyscholar CHANGED
@@ -22,10 +22,9 @@ command :scrape do |c|
22
22
  c.option '--out [Output File]', 'File to output the scrapes to'
23
23
 
24
24
  c.action do |args, options|
25
- options.default \
26
- :config => 'config.yml',
27
- :out => 'scholar.html'
28
- config = YAML.load_file('config.yml')
25
+ options.default :config => "config.yml", :out => "scholar.html"
26
+ configFile= "#{options.config}"
27
+ config = YAML.load_file(configFile)
29
28
  parsed = Rubyscholar::Parser.new(config["url"],
30
29
  config["email"])
31
30
  formatter = Rubyscholar::Formatter.new(parsed,
@@ -38,10 +37,40 @@ command :scrape do |c|
38
37
  config["italicize"].each do |term|
39
38
  html.gsub!( term , '<em>' + term + '</em>')
40
39
  end
41
-
42
- f= File.open('scholar.html','w')
40
+ outFile="#{options.out}"
41
+ f= File.open(outFile,'w')
43
42
  f.write html
44
43
  f.close()
45
44
  end
46
45
  end
47
46
 
47
+ command :init do |c|
48
+ c.syntax = 'rubyscholar init'
49
+ c.description = 'Creates a sample config.yml file for Scraping.'
50
+ c.action do |args, options|
51
+ say '# Intialising a configuration file for Rubyscholar.'
52
+ if File.exist?("config.yml")
53
+ abort("Initialisation aborted!") if ask("config.yml already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
54
+ end
55
+ puts "# Creating config.yml."
56
+ open("config.yml", 'w') do |page|
57
+ page.puts "# Google Scholar page (you can choose how you sort it)"
58
+ page.puts "url: "
59
+ page.puts "\n\n# Name to highlight (withing \" and \")"
60
+ page.puts "highlight: "
61
+ page.puts "\n\n# Need an Email address that has been registered with CrossRef to obtain DOIs using their OpenURL service. "
62
+ page.puts "# e.g. the following should provide an XML file: "
63
+ page.puts "# http://www.crossref.org/openurl?redirect=false&pid=YOUR@EMAIL>COM&aulast=Wurm&atitle=Behavioral%20Genomics:%20A,%20Bee,%20C,%20G,%20T"
64
+ page.puts "email: your@email.com"
65
+ page.puts "\n\n# Show \"[Cited Nx]\" if N > the following number"
66
+ page.puts "minCitations: 5 "
67
+ page.puts "\n\n# Words to italicize (emphasize). These will have \"<em>\" around them. "
68
+ page.puts "italicize: "
69
+ page.puts "\n\n# DOIs of articles for which we should show altmetric.org badges. "
70
+ page.puts "altmetricDOIs: "
71
+ page.puts "\n\n# Article titles for which we have urls to PDFs in \"name\" : \"url\" format"
72
+ page.puts "pdfs:"
73
+ end
74
+ end
75
+ end
76
+
@@ -1,3 +1,3 @@
1
1
  module Rubyscholar
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyscholar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -55,13 +55,13 @@ extensions: []
55
55
  extra_rdoc_files: []
56
56
  files:
57
57
  - .gitignore
58
+ - CHANGELOG.md
58
59
  - Gemfile
59
60
  - LICENSE.txt
60
61
  - README.md
61
62
  - Rakefile
62
63
  - bin/rubyscholar
63
64
  - bin/scrape.rb
64
- - config.yml
65
65
  - lib/rubyscholar.rb
66
66
  - lib/rubyscholar/version.rb
67
67
  - rubyscholar.gemspec
data/config.yml DELETED
@@ -1,49 +0,0 @@
1
- # Google Scholar page (you can choose how you sort it)
2
- url: "http://scholar.google.com/citations?sortby=pubdate&hl=en&user=k6y0EGsAAAAJ&view_op=list_works"
3
-
4
- # Name to highlight
5
- highlight: "Y Wurm"
6
-
7
-
8
- # Need an Email address that has been registered with CrossRef to obtain DOIs
9
- # using their OpenURL service.
10
- # e.g. the following should provide an XML file:
11
- # http://www.crossref.org/openurl?redirect=false&pid=YOUR@EMAIL>COM&aulast=Wurm&atitle=Behavioral%20Genomics:%20A,%20Bee,%20C,%20G,%20T
12
- email: your@email.com
13
-
14
-
15
- # Show "[Cited Nx]" if N > the following number
16
- minCitations: 5
17
-
18
- # Words to italicize (emphasize). These will have "<em>" around them.
19
- italicize:
20
- - Solenopsis invicta
21
- - Acromyrmex echinatior
22
- - de novo
23
-
24
- # DOIs of articles for which we should show altmetric.org badges.
25
- altmetricDOIs:
26
- - "10.1038/nature11832"
27
- - "10.1101/gr.121392.111"
28
- - "10.1073/pnas.1009690108"
29
- - "10.1073/pnas.1104825108"
30
-
31
- # Article titles for which we have urls to PDFs
32
- pdfs:
33
- "A Y-like social chromosome causes alternative colony organization in fire ants" : "/publications/wangwurm2013socialChromosome.pdf"
34
- "Duplication and concerted evolution in a master sex determiner under balancing selection" : "/publications/procb2013.pdf"
35
- "Comparative genomics of chemosensory protein genes reveals rapid evolution and positive selection in ant-specific duplicates" : "/publications/hdy2012122a.pdf"
36
- "The Molecular Clockwork of the Fire Ant Solenopsis invicta" : "/publications/ingram2012-fireAntClockGenes.pdf"
37
- "Epigenetics: The Making of Ant Castes" : "/publications/2012CurrBiolAntepigenetics.pdf"
38
- "Visualization and quality assessment of de novo genome assemblies" : "/publications/Bioinformatics-2011-Riba-Grognuz-3425-6"
39
- "The genomic impact of 100 million years of social evolution in seven ant species" : "/publications/TiG2011.pdf"
40
- "Relaxed selection is a precursor to the evolution of phenotypic plasticity" : "/publications/hunt2011phenotypicPlasticity.pdf"
41
- "The genome of the leaf-cutting ant Acromyrmex echinatior suggests key adaptations to advanced social life and fungus farming" : "/publications/nygaard2011-acromyrmex-genome.pdf"
42
- "Behind the Scenes of an Ant Genome Project" : "/publications/wurm2011antGenomeBehindTheScenes.pdf"
43
- "The genome of the fire ant Solenopsis invicta" : "/publications/wurm2011fireAntGenome.pdf"
44
- "Odorant Binding Proteins of the Red Imported Fire Ant, Solenopsis invicta: An Example of the Problems Facing the Analysis of Widely Divergent Proteins" : "/publications/gotzek2011obps.pdf"
45
- "Parasitoid Wasps: From Natural History to Genomic Studies" : "/publications/wurm2010wasps.pdf"
46
- "Changes in reproductive roles are associated with changes in gene expression in fire ant queens" : "/publications/wurm2010fireAntQueenDealationExpression.pdf"
47
- "Fourmidable: a database for ant genomics" : "/publications/wurm2009antDatabase.pdf"
48
- "Behavioral Genomics: A, Bee, C, G, T" : "/publications/wurm2007bees.pdf"
49
- "An annotated cDNA library and microarray for large-scale gene-expression studies in the ant Solenopsis invicta" : "/publications/wang2007fireAntMicroarrays.pdf"