danger-the_coding_love 0.0.1

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
+ SHA1:
3
+ metadata.gz: 38f3588fb17d1330d4922e4bea6accefd10f1e60
4
+ data.tar.gz: 2749fe5ad1f61e57e97194b599d592b6b20f5283
5
+ SHA512:
6
+ metadata.gz: 51d92394e60fb3fc721a3808680bdf09e6d13476ac10d7810816ba02b416bd3fda88f996746a56192160dee7e52cf7ad70c9b9c697031c262b191f6dd220e2cd
7
+ data.tar.gz: 41fd7bbb3ca05d0a7ec507d750bf577989d320017bcf492d63f3b92d40b8a75c2c9c290a8442c367a750ca3cc40fc7eb8373fe100691a1b6251056f2523e6e0a
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .DS_Store
2
+ pkg
3
+ .idea/
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ cache:
3
+ directories:
4
+ - bundle
5
+
6
+ rvm:
7
+ - 2.0
8
+ - 2.1.3
9
+ - 2.3.1
10
+
11
+ script:
12
+ - bundle exec rake spec
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in danger-the_coding_love.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,119 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ danger-the_coding_love (0.0.1)
5
+ danger (~> 2.0)
6
+ nokogiri
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.4.0)
12
+ claide (1.0.0)
13
+ claide-plugins (0.9.1)
14
+ cork
15
+ nap
16
+ open4 (~> 1.3)
17
+ coderay (1.1.1)
18
+ colored (1.2)
19
+ cork (0.1.0)
20
+ colored (~> 1.2)
21
+ danger (2.1.1)
22
+ claide (~> 1.0)
23
+ claide-plugins (> 0.9.0)
24
+ colored (~> 1.2)
25
+ cork (~> 0.1)
26
+ faraday (~> 0)
27
+ faraday-http-cache (~> 1.0)
28
+ git (~> 1)
29
+ kramdown (~> 1.5)
30
+ octokit (~> 4.2)
31
+ terminal-table (~> 1)
32
+ diff-lcs (1.2.5)
33
+ faraday (0.9.2)
34
+ multipart-post (>= 1.2, < 3)
35
+ faraday-http-cache (1.3.0)
36
+ faraday (~> 0.8)
37
+ ffi (1.9.14)
38
+ formatador (0.2.5)
39
+ git (1.3.0)
40
+ guard (2.14.0)
41
+ formatador (>= 0.2.4)
42
+ listen (>= 2.7, < 4.0)
43
+ lumberjack (~> 1.0)
44
+ nenv (~> 0.1)
45
+ notiffany (~> 0.0)
46
+ pry (>= 0.9.12)
47
+ shellany (~> 0.0)
48
+ thor (>= 0.18.1)
49
+ guard-compat (1.2.1)
50
+ guard-rspec (4.7.3)
51
+ guard (~> 2.1)
52
+ guard-compat (~> 1.1)
53
+ rspec (>= 2.99.0, < 4.0)
54
+ kramdown (1.11.1)
55
+ listen (3.0.7)
56
+ rb-fsevent (>= 0.9.3)
57
+ rb-inotify (>= 0.9.7)
58
+ lumberjack (1.0.10)
59
+ method_source (0.8.2)
60
+ mini_portile2 (2.1.0)
61
+ multipart-post (2.0.0)
62
+ nap (1.1.0)
63
+ nenv (0.3.0)
64
+ nokogiri (1.6.8)
65
+ mini_portile2 (~> 2.1.0)
66
+ pkg-config (~> 1.1.7)
67
+ notiffany (0.1.1)
68
+ nenv (~> 0.1)
69
+ shellany (~> 0.0)
70
+ octokit (4.3.0)
71
+ sawyer (~> 0.7.0, >= 0.5.3)
72
+ open4 (1.3.4)
73
+ pkg-config (1.1.7)
74
+ pry (0.10.4)
75
+ coderay (~> 1.1.0)
76
+ method_source (~> 0.8.1)
77
+ slop (~> 3.4)
78
+ rake (10.5.0)
79
+ rb-fsevent (0.9.7)
80
+ rb-inotify (0.9.7)
81
+ ffi (>= 0.5.0)
82
+ rspec (3.5.0)
83
+ rspec-core (~> 3.5.0)
84
+ rspec-expectations (~> 3.5.0)
85
+ rspec-mocks (~> 3.5.0)
86
+ rspec-core (3.5.2)
87
+ rspec-support (~> 3.5.0)
88
+ rspec-expectations (3.5.0)
89
+ diff-lcs (>= 1.2.0, < 2.0)
90
+ rspec-support (~> 3.5.0)
91
+ rspec-mocks (3.5.0)
92
+ diff-lcs (>= 1.2.0, < 2.0)
93
+ rspec-support (~> 3.5.0)
94
+ rspec-support (3.5.0)
95
+ sawyer (0.7.0)
96
+ addressable (>= 2.3.5, < 2.5)
97
+ faraday (~> 0.8, < 0.10)
98
+ shellany (0.0.1)
99
+ slop (3.6.0)
100
+ terminal-table (1.6.0)
101
+ thor (0.19.1)
102
+ yard (0.9.5)
103
+
104
+ PLATFORMS
105
+ ruby
106
+
107
+ DEPENDENCIES
108
+ bundler (~> 1.3)
109
+ danger-the_coding_love!
110
+ guard (~> 2.14)
111
+ guard-rspec (~> 4.7)
112
+ listen (= 3.0.7)
113
+ pry
114
+ rake (~> 10.0)
115
+ rspec (~> 3.4)
116
+ yard (~> 0.8)
117
+
118
+ BUNDLED WITH
119
+ 1.12.5
data/Guardfile ADDED
@@ -0,0 +1,19 @@
1
+ # A guardfile for making Danger Plugins
2
+ # For more info see https://github.com/guard/guard#readme
3
+
4
+ # To run, use `bundle exec guard`.
5
+
6
+ guard :rspec, cmd: 'bundle exec rspec' do
7
+ require 'guard/rspec/dsl'
8
+ dsl = Guard::RSpec::Dsl.new(self)
9
+
10
+ # RSpec files
11
+ rspec = dsl.rspec
12
+ watch(rspec.spec_helper) { rspec.spec_dir }
13
+ watch(rspec.spec_support) { rspec.spec_dir }
14
+ watch(rspec.spec_files)
15
+
16
+ # Ruby files
17
+ ruby = dsl.ruby
18
+ dsl.watch_spec_files_for(ruby.lib_files)
19
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2016 Valerio Mazzeo
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,24 @@
1
+ # danger-the_coding_love
2
+
3
+ Prints markdown containing a random post from [thecodinglove.com](http://thecodinglove.com).
4
+
5
+ ## Installation
6
+
7
+ $ gem install danger-the_coding_love
8
+
9
+ ## Usage
10
+
11
+ Methods and attributes from this plugin are available in
12
+ your `Dangerfile` under the `the_coding_love` namespace.
13
+
14
+ ## How it looks
15
+
16
+ ![alt text](https://cloud.githubusercontent.com/assets/1882080/16772431/260ffddc-484c-11e6-9464-858afefaa512.png "the_coding_love")
17
+
18
+ ## Development
19
+
20
+ 1. Clone this repo
21
+ 2. Run `bundle install` to setup dependencies.
22
+ 3. Run `bundle exec rake spec` to run the tests.
23
+ 4. Use `bundle exec guard` to automatically have tests run as you make changes.
24
+ 5. Make your changes.
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:specs)
5
+
6
+ task default: :specs
7
+
8
+ task :spec do
9
+ Rake::Task['specs'].invoke
10
+ Rake::Task['spec_docs'].invoke
11
+ end
12
+
13
+ desc 'Ensure that the plugin passes `danger plugins lint`'
14
+ task :spec_docs do
15
+ sh 'bundle exec danger plugins lint'
16
+ end
@@ -0,0 +1,47 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'the_coding_love/gem_version.rb'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'danger-the_coding_love'
8
+ spec.version = TheCodingLove::VERSION
9
+ spec.authors = ['Valerio Mazzeo']
10
+ spec.email = ['valerio.mazzeo@gmail.com']
11
+ spec.description = %q{Prints markdown containing a random post from thecodinglove.com.}
12
+ spec.summary = %q{Prints markdown containing a random post from thecodinglove.com.}
13
+ spec.homepage = 'https://github.com/valeriomazzeo/danger-the_coding_love'
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_runtime_dependency 'danger', '~>2.0'
22
+ spec.add_runtime_dependency 'nokogiri'
23
+
24
+ # General ruby development
25
+ spec.add_development_dependency 'bundler', '~> 1.3'
26
+ spec.add_development_dependency 'rake', '~> 10.0'
27
+
28
+ # Testing support
29
+ spec.add_development_dependency 'rspec', '~> 3.4'
30
+
31
+ # Linting code and docs
32
+ spec.add_development_dependency "yard", "~> 0.8"
33
+
34
+ # Makes testing easy via `bundle exec guard`
35
+ spec.add_development_dependency 'guard', '~> 2.14'
36
+ spec.add_development_dependency 'guard-rspec', '~> 4.7'
37
+
38
+ # If you want to work on older builds of ruby
39
+ spec.add_development_dependency 'listen', '3.0.7'
40
+
41
+ # This gives you the chance to run a REPL inside your test
42
+ # via
43
+ # require 'pry'
44
+ # binding.pry
45
+ # This will stop test execution and let you inspect the results
46
+ spec.add_development_dependency 'pry'
47
+ end
@@ -0,0 +1 @@
1
+ require 'the_coding_love/plugin'
@@ -0,0 +1 @@
1
+ require 'the_coding_love/gem_version'
@@ -0,0 +1,3 @@
1
+ module TheCodingLove
2
+ VERSION = "0.0.1".freeze
3
+ end
@@ -0,0 +1,36 @@
1
+ module Danger
2
+ # Prints markdown containing a random post from
3
+ # [thecodinglove.com](http://thecodinglove.com)
4
+ #
5
+ # @example Prints markdown containing a random post
6
+ #
7
+ # the_coding_love.random
8
+ #
9
+ # @see valeriomazzeo/danger-the_coding_love
10
+ # @tags thecodinglove.com, coding, love, random, gif
11
+ #
12
+ class DangerTheCodingLove < Plugin
13
+ # Prints markdown containing a random post from thecodinglove.com
14
+ #
15
+ # @return [text, image_url]
16
+ #
17
+ def random
18
+ require 'open-uri'
19
+ require 'nokogiri'
20
+
21
+ @doc = Nokogiri::HTML(open("http://thecodinglove.com/random"))
22
+ @doc = @doc.at_xpath("//div[@id='post1']")
23
+
24
+ text = @doc.at_xpath("//div/h3").text
25
+ image_url = @doc.at_xpath("//div[@class='bodytype']/p/img/@src").to_s
26
+
27
+ markdown("------\n#{text}\n--\n![alt text](#{image_url} \"thecodinglove.com\")")
28
+
29
+ return text, image_url
30
+ end
31
+
32
+ def self.instance_name
33
+ to_s.gsub("Danger", "").danger_underscore.split("/").last
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,59 @@
1
+ require 'pathname'
2
+ ROOT = Pathname.new(File.expand_path('../../', __FILE__))
3
+ $:.unshift((ROOT + 'lib').to_s)
4
+ $:.unshift((ROOT + 'spec').to_s)
5
+
6
+ require 'bundler/setup'
7
+ require 'pry'
8
+
9
+ require 'rspec'
10
+ require 'danger'
11
+
12
+ # Use coloured output, it's the best.
13
+ RSpec.configure do |config|
14
+ config.filter_gems_from_backtrace "bundler"
15
+ config.color = true
16
+ config.tty = true
17
+ end
18
+
19
+ require 'danger_plugin'
20
+
21
+ # These functions are a subset of https://github.com/danger/danger/blob/master/spec/spec_helper.rb
22
+ # If you are expanding these files, see if it's already been done ^.
23
+
24
+ # A silent version of the user interface,
25
+ # it comes with an extra function `.string` which will
26
+ # strip all ANSI colours from the string.
27
+
28
+ # rubocop:disable Lint/NestedMethodDefinition
29
+ def testing_ui
30
+ @output = StringIO.new
31
+ def @output.winsize
32
+ [20, 9999]
33
+ end
34
+
35
+ cork = Cork::Board.new(out: @output)
36
+ def cork.string
37
+ out.string.gsub(/\e\[([;\d]+)?m/, "")
38
+ end
39
+ cork
40
+ end
41
+ # rubocop:enable Lint/NestedMethodDefinition
42
+
43
+ # Example environment (ENV) that would come from
44
+ # running a PR on TravisCI
45
+ def testing_env
46
+ {
47
+ 'HAS_JOSH_K_SEAL_OF_APPROVAL' => 'true',
48
+ 'TRAVIS_PULL_REQUEST' => '800',
49
+ 'TRAVIS_REPO_SLUG' => 'artsy/eigen',
50
+ 'TRAVIS_COMMIT_RANGE' => '759adcbd0d8f...13c4dc8bb61d',
51
+ 'DANGER_GITHUB_API_TOKEN' => '123sbdq54erfsd3422gdfio'
52
+ }
53
+ end
54
+
55
+ # A stubbed out Dangerfile for use in tests
56
+ def testing_dangerfile
57
+ env = Danger::EnvironmentManager.new(testing_env)
58
+ Danger::Dangerfile.new(env, testing_ui)
59
+ end
@@ -0,0 +1,24 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+
3
+ module Danger
4
+ describe Danger::DangerTheCodingLove do
5
+ it 'should be a plugin' do
6
+ expect(Danger::DangerTheCodingLove.new(nil)).to be_a Danger::Plugin
7
+ end
8
+
9
+ describe 'with Dangerfile' do
10
+ before do
11
+ @dangerfile = testing_dangerfile
12
+ @the_coding_love = testing_dangerfile.the_coding_love
13
+ end
14
+
15
+ it "prints a random post" do
16
+ post = @the_coding_love.random
17
+
18
+ expect(post[0]).not_to be_nil
19
+ expect(post[1]).not_to be_nil
20
+ expect(@dangerfile.status_report[:markdowns]).not_to be_nil
21
+ end
22
+ end
23
+ end
24
+ end
metadata ADDED
@@ -0,0 +1,201 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: danger-the_coding_love
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Valerio Mazzeo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-08-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: danger
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
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: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.4'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.4'
83
+ - !ruby/object:Gem::Dependency
84
+ name: yard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.8'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.8'
97
+ - !ruby/object:Gem::Dependency
98
+ name: guard
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '2.14'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '2.14'
111
+ - !ruby/object:Gem::Dependency
112
+ name: guard-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '4.7'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '4.7'
125
+ - !ruby/object:Gem::Dependency
126
+ name: listen
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '='
130
+ - !ruby/object:Gem::Version
131
+ version: 3.0.7
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '='
137
+ - !ruby/object:Gem::Version
138
+ version: 3.0.7
139
+ - !ruby/object:Gem::Dependency
140
+ name: pry
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ description: Prints markdown containing a random post from thecodinglove.com.
154
+ email:
155
+ - valerio.mazzeo@gmail.com
156
+ executables: []
157
+ extensions: []
158
+ extra_rdoc_files: []
159
+ files:
160
+ - ".gitignore"
161
+ - ".travis.yml"
162
+ - Gemfile
163
+ - Gemfile.lock
164
+ - Guardfile
165
+ - LICENSE.txt
166
+ - README.md
167
+ - Rakefile
168
+ - danger-the_coding_love.gemspec
169
+ - lib/danger_plugin.rb
170
+ - lib/danger_the_coding_love.rb
171
+ - lib/the_coding_love/gem_version.rb
172
+ - lib/the_coding_love/plugin.rb
173
+ - spec/spec_helper.rb
174
+ - spec/the_coding_love_spec.rb
175
+ homepage: https://github.com/valeriomazzeo/danger-the_coding_love
176
+ licenses:
177
+ - MIT
178
+ metadata: {}
179
+ post_install_message:
180
+ rdoc_options: []
181
+ require_paths:
182
+ - lib
183
+ required_ruby_version: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ required_rubygems_version: !ruby/object:Gem::Requirement
189
+ requirements:
190
+ - - ">="
191
+ - !ruby/object:Gem::Version
192
+ version: '0'
193
+ requirements: []
194
+ rubyforge_project:
195
+ rubygems_version: 2.5.1
196
+ signing_key:
197
+ specification_version: 4
198
+ summary: Prints markdown containing a random post from thecodinglove.com.
199
+ test_files:
200
+ - spec/spec_helper.rb
201
+ - spec/the_coding_love_spec.rb