proteus-kits 0.3 → 0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 004a713b1130f26e77b51190546be6efd477f4cc
4
- data.tar.gz: 05e9132e154788899bbaa986f28a1d593a2f41e0
3
+ metadata.gz: e5b2e2b05d53b5e9234c487cbfdac300f8a7ea99
4
+ data.tar.gz: 4d78aea43cb836ad8d775cc9093497403af3276e
5
5
  SHA512:
6
- metadata.gz: cfffd71b509b80f3bf260ee900677958db82db8ea1713ea03b8fc93133f2c352a0dfaf8739f5c370a1b2e729145ae53fff5eb817cdb56760a6888c0a2c6c594f
7
- data.tar.gz: 5c65c5981468b8b59f11e9e68f351d89a30f0899309d530533dcdd0b8ada5c697739d56ae0a9e0c6882c160853edc7a7046f92cdca57228ad334e3e33c972dcb
6
+ metadata.gz: 019a7d3065cb24ca4cd7b67241f22ebf9f6cb0aaf15ec591c944e4cac47591ab485e5c833248a5493dbf641b9e17bd3535eb57b6a2107c37c4f9cae78c69235e
7
+ data.tar.gz: 7b541b78c175d2ec022f393f87c59e197e288b7edfe46f10cc8d345da2209a53a58aa8712c19c9ba93d3dd5a22fc1b70f8aa40315d4b9da3f6e9319d86fa1270
data/.gitignore CHANGED
@@ -3,3 +3,4 @@
3
3
  Gemfile.lock
4
4
  pkg
5
5
  tmp
