box_cutter 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: d14fd7b722f7ff9b5c9f7121c3555852f9e8e72e
4
+ data.tar.gz: d99bf5dd29fea684eabaa3ec4c5d596adcc6e156
5
+ SHA512:
6
+ metadata.gz: ff06d8f58508ffb611a8df1d2f1dd9a1d88665c9af387a06057e8e4102d7a7b2a31c3bf7a6fc4cb8dac7d510fd3a4312d54ba3a0885a158ed5b7fc7ae8fef7ad
7
+ data.tar.gz: 3a6d5c90eaa6d85755ec7712ddc4ec0432ba40786c3249f408d5f8f74ca0cea4b2df64bf4401ef22c59cf83fda9c4187b099149361687c76c66909c1fd4b8e31
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ tmp
2
+ pkg
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --warnings
3
+ --require spec_helper
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.1.2
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,105 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ box_cutter (0.0.1)
5
+ bundler (~> 1.3)
6
+ rails (= 4.1.4)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionmailer (4.1.4)
12
+ actionpack (= 4.1.4)
13
+ actionview (= 4.1.4)
14
+ mail (~> 2.5.4)
15
+ actionpack (4.1.4)
16
+ actionview (= 4.1.4)
17
+ activesupport (= 4.1.4)
18
+ rack (~> 1.5.2)
19
+ rack-test (~> 0.6.2)
20
+ actionview (4.1.4)
21
+ activesupport (= 4.1.4)
22
+ builder (~> 3.1)
23
+ erubis (~> 2.7.0)
24
+ activemodel (4.1.4)
25
+ activesupport (= 4.1.4)
26
+ builder (~> 3.1)
27
+ activerecord (4.1.4)
28
+ activemodel (= 4.1.4)
29
+ activesupport (= 4.1.4)
30
+ arel (~> 5.0.0)
31
+ activesupport (4.1.4)
32
+ i18n (~> 0.6, >= 0.6.9)
33
+ json (~> 1.7, >= 1.7.7)
34
+ minitest (~> 5.1)
35
+ thread_safe (~> 0.1)
36
+ tzinfo (~> 1.1)
37
+ arel (5.0.1.20140414130214)
38
+ builder (3.2.2)
39
+ diff-lcs (1.2.5)
40
+ erubis (2.7.0)
41
+ hike (1.2.3)
42
+ i18n (0.6.11)
43
+ json (1.8.1)
44
+ mail (2.5.4)
45
+ mime-types (~> 1.16)
46
+ treetop (~> 1.4.8)
47
+ mime-types (1.25.1)
48
+ minitest (5.4.0)
49
+ multi_json (1.10.1)
50
+ polyglot (0.3.5)
51
+ rack (1.5.2)
52
+ rack-test (0.6.2)
53
+ rack (>= 1.0)
54
+ rails (4.1.4)
55
+ actionmailer (= 4.1.4)
56
+ actionpack (= 4.1.4)
57
+ actionview (= 4.1.4)
58
+ activemodel (= 4.1.4)
59
+ activerecord (= 4.1.4)
60
+ activesupport (= 4.1.4)
61
+ bundler (>= 1.3.0, < 2.0)
62
+ railties (= 4.1.4)
63
+ sprockets-rails (~> 2.0)
64
+ railties (4.1.4)
65
+ actionpack (= 4.1.4)
66
+ activesupport (= 4.1.4)
67
+ rake (>= 0.8.7)
68
+ thor (>= 0.18.1, < 2.0)
69
+ rake (10.3.2)
70
+ rspec (3.0.0)
71
+ rspec-core (~> 3.0.0)
72
+ rspec-expectations (~> 3.0.0)
73
+ rspec-mocks (~> 3.0.0)
74
+ rspec-core (3.0.3)
75
+ rspec-support (~> 3.0.0)
76
+ rspec-expectations (3.0.3)
77
+ diff-lcs (>= 1.2.0, < 2.0)
78
+ rspec-support (~> 3.0.0)
79
+ rspec-mocks (3.0.3)
80
+ rspec-support (~> 3.0.0)
81
+ rspec-support (3.0.3)
82
+ sprockets (2.12.1)
83
+ hike (~> 1.2)
84
+ multi_json (~> 1.0)
85
+ rack (~> 1.0)
86
+ tilt (~> 1.1, != 1.3.0)
87
+ sprockets-rails (2.1.3)
88
+ actionpack (>= 3.0)
89
+ activesupport (>= 3.0)
90
+ sprockets (~> 2.8)
91
+ thor (0.19.1)
92
+ thread_safe (0.3.4)
93
+ tilt (1.4.1)
94
+ treetop (1.4.15)
95
+ polyglot
96
+ polyglot (>= 0.3.1)
97
+ tzinfo (1.2.1)
98
+ thread_safe (~> 0.1)
99
+
100
+ PLATFORMS
101
+ ruby
102
+
103
+ DEPENDENCIES
104
+ box_cutter!
105
+ rspec (~> 3.0)
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Leonel Galan
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,3 @@
1
+ # Box Cutter
2
+ ![ScreenShot](box_cutter.jpg)
3
+ [//]: # (Image by Evan-Amos taken from http://commons.wikimedia.org/wiki/File:Box-cutter.jpg)
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require 'bundler/setup'
2
+ require 'bundler/gem_tasks'
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new :rspec
6
+
7
+ desc 'Run the test suite'
8
+ task default: :rspec
data/bin/box_cutter ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ source_path = (Pathname.new(__FILE__).dirname + '../lib').expand_path
5
+ $LOAD_PATH << source_path
6
+
7
+ require 'box_cutter'
8
+
9
+ templates_root = File.expand_path(File.join("..", "templates"), File.dirname(__FILE__))
10
+ BoxCutter::AppGenerator.source_root templates_root
11
+ BoxCutter::AppGenerator.source_paths << Rails::Generators::AppGenerator.source_root << templates_root
12
+
13
+ BoxCutter::AppGenerator.start
@@ -0,0 +1,33 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path('../lib', __FILE__)
3
+ require 'box_cutter/version'
4
+ require 'date'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.required_ruby_version = ">= #{BoxCutter::RUBY_VERSION}"
8
+ s.authors = ['leonelgalan']
9
+ s.date = Date.today.strftime('%Y-%m-%d')
10
+
11
+ s.description = <<-EOS
12
+ BoxCutter is inspired by thoughtbot's Suspenders. Just like Suspenders says, use BoxCutter if you're in a
13
+ rush to build something amazing; don't use it if you like missing deadlines.
14
+ EOS
15
+
16
+ s.email = 'leonel@smashingboxes.com'
17
+ s.executables = ['box_cutter']
18
+ s.extra_rdoc_files = %w[README.md LICENSE]
19
+ s.files = `git ls-files`.split("\n")
20
+ s.homepage = 'http://github.com/leonelgalan/box_cutter'
21
+ s.license = 'MIT'
22
+ s.name = 'box_cutter'
23
+ s.rdoc_options = ['--charset=UTF-8']
24
+ s.require_paths = ['lib']
25
+ s.summary = "Generate a Rails app using debatable best practices."
26
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
27
+ s.version = BoxCutter::VERSION
28
+
29
+ s.add_dependency 'bundler', '~> 1.3'
30
+ s.add_dependency 'rails', BoxCutter::RAILS_VERSION
31
+
32
+ s.add_development_dependency 'rspec', '~> 3.0'
33
+ end
data/box_cutter.jpg ADDED
Binary file
@@ -0,0 +1,11 @@
1
+ module BoxCutter
2
+ class AppBuilder < Rails::AppBuilder
3
+ def readme
4
+ template 'README.md.erb', 'README.md'
5
+ end
6
+
7
+ # def set_ruby_to_version_being_used
8
+ # create_file '.ruby-version', "#{BoxCutter::RUBY_VERSION}\n"
9
+ # end
10
+ end
11
+ end
@@ -0,0 +1,21 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/rails/app/app_generator'
3
+
4
+ module BoxCutter
5
+ class AppGenerator < Rails::Generators::AppGenerator
6
+ def finish_template
7
+ invoke :box_cutter_customization
8
+ super
9
+ end
10
+
11
+ def box_cutter_customization
12
+ # build :set_ruby_to_version_being_used
13
+ end
14
+
15
+ protected
16
+
17
+ def get_builder_class
18
+ BoxCutter::AppBuilder
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ module BoxCutter
2
+ RAILS_VERSION = '4.1.4'
3
+ RUBY_VERSION = IO.read("#{File.dirname(__FILE__)}/../../.ruby-version").strip
4
+ VERSION = '0.0.1'
5
+ end
data/lib/box_cutter.rb ADDED
@@ -0,0 +1,3 @@
1
+ require 'box_cutter/version'
2
+ require 'box_cutter/generators/app_generator'
3
+ require 'box_cutter/app_builder'
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Box cut a new project with default configuration' do
4
+ it 'generated README.md contains project name' do
5
+ cut_the_box
6
+
7
+ readme_file = IO.read("#{project_path}/README.md")
8
+
9
+ expect(readme_file).to match(/Dummy/)
10
+ end
11
+ end
@@ -0,0 +1,20 @@
1
+ require 'bundler/setup'
2
+
3
+ Bundler.require(:default, :test)
4
+
5
+ require (Pathname.new(__FILE__).dirname + '../lib/box_cutter').expand_path
6
+
7
+ Dir['./spec/support/**/*.rb'].each { |file| require file }
8
+
9
+ RSpec.configure do |config|
10
+ config.include BoxCutterTestHelpers
11
+
12
+ config.before(:all) do
13
+ create_tmp_directory
14
+ end
15
+
16
+ config.before(:each) do
17
+ drop_dummy_database
18
+ remove_project_directory
19
+ end
20
+ end
@@ -0,0 +1,49 @@
1
+ module BoxCutterTestHelpers
2
+ APP_NAME = 'dummy'
3
+
4
+ def remove_project_directory
5
+ FileUtils.rm_rf(project_path)
6
+ end
7
+
8
+ def create_tmp_directory
9
+ FileUtils.mkdir_p(tmp_path)
10
+ end
11
+
12
+ def cut_the_box(arguments = nil)
13
+ Dir.chdir(tmp_path) do
14
+ Bundler.with_clean_env do
15
+ ENV['TESTING'] = '1'
16
+
17
+ %x(#{box_cutter_bin} #{APP_NAME} #{arguments})
18
+ end
19
+ end
20
+ end
21
+
22
+ def drop_dummy_database
23
+ if File.exist?(project_path)
24
+ Dir.chdir(project_path) do
25
+ Bundler.with_clean_env do
26
+ `rake db:drop`
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ def project_path
33
+ @project_path ||= Pathname.new("#{tmp_path}/#{APP_NAME}")
34
+ end
35
+
36
+ private
37
+
38
+ def tmp_path
39
+ @tmp_path ||= Pathname.new("#{root_path}/tmp")
40
+ end
41
+
42
+ def box_cutter_bin
43
+ File.join(root_path, 'bin', 'box_cutter')
44
+ end
45
+
46
+ def root_path
47
+ File.expand_path('../../../', __FILE__)
48
+ end
49
+ end
@@ -0,0 +1 @@
1
+ # <%= app_name.humanize %>
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: box_cutter
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - leonelgalan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-04 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.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 4.1.4
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 4.1.4
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: |
56
+ BoxCutter is inspired by thoughtbot's Suspenders. Just like Suspenders says, use BoxCutter if you're in a
57
+ rush to build something amazing; don't use it if you like missing deadlines.
58
+ email: leonel@smashingboxes.com
59
+ executables:
60
+ - box_cutter
61
+ extensions: []
62
+ extra_rdoc_files:
63
+ - README.md
64
+ - LICENSE
65
+ files:
66
+ - ".gitignore"
67
+ - ".rspec"
68
+ - ".ruby-version"
69
+ - Gemfile
70
+ - Gemfile.lock
71
+ - LICENSE
72
+ - README.md
73
+ - Rakefile
74
+ - bin/box_cutter
75
+ - box_cutter.gemspec
76
+ - box_cutter.jpg
77
+ - lib/box_cutter.rb
78
+ - lib/box_cutter/app_builder.rb
79
+ - lib/box_cutter/generators/app_generator.rb
80
+ - lib/box_cutter/version.rb
81
+ - spec/features/new_project_spec.rb
82
+ - spec/spec_helper.rb
83
+ - spec/support/box_cutter.rb
84
+ - templates/README.md.erb
85
+ homepage: http://github.com/leonelgalan/box_cutter
86
+ licenses:
87
+ - MIT
88
+ metadata: {}
89
+ post_install_message:
90
+ rdoc_options:
91
+ - "--charset=UTF-8"
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: 2.1.2
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 2.4.1
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: Generate a Rails app using debatable best practices.
110
+ test_files:
111
+ - spec/features/new_project_spec.rb
112
+ - spec/spec_helper.rb
113
+ - spec/support/box_cutter.rb