cuba-libre 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: ef00080474ba86043458676964412540b83bf957
4
+ data.tar.gz: 76cb5621d907f878f1b6fd1be4301e3ceff923e8
5
+ SHA512:
6
+ metadata.gz: fae93074f5e648909080efa122c57d25b8bf8bcef24960b42bf94bac0b0afb4817fe8255bf2b68ecf7921434266f107dd64d5fc3339a51e51db7e4f92197d7bd
7
+ data.tar.gz: dd0ecc8cf2f42421d07be4659de491ff7eeb67e3a8ee1537939ebc2680384ecb5868c796e978bda6e875fb84adf777d87e4c60ab211c2a1fb6641e793ea99779
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cuba-libre.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Gregory Durelle
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,37 @@
1
+ # Cuba::Libre
2
+
3
+ Cuba-libre is now a cocktail AND a generator to help creating Cuba projects.
4
+ Cuba is a micro-framework for Ruby based on Rack.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'cuba-libre'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install cuba-libre
21
+
22
+ ## Usage
23
+
24
+ $ cuba new [projectName]
25
+
26
+ This will create your cuba project with its 2 files:
27
+ * The config.ru to ```rackup```your project.
28
+ * The projectname.rb file that contains your project config and routes.
29
+
30
+
31
+ ## Contributing
32
+
33
+ 1. Fork it ( https://github.com/[my-github-username]/cuba-libre/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,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/cuba ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "cuba/libre"
4
+
5
+ if ARGV.length == 2 && ARGV[0] == 'new'
6
+ project = Cuba::Libre.new(ARGV[1].downcase)
7
+ project.create_dir
8
+ project.create_cuba_file
9
+ project.create_config_file
10
+ else
11
+ puts "cuba new <projectName>"
12
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cuba/libre/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "cuba-libre"
8
+ spec.version = Cuba::Libre::VERSION
9
+ spec.authors = ["Gregory Durelle"]
10
+ spec.email = ["gregory.durelle@gmail.com"]
11
+ spec.summary = %q{Generator for Cuba framework.}
12
+ spec.description = %q{Helps create cuba projects through a minimalist generator.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
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_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "cuba", "~> 3.3.0"
24
+ end
@@ -0,0 +1,5 @@
1
+ module Cuba
2
+ class Libre
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
data/lib/cuba/libre.rb ADDED
@@ -0,0 +1,77 @@
1
+ require "cuba/libre/version"
2
+ require 'securerandom'
3
+
4
+ module Cuba
5
+ class Libre
6
+ def initialize(name)
7
+ @project_name = name
8
+ end
9
+
10
+ def create_dir
11
+ Dir.mkdir(@project_name)
12
+ end
13
+
14
+ def create_config_file
15
+ File.open("./#{@project_name}/config.ru", 'w+') do |file|
16
+ file.write setup_config
17
+ end
18
+ end
19
+
20
+ def create_cuba_file
21
+ File.open("./#{@project_name}/#{ARGV[1]}.rb", 'w+') do |file|
22
+ file.write setup_cuba
23
+ end
24
+ end
25
+
26
+ private
27
+
28
+ def setup_cuba
29
+ <<-EOF
30
+ require 'cuba'
31
+
32
+ # If you need extra protection.
33
+ # require 'rack/protection'
34
+ # Cuba.use Rack::Protection
35
+ # Cuba.use Rack::Protection::RemoteReferrer
36
+
37
+ Cuba.use Rack::Session::Cookie, :secret => "#{SecureRandom.base64(128)}"
38
+
39
+ # Cuba includes a plugin called Cuba::Render that provides a couple of helper methods for rendering templates.
40
+ # require "cuba/render"
41
+ # Cuba.plugin(Cuba::Render)
42
+
43
+ # This plugin uses Tilt, which serves as an interface to a bunch of different Ruby template engines
44
+ # (ERB, Haml, Sass, CoffeeScript, etc.), so you can use the template engine of your choice.
45
+ # require 'slim'
46
+ # Cuba.settings[:render][:template_engine] = 'slim'
47
+
48
+ # Cuba.settings[:render][:template_engine] = "slim"
49
+ # Cuba.settings[:render][:views] = "./views/admin/"
50
+ # Cuba.settings[:render][:layout] = "admin"
51
+
52
+ # To launch just type: 'rackup' in your console
53
+ Cuba.define do
54
+ on get do
55
+ on "#{ARGV[1]}" do
56
+ on root do
57
+ res.write 'Hello world!'
58
+ end
59
+ end
60
+
61
+ on root do
62
+ res.redirect "/#{ARGV[1]}"
63
+ end
64
+ end
65
+ end
66
+ EOF
67
+ end
68
+
69
+ def setup_config
70
+ <<-EOF
71
+ require "./#{ARGV[1]}"
72
+
73
+ run Cuba
74
+ EOF
75
+ end
76
+ end
77
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cuba-libre
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Gregory Durelle
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ version_requirements: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ requirement: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ~>
23
+ - !ruby/object:Gem::Version
24
+ version: '1.7'
25
+ prerelease: false
26
+ type: :development
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ~>
37
+ - !ruby/object:Gem::Version
38
+ version: '10.0'
39
+ prerelease: false
40
+ type: :development
41
+ - !ruby/object:Gem::Dependency
42
+ name: cuba
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 3.3.0
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ~>
51
+ - !ruby/object:Gem::Version
52
+ version: 3.3.0
53
+ prerelease: false
54
+ type: :development
55
+ description: Helps create cuba projects through a minimalist generator.
56
+ email:
57
+ - gregory.durelle@gmail.com
58
+ executables:
59
+ - cuba
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/cuba
69
+ - cuba-libre.gemspec
70
+ - lib/cuba/libre.rb
71
+ - lib/cuba/libre/version.rb
72
+ homepage: ''
73
+ licenses:
74
+ - MIT
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 2.1.9
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: Generator for Cuba framework.
96
+ test_files: []