fcp_completed 0.0.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c33def1569b7f77e8554928f2379738af5beea0b
4
+ data.tar.gz: 8c5c390222d419acb2190c9d1b48235773a80a8d
5
+ SHA512:
6
+ metadata.gz: 70a2fa3ac87f4777efe98d96913e7ab8605a8b1e863fa6bdae8b9540fe305b79b0f17e61195db5e07fedf19ebf2031ca62f6bd7e1dcdae200d7f8545f966c075
7
+ data.tar.gz: fcfc0e9b5fafd8a55eb94611c8687ae9ee9fd8fa143a11f91a6bbbfb64b28db1eaea19a302ffd76efa18b6a940fbcd72ed2af48380258652e831bc4d4a15dde2
data/.gitignore ADDED
@@ -0,0 +1,36 @@
1
+ *.*~
2
+
3
+ *.gem
4
+ *.rbc
5
+ /.config
6
+ /coverage/
7
+ /InstalledFiles
8
+ /pkg/
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ ## Specific to RubyMotion:
14
+ .dat*
15
+ .repl_history
16
+ build/
17
+
18
+ ## Documentation cache and generated files:
19
+ /.yardoc/
20
+ /_yardoc/
21
+ /doc/
22
+ /rdoc/
23
+
24
+ ## Environment normalisation:
25
+ /.bundle/
26
+ /vendor/bundle
27
+ /lib/bundler/man/
28
+
29
+ # for a library or gem, you might want to ignore these files since the code is
30
+ # intended to run in multiple environments; otherwise, check them in:
31
+ Gemfile.lock
32
+ .ruby-version
33
+ .ruby-gemset
34
+
35
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
36
+ .rvmrc
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+ rvm:
3
+ - ruby-head
4
+ - 2.1.0
5
+ - 1.9.3
6
+ - jruby-head
7
+ - jruby-19mode
8
+ matrix:
9
+ allow_failures:
10
+ - rvm: jruby-head
11
+ branches:
12
+ only:
13
+ - master
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'nokogiri'
4
+ gem 'vcr'
5
+ gem 'webmock'
6
+ gem 'minitest'
7
+ gem 'minitest-rg'
8
+
9
+ group :test do
10
+ gem 'rake'
11
+ end
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Sadayuki Tozuka
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 all
13
+ 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 THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # Scrape freeCodeCamp [![Build Status](https://travis-ci.org/stozuka/freeCodeCamp-scraper.svg?branch=master)](https://travis-ci.org/stozuka/freeCodeCamp-scraper)
2
+ Command line application to get completed course names and dates on freeCodeCamp.com.
3
+
4
+ ## Usage
5
+ Run the following command:
6
+
7
+ ```
8
+ bundle install
9
+ ```
10
+
11
+ ### Command line usage
12
+
13
+ ```
14
+ ./bin/fcp_completed your_name
15
+ ```
16
+
17
+ 'your_name' can be checked on freeCodeCamp's site.
18
+
19
+ When you click your photo on upper right of the freeCodeCamp's top page, url will be changed to like, 'freecodecamp.com/.....'.
20
+
21
+ '.....' is your_name to be input to this command line application.
22
+
23
+ ## License
24
+ Distributed under the [MIT License](LICENSE).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require 'rake/testtask'
2
+
3
+ task :default => [:spec]
4
+
5
+ desc 'Run specs'
6
+ Rake::TestTask.new(name=:spec) do |t|
7
+ t.pattern = 'spec/*_spec.rb'
8
+ end
data/bin/fcp_completed ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../lib/fcp_completed'
3
+
4
+ name = ARGV[0]
5
+ free_code_camp = FCPCompleted.new(name)
6
+ free_code_camp.fcp_print
data/fcp.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
2
+ require './lib/fcp_modules/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'fcp_completed'
6
+ s.version = FCPVersion::VERSION
7
+ s.date = FCPVersion::DATE
8
+ s.executables << 'fcp_completed'
9
+ s.summary = 'Get completed course names and dates on freeCodeCamp'
10
+ s.description = 'Get completed course names and dates on freeCodeCamp'
11
+ s.authors = %w(stozuka)
12
+ s.email = %w(stozuka@gmail.com)
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_files = `git ls-files spec/*`.split("\n")
15
+ s.homepage = 'https://github.com/stozuka/freeCodeCamp-scraper'
16
+ s.license = 'MIT'
17
+
18
+ s.add_development_dependency 'minitest'
19
+ s.add_development_dependency 'minitest-rg'
20
+ s.add_development_dependency 'vcr'
21
+ s.add_development_dependency 'webmock'
22
+ s.add_runtime_dependency 'nokogiri'
23
+ end
@@ -0,0 +1,15 @@
1
+ require_relative 'fcp_modules/fcp_module'
2
+
3
+ class FcpCompleted
4
+ include FCPCompleted
5
+
6
+ def initialize(name)
7
+ @data = get_data(name)
8
+ end
9
+
10
+ def fcp_print
11
+ @data.each do |course, date|
12
+ puts "#{course}, #{date}"
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,28 @@
1
+ require 'open-uri'
2
+ require 'nokogiri'
3
+
4
+ module FCPCompleted
5
+ @course_date = []
6
+ URL ||= "http://freecodecamp.com/"
7
+ COURSE_XPATH ||= "//td[@class='col-xs-4']/text()"
8
+ DATE_XPATH ||= "//td[@class='col-xs-2']/text()"
9
+
10
+ # crawl the site, and get the name of completed courses and its date
11
+ def get_data(name)
12
+ doc = Nokogiri::HTML(open(URL + name))
13
+
14
+ course_completed = doc.xpath(COURSE_XPATH).to_a
15
+ date_completed = doc.xpath(DATE_XPATH).to_a
16
+
17
+ @course_date = course_completed.zip(date_completed)
18
+ end
19
+
20
+ # output the result into a file
21
+ def file_output
22
+ File.open('output_spec.txt', 'w') do |file|
23
+ @course_date.each do |course, date|
24
+ file.write("#{course}, #{date}\n")
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,5 @@
1
+ # Gem info
2
+ module FCPVersion
3
+ VERSION = '0.0.0'
4
+ DATE = '2015-10-27'
5
+ end
data/spec/fcp_spec.rb ADDED
@@ -0,0 +1,25 @@
1
+ require 'minitest/autorun'
2
+ require 'minitest/rg'
3
+ require 'vcr'
4
+ require 'webmock/minitest'
5
+ require_relative '../lib/fcp_completed'
6
+
7
+ VCR.configure do |config|
8
+ config.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
9
+ config.hook_into :webmock
10
+ end
11
+
12
+ VCR.use_cassette('completed_information') do
13
+ describe 'test' do
14
+
15
+ obj = FcpCompleted.new('stozuka')
16
+ obj.file_output
17
+
18
+ it 'has same course names and dates' do
19
+ `diff output_spec.txt ./spec/fixtures/output.txt`.must_equal ''
20
+ end
21
+
22
+ `rm output_spec.txt`
23
+
24
+ end
25
+ end
@@ -0,0 +1,110 @@
1
+ Waypoint: Learn how Free Code Camp Works, Oct 15, 2015
2
+ Waypoint: Create a GitHub Account and Join our Chat Rooms, Oct 15, 2015
3
+ Waypoint: Configure your Code Portfolio, Oct 15, 2015
4
+ Waypoint: Join a Campsite in Your City, Oct 15, 2015
5
+ Waypoint: Learn What to Do If You Get Stuck, Oct 15, 2015
6
+ Waypoint: Say Hello to HTML Elements, Oct 15, 2015
7
+ Waypoint: Headline with the h2 Element, Oct 15, 2015
8
+ Waypoint: Inform with the Paragraph Element, Oct 15, 2015
9
+ Waypoint: Uncomment HTML, Oct 15, 2015
10
+ Waypoint: Comment out HTML, Oct 15, 2015
11
+ Waypoint: Fill in the Blank with Placeholder Text, Oct 15, 2015
12
+ Waypoint: Delete HTML Elements, Oct 15, 2015
13
+ Waypoint: Change the Color of Text, Oct 15, 2015
14
+ Waypoint: Use CSS Selectors to Style Elements, Oct 15, 2015
15
+ Waypoint: Use a CSS Class to Style an Element, Oct 15, 2015
16
+ Waypoint: Style Multiple Elements with a CSS Class, Oct 15, 2015
17
+ Waypoint: Change the Font Size of an Element, Oct 18, 2015
18
+ Waypoint: Set the Font Family of an Element, Oct 18, 2015
19
+ Waypoint: Import a Google Font, Oct 18, 2015
20
+ Waypoint: Specify How Fonts Should Degrade, Oct 18, 2015
21
+ Waypoint: Add Images to your Website, Oct 18, 2015
22
+ Waypoint: Size your Images, Oct 18, 2015
23
+ Waypoint: Add Borders Around your Elements, Oct 18, 2015
24
+ Waypoint: Add Rounded Corners with a Border Radius, Oct 18, 2015
25
+ Waypoint: Make Circular Images with a Border Radius, Oct 18, 2015
26
+ Waypoint: Link to External Pages with Anchor Elements, Oct 18, 2015
27
+ Waypoint: Nest an Anchor Element within a Paragraph, Oct 18, 2015
28
+ Waypoint: Make Dead Links using the Hash Symbol, Oct 18, 2015
29
+ Waypoint: Turn an Image into a Link, Oct 18, 2015
30
+ Waypoint: Add Alt Text to an Image for Accessibility, Oct 18, 2015
31
+ Waypoint: Create a Bulleted Unordered List, Oct 18, 2015
32
+ Waypoint: Create an Ordered List, Oct 18, 2015
33
+ Waypoint: Create a Text Field, Oct 18, 2015
34
+ Waypoint: Add Placeholder Text to a Text Field, Oct 18, 2015
35
+ Waypoint: Create a Form Element, Oct 19, 2015
36
+ Waypoint: Add a Submit Button to a Form, Oct 19, 2015
37
+ Waypoint: Use HTML5 to Require a Field, Oct 19, 2015
38
+ Waypoint: Create a Set of Radio Buttons, Oct 20, 2015
39
+ Waypoint: Create a Set of Checkboxes, Oct 20, 2015
40
+ Waypoint: Check Radio Buttons and Checkboxes by Default, Oct 20, 2015
41
+ Waypoint: Nest Many Elements within a Single Div Element, Oct 20, 2015
42
+ Waypoint: Give a Background Color to a Div Element, Oct 20, 2015
43
+ Waypoint: Set the ID of an Element, Oct 21, 2015
44
+ Waypoint: Use an ID Attribute to Style an Element, Oct 21, 2015
45
+ Waypoint: Adjusting the Padding of an Element, Oct 21, 2015
46
+ Waypoint: Adjust the Margin of an Element, Oct 21, 2015
47
+ Waypoint: Add a Negative Margin to an Element, Oct 21, 2015
48
+ Waypoint: Add Different Padding to Each Side of an Element, Oct 21, 2015
49
+ Waypoint: Add Different Margins to Each Side of an Element, Oct 21, 2015
50
+ Waypoint: Use Clockwise Notation to Specify the Padding of an Element, Oct 21, 2015
51
+ Waypoint: Use Clockwise Notation to Specify the Margin of an Element, Oct 21, 2015
52
+ Waypoint: Style the HTML Body Element, Oct 21, 2015
53
+ Waypoint: Inherit Styles from the Body Element, Oct 21, 2015
54
+ Waypoint: Prioritize One Style Over Another, Oct 21, 2015
55
+ Waypoint: Override Styles in Subsequent CSS, Oct 21, 2015
56
+ Waypoint: Override Class Declarations by Styling ID Attributes, Oct 21, 2015
57
+ Waypoint: Override Class Declarations with Inline Styles, Oct 21, 2015
58
+ Waypoint: Override All Other Styles by using Important, Oct 21, 2015
59
+ Waypoint: Use Hex Code for Specific Colors, Oct 22, 2015
60
+ Waypoint: Use Hex Code to Color Elements White, Oct 22, 2015
61
+ Waypoint: Use Hex Code to Color Elements Red, Oct 22, 2015
62
+ Waypoint: Use Hex Code to Color Elements Green, Oct 22, 2015
63
+ Waypoint: Use Hex Code to Color Elements Blue, Oct 22, 2015
64
+ Waypoint: Use Hex Code to Mix Colors, Oct 22, 2015
65
+ Waypoint: Use Hex Code to Color Elements Gray, Oct 22, 2015
66
+ Waypoint: Use Hex Code for Specific Shades of Gray, Oct 22, 2015
67
+ Waypoint: Use Abbreviated Hex Code, Oct 22, 2015
68
+ Waypoint: Use RGB values to Color Elements, Oct 22, 2015
69
+ Waypoint: Use RGB to Color Elements White, Oct 22, 2015
70
+ Waypoint: Use RGB to Color Elements Red, Oct 22, 2015
71
+ Waypoint: Use RGB to Color Elements Green, Oct 22, 2015
72
+ Waypoint: Use RGB to Color Elements Blue, Oct 22, 2015
73
+ Waypoint: Use RGB to Mix Colors, Oct 22, 2015
74
+ Waypoint: Use RGB to Color Elements Gray, Oct 22, 2015
75
+ Waypoint: Use Responsive Design with Bootstrap Fluid Containers, Oct 22, 2015
76
+ Waypoint: Make Images Mobile Responsive, Oct 22, 2015
77
+ Waypoint: Center Text with Bootstrap, Oct 22, 2015
78
+ Waypoint: Create a Bootstrap Button, Oct 22, 2015
79
+ Waypoint: Create a Block Element Bootstrap Button, Oct 22, 2015
80
+ Waypoint: Taste the Bootstrap Button Color Rainbow, Oct 22, 2015
81
+ Waypoint: Call out Optional Actions with Button Info, Oct 22, 2015
82
+ Waypoint: Warn your Users of a Dangerous Action, Oct 22, 2015
83
+ Waypoint: Use the Bootstrap Grid to Put Elements Side By Side, Oct 24, 2015
84
+ Waypoint: Ditch Custom CSS for Bootstrap, Oct 24, 2015
85
+ Waypoint: Use Spans for Inline Elements, Oct 24, 2015
86
+ Waypoint: Create a Custom Heading, Oct 24, 2015
87
+ Waypoint: Add Font Awesome Icons to our Buttons, Oct 24, 2015
88
+ Waypoint: Add Font Awesome Icons to all of our Buttons, Oct 24, 2015
89
+ Waypoint: Responsively Style Radio Buttons, Oct 24, 2015
90
+ Waypoint: Responsively Style Checkboxes, Oct 25, 2015
91
+ Waypoint: Style Text Inputs as Form Controls, Oct 25, 2015
92
+ Waypoint: Line up Form Elements Responsively with Bootstrap, Oct 25, 2015
93
+ Waypoint: Create a Bootstrap Headline, Oct 26, 2015
94
+ Waypoint: House our page within a Bootstrap Container Fluid Div, Oct 26, 2015
95
+ Waypoint: Create a Bootstrap Row, Oct 26, 2015
96
+ Waypoint: Split your Bootstrap Row, Oct 26, 2015
97
+ Waypoint: Create Bootstrap Wells, Oct 26, 2015
98
+ Waypoint: Add Elements within your Bootstrap Wells, Oct 26, 2015
99
+ Waypoint: Apply the Default Bootstrap Button Style, Oct 26, 2015
100
+ Waypoint: Create a Class to Target with jQuery Selectors, Oct 26, 2015
101
+ Waypoint: Add ID Attributes to Bootstrap Elements, Oct 26, 2015
102
+ Waypoint: Label Bootstrap Wells, Oct 26, 2015
103
+ Waypoint: Give Each Element a Unique ID, Oct 26, 2015
104
+ Waypoint: Label Bootstrap Buttons, Oct 26, 2015
105
+ Waypoint: Use Comments to Clarify Code, Oct 26, 2015
106
+ Waypoint: Browse Camper News, Oct 26, 2015
107
+ Waypoint: Reference our Wiki, Oct 26, 2015
108
+ Waypoint: Join our LinkedIn Alumni Network, Oct 26, 2015
109
+ Waypoint: Commit to a Goal and a Nonprofit, Oct 26, 2015
110
+ Waypoint: Learn how Script Tags and Document Ready Work, Oct 26, 2015