kickstarter_curl 0.0.1

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: 71fa35a03ee6d26cb6ae6a30fdbb12e0163b080f
4
+ data.tar.gz: 226dfcd301480fd83a1c0c40b7dbc53a6d587d2c
5
+ SHA512:
6
+ metadata.gz: d7f445e45e1b9cc650d3bb0e2759e4fedd4b4c209ca029efaa2f317a8f7ea7cfbc839fddfc729a735a23c868fb04f5a183492b85a11889a9f13063cf08a7cec8
7
+ data.tar.gz: b8c08e3975b827278905dc2819b06da2965efc126258e16d5a9e8f48b64b5273a47f6432341942ba8fb26c455aab171faa11591cb8ffac527b90afde78032569
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.idea/.name ADDED
@@ -0,0 +1 @@
1
+ kickstarter_curl
@@ -0,0 +1,25 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="CompilerConfiguration">
4
+ <option name="DEFAULT_COMPILER" value="Javac" />
5
+ <resourceExtensions />
6
+ <wildcardResourcePatterns>
7
+ <entry name="?*.properties" />
8
+ <entry name="?*.xml" />
9
+ <entry name="?*.gif" />
10
+ <entry name="?*.png" />
11
+ <entry name="?*.jpeg" />
12
+ <entry name="?*.jpg" />
13
+ <entry name="?*.html" />
14
+ <entry name="?*.dtd" />
15
+ <entry name="?*.tld" />
16
+ <entry name="?*.ftl" />
17
+ </wildcardResourcePatterns>
18
+ <annotationProcessing>
19
+ <profile default="true" name="Default" enabled="false">
20
+ <processorPath useClasspath="true" />
21
+ </profile>
22
+ </annotationProcessing>
23
+ </component>
24
+ </project>
25
+
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
4
+ </project>
5
+
data/.idea/misc.xml ADDED
@@ -0,0 +1,78 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="CopyrightManager" default="">
4
+ <module2copyright />
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true">
7
+ <output url="file://$PROJECT_DIR$/out" />
8
+ </component>
9
+ <component name="SvnConfiguration" maxAnnotateRevisions="500" myUseAcceleration="nothing" myAutoUpdateAfterCommit="false" cleanupOnStartRun="false">
10
+ <option name="USER" value="" />
11
+ <option name="PASSWORD" value="" />
12
+ <option name="mySSHConnectionTimeout" value="30000" />
13
+ <option name="mySSHReadTimeout" value="30000" />
14
+ <option name="LAST_MERGED_REVISION" />
15
+ <option name="MERGE_DRY_RUN" value="false" />
16
+ <option name="MERGE_DIFF_USE_ANCESTRY" value="true" />
17
+ <option name="UPDATE_LOCK_ON_DEMAND" value="false" />
18
+ <option name="IGNORE_SPACES_IN_MERGE" value="false" />
19
+ <option name="DETECT_NESTED_COPIES" value="true" />
20
+ <option name="CHECK_NESTED_FOR_QUICK_MERGE" value="false" />
21
+ <option name="IGNORE_SPACES_IN_ANNOTATE" value="true" />
22
+ <option name="SHOW_MERGE_SOURCES_IN_ANNOTATE" value="true" />
23
+ <option name="FORCE_UPDATE" value="false" />
24
+ <option name="IGNORE_EXTERNALS" value="false" />
25
+ <myIsUseDefaultProxy>false</myIsUseDefaultProxy>
26
+ </component>
27
+ <component name="VssConfiguration">
28
+ <option name="CLIENT_PATH" value="" />
29
+ <option name="SRCSAFEINI_PATH" value="" />
30
+ <option name="USER_NAME" value="" />
31
+ <option name="PWD" value="" />
32
+ <CheckoutOptions>
33
+ <option name="COMMENT" value="" />
34
+ <option name="DO_NOT_GET_LATEST_VERSION" value="false" />
35
+ <option name="REPLACE_WRITABLE" value="false" />
36
+ <option name="RECURSIVE" value="false" />
37
+ </CheckoutOptions>
38
+ <CheckinOptions>
39
+ <option name="COMMENT" value="" />
40
+ <option name="KEEP_CHECKED_OUT" value="false" />
41
+ <option name="RECURSIVE" value="false" />
42
+ </CheckinOptions>
43
+ <AddOptions>
44
+ <option name="STORE_ONLY_LATEST_VERSION" value="false" />
45
+ <option name="CHECK_OUT_IMMEDIATELY" value="false" />
46
+ </AddOptions>
47
+ <UndocheckoutOptions>
48
+ <option name="MAKE_WRITABLE" value="false" />
49
+ <option name="REPLACE_LOCAL_COPY" value="2" />
50
+ <option name="RECURSIVE" value="false" />
51
+ </UndocheckoutOptions>
52
+ <GetOptions>
53
+ <option name="REPLACE_WRITABLE" value="0" />
54
+ <option name="MAKE_WRITABLE" value="false" />
55
+ <option name="ANSWER_NEGATIVELY" value="false" />
56
+ <option name="ANSWER_POSITIVELY" value="false" />
57
+ <option name="RECURSIVE" value="false" />
58
+ <option name="VERSION" />
59
+ </GetOptions>
60
+ </component>
61
+ <component name="masterDetails">
62
+ <states>
63
+ <state key="ProjectJDKs.UI">
64
+ <settings>
65
+ <last-edited>1.7</last-edited>
66
+ <splitter-proportions>
67
+ <option name="proportions">
68
+ <list>
69
+ <option value="0.20000002" />
70
+ </list>
71
+ </option>
72
+ </splitter-proportions>
73
+ </settings>
74
+ </state>
75
+ </states>
76
+ </component>
77
+ </project>
78
+
data/.idea/modules.xml ADDED
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/kickstarter_curl.iml" filepath="$PROJECT_DIR$/kickstarter_curl.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
9
+
@@ -0,0 +1,5 @@
1
+ <component name="DependencyValidationManager">
2
+ <state>
3
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
4
+ </state>
5
+ </component>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
7
+
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # Version 0.0.1
2
+
3
+ 2014-01-31
4
+
5
+ ### Added
6
+
7
+ * Initial working version!
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in kickstarter_curl.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Eric Webb
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,44 @@
1
+ # KickstarterCurl
2
+
3
+ A simple command line tool that collects metadata (ie: number of backers, amount pledged) from a Kickstarter project page.
4
+
5
+ ``` bash
6
+ $ kickstarter-curl metadata --url https://www.kickstarter.com/projects/1275337514/kegbot-internet-beer-kegerator
7
+
8
+ # Returns
9
+ {"backers":28,"pledged":2759,"queried_at":"2014-01-31 12:12:02 -0800", ...}
10
+ ```
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ gem 'kickstarter_curl'
17
+
18
+ And then execute:
19
+
20
+ $ bundle
21
+
22
+ Or install it yourself as:
23
+
24
+ $ gem install kickstarter_curl
25
+
26
+ ## Usage
27
+
28
+ `kickstarter-curl` is a simple command line tool that spits out JSON, and optionally updates a CSV file.
29
+
30
+ ``` bash
31
+ $ kickstarter-curl help metadata
32
+ Usage:
33
+ kickstarter-curl metadata --url=URL
34
+
35
+ Options:
36
+ --url=URL # URL of the Kickstarter project
37
+ [--csv-file=CSV_FILE] # File to save metadata to as CSV
38
+
39
+ Fetches metadata related the specified Kickstarter project
40
+ ```
41
+
42
+ ## Version History
43
+
44
+ See CHANGELOG.md
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'kickstarter_curl/cli'
4
+
5
+ KickstarterCurl::Cli.start(ARGV)
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'kickstarter_curl/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "kickstarter_curl"
8
+ spec.version = KickstarterCurl::VERSION
9
+ spec.authors = ["Eric Webb"]
10
+ spec.email = ["opensource@collectivegenius.net"]
11
+ spec.description = "A simple command line tool that collects metadata from a Kickstarter project page."
12
+ spec.summary = "A simple command line tool that collects metadata from a Kickstarter project page."
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+
24
+ spec.add_runtime_dependency "nokogiri", "~> 1.6"
25
+ spec.add_runtime_dependency "thor", "0.18.1"
26
+ spec.add_runtime_dependency "hashie", "~> 2.0"
27
+ end
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
4
+ <exclude-output />
5
+ <content url="file://$MODULE_DIR$" />
6
+ <orderEntry type="jdk" jdkName="rbenv: 2.0.0-p353" jdkType="RUBY_SDK" />
7
+ <orderEntry type="sourceFolder" forTests="false" />
8
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v1.3.5, rbenv: 2.0.0-p353) [gem]" level="application" />
9
+ <orderEntry type="library" scope="PROVIDED" name="hashie (v2.0.5, rbenv: 2.0.0-p353) [gem]" level="application" />
10
+ <orderEntry type="library" scope="PROVIDED" name="mini_portile (v0.5.2, rbenv: 2.0.0-p353) [gem]" level="application" />
11
+ <orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.6.1, rbenv: 2.0.0-p353) [gem]" level="application" />
12
+ <orderEntry type="library" scope="PROVIDED" name="rake (v10.1.1, rbenv: 2.0.0-p353) [gem]" level="application" />
13
+ <orderEntry type="library" scope="PROVIDED" name="thor (v0.18.1, rbenv: 2.0.0-p353) [gem]" level="application" />
14
+ </component>
15
+ </module>
16
+
@@ -0,0 +1,33 @@
1
+ require 'open-uri'
2
+ require 'nokogiri'
3
+ require 'hashie'
4
+ require 'thor'
5
+ require 'json'
6
+
7
+ module KickstarterCurl
8
+ class Cli < Thor
9
+ desc 'metadata', 'Fetches metadata (number of backers, amount pledged, etc.) related the specified Kickstarter project'
10
+ option :url, :required => true, :desc => 'URL of the Kickstarter project'
11
+ option :csv_file, :desc => "File to save metadata to as CSV"
12
+ def metadata()
13
+ metadata = Hashie::Mash.new
14
+ metadata.queried_at = Time.now
15
+
16
+ url = options[:url]
17
+ doc = Nokogiri::HTML(open(url))
18
+
19
+ metadata.url = url
20
+ metadata.backers = doc.css('*[data-backers-count]').attr('data-backers-count').value.to_i
21
+ metadata.pledged = doc.css('*[data-pledged]').attr('data-pledged').value.to_i
22
+
23
+ puts metadata.to_hash.to_json
24
+
25
+ # optionally save CSV
26
+ if csv_output = options[:csv_file]
27
+ File.open(csv_output, 'a') do |f|
28
+ f.puts [metadata.queried_at, metadata.backers, metadata.pledged, metadata.url].join(', ')
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,3 @@
1
+ module KickstarterCurl
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,5 @@
1
+ require "kickstarter_curl/version"
2
+
3
+ module KickstarterCurl
4
+ # Your code goes here...
5
+ end
metadata ADDED
@@ -0,0 +1,136 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kickstarter_curl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Eric Webb
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
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: '1.6'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: thor
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.18.1
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 0.18.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: hashie
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '2.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '2.0'
83
+ description: A simple command line tool that collects metadata from a Kickstarter
84
+ project page.
85
+ email:
86
+ - opensource@collectivegenius.net
87
+ executables:
88
+ - kickstarter-curl
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - .gitignore
93
+ - .idea/.name
94
+ - .idea/compiler.xml
95
+ - .idea/encodings.xml
96
+ - .idea/misc.xml
97
+ - .idea/modules.xml
98
+ - .idea/scopes/scope_settings.xml
99
+ - .idea/vcs.xml
100
+ - CHANGELOG.md
101
+ - Gemfile
102
+ - LICENSE.txt
103
+ - README.md
104
+ - Rakefile
105
+ - bin/kickstarter-curl
106
+ - kickstarter_curl.gemspec
107
+ - kickstarter_curl.iml
108
+ - lib/kickstarter_curl.rb
109
+ - lib/kickstarter_curl/cli.rb
110
+ - lib/kickstarter_curl/version.rb
111
+ homepage: ''
112
+ licenses:
113
+ - MIT
114
+ metadata: {}
115
+ post_install_message:
116
+ rdoc_options: []
117
+ require_paths:
118
+ - lib
119
+ required_ruby_version: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - '>='
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ requirements: []
130
+ rubyforge_project:
131
+ rubygems_version: 2.0.14
132
+ signing_key:
133
+ specification_version: 4
134
+ summary: A simple command line tool that collects metadata from a Kickstarter project
135
+ page.
136
+ test_files: []