quote_machine 0.1.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
+ SHA256:
3
+ metadata.gz: a2916d016faa8a425d7997a514898c3ccaf56af072c7639cf66a2f6575ace887
4
+ data.tar.gz: 12e145f294e104082c29aea80cd478af810ab4201b290fefcdd09b46ea2205f3
5
+ SHA512:
6
+ metadata.gz: 0aaf4c5719cf418bfb0d9d81a1c2847aa4992dde93248fc22db6faa73d07739fb0f0c97932c4bfb0ee42aa354243a11ea2979aa2cc7d71cf71c0e5b98ae2fffa
7
+ data.tar.gz: 7fde7f6c0f9458456648f8364346cc754cc460d6990e41ee6760c2f2afa5d56b47e344d0b30d08fb253c8e9f700a62c24a31b5e269fc9e3a17feac20ff5c188a
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.3
7
+ before_install: gem install bundler -v 1.17.2
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in quote_machine.gemspec
6
+ gemspec
7
+
8
+ gem 'minitest-reporters', '1.2.0'
data/Gemfile.lock ADDED
@@ -0,0 +1,31 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ quote_machine (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ansi (1.5.0)
10
+ builder (3.2.3)
11
+ minitest (5.11.3)
12
+ minitest-reporters (1.2.0)
13
+ ansi
14
+ builder
15
+ minitest (>= 5.0)
16
+ ruby-progressbar
17
+ rake (10.5.0)
18
+ ruby-progressbar (1.10.1)
19
+
20
+ PLATFORMS
21
+ ruby
22
+
23
+ DEPENDENCIES
24
+ bundler (~> 1.17)
25
+ minitest (~> 5.0)
26
+ minitest-reporters (= 1.2.0)
27
+ quote_machine!
28
+ rake (~> 10.0)
29
+
30
+ BUNDLED WITH
31
+ 1.17.2
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # QuoteMachine
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/quote_machine`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'quote_machine'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install quote_machine
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ 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).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/quote_machine.
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "quote_machine"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,107 @@
1
+ 5
2
+
3
+ I believe in you my soul, the other I am must not abase itself to you,
4
+ And you must not be abased to the other.
5
+
6
+ Loafe with me on the grass, loose the stop from your throat,
7
+ Not words, not music or rhyme I want, not custom or lecture, not even the best,
8
+ Only the lull I like, the hum of your valvèd voice.
9
+
10
+ I mind how once we lay such a transparent summer morning,
11
+ How you settled your head athwart my hips and gently turn’d over upon me,
12
+ And parted the shirt from my bosom-bone, and plunged your tongue to my bare-stript
13
+ heart,
14
+ And reach’d till you felt my beard, and reach’d till you held my feet.
15
+
16
+ Swiftly arose and spread around me the peace and knowledge that pass all the argument of
17
+ the earth,
18
+ And I know that the hand of God is the promise of my own,
19
+ And I know that the spirit of God is the brother of my own,
20
+ And that all the men ever born are also my brothers, and the women my sisters and lovers,
21
+ And that a kelson of the creation is love,
22
+ And limitless are leaves stiff or drooping in the fields,
23
+ And brown ants in the little wells beneath them,
24
+ And mossy scabs of the worm fence, heap’d stones, elder, mullein and poke-weed.
25
+
26
+ 6
27
+
28
+ A child said WHAT IS THE GRASS? fetching it to me with full hands;
29
+ How could I answer the child? I do not know what it is any more than he.
30
+
31
+ I guess it must be the flag of my disposition, out of hopeful green
32
+ stuff woven.
33
+
34
+ Or I guess it is the handkerchief of the Lord,
35
+ A scented gift and remembrancer designedly dropt,
36
+ Bearing the owner's name someway in the corners, that we may
37
+ see and remark, and say Whose?
38
+
39
+ Or I guess the grass is itself a child, the produced babe of the
40
+ vegetation.
41
+
42
+ Or I guess it is a uniform hieroglyphic,
43
+ And it means, Sprouting alike in broad zones and narrow zones,
44
+ Growing among black folks as among white,
45
+ Kanuck, Tuckahoe, Congressman, Cuff, I give them the same, I
46
+ receive them the same.
47
+
48
+ And now it seems to me the beautiful uncut hair of graves.
49
+
50
+ Tenderly will I use you curling grass,
51
+ It may be you transpire from the breasts of young men,
52
+ It may be if I had known them I would have loved them,
53
+ It may be you are from old people, or from offspring taken soon
54
+ out of their mothers' laps,
55
+ And here you are the mothers' laps.
56
+
57
+ This grass is very dark to be from the white heads of old mothers,
58
+ Darker than the colorless beards of old men,
59
+ Dark to come from under the faint red roofs of mouths.
60
+
61
+ O I perceive after all so many uttering tongues,
62
+ And I perceive they do not come from the roofs of mouths for
63
+ nothing.
64
+
65
+ I wish I could translate the hints about the dead young men and
66
+ women,
67
+
68
+ And the hints about old men and mothers, and the offspring taken
69
+ soon out of their laps.
70
+
71
+ What do you think has become of the young and old men?
72
+ And what do you think has become of the women and chil-
73
+ dren?
74
+
75
+ They are alive and well somewhere,
76
+ The smallest sprout shows there is really no death,
77
+ And if ever there was it led forward life, and does not wait at the
78
+ end to arrest it,
79
+ And ceas'd the moment life appear'd.
80
+
81
+ All goes onward and outward, nothing collapses,
82
+ And to die is different from what any one supposed, and luckier.
83
+
84
+ 7
85
+
86
+ Has any one supposed it lucky to be born?
87
+ I hasten to inform him or her it is just as lucky to die, and I know it.
88
+
89
+ I pass death with the dying and birth with the new-wash’d babe, and am not contain’d between my
90
+ hat and boots,
91
+ And peruse manifold objects, no two alike and every one good,
92
+ The earth good and the stars good, and their adjuncts all good.
93
+
94
+ I am not an earth nor an adjunct of an earth,
95
+ I am the mate and companion of people, all just as immortal and fathomless as myself,
96
+ (They do not know how immortal, but I know.)
97
+
98
+ Every kind for itself and its own, for me mine male and female,
99
+ For me those that have been boys and that love women,
100
+ For me the man that is proud and feels how it stings to be slighted,
101
+ For me the sweet-heart and the old maid, for me mothers and the mothers of mothers,
102
+ For me lips that have smiled, eyes that have shed tears,
103
+ For me children and the begetters of children.
104
+
105
+ Undrape! you are not guilty to me, nor stale nor discarded,
106
+ I see through the broadcloth and gingham whether or no,
107
+ And am around, tenacious, acquisitive, tireless, and cannot be shaken away.
@@ -0,0 +1,3 @@
1
+ module QuoteMachine
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,193 @@
1
+ require "quote_machine/version"
2
+
3
+ # module QuoteMachine
4
+ # class Error < StandardError; end
5
+ # # Your code goes here...
6
+ # end
7
+
8
+ # declare instance variables
9
+ @poem = []
10
+ @stanza_pick = 0
11
+ @stanza_current = 0
12
+ @section_current = 0
13
+
14
+
15
+ def read_poem(file_name)
16
+ text = File.read(file_name)
17
+ end
18
+
19
+ def convert_text_to_array(text)
20
+ text_array = text.split("\n")
21
+ end
22
+
23
+
24
+ def create_final_poem_array(text_array)
25
+ # Convert text_array into a new two dimensional array (@poem)
26
+ # with each stanza it's own element in the
27
+ # @poem array and each segment in the @poem element an element in the @poem
28
+ # element.
29
+ stanza_num = 0
30
+ section = 0
31
+ text_array.each do |line|
32
+ if line.length == 1 #the stanza number
33
+
34
+ # puts "in stanza number"
35
+ if stanza_num == 0 && @poem[0] == nil
36
+ # puts "should be writing the first stanza number"
37
+ @poem[stanza_num] = line.split
38
+ else
39
+ # puts "in writing stanza 2 or more"
40
+ stanza_num +=1
41
+ section = 0
42
+ # puts "line is #{line}"
43
+ @poem[stanza_num] = line.split
44
+ # section += 1
45
+ # puts @poem[stanza_num][0]
46
+ end
47
+
48
+ elsif line == "" #these are blank lines which tell you a new section is beginning
49
+ # puts "in blank line"
50
+ section += 1
51
+ else
52
+ temp = @poem[stanza_num][section]
53
+ # puts "temp is #{temp.class}"
54
+ if temp.class == NilClass
55
+ @poem[stanza_num][section] = line
56
+ else
57
+ @poem[stanza_num][section] = @poem[stanza_num][section] + "\n" + line
58
+ end
59
+ end
60
+ end
61
+ end
62
+
63
+
64
+ def pick_stanza
65
+ stanza = rand(0...(@poem.length))
66
+ end
67
+
68
+ def pick_section(stanza)
69
+ sections = @poem[stanza].length
70
+ section = rand(1...(sections))
71
+ end
72
+
73
+ def show_current_section
74
+ star_line = "************************************************\n"
75
+ "#{star_line} #{@poem[@stanza_current][@section_current]} #{star_line}"
76
+ end
77
+
78
+ def show_previous_section
79
+ if @section_current > 0
80
+ "\n\n #{@poem[@stanza_current][@section_current - 1]} \n\n"
81
+ end
82
+ end
83
+
84
+ def show_next_section
85
+ if @section_current < (@poem[@stanza_current].length - 1)
86
+ " #{@poem[@stanza_current][@section_current + 1]}\n"
87
+ end
88
+ end
89
+
90
+ def show_entire_verse
91
+ print_verse = ""
92
+ @poem[@stanza_current].each_with_index do |segment, i|
93
+ if i == @section_current
94
+ print_verse = print_verse + show_current_section
95
+ else
96
+ print_verse = print_verse + segment + "\n"
97
+ end
98
+ end
99
+ print_verse
100
+ end
101
+
102
+ def show_entire_poem
103
+ print_poem = ""
104
+ @poem.each_with_index do |verse, v|
105
+ verse.each_with_index do |segment, s|
106
+ if s == @section_current && @stanza_current == v
107
+ print_poem = print_poem + show_current_section
108
+ # show_current_section
109
+ else
110
+ # puts segment
111
+ # puts "\n"
112
+ print_poem = print_poem + segment + "\n"
113
+ end
114
+ end
115
+ end
116
+ print_poem
117
+ end
118
+
119
+ def clear_screen
120
+ puts `clear`
121
+ end
122
+
123
+ def show_section
124
+ puts "\n"
125
+ # puts @poem[stanza][section_num]
126
+ # puts @poem[pick_stanza][pick_section]
127
+ stanza = pick_stanza
128
+ @stanza_current = stanza
129
+ @section_current = pick_section(stanza)
130
+ # puts @stanz_current.to_s + " " + @section_current.to_s
131
+ puts @poem[@stanza_current][@section_current]
132
+ puts "\n\n\n\n"
133
+ end
134
+
135
+
136
+ # Main Program
137
+
138
+ def main_program
139
+ init_poem
140
+ show_section
141
+ # display_interface
142
+ end
143
+
144
+ # def display_interface
145
+ # option = 1
146
+ # while option != 7
147
+ # puts "Enter 1 for new segment, 2 to repeat sement, 3 previous plus current, 4 previous current next, 5 verse, 6 poem, 7 end"
148
+ # # option = gets.chomp.to_i
149
+ # option = 2
150
+ # clear_screen
151
+ # if option == 1
152
+ # clear_screen
153
+ # show_section
154
+ # elsif option == 2
155
+ # clear_screen
156
+ # show_current_section
157
+ # elsif option == 3
158
+ # clear_screen
159
+ # show_previous_section
160
+ # show_current_section
161
+ # elsif option == 4
162
+ # clear_screen
163
+ # show_previous_section
164
+ # show_current_section
165
+ # show_next_section
166
+ # elsif option == 5
167
+ # clear_screen
168
+ # show_entire_verse
169
+ # elsif option == 6
170
+ # clear_screen
171
+ # show_entire_poem
172
+ # else
173
+ # puts "end"
174
+ # end
175
+ # end
176
+ # end
177
+
178
+
179
+ def init_poem
180
+ text = read_poem('complete_verse.txt')
181
+ text_array = convert_text_to_array(text)
182
+ create_final_poem_array(text_array)
183
+ end
184
+
185
+ # run the program
186
+ puts Dir.pwd
187
+ # main_program
188
+
189
+ def test_method
190
+ "text"
191
+ end
192
+
193
+
@@ -0,0 +1,41 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "quote_machine/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "quote_machine"
8
+ spec.version = QuoteMachine::VERSION
9
+ spec.authors = ["Chris Chapman"]
10
+ spec.email = ["chapmanchri@gmail.com"]
11
+
12
+ spec.summary = %q{QuoteMachine}
13
+ spec.description = %q{QuoteMachine}
14
+ spec.homepage = "https://gitlab.com/chapmanchri/quote_machine"
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata["allowed_push_host"] = "https://rubygems.org/"
20
+
21
+ spec.metadata["homepage_uri"] = spec.homepage
22
+ spec.metadata["source_code_uri"] = "https://gitlab.com/chapmanchri/quote_machine"
23
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
24
+ else
25
+ raise "RubyGems 2.0 or newer is required to protect against " \
26
+ "public gem pushes."
27
+ end
28
+
29
+ # Specify which files should be added to the gem when it is released.
30
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
31
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
32
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
33
+ end
34
+ spec.bindir = "exe"
35
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
+ spec.require_paths = ["lib"]
37
+
38
+ spec.add_development_dependency "bundler", "~> 1.17"
39
+ spec.add_development_dependency "rake", "~> 10.0"
40
+ spec.add_development_dependency "minitest", "~> 5.0"
41
+ end
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: quote_machine
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Chris Chapman
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-08-18 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.17'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.17'
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: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ description: QuoteMachine
56
+ email:
57
+ - chapmanchri@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".travis.yml"
64
+ - Gemfile
65
+ - Gemfile.lock
66
+ - README.md
67
+ - Rakefile
68
+ - bin/console
69
+ - bin/setup
70
+ - complete_verse.txt
71
+ - lib/quote_machine.rb
72
+ - lib/quote_machine/version.rb
73
+ - quote_machine.gemspec
74
+ homepage: https://gitlab.com/chapmanchri/quote_machine
75
+ licenses: []
76
+ metadata:
77
+ allowed_push_host: https://rubygems.org/
78
+ homepage_uri: https://gitlab.com/chapmanchri/quote_machine
79
+ source_code_uri: https://gitlab.com/chapmanchri/quote_machine
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ requirements: []
95
+ rubygems_version: 3.0.3
96
+ signing_key:
97
+ specification_version: 4
98
+ summary: QuoteMachine
99
+ test_files: []