simonmenke-diamonds 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.
- data/License.txt +20 -0
- data/about.yml +10 -0
- data/app_generators/diamonds/diamonds_generator.rb +81 -0
- data/app_generators/diamonds/templates/License.txt +20 -0
- data/app_generators/diamonds/templates/README +0 -0
- data/app_generators/diamonds/templates/about.yml +6 -0
- data/app_generators/diamonds/templates/init.rb +0 -0
- data/app_generators/diamonds/templates/lib.rb +3 -0
- data/app_generators/diamonds/templates/routes.rb +0 -0
- data/app_generators/diamonds/templates/version.rb +10 -0
- data/bin/diamonds +17 -0
- data/lib/app/diamonds.rb +72 -0
- data/lib/diamonds.rb +20 -0
- data/lib/plugin/diamonds.rb +3 -0
- metadata +96 -0
data/License.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2008 Simon Menke
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/about.yml
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
|
3
|
+
class DiamondsGenerator < RubiGen::Base
|
4
|
+
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
|
5
|
+
Config::CONFIG['ruby_install_name'])
|
6
|
+
|
7
|
+
default_options :shebang => DEFAULT_SHEBANG
|
8
|
+
|
9
|
+
attr_reader :app_name, :module_name
|
10
|
+
|
11
|
+
def initialize(runtime_args, runtime_options = {})
|
12
|
+
super
|
13
|
+
usage if args.empty?
|
14
|
+
@destination_root = args.shift
|
15
|
+
@app_name = File.basename(File.expand_path(@destination_root))
|
16
|
+
@module_name = app_name.camelize
|
17
|
+
# extract_options
|
18
|
+
end
|
19
|
+
|
20
|
+
def manifest
|
21
|
+
# Use /usr/bin/env if no special shebang was specified
|
22
|
+
script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] }
|
23
|
+
windows = (RUBY_PLATFORM =~ /dos|win32|cygwin/i) || (RUBY_PLATFORM =~ /(:?mswin|mingw)/)
|
24
|
+
|
25
|
+
record do |m|
|
26
|
+
# Root directory and all subdirectories.
|
27
|
+
m.directory ''
|
28
|
+
(BASEDIRS + ["lib/#{app_name}"]).each { |path| m.directory path }
|
29
|
+
|
30
|
+
# Root
|
31
|
+
m.template_copy_each %w( about.yml )
|
32
|
+
|
33
|
+
m.template "about.yml", "about.yml"
|
34
|
+
m.template "README", "README"
|
35
|
+
m.template "License.txt", "License.txt"
|
36
|
+
m.template "routes.rb", "config/routes.rb"
|
37
|
+
m.template "init.rb", "rails/init.rb"
|
38
|
+
m.template "lib.rb", "lib/#{app_name}.rb"
|
39
|
+
m.template "version.rb", "lib/#{app_name}/version.rb"
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
protected
|
45
|
+
def banner
|
46
|
+
<<-EOS
|
47
|
+
Create a stub for #{File.basename $0} to get started.
|
48
|
+
|
49
|
+
Usage: #{File.basename $0} /path/to/your/app [options]"
|
50
|
+
EOS
|
51
|
+
end
|
52
|
+
|
53
|
+
def add_options!(opts)
|
54
|
+
opts.separator ''
|
55
|
+
opts.separator "#{File.basename $0} options:"
|
56
|
+
opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
57
|
+
end
|
58
|
+
|
59
|
+
# Installation skeleton. Intermediate directories are automatically
|
60
|
+
# created so don't sweat their absence here.
|
61
|
+
BASEDIRS = %w(
|
62
|
+
app
|
63
|
+
app/controllers
|
64
|
+
app/helpers
|
65
|
+
app/models
|
66
|
+
app/views
|
67
|
+
bin
|
68
|
+
config
|
69
|
+
db
|
70
|
+
db/migrations
|
71
|
+
lib
|
72
|
+
lib/tasks
|
73
|
+
public
|
74
|
+
public/images
|
75
|
+
public/stylesheets
|
76
|
+
public/javascripts
|
77
|
+
rails
|
78
|
+
vendor
|
79
|
+
vendor/plugins
|
80
|
+
)
|
81
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2008 FIX_ME:author
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
File without changes
|
File without changes
|
File without changes
|
data/bin/diamonds
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr.bin/env ruby
|
2
|
+
|
3
|
+
$IS_APP = true
|
4
|
+
|
5
|
+
require 'rubygems'
|
6
|
+
require 'activesupport'
|
7
|
+
require 'thor'
|
8
|
+
require 'yaml'
|
9
|
+
require 'rubigen'
|
10
|
+
require 'rubigen/scripts/generate'
|
11
|
+
begin
|
12
|
+
require File.join(File.dirname(__FILE__), "../lib/diamonds")
|
13
|
+
rescue LoadError
|
14
|
+
require 'diamonds'
|
15
|
+
end
|
16
|
+
|
17
|
+
Diamonds.start
|
data/lib/app/diamonds.rb
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
|
2
|
+
class Diamonds < Thor
|
3
|
+
|
4
|
+
desc "create NAME", "create an empty diamond."
|
5
|
+
def create(name)
|
6
|
+
|
7
|
+
RubiGen::Base.use_application_sources!
|
8
|
+
RubiGen::Scripts::Generate.new.run([name], :generator => 'diamonds')
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "build", "build a gem."
|
13
|
+
def build
|
14
|
+
Gem::Builder.new(gemspec).build
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "install", "install a gem."
|
18
|
+
def install
|
19
|
+
build
|
20
|
+
system "sudo gem install ./#{gemspec.full_name}.gem"
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "spec", "generate the gemspec file."
|
24
|
+
def spec
|
25
|
+
exit unless gemspec(false).validate
|
26
|
+
File.open("#{about["name"]}.gemspec", "w+") { |f| f.write gemspec.to_ruby }
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def about
|
32
|
+
@about ||= YAML.load_file('about.yml')
|
33
|
+
end
|
34
|
+
|
35
|
+
def get_version
|
36
|
+
version = about["version"]
|
37
|
+
version ||= begin
|
38
|
+
m = Module.new
|
39
|
+
m.module_eval(File.new("lib/#{about["name"]}.rb").read, "lib/#{about["name"]}.rb") if File.file? "lib/#{about["name"]}.rb"
|
40
|
+
m.module_eval(File.new("lib/#{about["name"]}/version.rb").read, "lib/#{about["name"]}/version.rb") if File.file? "lib/#{about["name"]}/version.rb"
|
41
|
+
m.const_get("#{about["name"]}".camelize).const_get('VERSION').const_get('STRING')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def gemspec(simulate_github=true)
|
46
|
+
@gemspec ||= Gem::Specification.new do |s|
|
47
|
+
s.name = [(simulate_github ? about['github'] : nil), about["name"]].compact.join('-')
|
48
|
+
s.version = get_version
|
49
|
+
s.platform = Gem::Platform::RUBY
|
50
|
+
s.summary = about["description"]
|
51
|
+
s.author = about["author"]
|
52
|
+
s.email = about["email"]
|
53
|
+
s.homepage = about["homepage"]
|
54
|
+
|
55
|
+
s.files = Dir.glob("{app_generators,bin,app,config,db,lib,public,rails,vendor,test,spec}/**/*") +
|
56
|
+
Dir.glob("{README,CHANGELOG,about.yml}") +
|
57
|
+
Dir.glob("{MIT-LICENSE,License.*}")
|
58
|
+
s.require_path = 'lib'
|
59
|
+
s.has_rdoc = true
|
60
|
+
|
61
|
+
s.bindir = "bin"
|
62
|
+
s.executables += Dir.glob("bin/*").collect { |p| File.basename(p) }
|
63
|
+
|
64
|
+
about['dependencies'].each do |dependency|
|
65
|
+
s.add_dependency *dependency.split(/\s+/, 2)
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
data/lib/diamonds.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
if $IS_APP
|
3
|
+
|
4
|
+
require File.join(File.dirname(__FILE__), 'app/diamonds')
|
5
|
+
|
6
|
+
else
|
7
|
+
|
8
|
+
require File.join(File.dirname(__FILE__), 'plugin/diamonds')
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
Diamonds.module_eval %{
|
13
|
+
module VERSION #:nodoc:
|
14
|
+
MAJOR = 0
|
15
|
+
MINOR = 0
|
16
|
+
TINY = 1
|
17
|
+
|
18
|
+
STRING = [MAJOR, MINOR, TINY].join('.')
|
19
|
+
end
|
20
|
+
}
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: simonmenke-diamonds
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Simon Menke
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-10-27 00:00:00 -07:00
|
13
|
+
default_executable: diamonds
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: activesupport
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.0.0
|
23
|
+
version:
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: thor
|
26
|
+
version_requirement:
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 0.9.7
|
32
|
+
version:
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rubigen
|
35
|
+
version_requirement:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.3.3
|
41
|
+
version:
|
42
|
+
description:
|
43
|
+
email: simon.menke@gmail.com
|
44
|
+
executables:
|
45
|
+
- diamonds
|
46
|
+
extensions: []
|
47
|
+
|
48
|
+
extra_rdoc_files: []
|
49
|
+
|
50
|
+
files:
|
51
|
+
- app_generators/diamonds
|
52
|
+
- app_generators/diamonds/diamonds_generator.rb
|
53
|
+
- app_generators/diamonds/templates
|
54
|
+
- app_generators/diamonds/templates/about.yml
|
55
|
+
- app_generators/diamonds/templates/init.rb
|
56
|
+
- app_generators/diamonds/templates/lib.rb
|
57
|
+
- app_generators/diamonds/templates/License.txt
|
58
|
+
- app_generators/diamonds/templates/README
|
59
|
+
- app_generators/diamonds/templates/routes.rb
|
60
|
+
- app_generators/diamonds/templates/version.rb
|
61
|
+
- bin/diamonds
|
62
|
+
- lib/app
|
63
|
+
- lib/app/diamonds.rb
|
64
|
+
- lib/diamonds.rb
|
65
|
+
- lib/plugin
|
66
|
+
- lib/plugin/diamonds.rb
|
67
|
+
- about.yml
|
68
|
+
- License.txt
|
69
|
+
has_rdoc: true
|
70
|
+
homepage:
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: "0"
|
81
|
+
version:
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: "0"
|
87
|
+
version:
|
88
|
+
requirements: []
|
89
|
+
|
90
|
+
rubyforge_project:
|
91
|
+
rubygems_version: 1.2.0
|
92
|
+
signing_key:
|
93
|
+
specification_version: 2
|
94
|
+
summary: Diamonds are beautiful gems
|
95
|
+
test_files: []
|
96
|
+
|