gem_constructor 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in constructor.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,33 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ constructor (0.0.1)
5
+ bundler (~> 1.0.3)
6
+ erubis (~> 2.6.6)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ abstract (1.0.0)
12
+ diff-lcs (1.1.2)
13
+ erubis (2.6.6)
14
+ abstract (>= 1.0.0)
15
+ rspec (2.0.1)
16
+ rspec-core (~> 2.0.1)
17
+ rspec-expectations (~> 2.0.1)
18
+ rspec-mocks (~> 2.0.1)
19
+ rspec-core (2.0.1)
20
+ rspec-expectations (2.0.1)
21
+ diff-lcs (>= 1.1.2)
22
+ rspec-mocks (2.0.1)
23
+ rspec-core (~> 2.0.1)
24
+ rspec-expectations (~> 2.0.1)
25
+
26
+ PLATFORMS
27
+ ruby
28
+
29
+ DEPENDENCIES
30
+ bundler (~> 1.0.3)
31
+ constructor!
32
+ erubis (~> 2.6.6)
33
+ rspec (~> 2.0.1)
data/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # Constructor
2
+
3
+ This is a simple gem that adds to the default bundler gem generator by adding:
4
+
5
+ * Readme
6
+ * `rake spec` to the Rakefile
7
+ * Rspec directory
8
+ * spec_helper.rb
9
+
10
+ ## How To Install
11
+
12
+ gem install constructor
13
+
14
+ ## Example
15
+
16
+ constructor <gem name>
17
+
18
+ ## Note on Patches/Pull Requests
19
+
20
+ * Fork the project.
21
+ * Create a feature branch
22
+ * Make your feature addition or bug fix.
23
+ * Add tests.
24
+ * Commit, do not mess with RakeFile, version, or history.
25
+ * Send me a pull request.
26
+
27
+ ## Copyright
28
+
29
+ Copyright (c) 2010 Red Davis.
30
+
31
+ ## License
32
+
33
+ The MIT License
34
+
35
+ Permission is hereby granted, free of charge, to any person obtaining a copy
36
+ of this software and associated documentation files (the "Software"), to deal
37
+ in the Software without restriction, including without limitation the rights
38
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
39
+ copies of the Software, and to permit persons to whom the Software is
40
+ furnished to do so, subject to the following conditions:
41
+
42
+ The above copyright notice and this permission notice shall be included in
43
+ all copies or substantial portions of the Software.
44
+
45
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
46
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
47
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
48
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
49
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
50
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
51
+ THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
data/bin/constructor ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rubygems"
4
+ require File.expand_path("../", __FILE__) + "/../lib/constructor"
5
+
6
+ lib_name = ARGV[0]
7
+ Constructor.construct(lib_name)
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "gem_constructor/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "gem_constructor"
7
+ s.version = GemConstructor::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Red Davis"]
10
+ s.email = ["red@railslove.com"]
11
+ s.homepage = "http://rubygems.org/gems/gem_constructor"
12
+ s.summary = %q{Gem skeleton builder using bundler and rspec}
13
+ s.description = %q{Gem skeleton builder using bundler and rspec}
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+
20
+ s.rubyforge_project = "gem_constructor"
21
+
22
+ s.add_dependency "bundler", "~> 1.0.3"
23
+ s.add_dependency "erubis", "~> 2.6.6"
24
+
25
+ s.add_development_dependency "rspec", "~> 2.0.1"
26
+ end
@@ -0,0 +1,9 @@
1
+ require 'bundler'
2
+ require 'rspec/core/rake_task'
3
+
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ desc "Run specs"
7
+ RSpec::Core::RakeTask.new
8
+
9
+ task :default => :spec
@@ -0,0 +1,62 @@
1
+ # Gem Name
2
+
3
+ Description
4
+
5
+ ## How To Install
6
+
7
+ sudo gem install campfire_bot
8
+
9
+ ## Example
10
+
11
+ require "rubygems"
12
+ require "campfire_bot"
13
+
14
+ Campfire::Bot.config do |bot|
15
+ # Login
16
+ bot.login do |l|
17
+ l.username = "username"
18
+ l.password = "password"
19
+ l.subdomain = "subdomain"
20
+ l.room = "room"
21
+ end
22
+
23
+ # Events
24
+ bot.on(/^How are you?/) do
25
+ bot.msg("Im very well thank-you")
26
+ end
27
+ end.start
28
+
29
+ ## Note on Patches/Pull Requests
30
+
31
+ * Fork the project.
32
+ * Create a feature branch
33
+ * Make your feature addition or bug fix.
34
+ * Add tests.
35
+ * Commit, do not mess with RakeFile, version, or history.
36
+ * Send me a pull request.
37
+
38
+ ## Copyright
39
+
40
+ Copyright (c) 2010 YOUR NAME.
41
+
42
+ ## License
43
+
44
+ The MIT License
45
+
46
+ Permission is hereby granted, free of charge, to any person obtaining a copy
47
+ of this software and associated documentation files (the "Software"), to deal
48
+ in the Software without restriction, including without limitation the rights
49
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
50
+ copies of the Software, and to permit persons to whom the Software is
51
+ furnished to do so, subject to the following conditions:
52
+
53
+ The above copyright notice and this permission notice shall be included in
54
+ all copies or substantial portions of the Software.
55
+
56
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
57
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
58
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
59
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
60
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
61
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
62
+ THE SOFTWARE.
@@ -0,0 +1,16 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+
4
+ require "<%= @lib_name %>"
5
+ require "rspec"
6
+
7
+ def fixture(file_name)
8
+ File.read(fixture_path(file_name))
9
+ end
10
+
11
+ def fixture_path(file_name)
12
+ File.expand_path(File.dirname(__FILE__)) + "/fixtures/#{file_name}"
13
+ end
14
+
15
+ RSpec.configure do |config|
16
+ end
@@ -0,0 +1,3 @@
1
+ module GemConstructor
2
+ VERSION = "0.0.3"
3
+ end
@@ -0,0 +1,70 @@
1
+ $:.unshift(File.expand_path("../", __FILE__))
2
+
3
+ # Dependencies
4
+ require "erubis"
5
+ require "fileutils"
6
+
7
+ # Files
8
+ require "gem_constructor/version"
9
+
10
+ module GemConstructor
11
+ module_function
12
+
13
+ def construct(lib_name)
14
+ @lib_name = lib_name
15
+
16
+ run_bundler
17
+ construct_rake_file
18
+ construct_readme
19
+ construct_specs
20
+ end
21
+
22
+ public :construct
23
+
24
+ def run_bundler
25
+ system("bundle gem #{@lib_name}")
26
+ end
27
+
28
+ def construct_rake_file
29
+ File.open("#{@lib_name}/RakeFile", "w") do |file|
30
+ file.write(template("rake_file"))
31
+ end
32
+ end
33
+
34
+ def construct_readme
35
+ File.open("#{@lib_name}/README.md", "w") do |file|
36
+ file.write(template("readme"))
37
+ end
38
+ end
39
+
40
+ def construct_specs
41
+ # Directories
42
+ FileUtils.mkdir_p(spec_path + "/#{@lib_name}")
43
+
44
+ # Fixture directory
45
+ FileUtils.mkdir_p(spec_path + "/fixtures")
46
+
47
+ # Spec helper
48
+ File.open("#{spec_path}/spec_helper.rb", "w") do |file|
49
+ file.write(erubis("spec_helper"))
50
+ end
51
+
52
+ # .rspec
53
+ File.open("#{@lib_name}/.rspec", "w") do |file|
54
+ file.write("--color")
55
+ file.write("--profile")
56
+ end
57
+ end
58
+
59
+ def spec_path
60
+ File.join(@lib_name, "spec")
61
+ end
62
+
63
+ def erubis(template_name)
64
+ Erubis::Eruby.new(template(template_name)).result(binding())
65
+ end
66
+
67
+ def template(name)
68
+ File.read(File.expand_path("../", __FILE__) + "/gem_constructor/templates/#{name}.erb")
69
+ end
70
+ end
@@ -0,0 +1,10 @@
1
+ $:.unshift(File.dirname(__FILE__))
2
+ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+
4
+ require 'constructor'
5
+ require 'rspec'
6
+
7
+ # Sorry...
8
+
9
+ RSpec.configure do |config|
10
+ end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gem_constructor
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 3
9
+ version: 0.0.3
10
+ platform: ruby
11
+ authors:
12
+ - Red Davis
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-10-29 00:00:00 +01:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: bundler
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 0
30
+ - 3
31
+ version: 1.0.3
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: erubis
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 2
43
+ - 6
44
+ - 6
45
+ version: 2.6.6
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: rspec
50
+ prerelease: false
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ segments:
56
+ - 2
57
+ - 0
58
+ - 1
59
+ version: 2.0.1
60
+ type: :development
61
+ version_requirements: *id003
62
+ description: Gem skeleton builder using bundler and rspec
63
+ email:
64
+ - red@railslove.com
65
+ executables:
66
+ - constructor
67
+ extensions: []
68
+
69
+ extra_rdoc_files: []
70
+
71
+ files:
72
+ - .gitignore
73
+ - Gemfile
74
+ - Gemfile.lock
75
+ - README.md
76
+ - Rakefile
77
+ - bin/constructor
78
+ - gem_constructor.gemspec
79
+ - lib/gem_constructor.rb
80
+ - lib/gem_constructor/templates/rake_file.erb
81
+ - lib/gem_constructor/templates/readme.erb
82
+ - lib/gem_constructor/templates/spec_helper.erb
83
+ - lib/gem_constructor/version.rb
84
+ - spec/spec_helper.rb
85
+ has_rdoc: true
86
+ homepage: http://rubygems.org/gems/gem_constructor
87
+ licenses: []
88
+
89
+ post_install_message:
90
+ rdoc_options: []
91
+
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ segments:
99
+ - 0
100
+ version: "0"
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ segments:
106
+ - 0
107
+ version: "0"
108
+ requirements: []
109
+
110
+ rubyforge_project: gem_constructor
111
+ rubygems_version: 1.3.6
112
+ signing_key:
113
+ specification_version: 3
114
+ summary: Gem skeleton builder using bundler and rspec
115
+ test_files:
116
+ - spec/spec_helper.rb