sinatra-cli 0.0.1

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
+ SHA1:
3
+ metadata.gz: 94752b2ae2fde26bbcf704b2ebab5332209caf78
4
+ data.tar.gz: d5869f7884e753e51d6ec46631f464aa1a8728d7
5
+ SHA512:
6
+ metadata.gz: 8cc78dc57ce5840331644eb7f739f8042dff4b622e6f66db3b18420c7eea817042492464ecd66d58f3c11175fd0fb347d93d7bf8bbd3b3204c38eb8e39bcdd4c
7
+ data.tar.gz: 084fba38b0a7d07811f95e5180d702d369935c734fcbb5a964713cb738ff6630abf1fc7b04265ca390eb1cfe8fd6c42bd006ab53d33c4dcbc6391b220c10eb49
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 sinatra-cli.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Eric Kelly
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,31 @@
1
+ # Sinatra::Cli
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'sinatra-cli'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install sinatra-cli
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/sinatra-cli/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/sinatra ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "sinatra/cli"
4
+
5
+ Sinatra::CLI::Generator.start(ARGV)
@@ -0,0 +1,95 @@
1
+ require "thor"
2
+
3
+ module Sinatra
4
+ module CLI
5
+ class Generator < Thor::Group
6
+ include Thor::Actions
7
+
8
+ argument :app_name
9
+
10
+ def self.source_root
11
+ File.join(File.dirname(__FILE__), "../../../", "templates")
12
+ end
13
+
14
+ def create_models_dir
15
+ keep_file "#{app_name}/app/models"
16
+ end
17
+
18
+ def create_views_dir
19
+ template "app/views/index.erb", "#{app_name}/views/index.erb"
20
+ template "app/views/layout.erb", "#{app_name}/views/layout.erb"
21
+ end
22
+
23
+ def create_database_config
24
+ template "config/database.yml.erb", "#{app_name}/config/database.yml"
25
+ end
26
+
27
+ def create_seeds_file
28
+ copy_file "db/seeds.rb", "#{app_name}/db/seeds.rb"
29
+ end
30
+
31
+ def create_assets
32
+ create_file "#{app_name}/public/javascripts/app.js"
33
+ create_file "#{app_name}/public/stylesheets/app.css"
34
+ keep_file "#{app_name}/public/images/"
35
+ end
36
+
37
+ def create_gitignore
38
+ copy_file ".gitignore", "#{app_name}/.gitignore"
39
+ end
40
+
41
+ def create_app_file
42
+ copy_file "app.rb", "#{app_name}/app.rb"
43
+ end
44
+
45
+ def create_gemfile
46
+ copy_file "Gemfile", "#{app_name}/Gemfile"
47
+ end
48
+
49
+ def create_rakefile
50
+ copy_file "Rakefile", "#{app_name}/Rakefile"
51
+ end
52
+
53
+ def create_readme
54
+ template "README.md.erb", "#{app_name}/README.md"
55
+ end
56
+
57
+ def setup_rspec
58
+ insert_into_file(
59
+ "#{app_name}/Gemfile",
60
+ "gem 'rspec'",
61
+ after: "group :test, :development do"
62
+ )
63
+
64
+ copy_file ".rspec", "#{app_name}/.rspec"
65
+ copy_file "spec/spec_helper.rb", "#{app_name}/spec/spec_helper.rb"
66
+ end
67
+
68
+ def setup_capybara
69
+ insert_into_file(
70
+ "#{app_name}/Gemfile",
71
+ "gem 'capybara'",
72
+ after: "group :test, :development do"
73
+ )
74
+
75
+ insert_into_file(
76
+ "#{app_name}/spec/spec_helper.rb",
77
+ "require 'capybara/rspec'",
78
+ after: "require 'rspec'"
79
+ )
80
+
81
+ append_to_file "#{app_name}/spec/spec_helper.rb", "\n\nCapybara.app = Sinatra::Application"
82
+ end
83
+
84
+ def bundle_install
85
+ system "cd #{app_name} && bundle install && cd ../"
86
+ end
87
+
88
+ protected
89
+
90
+ def keep_file(destination)
91
+ create_file "#{destination}/.keep"
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,5 @@
1
+ module Sinatra
2
+ module CLI
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ require "sinatra/cli/generator"
2
+ require "sinatra/cli/version"
3
+
4
+ module Sinatra
5
+ module CLI
6
+ # Your code goes here...
7
+ end
8
+ 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 'sinatra/cli/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "sinatra-cli"
8
+ spec.version = Sinatra::CLI::VERSION
9
+ spec.authors = ["Eric Kelly"]
10
+ spec.email = ["heroiceric@gmail.com"]
11
+ spec.summary = %q{A CLI for generating Sinatra apps.}
12
+ spec.description = %q{}
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 "thor"
24
+ end
@@ -0,0 +1,2 @@
1
+ .bundle
2
+ .DS_store
data/templates/.rspec ADDED
File without changes
data/templates/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'pg'
4
+ gem 'rake'
5
+ gem 'sinatra'
6
+ gem 'sinatra-activerecord'
7
+ gem 'sinatra-contrib'
8
+
9
+ group :test, :development do
10
+ gem 'capybara'
11
+ gem 'pry'
12
+ gem 'rspec'
13
+ end
@@ -0,0 +1 @@
1
+ # <%= app_name %>
@@ -0,0 +1,2 @@
1
+ require './app'
2
+ require 'sinatra/activerecord/rake'
@@ -0,0 +1 @@
1
+ <h1><%= app_name %></h1>
@@ -0,0 +1,14 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title><%= app_name %></title>
7
+ <link rel="stylesheet" href="/stylesheets/app.css" />
8
+ </head>
9
+ <body>
10
+ <%%= yield %>
11
+
12
+ <script src="/javascripts/app.js"></script>
13
+ </body>
14
+ </html>
data/templates/app.rb ADDED
@@ -0,0 +1,20 @@
1
+ require 'sinatra'
2
+ require 'sinatra/activerecord'
3
+ require 'sinatra/reloader'
4
+
5
+ configure :development, :test do
6
+ require 'pry'
7
+ end
8
+
9
+ configure do
10
+ set :views, 'app/views'
11
+ end
12
+
13
+ Dir[File.join(File.dirname(__FILE__), 'app', '**', '*.rb')].each do |file|
14
+ require file
15
+ also_reload file
16
+ end
17
+
18
+ get '/' do
19
+ erb :index
20
+ end
@@ -0,0 +1,26 @@
1
+ # Configure the database used when in the development environment
2
+ development:
3
+ adapter: postgresql
4
+ encoding: unicode
5
+ database: <%= app_name %>_development
6
+ pool: 5
7
+ username:
8
+ password:
9
+
10
+ # Configure the database used when in the test environment
11
+ test:
12
+ adapter: postgresql
13
+ encoding: unicode
14
+ database: <%= app_name %>_test
15
+ pool: 5
16
+ username:
17
+ password:
18
+
19
+ # Configure the database used when in the production environment
20
+ production:
21
+ adapter: postgresql
22
+ encoding: unicode
23
+ database: <%= app_name %>_production
24
+ pool: 5
25
+ username:
26
+ password:
@@ -0,0 +1,6 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Example:
5
+ #
6
+ # Person.create(first_name: 'Eric', last_name: 'Kelly')
@@ -0,0 +1,7 @@
1
+ require 'pry'
2
+ require 'rspec'
3
+
4
+ require_relative '../app.rb'
5
+
6
+ set :environment, :test
7
+ set :database, :test
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sinatra-cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Eric Kelly
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-02 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.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
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: thor
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: ''
56
+ email:
57
+ - heroiceric@gmail.com
58
+ executables:
59
+ - sinatra
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/sinatra
69
+ - lib/sinatra/cli.rb
70
+ - lib/sinatra/cli/generator.rb
71
+ - lib/sinatra/cli/version.rb
72
+ - sinatra-cli.gemspec
73
+ - templates/.gitignore
74
+ - templates/.rspec
75
+ - templates/Gemfile
76
+ - templates/README.md.erb
77
+ - templates/Rakefile
78
+ - templates/app.rb
79
+ - templates/app/views/index.erb
80
+ - templates/app/views/layout.erb
81
+ - templates/config/database.yml.erb
82
+ - templates/db/seeds.rb
83
+ - templates/spec/spec_helper.rb
84
+ homepage: ''
85
+ licenses:
86
+ - MIT
87
+ metadata: {}
88
+ post_install_message:
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ requirements: []
103
+ rubyforge_project:
104
+ rubygems_version: 2.2.2
105
+ signing_key:
106
+ specification_version: 4
107
+ summary: A CLI for generating Sinatra apps.
108
+ test_files: []