6
+ spec/dummy
data/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright © 2014–2015 [thoughtbot, inc.](http://thoughtbot.com)
3
+ Copyright © 2014–2016 [thoughtbot, inc.](http://thoughtbot.com)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the “Software”), to deal
data/README.md CHANGED
@@ -8,7 +8,7 @@ and includes our favorite front-end development tools.
8
8
 
9
9
  * [Middleman](http://github.com/thoughtbot/proteus-middleman)
10
10
  * [Jekyll](http://github.com/thoughtbot/proteus-jekyll)
11
- * [Gulp](http://github.com/thoughtbot/proteus-gulp)
11
+ * Have a request for another kit? Open an issue to let us know.
12
12
 
13
13
  ## Installation
14
14
 
@@ -69,4 +69,4 @@ Proteus is maintained and funded by [thoughtbot, inc](http://thoughtbot.com). Th
69
69
 
70
70
  ## License
71
71
 
72
- Copyright © 2014–2015 [thoughtbot, inc](http://thoughtbot.com). Proteus is free software, and may be redistributed under the terms specified in the [license](LICENSE.md).
72
+ Copyright © 2014–2016 [thoughtbot, inc](http://thoughtbot.com). Proteus is free software, and may be redistributed under the terms specified in the [license](LICENSE.md).
@@ -1,2 +1,3 @@
1
1
  require "proteus/version"
2
+ require "proteus/repos"
2
3
  require "proteus/kit"
@@ -1,32 +1,56 @@
1
1
  require "proteus/version"
2
+ require "proteus/repos"
2
3
  require "thor"
3
4
 
4
5
  module Proteus
5
6
  class Kit < Thor
6
7
  include Thor::Actions
7
8
 
8
- desc "url", "gets the git url"
9
- def url(kit)
10
- "git@github.com:thoughtbot/proteus-#{kit}.git"
9
+ no_commands do
10
+ def url(id)
11
+ kit = Proteus::REPOS[id.to_sym]
12
+ kit[:url]
13
+ end
14
+
15
+ def name(id)
16
+ kit = Proteus::REPOS[id.to_sym]
17
+ kit[:name]
18
+ end
19
+ end
20
+
21
+ desc "list", "shows a list of available kits"
22
+ def list
23
+ repos = Proteus::REPOS
24
+ repos.each do |id, repo|
25
+ puts "#{id} - #{repo[:name]}"
26
+ end
11
27
  end
12
28
 
13
29
  desc "new", "runs the command to clone a particular kit"
14
- def new(kit_name, repo_name = nil)
15
- repo_name ||= kit_name
16
-
17
- if system "git ls-remote #{url(kit_name)} #{repo_name} > /dev/null 2>&1"
18
- puts "Starting a new proteus-#{kit_name} project in #{repo_name}"
19
- system %{
20
- git clone "#{url(kit_name)}" "#{repo_name}" &&
21
- cd "#{repo_name}" &&
22
- rm -rf .git &&
23
- git init &&
24
- git add . &&
25
- git commit -am 'New proteus-#{kit_name} project' &&
26
- cd -
27
- }
30
+ def new(id, dir = nil)
31
+ dir ||= id
32
+ kit = Proteus::REPOS[id.to_sym]
33
+
34
+ if kit
35
+ name = kit[:name]
36
+ url = kit[:url]
37
+
38
+ if system "git ls-remote #{url} #{dir} > /dev/null 2>&1"
39
+ puts "Starting a new #{name} project in #{dir} from #{url}"
40
+ system %{
41
+ git clone "#{url}" "#{dir}" &&
42
+ cd "#{dir}" &&
43
+ rm -rf .git &&
44
+ git init &&
45
+ git add . &&
46
+ git commit -m 'New #{name} project' &&
47
+ cd -
48
+ }
49
+ else
50
+ puts "Can't find a repo at #{url}."
51
+ end
28
52
  else
29
- puts "A thoughtbot repo doesn't exist with that name"
53
+ puts "Kit not found. Run `proteus list` to see available kits."
30
54
  end
31
55
  end
32
56
 
@@ -50,7 +74,8 @@ module Proteus
50
74
 
51
75
  desc "version", "Show Proteus version"
52
76
  def version
53
- say "Proteus #{Proteus::VERSION}"
77
+ version_number = Proteus::VERSION
78
+ puts "Proteus #{version_number}"
54
79
  end
55
80
  end
56
81
  end
@@ -0,0 +1,13 @@
1
+ module Proteus
2
+ REPOS = {
3
+ middleman: {
4
+ name: "Middleman Starter",
5
+ url: "https://github.com/thoughtbot/proteus-middleman.git"
6
+ },
7
+
8
+ jekyll: {
9
+ name: "Jekyll Starter",
10
+ url: "https://github.com/thoughtbot/proteus-jekyll.git"
11
+ }
12
+ }
13
+ end
@@ -1,3 +1,3 @@
1
1
  module Proteus
2
- VERSION = "0.3"
2
+ VERSION = "0.4"
3
3
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.7"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
- spec.add_development_dependency "rspec", "~> 2.6"
23
+ spec.add_development_dependency "rspec", "~> 3.3"
24
24
 
25
- spec.add_dependency "thor"
25
+ spec.add_dependency "thor", "~> 0.19"
26
26
  end
@@ -2,15 +2,43 @@ require "spec_helper"
2
2
 
3
3
  describe Proteus do
4
4
  before do
5
+ remove_dummy_repo
5
6
  @proteus = Proteus::Kit.new
7
+ @repos = Proteus::REPOS
6
8
  end
7
9
 
8
- it "completes the url" do
9
- url = @proteus.url("test")
10
- expect(url).to eq("git@github.com:thoughtbot/proteus-test.git")
10
+ it "has a list of repos" do
11
+ expect(@repos).not_to be_nil
11
12
  end
12
13
 
13
- it "returns a friendly message if the repo doesn't exist" do
14
- expect(@proteus.new('invalid')).to eq("A thoughtbot repo doesn't exist with that name")
14
+ it "gets repos in the list" do
15
+ expect(@repos.size).to be > 0
16
+ end
17
+
18
+ it "gets the kit name" do
19
+ expect(@proteus.name("jekyll")).to eq("Jekyll Starter")
20
+ end
21
+
22
+ it "gets the Git url" do
23
+ url = "https://github.com/thoughtbot/proteus-middleman.git"
24
+ expect(@proteus.url("middleman")).to eq(url)
25
+ end
26
+
27
+ it "displays a list of repos" do
28
+ expect { @proteus.list }.to output().to_stdout
29
+ end
30
+
31
+ it "displays a friendly message if the kit isn't in the list" do
32
+ message = "Kit not found. Run `proteus list` to see available kits.\n"
33
+ expect { @proteus.new("invalid") }.to output(message).to_stdout
34
+ end
35
+
36
+ it "displays the current version" do
37
+ version = Proteus::VERSION
38
+ expect { @proteus.version }.to output("Proteus #{version}\n").to_stdout
39
+ end
40
+
41
+ def remove_dummy_repo
42
+ FileUtils.rm_rf(Dir["./spec/dummy"])
15
43
  end
16
44
  end
@@ -1,3 +1,25 @@
1
1
  $LOAD_PATH << File.join('../lib')
2
2
 
3
3
  require 'proteus'
4
+
5
+ def quietly
6
+ streams = STDOUT, STDERR
7
+ on_hold = streams.collect { |stream| stream.dup }
8
+ streams.each do |stream|
9
+ stream.reopen(null_stream)
10
+ stream.sync = true
11
+ end
12
+ yield
13
+ ensure
14
+ streams.each_with_index do |stream, i|
15
+ stream.reopen(on_hold[i])
16
+ end
17
+ end
18
+
19
+ def null_stream
20
+ if RUBY_PLATFORM =~ /mswin/
21
+ 'NUL:'
22
+ else
23
+ '/dev/null'
24
+ end
25
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proteus-kits
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: '0.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Ogle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-19 00:00:00.000000000 Z
11
+ date: 2016-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.6'
47
+ version: '3.3'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.6'
54
+ version: '3.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: thor
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '0.19'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '0.19'
69
69
  description: A collection of useful starter kits to help you prototype faster
70
70
  email:
71
71
  - support@thoughtbot.com
@@ -83,6 +83,7 @@ files:
83
83
  - bin/proteus
84
84
  - lib/proteus.rb
85
85
  - lib/proteus/kit.rb
86
+ - lib/proteus/repos.rb
86
87
  - lib/proteus/version.rb
87
88
  - proteus-kits.gemspec
88
89
  - spec/proteus_spec.rb
@@ -107,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
108
  version: '0'
108
109
  requirements: []
109
110
  rubyforge_project:
110
- rubygems_version: 2.4.6
111
+ rubygems_version: 2.4.5.1
111
112
  signing_key:
112
113
  specification_version: 4
113
114
  summary: Starter kits to help you prototype faster