coldshoulder 0.0.5

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/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ .rspec
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+
4
+ group :development, :test do
5
+ gem 'rspec'
6
+ gem 'rspec-mocks'
7
+ end
8
+
9
+ gem 'curb'
10
+ gem 'subcommand'
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Bryan Mikaelian
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # Coldshoulder
2
+
3
+ Generate those gitignore files with ease.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'coldshoulder'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install coldshoulder
18
+
19
+ ## Usage
20
+
21
+ coldshoulder [Language name]
22
+
23
+ Note: You have to specify the exact name of the file in the following repo https://github.com/github/gitignore . This will be fixed in a future release.
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/bin/coldshoulder ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env/ ruby
2
+
3
+ require 'coldshoulder'
4
+
5
+ Coldshoulder::Generator.new(ARGV[0]).generate
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/coldshoulder/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Bryan Mikaelian"]
6
+ gem.email = ["bryan.mikaelian@gmail.com"]
7
+ gem.description = %q{Ignore those files.}
8
+ gem.summary = %q{Written in Ruby, coldshoulder is a command line tool that will let you easily generate a gitignore file.}
9
+ gem.homepage = ""
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "coldshoulder"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Coldshoulder::VERSION
17
+ end
@@ -0,0 +1,36 @@
1
+ module Coldshoulder
2
+
3
+ class Generator
4
+
5
+ attr_reader :target_language
6
+
7
+ def initialize(*args)
8
+ @target_language = args.shift
9
+ end
10
+
11
+ def request_url(url)
12
+ Curl::Easy.perform(url)
13
+ end
14
+
15
+ def generate
16
+ build_ignore_file
17
+ end
18
+
19
+ protected
20
+
21
+ def build_ignore_file
22
+ puts 'Generating gitignore file...'
23
+ r = request_url("https://raw.github.com/github/gitignore/master/#{@target_language}.gitignore")
24
+ if r.response_code == 200
25
+ File.open('.gitignore', 'w') do |f|
26
+ f.write("#\n# Generating using coldshoulder - github.com/bryanmikaelian/coldshoulder\n#\n\n#{r.body_str}")
27
+ end
28
+ puts "Ignore file generated for language #{@target_language}"
29
+ else
30
+ puts "The gitignore file could not be generated. Ignore file for the language #{@target_language} not found"
31
+ end
32
+ end
33
+
34
+ end
35
+
36
+ end
@@ -0,0 +1,3 @@
1
+ module Coldshoulder
2
+ VERSION = "0.0.5"
3
+ end
@@ -0,0 +1,8 @@
1
+ require "coldshoulder/version"
2
+ require 'coldshoulder/generator'
3
+
4
+ module Coldshoulder
5
+ require 'curb'
6
+ require 'subcommand'
7
+
8
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe Coldshoulder::Generator do
4
+
5
+ it 'has a way to get a URL' do
6
+ Coldshoulder::Generator.new.request_url('http://www.google.com').response_code.should == 200
7
+ end
8
+
9
+ it 'sets the target language' do
10
+ c = Coldshoulder::Generator.new('Ruby')
11
+ c.target_language.should == 'Ruby'
12
+ end
13
+
14
+ it 'generates a gitignore file' do
15
+ file = mock('file')
16
+ File.should_receive(:open).with(".gitignore", "w").and_yield(file)
17
+ file.should_receive(:write)
18
+ Coldshoulder::Generator.new('Ruby').generate
19
+ end
20
+
21
+ it 'does not generate a gitignore file when a bad language is provided' do
22
+ file = mock('file')
23
+ File.should_not_receive(:open)
24
+ Coldshoulder::Generator.new('PythonRubySharp').generate
25
+ end
26
+
27
+ end
@@ -0,0 +1,14 @@
1
+ require 'coldshoulder'
2
+
3
+ RSpec.configure do |config|
4
+ config.treat_symbols_as_metadata_keys_with_true_values = true
5
+ config.run_all_when_everything_filtered = true
6
+ config.filter_run :focus
7
+
8
+ # Run specs in random order to surface order dependencies. If you find an
9
+ # order dependency and want to debug it, you can fix the order by providing
10
+ # the seed, which is printed after each run.
11
+ # --seed 1234
12
+ config.order = 'random'
13
+ end
14
+
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: coldshoulder
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.5
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Bryan Mikaelian
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-08-06 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Ignore those files.
15
+ email:
16
+ - bryan.mikaelian@gmail.com
17
+ executables:
18
+ - coldshoulder
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - .gitignore
23
+ - Gemfile
24
+ - LICENSE
25
+ - README.md
26
+ - Rakefile
27
+ - bin/coldshoulder
28
+ - coldshoulder.gemspec
29
+ - lib/coldshoulder.rb
30
+ - lib/coldshoulder/generator.rb
31
+ - lib/coldshoulder/version.rb
32
+ - spec/generator_spec.rb
33
+ - spec/spec_helper.rb
34
+ homepage: ''
35
+ licenses: []
36
+ post_install_message:
37
+ rdoc_options: []
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ none: false
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ requirements: []
53
+ rubyforge_project:
54
+ rubygems_version: 1.8.24
55
+ signing_key:
56
+ specification_version: 3
57
+ summary: Written in Ruby, coldshoulder is a command line tool that will let you easily
58
+ generate a gitignore file.
59
+ test_files:
60
+ - spec/generator_spec.rb
61
+ - spec/spec_helper.rb