bundlegem 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3dfd1e6343877a7582beb24298138a62f6180671
4
- data.tar.gz: 22d2ad48252af45d5a98708e94d29a40fb56f0dd
3
+ metadata.gz: 4e5e797b5856b222d593bf5b5e8916bd616f66f1
4
+ data.tar.gz: 5839b9e9cd73a5252259e22b8049a8de2ba296b9
5
5
  SHA512:
6
- metadata.gz: cc5bb9ad05e1623e699ecf2d868f5cd48d60b31e9b03691b29f22150e416eeec3daad99a3259f99d46afaf3d0b107a3bb7622866326d356776a3f69d4ef8b2f9
7
- data.tar.gz: b21541941978bf508bb0e399d722778f8ce0b90c6d0758a5b8d14ed5855bf4d820dd8c82a21a138b3fe7ee77558cdc86650e99ee583b17bccb66fd043b9cf114
6
+ metadata.gz: f1ce5dc9007921c797c56d8717d1c4a97feb68ea56d420dfdd97cb09f598278945a61ed36fba122ab2fb62e722610d1a5c54d9ffb25c5d8bf05b1cc697702808
7
+ data.tar.gz: d36b8764acd21cb34d9e5b2db1b6c690eeb75b33ed9383eea394577d07ac133d7eeec07c79b614e9a0b45c9763413e35b8f730a26b5f0a3a6040fa76adf4ad6d
data/bin/bundlegem CHANGED
@@ -30,7 +30,7 @@ if ARGV[0] == "--newtemplate"
30
30
  end
31
31
 
32
32
  if ARGV[0] == "--install-best-templates"
33
- puts Bundlegem.install_best_templates
33
+ Bundlegem.install_best_templates
34
34
  exit 0
35
35
  end
36
36
 
data/lib/bundlegem.rb CHANGED
@@ -32,6 +32,24 @@ module Bundlegem
32
32
  mark_default_template(output_string, configurator.default_template)
33
33
  end
34
34
 
35
+ def install_best_templates
36
+ configurator = Configurator.new
37
+ config_file_data = configurator.config_file_data
38
+ puts "Downloading templates from the following locations: \n #{config_file_data['best_templates'].split(" ").join("\n ")}"
39
+ config_file_data['best_templates'].split.each do |url|
40
+ uri = URI.parse(url)
41
+ template_folder_name = File.basename(uri.path).sub(/\.git$/, "")
42
+ if !File.exists?("#{ENV['HOME']}/.bundlegem/templates/#{template_folder_name}")
43
+ cmd = "cd #{ENV['HOME']}/.bundlegem/templates && git clone #{url}"
44
+ cmd += " 2> /dev/null" if $test_env
45
+ `#{cmd}`
46
+ else
47
+ # TODO:
48
+ # Prompt to update the repo if they have a clean working state.
49
+ end
50
+ end
51
+ end
52
+
35
53
  def gem(options, gem_name)
36
54
  require 'bundlegem/cli'
37
55
  require 'bundlegem/cli/gem'
@@ -112,22 +130,6 @@ module Bundlegem
112
130
  end
113
131
  end
114
132
 
115
- def install_best_templates
116
- puts "Downloading templates from the following locations: #{ENV['best_templates']}"
117
- ENV['best_templates'].split.each do |url|
118
- uri = URI.parse(url)
119
- template_folder_name = File.basename(uri.path).sub(/\.git$/, "")
120
- if !File.exists?(template_folder_name)
121
- cmd = "cd #{ENV['HOME']}/.bundlegem/templates && git clone #{url}"
122
- cmd += " 2> /dev/null" if $test_env
123
- `#{cmd}`
124
- else
125
- # TODO:
126
- # Prompt to update the repo if they have a clean working state.
127
- end
128
- end
129
- end
130
-
131
133
  end
132
134
 
133
135
  end
@@ -1,5 +1,4 @@
1
1
  require 'pathname'
2
- require 'pry'
3
2
 
4
3
  module Bundlegem
5
4
  class CLI::Gem
@@ -4,7 +4,7 @@ require 'yaml'
4
4
  module Bundlegem
5
5
 
6
6
  class Configurator
7
- attr_accessor :user_defined_templates, :user_downloaded_templates
7
+ attr_accessor :user_defined_templates, :user_downloaded_templates, :config_file_data
8
8
 
9
9
  def initialize
10
10
  @config_directory_root = "#{ENV['HOME']}/.bundlegem"
@@ -17,16 +17,16 @@ module Bundlegem
17
17
  @user_downloaded_templates = get_user_downloaded_templates
18
18
 
19
19
  # load configurations from config file
20
- @c = YAML.load_file @config_file
20
+ @config_file_data = YAML.load_file @config_file
21
21
  end
22
22
 
23
23
  def default_template
24
- @c["default_template"]
24
+ @config_file_data["default_template"]
25
25
  end
26
26
 
27
27
  def default_template=(val)
28
- @c["default_template"] = val
29
- File.write(@config_file, "# Comments made to this file will not be preserved\n#{YAML.dump(@c)}")
28
+ @config_file_data["default_template"] = val
29
+ File.write(@config_file, "# Comments made to this file will not be preserved\n#{YAML.dump(@config_file_data)}")
30
30
  end
31
31
 
32
32
  def built_in_templates
@@ -1,3 +1,3 @@
1
1
  module Bundlegem
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -32,7 +32,7 @@ describe Bundlegem do
32
32
  expect(list_output.include?(category)).to be true
33
33
  end
34
34
 
35
- # what template is it being generated from? Default?
35
+ # This bulids the default gem template
36
36
  it "can generate the default built-in gem fine" do
37
37
  options = {"bin"=>false, "ext"=>false, :coc=> false}
38
38
  gem_name = "tmp_gem"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundlegem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - TheNotary
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-12 00:00:00.000000000 Z
11
+ date: 2016-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor