HelloWorldFizzBuzz 0.1.3

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.
data/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # HelloWorldFizzBuzz
2
+
3
+ Is a commandline app to show examples of hello world & fizzbuzz in different programming languages.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'HelloWorldFizzBuzz'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install HelloWorldFizzBuzz
20
+
21
+ ## Usage
22
+
23
+ Type:
24
+
25
+ HelloWorldFizzBuzz -w language
26
+
27
+ To show the language's hello world example
28
+
29
+ Type:
30
+
31
+ HelloWorldFizzBuzz -b language
32
+
33
+ To show the language's fizz buzz example
34
+
35
+ Type:
36
+
37
+ HelloWorldFizzBuzz -l
38
+
39
+ To show the License of this project
40
+
41
+ ## Development
42
+
43
+ After checking out the repo, run bundle install to install dependencies. Then, run `rake test` to run the tests.
44
+
45
+ To install this gem onto your local machine, run `bundle exec rake install`.
46
+
47
+ ## Contributing
48
+
49
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rangeroob/HelloWorldFizzBuzz.
50
+ This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
51
+
52
+ 1. Fork it
53
+ 2. Create your feature branch (git checkout -b my-new-feature)
54
+ 3. Commit your changes (git commit -am 'Add some feature')
55
+ 4. Push to the branch (git push origin my-new-feature)
56
+ 5. Create new Pull Request
57
+
58
+ The Easiest way to contribute to this project is to add programing language examples of
59
+ hello world & fizzbuzz in the `/HelloWorldFizzBuzz/lib/sqlite.rb` file
60
+
61
+ example:
62
+
63
+ @posts.insert(language: 'ruby',
64
+ helloworld: "puts 'Hello, world!'",
65
+ fizzbuzz: "
66
+ def fizzbuzz(n)
67
+ (1..n).each do |i|
68
+ if i % 3 == 0 && i % 5 == 0
69
+ puts 'fizzbuzz'
70
+ elsif i % 3 == 0
71
+ puts 'fizz'
72
+ elsif i % 5 == 0
73
+ puts 'buzz'
74
+ else
75
+ puts i
76
+ end
77
+ end
78
+ end
79
+
80
+ fizzbuzz(100)")
81
+ ## License
82
+
83
+ The gem is available as open source under the terms of the [GPL-3.0](https://opensource.org/licenses/GPL-3.0).
84
+
85
+
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
@@ -0,0 +1,4 @@
1
+ #! /usr/bin/env_ruby
2
+ # HelloWorldFizzBuzz
3
+
4
+ require 'HelloWorldFizzBuzz'
@@ -0,0 +1,118 @@
1
+ #! /bin/usr/env ruby
2
+
3
+ # HelloWorldFizzBuzz
4
+ module HelloWorldFizzBuzz
5
+ # Sqlite database Module
6
+ module Sqlite
7
+ def connect_database
8
+ @db = Sequel.sqlite
9
+
10
+ # create an items table
11
+ begin
12
+ @db.create_table :list do
13
+ primary_key :id
14
+ String :language
15
+ String :helloworld
16
+ String :fizzbuzz
17
+ end
18
+ end
19
+ # create a dataset from the items table
20
+ @posts = @db[:list]
21
+
22
+ # populate the table
23
+
24
+ ## Add hello-world && fizz-buzz examples Below (In Alphabetic Order)
25
+
26
+ ### A
27
+
28
+ ### B
29
+
30
+ ### C
31
+
32
+ ### D
33
+
34
+ ### E
35
+
36
+ ### F
37
+
38
+ ### G
39
+
40
+ ### H
41
+
42
+ ### I
43
+
44
+ ### J
45
+
46
+ ### K
47
+
48
+ ### L
49
+
50
+ ### M
51
+
52
+ ### N
53
+
54
+ ### O
55
+
56
+ ### P
57
+ @posts.insert(language: 'php',
58
+ helloworld: "<?php
59
+ print('Hello World');
60
+ ?>",
61
+ fizzbuzz: "
62
+ for ($i = 1; $i <= 100; $i++)
63
+ {
64
+ if($i % 3 == 0 && $i % 5 ==0){
65
+ echo 'FizzBuzz<br />';
66
+ }
67
+ else if($i % 3 == 0){
68
+ echo 'Fizz<br />';
69
+ }
70
+ else if($i % 5 == 0){
71
+ echo 'Buzz<br />';
72
+ }
73
+ else {
74
+ echo $i.'<br />'';
75
+ }
76
+ }
77
+ ")
78
+
79
+ ### Q
80
+
81
+ ### R
82
+ @posts.insert(language: 'ruby',
83
+ helloworld: "puts 'Hello, world!'",
84
+ fizzbuzz: "
85
+ def fizzbuzz(n)
86
+ (1..n).each do |i|
87
+ if i % 3 == 0 && i % 5 == 0
88
+ puts 'fizzbuzz'
89
+ elsif i % 3 == 0
90
+ puts 'fizz'
91
+ elsif i % 5 == 0
92
+ puts 'buzz'
93
+ else
94
+ puts i
95
+ end
96
+ end
97
+ end
98
+
99
+ fizzbuzz(100)")
100
+
101
+ ### S
102
+
103
+ ### T
104
+
105
+ ### U
106
+
107
+ ### V
108
+
109
+ ### W
110
+
111
+ ### X
112
+
113
+ ### Y
114
+
115
+ ### Z
116
+ end
117
+ end
118
+ end