meditation 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +32 -0
- data/README.md +55 -0
- data/Rakefile +2 -0
- data/bin/console +22 -0
- data/bin/meditation-start +5 -0
- data/bin/setup +8 -0
- data/config/environment.rb +7 -0
- data/lib/meditation/cli.rb +59 -0
- data/lib/meditation/each_meditation.rb +4 -0
- data/lib/meditation/scraper.rb +46 -0
- data/lib/meditation/todays_choices.rb +22 -0
- data/lib/meditation/version.rb +3 -0
- data/lib/meditation.rb +5 -0
- data/meditation-0.1.0.gem +0 -0
- data/meditation.gemspec +30 -0
- data/spec.md +11 -0
- metadata +131 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8e19cfd2389f0697d86b40d157af3a7b9dbdf24e
|
4
|
+
data.tar.gz: 9e98fcea6cbfdb8026cf8cccf57a2c7bdeb3c6eb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 32fd49efe2b790b6ae8e3d5bd3d1bf938dcfff9cf66b4bb4518272547f9e841c7493d5dafcf01c2c43436dc557e361380360d040547bcaa2a43bea0608a7a0d5
|
7
|
+
data.tar.gz: 5bf127f6da3b6bbd22e1f12fb6f3973626f3f55428aa881ff1b0511b8d20de2385595c9246711e46acd051d7658661965e09d8a569b49dd148fcd58ca988dfff
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
meditation (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
coderay (1.1.0)
|
10
|
+
method_source (0.9.0)
|
11
|
+
mini_portile2 (2.3.0)
|
12
|
+
nokogiri (1.8.1)
|
13
|
+
mini_portile2 (~> 2.3.0)
|
14
|
+
pry (0.11.1)
|
15
|
+
coderay (~> 1.1.0)
|
16
|
+
method_source (~> 0.9.0)
|
17
|
+
rake (10.4.2)
|
18
|
+
require_all (1.4.0)
|
19
|
+
|
20
|
+
PLATFORMS
|
21
|
+
ruby
|
22
|
+
|
23
|
+
DEPENDENCIES
|
24
|
+
bundler (~> 1.16.a)
|
25
|
+
meditation!
|
26
|
+
nokogiri
|
27
|
+
pry
|
28
|
+
rake (~> 10.0)
|
29
|
+
require_all
|
30
|
+
|
31
|
+
BUNDLED WITH
|
32
|
+
1.16.0.pre.3
|
data/README.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# Meditation
|
2
|
+
|
3
|
+
NOTES -- Tuesday morning, final cleanup, and how to publish. Then see if I can get my other one working.
|
4
|
+
1. Link to License?
|
5
|
+
2. Final cleanup
|
6
|
+
2.5 merge working branch with master.
|
7
|
+
3. publish
|
8
|
+
4. make video demo
|
9
|
+
5. submit links to github https://github.com/MiriamPeskowitz/CLI-meditation
|
10
|
+
6.
|
11
|
+
|
12
|
+
## Description
|
13
|
+
|
14
|
+
So you want a quick meditation, but every meditation site has a gazillion choices. It takes 20 minutes just to find the one you want, and then you have to go to work! They say too many choices make us unhappy. Here's the solution: five meditations to choose from. If you start obsessing, just choose #5 and be done with it.
|
15
|
+
|
16
|
+
Happy calm!
|
17
|
+
|
18
|
+
**
|
19
|
+
|
20
|
+
Welcome to my CLI Data Gem project. It began as a more ambitious gem that scraped four sites and brought you four different types of info and wisdom with which to begin your day. It went wide instead of deep. I put that on hold to create this new version, which scrapes the Audio Dharma site to bring you a choice of five meditative talks.
|
21
|
+
|
22
|
+
github: https://github.com/MiriamPeskowitz/CLI-meditation
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
## Installation
|
28
|
+
|
29
|
+
Add this line to your application's Gemfile:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
gem 'meditation'
|
33
|
+
```
|
34
|
+
|
35
|
+
And then execute:
|
36
|
+
|
37
|
+
$ bundle
|
38
|
+
|
39
|
+
Or install it yourself as:
|
40
|
+
|
41
|
+
$ gem install meditation
|
42
|
+
|
43
|
+
## Usage
|
44
|
+
To use CLI-Meditation: ruby bin/meditation-start in your console.
|
45
|
+
|
46
|
+
|
47
|
+
## Development
|
48
|
+
|
49
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
50
|
+
|
51
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
52
|
+
|
53
|
+
## Contributing
|
54
|
+
|
55
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/MiriamPeskowitz/meditation.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "meditation"
|
5
|
+
#DO i need lines 3-4 here?
|
6
|
+
|
7
|
+
require "irb"
|
8
|
+
require "pry"
|
9
|
+
|
10
|
+
|
11
|
+
def reload
|
12
|
+
load_all './lib'
|
13
|
+
end
|
14
|
+
|
15
|
+
require_relative "../config/environment"
|
16
|
+
|
17
|
+
|
18
|
+
IRB.start
|
19
|
+
Pry.start
|
20
|
+
|
21
|
+
|
22
|
+
puts "welcome to the sandbox"
|
data/bin/setup
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
class Meditation::CLI_controller
|
2
|
+
|
3
|
+
def call #initialize the CLI controller object -- wrap my brain around this.
|
4
|
+
#scrape first
|
5
|
+
puts "**** Welcome to Miriam's meditation gem. ****"
|
6
|
+
puts "************************************************"
|
7
|
+
|
8
|
+
@today = Meditation::Scraper.new.scrape
|
9
|
+
menu
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
def menu
|
14
|
+
list_or_exit_input = ""
|
15
|
+
|
16
|
+
while list_or_exit_input != "exit"
|
17
|
+
puts "Enter 'list' to see five Audio Dharma meditations, or 'exit' to leave."
|
18
|
+
list_or_exit_input = gets.strip.downcase
|
19
|
+
|
20
|
+
#logic for the input:
|
21
|
+
if list_or_exit_input == "list"
|
22
|
+
puts "************************************************"
|
23
|
+
list_meditations
|
24
|
+
|
25
|
+
puts "Enter the number of the meditative talk you'd like to hear. (It'll auto-open in your browser.)"
|
26
|
+
pick_meditation
|
27
|
+
|
28
|
+
|
29
|
+
elsif list_or_exit_input == "exit"
|
30
|
+
puts "Have a calm and grounded day."
|
31
|
+
puts "*****************************"
|
32
|
+
break
|
33
|
+
|
34
|
+
else
|
35
|
+
puts "Can you repeat that?"
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
def list_meditations
|
43
|
+
@today.meditations.each_with_index do |m, i|
|
44
|
+
puts "#{i + 1}: #{m.title}"
|
45
|
+
puts " by #{m.teacher} (Length: #{m.length})"
|
46
|
+
end
|
47
|
+
puts "************************************************"
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
def pick_meditation
|
52
|
+
selected_meditation = gets.strip
|
53
|
+
puts "http://www.audiodharma.org/#{@today.meditations[selected_meditation.to_i-1].stream}"
|
54
|
+
system("open http://www.audiodharma.org/#{@today.meditations[selected_meditation.to_i-1].stream}")
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
|
2
|
+
require "nokogiri"
|
3
|
+
|
4
|
+
|
5
|
+
class Meditation::Scraper
|
6
|
+
attr_accessor :meditations, :doc
|
7
|
+
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@todays_choices = Meditation::Todays_choices.new
|
11
|
+
@doc = Nokogiri::HTML(open("http://www.audiodharma.org/"))
|
12
|
+
end
|
13
|
+
|
14
|
+
def scrape
|
15
|
+
scrape_meditations
|
16
|
+
@todays_choices
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
def scrape_meditations
|
21
|
+
|
22
|
+
@doc.search(".talklist tr")[1..5].collect do |med| #make sure I dig deep enough
|
23
|
+
#into the css on these searches.
|
24
|
+
|
25
|
+
#instantiate the meditation
|
26
|
+
meditation = Meditation::Each_meditation.new
|
27
|
+
|
28
|
+
#scrape the data
|
29
|
+
meditation.title = med.css(".talk_title").text.strip
|
30
|
+
meditation.teacher = med.css(".talkteacher").text.strip
|
31
|
+
meditation.length = med.css(".talk_length").text.strip
|
32
|
+
meditation.stream = med.css("a:nth-child(2)").attr("href").text.strip
|
33
|
+
|
34
|
+
@todays_choices.add_meditation(meditation)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
# the other choice:
|
43
|
+
# # Nokogiri::HTML(open("https://www.tarabrach.com/guided-meditations"))
|
44
|
+
#
|
45
|
+
# end
|
46
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
require 'pry'
|
3
|
+
|
4
|
+
|
5
|
+
class Meditation::Todays_choices
|
6
|
+
attr_accessor :meditations #change this to attr_reader, since I set it below?
|
7
|
+
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
@meditations = []
|
11
|
+
end
|
12
|
+
|
13
|
+
def meditations
|
14
|
+
@meditations
|
15
|
+
end
|
16
|
+
|
17
|
+
def add_meditation(meditation)
|
18
|
+
@meditations << meditation
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
end
|
data/lib/meditation.rb
ADDED
Binary file
|
data/meditation.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "meditation/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "meditation"
|
8
|
+
spec.version = "0.1.1"
|
9
|
+
spec.authors = ["Miriam Peskowitz"]
|
10
|
+
spec.email = ["miriam5000@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Meditations to start your day.}
|
13
|
+
|
14
|
+
spec.homepage = "https://github.com/MiriamPeskowitz/CLI-meditation"
|
15
|
+
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.16.a"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "pry", "~> 0.11.2"
|
27
|
+
spec.add_development_dependency "nokogiri", "~> 1.8.1"
|
28
|
+
spec.add_development_dependency "require_all", "~> 1.4.0"
|
29
|
+
|
30
|
+
end
|
data/spec.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# Specifications for the CLI Assessment
|
2
|
+
|
3
|
+
Specs:
|
4
|
+
- [x] Have a CLI for interfacing with the application
|
5
|
+
The CLI-Controller coordinates the interface.
|
6
|
+
- [x] Pull data from an external source
|
7
|
+
Scrapes data from audiodharma.org
|
8
|
+
- [x] Import both list and detail views
|
9
|
+
The scraper class scrapes the five most recent meditations, and in the CLi you can pick which one you want.
|
10
|
+
|
11
|
+
|
metadata
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: meditation
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Miriam Peskowitz
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-10-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.16.a
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.16.a
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.11.2
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.11.2
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: nokogiri
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.8.1
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.8.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: require_all
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.4.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.4.0
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- miriam5000@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- Gemfile
|
92
|
+
- Gemfile.lock
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- bin/console
|
96
|
+
- bin/meditation-start
|
97
|
+
- bin/setup
|
98
|
+
- config/environment.rb
|
99
|
+
- lib/meditation.rb
|
100
|
+
- lib/meditation/cli.rb
|
101
|
+
- lib/meditation/each_meditation.rb
|
102
|
+
- lib/meditation/scraper.rb
|
103
|
+
- lib/meditation/todays_choices.rb
|
104
|
+
- lib/meditation/version.rb
|
105
|
+
- meditation-0.1.0.gem
|
106
|
+
- meditation.gemspec
|
107
|
+
- spec.md
|
108
|
+
homepage: https://github.com/MiriamPeskowitz/CLI-meditation
|
109
|
+
licenses: []
|
110
|
+
metadata: {}
|
111
|
+
post_install_message:
|
112
|
+
rdoc_options: []
|
113
|
+
require_paths:
|
114
|
+
- lib
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
requirements: []
|
126
|
+
rubyforge_project:
|
127
|
+
rubygems_version: 2.6.14
|
128
|
+
signing_key:
|
129
|
+
specification_version: 4
|
130
|
+
summary: Meditations to start your day.
|
131
|
+
test_files: []
|