shiny-generator 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +3 -0
- data/Gemfile +5 -0
- data/README.md +37 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/shiny/generator.rb +10 -0
- data/lib/shiny/generator/scraper.rb +12 -0
- data/lib/shiny/generator/template.rb +22 -0
- data/lib/shiny/generator/template1/server.R +22 -0
- data/lib/shiny/generator/template1/ui.R +25 -0
- data/lib/shiny/generator/version.rb +5 -0
- data/sample/sample.rb +13 -0
- data/shiny-generator.gemspec +31 -0
- data/shiny/server.R +22 -0
- data/shiny/ui.R +25 -0
- metadata +89 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0c4a736724a930d0ca89a5617bc55c3dbab3b981
|
4
|
+
data.tar.gz: 9731cfa61cd416bddd93ff2903e6038e2f0dbaa4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0d08ed2e07e1a8e2f3883380266218350a7464241ca712c352d3dcc317359d86ddfb82b2377188a09e1d41b4ad0a3f6da25dd2d8707f43489c94e31ad8a434ee
|
7
|
+
data.tar.gz: 67b394419698fb487d83babd08170e00103f8b68b4ad8f5f93dc9b6721ced7591635b1555a1d478db5130a9028d7812f4721af7724adfbb59725f1ec75c7c054
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Shiny::Generator
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'shiny-generator'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install shiny-generator
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
require 'shiny/generator'
|
23
|
+
```
|
24
|
+
|
25
|
+
## Development
|
26
|
+
|
27
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
28
|
+
|
29
|
+
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` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
1. Fork it ( https://github.com/[my-github-username]/shiny-generator/fork )
|
34
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
35
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
36
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
37
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "shiny/generator"
|
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
|
data/bin/setup
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
module Shiny
|
2
|
+
module Generator
|
3
|
+
class Template
|
4
|
+
def create
|
5
|
+
dir = File.expand_path File.dirname(__FILE__)
|
6
|
+
@ui_r = open("#{dir}/template1/ui.R","r").read
|
7
|
+
@server_r = open("#{dir}/template1/server.R","r").read
|
8
|
+
`if [ ! -d "shiny" ]; then
|
9
|
+
mkdir shiny
|
10
|
+
fi`
|
11
|
+
ui_r = open("shiny/ui.R","w")
|
12
|
+
server_r = open("shiny/server.R","w")
|
13
|
+
ui_r.write(@ui_r)
|
14
|
+
server_r.write(@server_r)
|
15
|
+
ui_r.close
|
16
|
+
server_r.close
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
shinyServer(function(input, output) {
|
2
|
+
|
3
|
+
output$main_plot <- renderPlot({
|
4
|
+
|
5
|
+
hist(faithful$eruptions,
|
6
|
+
probability = TRUE,
|
7
|
+
breaks = as.numeric(input$n_breaks),
|
8
|
+
xlab = "Duration (minutes)",
|
9
|
+
main = "Geyser eruption duration")
|
10
|
+
|
11
|
+
if (input$individual_obs) {
|
12
|
+
rug(faithful$eruptions)
|
13
|
+
}
|
14
|
+
|
15
|
+
if (input$density) {
|
16
|
+
dens <- density(faithful$eruptions,
|
17
|
+
adjust = input$bw_adjust)
|
18
|
+
lines(dens, col = "blue")
|
19
|
+
}
|
20
|
+
|
21
|
+
})
|
22
|
+
})
|
@@ -0,0 +1,25 @@
|
|
1
|
+
shinyUI(bootstrapPage(
|
2
|
+
|
3
|
+
selectInput(inputId = "n_breaks",
|
4
|
+
label = "Number of bins in histogram (approximate):",
|
5
|
+
choices = c(10, 20, 35, 50),
|
6
|
+
selected = 20),
|
7
|
+
|
8
|
+
checkboxInput(inputId = "individual_obs",
|
9
|
+
label = strong("Show individual observations"),
|
10
|
+
value = FALSE),
|
11
|
+
|
12
|
+
checkboxInput(inputId = "density",
|
13
|
+
label = strong("Show density estimate"),
|
14
|
+
value = FALSE),
|
15
|
+
|
16
|
+
plotOutput(outputId = "main_plot", height = "300px"),
|
17
|
+
|
18
|
+
# Display this only if the density is shown
|
19
|
+
conditionalPanel(condition = "input.density == true",
|
20
|
+
sliderInput(inputId = "bw_adjust",
|
21
|
+
label = "Bandwidth adjustment:",
|
22
|
+
min = 0.2, max = 2, value = 1, step = 0.2)
|
23
|
+
)
|
24
|
+
|
25
|
+
))
|
data/sample/sample.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'shiny/generator/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "shiny-generator"
|
8
|
+
spec.version = Shiny::Generator::VERSION
|
9
|
+
spec.authors = ["Shohei Aoki"]
|
10
|
+
spec.email = ["shoaok@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{R Shiny WebApp generator}
|
13
|
+
spec.description = %q{Easy scraping and visualizing with R Shiny}
|
14
|
+
spec.homepage = "https://github.com/shohei/shiny-generator"
|
15
|
+
|
16
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
17
|
+
# delete this section to allow pushing this gem to any host.
|
18
|
+
# if spec.respond_to?(:metadata)
|
19
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
20
|
+
# else
|
21
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
22
|
+
# end
|
23
|
+
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
30
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
31
|
+
end
|
data/shiny/server.R
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
shinyServer(function(input, output) {
|
2
|
+
|
3
|
+
output$main_plot <- renderPlot({
|
4
|
+
|
5
|
+
hist(faithful$eruptions,
|
6
|
+
probability = TRUE,
|
7
|
+
breaks = as.numeric(input$n_breaks),
|
8
|
+
xlab = "Duration (minutes)",
|
9
|
+
main = "Geyser eruption duration")
|
10
|
+
|
11
|
+
if (input$individual_obs) {
|
12
|
+
rug(faithful$eruptions)
|
13
|
+
}
|
14
|
+
|
15
|
+
if (input$density) {
|
16
|
+
dens <- density(faithful$eruptions,
|
17
|
+
adjust = input$bw_adjust)
|
18
|
+
lines(dens, col = "blue")
|
19
|
+
}
|
20
|
+
|
21
|
+
})
|
22
|
+
})
|
data/shiny/ui.R
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
shinyUI(bootstrapPage(
|
2
|
+
|
3
|
+
selectInput(inputId = "n_breaks",
|
4
|
+
label = "Number of bins in histogram (approximate):",
|
5
|
+
choices = c(10, 20, 35, 50),
|
6
|
+
selected = 20),
|
7
|
+
|
8
|
+
checkboxInput(inputId = "individual_obs",
|
9
|
+
label = strong("Show individual observations"),
|
10
|
+
value = FALSE),
|
11
|
+
|
12
|
+
checkboxInput(inputId = "density",
|
13
|
+
label = strong("Show density estimate"),
|
14
|
+
value = FALSE),
|
15
|
+
|
16
|
+
plotOutput(outputId = "main_plot", height = "300px"),
|
17
|
+
|
18
|
+
# Display this only if the density is shown
|
19
|
+
conditionalPanel(condition = "input.density == true",
|
20
|
+
sliderInput(inputId = "bw_adjust",
|
21
|
+
label = "Bandwidth adjustment:",
|
22
|
+
min = 0.2, max = 2, value = 1, step = 0.2)
|
23
|
+
)
|
24
|
+
|
25
|
+
))
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: shiny-generator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shohei Aoki
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-05 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.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
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
|
+
description: Easy scraping and visualizing with R Shiny
|
42
|
+
email:
|
43
|
+
- shoaok@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- ".travis.yml"
|
50
|
+
- Gemfile
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- bin/console
|
54
|
+
- bin/setup
|
55
|
+
- lib/shiny/generator.rb
|
56
|
+
- lib/shiny/generator/scraper.rb
|
57
|
+
- lib/shiny/generator/template.rb
|
58
|
+
- lib/shiny/generator/template1/server.R
|
59
|
+
- lib/shiny/generator/template1/ui.R
|
60
|
+
- lib/shiny/generator/version.rb
|
61
|
+
- sample/sample.rb
|
62
|
+
- shiny-generator.gemspec
|
63
|
+
- shiny/server.R
|
64
|
+
- shiny/ui.R
|
65
|
+
homepage: https://github.com/shohei/shiny-generator
|
66
|
+
licenses: []
|
67
|
+
metadata: {}
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubyforge_project:
|
84
|
+
rubygems_version: 2.4.5
|
85
|
+
signing_key:
|
86
|
+
specification_version: 4
|
87
|
+
summary: R Shiny WebApp generator
|
88
|
+
test_files: []
|
89
|
+
has_rdoc:
|