repo_tools 0.1.1 → 0.2.0

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: 64330d242c6930e6be67f32dd04dd60c3655f2d8
4
- data.tar.gz: 6f82f5abb8fafc29f838829597fa75f3d47a6c60
3
+ metadata.gz: d6216a245d5b171c079ced2f72c1405f097db730
4
+ data.tar.gz: fc84db3fbcc912c5d1556b48ce3994162ed95e29
5
5
  SHA512:
6
- metadata.gz: 250ee26d39dc5846642e84de8bd27fb4b405eeb9e16b75dad566e4d94fcc7e1ad6d4b1eeabe7e177c78be3b6b958252f8c8e7604d9410c8578cb498551c4717b
7
- data.tar.gz: 2fc81629bd992e2a94825d56b8657bcfcf13704d9cecf3a81d0220dc61e41cb11c8e01b8c05ae3664bdaacfe6a7aad65ca6ca536e02ca3953828dabe0b787b6f
6
+ metadata.gz: 0eb961b9ed642e8d7edeaffedd750f3846d81f19b6880e49e97bac03b9355ca4012f184bc2f04d242cd95d38b231a271eab1b3f207e8f0d18ae865ff6a3e5422
7
+ data.tar.gz: 0471af6f680bb482c174b73a99a3310c9429d395b3264f6d14be97ea6fbd52e0c5066ede8605b1da83b74022db2ab1c1b559e1347c5a10e124bd4b0f8d04d0e7
@@ -1,18 +1,16 @@
1
1
  module RepoTools; class Puller
2
2
 
3
- attr_reader :ssh_clone_url, :project_root, :environment
3
+ attr_reader :ssh_clone_url
4
4
 
5
- def initialize(ssh_clone_url, project_root, environment)
6
- @ssh_clone_url = ssh_clone_url
7
- @project_root = project_root
8
- @environment = environment
5
+ def initialize(args)
6
+ @ssh_clone_url = args.fetch(:ssh_clone_url)
7
+ @destination_dirname = args.fetch(:destination_dirname)
9
8
  end
10
9
 
11
10
  def clean_and_clone
12
11
  return if git_status_checker.up_to_date?
13
12
  FileUtils.rm_rf destination_dirname
14
13
  clone
15
- log_clone
16
14
  end
17
15
 
18
16
  def git_status_checker
@@ -23,14 +21,8 @@ module RepoTools; class Puller
23
21
  `git clone #{ssh_clone_url} #{destination_dirname}`
24
22
  end
25
23
 
26
- def log_clone
27
- File.open(log, 'a') do |f|
28
- f.puts "[#{Time.now.utc.iso8601}]: #{project_name} was cloned"
29
- end
30
- end
31
-
32
24
  def destination_dirname
33
- p = Pathname.new(project_root).join('tmp', environment, project_name)
25
+ p = Pathname.new(@destination_dirname)
34
26
  FileUtils.mkdir_p(p.dirname)
35
27
  p
36
28
  end
@@ -39,12 +31,5 @@ module RepoTools; class Puller
39
31
  ssh_clone_url.match(/\/((\w|\-)+)/)[1]
40
32
  end
41
33
 
42
- def log
43
- p = Pathname.new(project_root).join('log', environment).join("#{project_name}.log")
44
- FileUtils.mkdir_p(p.dirname)
45
- FileUtils.touch(p)
46
- p
47
- end
48
-
49
34
  end; end
50
35
 
@@ -1,3 +1,3 @@
1
1
  module RepoTools
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/tasks/test.rake CHANGED
@@ -1,6 +1,10 @@
1
- desc 'test whether repotools is working'
1
+ desc 'clone a git repo locally to make sure repo_tools is working'
2
2
  task :puller_test do
3
3
  root = Dir.pwd
4
- puller = RepoTools::Puller.new("git@github.com:MrPowers/frontend-generators.git", root, "test")
4
+ args = {
5
+ ssh_clone_url: "git@github.com:MrPowers/frontend-generators.git",
6
+ destination_dirname: "#{root}/test/"
7
+ }
8
+ puller = RepoTools::Puller.new(args)
5
9
  puller.clean_and_clone
6
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: repo_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MrPowers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-23 00:00:00.000000000 Z
11
+ date: 2015-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler