centerstage 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: c93bf1474e687558178b020db40a1561cafff18a
4
+ data.tar.gz: ab72f229faf860da09efc7f5c70fff8666f3b0b1
5
+ SHA512:
6
+ metadata.gz: 05614b7c5cb38f833c4838312cbfcdd2d9b8d20f89c28d4373dcd2667e94964b1c3b78eff383de59deee46f3e47ce958cf65cfdd98e53da36f152bfc6d4a6ac4
7
+ data.tar.gz: 289f69ed3aa0b715c92ad8ac00a1e540bcd15ac0edf82032b9f261322ffc04b4063bb24d865d786b9aa4c3769dd6ec3557f019194c2ccaf5fc4366bad8f94b03
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in centerstage.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Wess Cope
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # Centerstage
2
+
3
+ Centerstage is a commandline helper for creating Sinatra/Datamapper apps, including Rakefile and templates for creating routes and models.
4
+
5
+ ## Installation
6
+
7
+ To install, just run:
8
+
9
+ $ gem install centerstage
10
+
11
+ ## Usage
12
+
13
+ Once Centerstage is installed, you can get started using it by running:
14
+
15
+ $ centerstage setup
16
+
17
+ This will download the project template from the repo and install it to private directory (~/.center-stage). You can also, optionally, pass a fork url of your Centerstage
18
+ project setup. When you pass your fork (fork of http://github.com/wess/center-stage), Centerstage will attempt to download your fork and setup the project template for create.
19
+ Example:
20
+
21
+ $ centerstage setup "http://github.com/<yourname>/center-stage"
22
+
23
+
24
+ Once setup, you create your new Centerstage project using:
25
+
26
+ $ centerstage create /path/to/project
27
+ $ cd /path/to/project
28
+ $ bundle install
29
+
30
+ This will create a folder and a stubbed out Sinatra/Datamapper project that includes a Rakefile with prewritten commands for generating routes and models. In the project's directory
31
+ there is a `.templates` folder, this folder contains the templates used to generate routes (views) and models. You can change or update these as you see fit. When you use the
32
+ `generate` command, Rake will look to the template when generating the file.
33
+
34
+ You can visit http://github.com/wess/center-stage to see the project's setup. You can fork this repo and and make changes, and rerun `centerstage setup "your-fork-url"` to
35
+ use your fork.
36
+
37
+ ## Development
38
+ Pull requests are always welcome, either to the main center-stage project setup or to the centerstage gem.
39
+
40
+ ## Contributing
41
+
42
+ Bug reports and pull requests are welcome on GitHub at https://github.com/wess/center-stage.
43
+
44
+
45
+ ## License
46
+
47
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
48
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/centerstage ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "centerstage"
4
+ Centerstage::App.start(ARGV)
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'centerstage/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "centerstage"
8
+ spec.version = Centerstage::VERSION
9
+ spec.authors = ["Wess Cope"]
10
+ spec.email = ["wcope@me.com"]
11
+
12
+ spec.summary = %q{Sinatra setup and generator.}
13
+ spec.description = %q{Centerstage is a command line script to generate Sinatra based applications with data mapper, including an extendable Rakefile for generating new routes and models.}
14
+ spec.homepage = "https://github.com/wess/center-stage"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "bin"
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.11"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "thor", "~> 0.19.1"
25
+ spec.add_development_dependency "rubyzip", "~> 1.1", ">= 1.1.7"
26
+ end
@@ -0,0 +1,3 @@
1
+ module Centerstage
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,88 @@
1
+ require 'thor'
2
+ require 'uri'
3
+ require 'open-uri'
4
+ require 'fileutils'
5
+ require 'etc'
6
+ require 'zip'
7
+ require 'erb'
8
+ require "centerstage/version"
9
+
10
+
11
+ URL = "https://github.com/wess/center-stage/archive/master.zip"
12
+ HOME_DIR = Etc.getpwuid.dir
13
+ CENTER_STAGE_DIR = "#{HOME_DIR}/.center-stage"
14
+ CONFIG_TEMPLATE = <<-BLOCK
15
+ app_name: <%= name %>
16
+
17
+ development:
18
+ db:
19
+ user: username
20
+ name: database
21
+
22
+ production:
23
+ db:
24
+ user: username
25
+ name: database
26
+
27
+ BLOCK
28
+
29
+ module Centerstage
30
+ class App < Thor
31
+ desc "setup", "Sets up CenterStage for use"
32
+ def setup(fork=URL)
33
+ if not valid_url?(fork)
34
+ puts "URL provided for fork of Centerstage, is invalid."
35
+ return
36
+ end
37
+
38
+ if File.directory?(CENTER_STAGE_DIR)
39
+ FileUtils.rm_rf CENTER_STAGE_DIR
40
+ end
41
+
42
+ FileUtils.mkdir_p(CENTER_STAGE_DIR)
43
+
44
+ zip_path = "#{CENTER_STAGE_DIR}/center-stage.zip"
45
+ open zip_path, 'wb' do |file|
46
+ file << open(fork).read
47
+ end
48
+
49
+ Zip::File.open zip_path do |zip_file|
50
+ zip_file.each do |entry|
51
+ path_array = entry.name.split("/").drop(1)
52
+ path = "#{CENTER_STAGE_DIR}/#{path_array.join("/")}"
53
+
54
+ entry.extract path
55
+ end
56
+ end
57
+
58
+ File.delete zip_path
59
+
60
+ puts "Setup complete"
61
+ end
62
+
63
+ desc "create NAME", "Creates a new Sinatra/Datamapper app"
64
+ def create(name)
65
+ app_dir = "#{Dir.pwd}/#{name}"
66
+ app_name = name.slice(0, 1).capitalize + name.slice(1..-1)
67
+
68
+ FileUtils.cp_r CENTER_STAGE_DIR, app_dir
69
+
70
+ Dir.glob("#{app_dir}/**/*.*") do |file|
71
+ template = ERB.new File.read(file)
72
+ File.open(file, 'w') do |f|
73
+ f.write template.result(binding)
74
+ end
75
+ end
76
+ end
77
+
78
+ no_commands do
79
+ def valid_url?(url)
80
+ uri = URI.parse(url)
81
+ uri.kind_of?(URI::HTTP)
82
+ rescue URI::InvalidURIError
83
+ false
84
+ end
85
+ end
86
+ end
87
+ end
88
+
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: centerstage
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Wess Cope
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-20 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.11'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.11'
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.19.1
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.19.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubyzip
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.1'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 1.1.7
65
+ type: :development
66
+ prerelease: false
67
+ version_requirements: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - "~>"
70
+ - !ruby/object:Gem::Version
71
+ version: '1.1'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 1.1.7
75
+ description: Centerstage is a command line script to generate Sinatra based applications
76
+ with data mapper, including an extendable Rakefile for generating new routes and
77
+ models.
78
+ email:
79
+ - wcope@me.com
80
+ executables:
81
+ - centerstage
82
+ extensions: []
83
+ extra_rdoc_files: []
84
+ files:
85
+ - ".gitignore"
86
+ - Gemfile
87
+ - LICENSE.txt
88
+ - README.md
89
+ - Rakefile
90
+ - bin/centerstage
91
+ - centerstage.gemspec
92
+ - lib/centerstage.rb
93
+ - lib/centerstage/version.rb
94
+ homepage: https://github.com/wess/center-stage
95
+ licenses:
96
+ - MIT
97
+ metadata: {}
98
+ post_install_message:
99
+ rdoc_options: []
100
+ require_paths:
101
+ - lib
102
+ required_ruby_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ requirements: []
113
+ rubyforge_project:
114
+ rubygems_version: 2.5.1
115
+ signing_key:
116
+ specification_version: 4
117
+ summary: Sinatra setup and generator.
118
+ test_files: []