coffee_bean 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ .yardoc
6
+ doc
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format nested
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use --create ruby-1.9.3@coffee_bean_gem
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ # 1.0.0
2
+
3
+ * Initial release
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 David Czarnecki
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/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # coffee_bean
2
+
3
+ A ruby gem for kickstarting a CoffeeScript project.
4
+
5
+ ## Installation
6
+
7
+ `gem install coffee_bean`
8
+
9
+ ## Usage
10
+
11
+ `coffee_bean new <project name>`
12
+
13
+ ```
14
+ Tasks:
15
+ coffee_bean help PROJECT_NAME [TASK] # Describe available tasks or one specific task
16
+ coffee_bean new PROJECT_NAME # Create a new CoffeeScript project
17
+
18
+ Options:
19
+ [--author-name=AUTHOR_NAME] # Author name, e.g. David Czarnecki.
20
+ # Default: Firstname Lastname
21
+ [--test-framework=TEST_FRAMEWORK] # Test framework, e.g. spec. spec/ and spec_helper.js would be created.
22
+ # Default: test
23
+ [--initial-file=INITIAL_FILE] # Initial file, e.g. index. src/index.coffee would be created.
24
+ # Default: index
25
+ [--project-description=PROJECT_DESCRIPTION] # Project description, e.g. A description of the project.
26
+ # Default: A description of the project.
27
+ [--github-owner=GITHUB_OWNER] # GitHub project owner, e.g. czarneckid
28
+ # Default: owner
29
+ ```
30
+
31
+ ## Contributing to coffee_bean
32
+
33
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
34
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
35
+ * Fork the project
36
+ * Start a feature/bugfix branch
37
+ * Commit and push until you are happy with your contribution
38
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
39
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
40
+
41
+ ## Copyright
42
+
43
+ Copyright (c) 2012 David Czarnecki. See LICENSE.txt for further details.
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake'
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec) do |spec|
6
+ spec.pattern = 'spec/**/*_spec.rb'
7
+ spec.rspec_opts = ['--backtrace']
8
+ # spec.ruby_opts = ['-w']
9
+ end
10
+
11
+ task :default => :spec
data/bin/coffee_bean ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $: << File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../lib')
4
+
5
+ require 'rubygems'
6
+ require 'coffee_bean'
7
+
8
+ CoffeeBean::Generator.start
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require 'coffee_bean/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "coffee_bean"
7
+ s.version = CoffeeBean::VERSION
8
+ s.authors = ["David Czarnecki"]
9
+ s.email = ["me@davidczarnecki.com"]
10
+ s.homepage = "https://github.com/czarneckid/coffee_bean"
11
+ s.summary = %q{A ruby gem for kickstarting a CoffeeScript project}
12
+ s.description = %q{A ruby gem for kickstarting a CoffeeScript project}
13
+
14
+ s.rubyforge_project = "coffee_bean"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency('thor')
22
+
23
+ s.add_development_dependency('rake')
24
+ s.add_development_dependency('rspec')
25
+ end
@@ -0,0 +1,6 @@
1
+ require 'thor'
2
+ require 'coffee_bean/version'
3
+ require 'coffee_bean/generator'
4
+
5
+ module CoffeeBean
6
+ end
@@ -0,0 +1,35 @@
1
+ require 'thor/group'
2
+ require 'thor/actions'
3
+
4
+ module CoffeeBean
5
+ class Generator < Thor
6
+ include Thor::Actions
7
+
8
+ argument :project_name
9
+
10
+ class_option :author_name, :default => 'Firstname Lastname', :desc => 'Author name, e.g. David Czarnecki.'
11
+ class_option :test_framework, :default => 'test', :desc => 'Test framework, e.g. spec. spec/ and spec_helper.js would be created.'
12
+ class_option :initial_file, :default => 'index', :desc => 'Initial file, e.g. index. src/index.coffee would be created.'
13
+ class_option :project_description, :default => 'A description of the project.', :desc => 'Project description, e.g. A description of the project.'
14
+ class_option :github_owner, :default => 'owner', :desc => 'GitHub project owner, e.g. czarneckid'
15
+
16
+ def self.source_root
17
+ File.dirname(__FILE__)
18
+ end
19
+
20
+ desc "new", "Create a new CoffeeScript project"
21
+ def new
22
+ template('templates/.gitignore', "#{project_name}/.gitignore")
23
+ template('templates/.npmignore', "#{project_name}/.npmignore")
24
+ template('templates/LICENSE.txt', "#{project_name}/LICENSE.txt")
25
+ template('templates/CHANGELOG.md', "#{project_name}/CHANGELOG.md")
26
+ template('templates/README.md', "#{project_name}/README.md")
27
+ template('templates/Makefile', "#{project_name}/Makefile")
28
+ template('templates/package.json', "#{project_name}/package.json")
29
+
30
+ create_file("#{project_name}/#{options[:test_framework]}/#{options[:test_framework]}_helper.js")
31
+ create_file("#{project_name}/#{options[:test_framework]}/#{project_name}_#{options[:test_framework]}.coffee")
32
+ create_file("#{project_name}/src/#{options[:initial_file]}.coffee")
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,3 @@
1
+ lib
2
+ node_modules
3
+ npm-debug.log
@@ -0,0 +1,5 @@
1
+ .DS_Store
2
+ .git*
3
+ *.md
4
+ Makefile
5
+ src/
@@ -0,0 +1 @@
1
+ # CHANGELOG
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 <%= options[:author_name] %>
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.
@@ -0,0 +1,21 @@
1
+ generate-js: deps
2
+ @find src -name '*.coffee' | xargs coffee -c -o lib
3
+
4
+ remove-js:
5
+ @rm -fr lib/
6
+
7
+ deps:
8
+ @test `which coffee` || echo 'You need to have CoffeeScript in your PATH.\nPlease install it using `brew install coffee-script` or `npm install coffee-script`.'
9
+
10
+ test: generate-js
11
+ @./node_modules/.bin/mocha --reporter <%= options[:test_framework] %> -r <%= options[:test_framework] %>/<%= options[:test_framework] %>_helper.js <%= options[:test_framework] %>/<%= project_name %>_<%= options[:test_framework] %>.coffee
12
+
13
+ publish: generate-js
14
+ @test `which npm` || echo 'You need npm to do npm publish... makes sense?'
15
+ npm publish
16
+ @remove-js
17
+
18
+ link: generate-js
19
+ @test `which npm` || echo 'You need npm to do npm link... makes sense?'
20
+ npm link
21
+ @remove-js
@@ -0,0 +1,25 @@
1
+ # <%= project_name %>
2
+
3
+ Project description goes here.
4
+
5
+ ## Installation
6
+
7
+ Installation notes go here.
8
+
9
+ ## Usage
10
+
11
+ Usage notes go here.
12
+
13
+ ## Contributing to <%= project_name %>
14
+
15
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
16
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
17
+ * Fork the project
18
+ * Start a feature/bugfix branch
19
+ * Commit and push until you are happy with your contribution
20
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
21
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
22
+
23
+ ## Copyright
24
+
25
+ Copyright (c) 2012 <%= options[:author_name] %>. See LICENSE.txt for further details.
@@ -0,0 +1,22 @@
1
+ {
2
+ "author": "<%= options[:author_name] %>",
3
+ "name": "<%= project_name %>",
4
+ "description": "<%= options[:project_description] %>",
5
+ "version": "0.0.1",
6
+ "homepage": "http://github.com/<%= options[:github_owner] %>/<%= project_name %>",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git://github.com/<%= options[:github_owner] %>/<%= project_name %>.git"
10
+ },
11
+ "main": "./lib/<%= options[:initial_file] %>",
12
+ "scripts": {
13
+ "test": "make test"
14
+ },
15
+ "engines": {
16
+ "node": "~0.6.14"
17
+ },
18
+ "dependencies": {
19
+ },
20
+ "devDependencies": {
21
+ }
22
+ }
@@ -0,0 +1,3 @@
1
+ module CoffeeBean
2
+ VERSION = '1.0.0'
3
+ end
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+
3
+ describe CoffeeBean::Generator do
4
+ let(:generator) do
5
+ CoffeeBean::Generator.new(['product'], {}, {})
6
+ end
7
+
8
+ describe 'class_options' do
9
+ it 'should have the correct default options' do
10
+ CoffeeBean::Generator.class_options.tap do |options|
11
+ options[:author_name].default.should == 'Firstname Lastname'
12
+ options[:test_framework].default.should == 'test'
13
+ options[:initial_file].default.should == 'index'
14
+ options[:project_description].default.should == 'A description of the project.'
15
+ options[:github_owner].default.should == 'owner'
16
+ end
17
+ end
18
+ end
19
+
20
+ describe '#new' do
21
+ it 'should create the right files when generating a new CoffeeScript project with defaults' do
22
+ generator_result = capture(:stdout) do
23
+ CoffeeBean::Generator.start(['new', 'beanery'])
24
+ end
25
+
26
+ beanery_directory = File.dirname(__FILE__) + '/../../beanery'
27
+ File.directory?(beanery_directory).should be_true
28
+ File.exist?(File.join(beanery_directory, '.gitignore')).should be_true
29
+ File.exist?(File.join(beanery_directory, '.npmignore')).should be_true
30
+ File.exist?(File.join(beanery_directory, 'CHANGELOG.md')).should be_true
31
+ File.exist?(File.join(beanery_directory, 'LICENSE.txt')).should be_true
32
+ File.exist?(File.join(beanery_directory, 'Makefile')).should be_true
33
+ File.exist?(File.join(beanery_directory, 'package.json')).should be_true
34
+ File.exist?(File.join(beanery_directory, 'README.md')).should be_true
35
+ File.exist?(File.join(beanery_directory, 'src', 'index.coffee')).should be_true
36
+ File.exist?(File.join(beanery_directory, 'test', 'beanery_test.coffee')).should be_true
37
+ File.exist?(File.join(beanery_directory, 'test', 'test_helper.js')).should be_true
38
+ FileUtils.rm_rf(beanery_directory)
39
+ end
40
+
41
+ it 'should create the right files when generating a new CoffeeScript project with option changes' do
42
+ generator_result = capture(:stdout) do
43
+ CoffeeBean::Generator.start(['new', 'beanery', '--test_framework=spec', '--initial_file=beanery'])
44
+ end
45
+
46
+ beanery_directory = File.dirname(__FILE__) + '/../../beanery'
47
+ File.directory?(beanery_directory).should be_true
48
+ File.exist?(File.join(beanery_directory, '.gitignore')).should be_true
49
+ File.exist?(File.join(beanery_directory, '.npmignore')).should be_true
50
+ File.exist?(File.join(beanery_directory, 'CHANGELOG.md')).should be_true
51
+ File.exist?(File.join(beanery_directory, 'LICENSE.txt')).should be_true
52
+ File.exist?(File.join(beanery_directory, 'Makefile')).should be_true
53
+ File.exist?(File.join(beanery_directory, 'package.json')).should be_true
54
+ File.exist?(File.join(beanery_directory, 'README.md')).should be_true
55
+ File.exist?(File.join(beanery_directory, 'src', 'beanery.coffee')).should be_true
56
+ File.exist?(File.join(beanery_directory, 'spec', 'beanery_spec.coffee')).should be_true
57
+ File.exist?(File.join(beanery_directory, 'spec', 'spec_helper.js')).should be_true
58
+ FileUtils.rm_rf(beanery_directory)
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'CoffeeBean::VERSION' do
4
+ it 'should be the correct version' do
5
+ CoffeeBean::VERSION.should == '1.0.0'
6
+ end
7
+ end
@@ -0,0 +1,19 @@
1
+ require 'rspec'
2
+ require 'coffee_bean'
3
+
4
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
5
+
6
+ RSpec.configure do |config|
7
+ def capture(stream)
8
+ begin
9
+ stream = stream.to_s
10
+ eval "$#{stream} = StringIO.new"
11
+ yield
12
+ result = eval("$#{stream}").string
13
+ ensure
14
+ eval("$#{stream} = #{stream.upcase}")
15
+ end
16
+
17
+ result
18
+ end
19
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: coffee_bean
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - David Czarnecki
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-30 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: thor
16
+ requirement: &2169552180 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *2169552180
25
+ - !ruby/object:Gem::Dependency
26
+ name: rake
27
+ requirement: &2169551720 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *2169551720
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ requirement: &2169551260 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *2169551260
47
+ description: A ruby gem for kickstarting a CoffeeScript project
48
+ email:
49
+ - me@davidczarnecki.com
50
+ executables:
51
+ - coffee_bean
52
+ extensions: []
53
+ extra_rdoc_files: []
54
+ files:
55
+ - .gitignore
56
+ - .rspec
57
+ - .rvmrc
58
+ - CHANGELOG.md
59
+ - Gemfile
60
+ - LICENSE.txt
61
+ - README.md
62
+ - Rakefile
63
+ - bin/coffee_bean
64
+ - coffee_bean.gemspec
65
+ - lib/coffee_bean.rb
66
+ - lib/coffee_bean/generator.rb
67
+ - lib/coffee_bean/templates/.gitignore
68
+ - lib/coffee_bean/templates/.npmignore
69
+ - lib/coffee_bean/templates/CHANGELOG.md
70
+ - lib/coffee_bean/templates/LICENSE.txt
71
+ - lib/coffee_bean/templates/Makefile
72
+ - lib/coffee_bean/templates/README.md
73
+ - lib/coffee_bean/templates/package.json
74
+ - lib/coffee_bean/version.rb
75
+ - spec/coffee_bean/generator_spec.rb
76
+ - spec/coffee_bean/version_spec.rb
77
+ - spec/spec_helper.rb
78
+ homepage: https://github.com/czarneckid/coffee_bean
79
+ licenses: []
80
+ post_install_message:
81
+ rdoc_options: []
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ segments:
91
+ - 0
92
+ hash: -4593417298593082985
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ segments:
100
+ - 0
101
+ hash: -4593417298593082985
102
+ requirements: []
103
+ rubyforge_project: coffee_bean
104
+ rubygems_version: 1.8.10
105
+ signing_key:
106
+ specification_version: 3
107
+ summary: A ruby gem for kickstarting a CoffeeScript project
108
+ test_files:
109
+ - spec/coffee_bean/generator_spec.rb
110
+ - spec/coffee_bean/version_spec.rb
111
+ - spec/spec_helper.rb