fedux_org-stdlib 0.10.9 → 0.11.0

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: c44cab08056c229bf8535d4994846ca07d7a0362
4
- data.tar.gz: ab0ec728021b15f9618ab70d536626699e0fe75e
3
+ metadata.gz: 31db18c4ed616bb7c477b7669fb4a884a5951ad9
4
+ data.tar.gz: a6e28c08271d0c328e5465dccc9035fc779e5ad6
5
5
  SHA512:
6
- metadata.gz: c4af40e686018d96dae9d10b4bb05a3d83faed1a69246d517c06a82d752977b363fb8b191221bb2540f03d5a3defbf881cc9875853425034e5f1ae1b718199af
7
- data.tar.gz: b6a748aa6768e39770996a2f1843add05cab929a48f0f4db2628df1c22bbaeefdef5d8bb6bdcfb27a9ae34bd6591e09a46003187d39574602cb878615781530c
6
+ metadata.gz: 0776e830115fd6e002abd29ebe3f4a545481a50d9bb938459062c040d9359c640ac6e2c5bc63c872b6d5d1fec5834c88b2ef0845e1553e946889214c302a88c6
7
+ data.tar.gz: 1317c081ebb2d9efccfa74d4ac2bb4a9a458ed46f50e9189eaeb6d043d786ef04fbbd20885fdd319f9dc30539dc98aee667edf62b0858721e1467930e76863fa
data/Gemfile CHANGED
@@ -42,6 +42,9 @@ group :development, :test do
42
42
  gem 'facter'
43
43
  gem 'hirb'
44
44
  # gem 'tty'
45
+ #
46
+ gem 'rugged'
47
+ gem 'addressable'
45
48
 
46
49
  gem 'fedux_org_stdlib-fixtures-plugin_manager-load', require: false, path: File.expand_path('../fixtures/plugin-load-app', __FILE__)
47
50
  # gem 'fedux_org_stdlib-fixtures-plugin_manager-no_load', require: false, path: File.expand_path('../fixtures/plugin-no_load-app', __FILE__)
@@ -126,6 +126,7 @@ GEM
126
126
  rainbow (>= 1.99.1, < 3.0)
127
127
  ruby-progressbar (~> 1.4)
128
128
  ruby-progressbar (1.7.0)
129
+ rugged (0.21.2)
129
130
  simplecov (0.9.1)
130
131
  docile (~> 1.1.0)
131
132
  multi_json (~> 1.0)
@@ -156,6 +157,7 @@ PLATFORMS
156
157
  ruby
157
158
 
158
159
  DEPENDENCIES
160
+ addressable
159
161
  aruba (>= 0.6.1)
160
162
  awesome_print
161
163
  bundler (>= 1.3)
@@ -180,6 +182,7 @@ DEPENDENCIES
180
182
  rspec
181
183
  rspec-legacy_formatters
182
184
  rubocop
185
+ rugged
183
186
  simplecov
184
187
  taskjuggler
185
188
  tmrb
@@ -1,8 +1,9 @@
1
+ # encoding: utf-8
2
+ require 'fedux_org_stdlib/require_files'
1
3
  require 'fedux_org_stdlib/shell_language_detector'
2
4
  require 'fedux_org_stdlib/logging/logger'
3
5
  require_library %w(i18n)
4
6
 
5
- # encoding: utf-8
6
7
  module FeduxOrgStdlib
7
8
  # Configuration for language on cli
8
9
  #
@@ -0,0 +1,81 @@
1
+ # encoding: utf-8
2
+ require 'fedux_org_stdlib/require_files'
3
+ require 'fedux_org_stdlib/rake/task'
4
+ require_library %w(i18n)
5
+ require 'tmpdir'
6
+ require 'fileutils'
7
+ require 'digest/sha2'
8
+
9
+ module FeduxOrgStdlib
10
+ module Rake
11
+ # Webserver Task
12
+ #
13
+ # @see Rakefile
14
+ class WebserverTask < Task
15
+ # @!attribute [r] report
16
+ # The report to be generated
17
+ attr_reader :repository, :build_directory, :directory
18
+
19
+ # Create a new webserver task
20
+ #
21
+ # @param [String] directory
22
+ # The directory where the generated server should be stored
23
+ # @param [String] repository_url
24
+ # The url which should be used to fetch the remote repository
25
+ # @param [Array] build_directory (/tmp/webserver.xxx)
26
+ # The directory where the executables should be build
27
+ # @param [Array] build_script (build.sh)
28
+ # The script which should be used to build the executables
29
+ #
30
+ # @example Create new task
31
+ # FeduxOrgStdlib::Rake::WebserverTask.new
32
+ def initialize(
33
+ directory: File.expand_path('utils/server'),
34
+ repository_url: 'https://github.com/dg-ratiodata/local_webserver',
35
+ build_directory: Dir.mktmpdir('webserver'),
36
+ build_script: 'build.sh',
37
+ **args
38
+ )
39
+ super(**args)
40
+
41
+ @repository = FeduxOrgStdlib::RemoteRepository.new(repository_url)
42
+ @directory = File.expand_path(directory)
43
+ @build_directory = File.expand_path(build_directory)
44
+ @build_script = build_script
45
+ end
46
+
47
+ # @private
48
+ def run_task(_verbose)
49
+ create_build_directory
50
+ fetch_repository
51
+ build_server
52
+ copy_files_to_destination_directory
53
+ end
54
+
55
+ private
56
+
57
+ def create_build_directory
58
+ FileUtils.mkdir_p build_directory
59
+ end
60
+
61
+ def fetch_repository
62
+ repository.clone_to build_directory
63
+ end
64
+
65
+ def build_server
66
+ Dir.chdir build_directory do
67
+ system File.join('.', build_script)
68
+ end
69
+ end
70
+
71
+ def copy_files_to_destination_directory
72
+ FileUtils.mkdir_p directory
73
+ FileUtils.cp new_executable_files, directory
74
+ end
75
+
76
+ def new_executable_files
77
+ Dir.glob(File.join(build_directory, '**', '*')).select { |f| File.executable? f }
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+ require 'fedux_org_stdlib/require_files'
3
+ require_library %w(rugged addressable/uri)
4
+
5
+ module FeduxOrgStdlib
6
+ class RemoteRepository
7
+ private
8
+
9
+ attr_reader :url
10
+
11
+ public
12
+
13
+ def initialize(url)
14
+ @url = Addressable::URI.heuristic_parse(url)
15
+ end
16
+
17
+ def clone_to(directory)
18
+ Rugged::Repository.clone_at(url.to_s, directory)
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # FeduxOrgStdlib
3
3
  module FeduxOrgStdlib
4
- VERSION = '0.10.9'
4
+ VERSION = '0.11.0'
5
5
  end
@@ -12,7 +12,7 @@ RSpec.describe String do
12
12
  end
13
13
 
14
14
  it 'removes special characters "§$%&/()=?!\t' do
15
- expect(%('°^!"§$%&/()=?!\t
15
+ expect(%('°^!"§$%&/()=?!\t).characterize).to eq ''
16
16
  end
17
17
  end
18
18
  end
@@ -0,0 +1,35 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+ require 'fedux_org_stdlib/remote_repository'
5
+
6
+ RSpec.describe FeduxOrgStdlib::RemoteRepository do
7
+ before :each do
8
+ in_current_dir do
9
+ repo = Rugged::Repository.init_at('remote_repo')
10
+
11
+ oid = repo.write("This is a blob.", :blob)
12
+ index = repo.index
13
+ index.add(:path => "README.md", :oid => oid, :mode => 0100644)
14
+
15
+ options = {}
16
+ options[:tree] = index.write_tree(repo)
17
+
18
+ options[:author] = { :email => "testuser@github.com", :name => 'Test Author', :time => Time.now }
19
+ options[:committer] = { :email => "testuser@github.com", :name => 'Test Author', :time => Time.now }
20
+ options[:message] ||= "Making a commit via Rugged!"
21
+ options[:parents] = repo.empty? ? [] : [ repo.head.target ].compact
22
+ options[:update_ref] = 'HEAD'
23
+
24
+ Rugged::Commit.create(repo, options)
25
+ end
26
+ end
27
+
28
+ context '#clone_to' do
29
+ it 'clones remote repository' do
30
+ repository = FeduxOrgStdlib::RemoteRepository.new("file://#{absolute_path('remote_repo')}")
31
+ repository.clone_to absolute_path('dir')
32
+ expect(Pathname.new(absolute_path('dir'))).to be_exist
33
+ end
34
+ end
35
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fedux_org-stdlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.9
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Meyer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-14 00:00:00.000000000 Z
11
+ date: 2014-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -125,6 +125,7 @@ files:
125
125
  - lib/fedux_org_stdlib/rake/sub_task.rb
126
126
  - lib/fedux_org_stdlib/rake/task.rb
127
127
  - lib/fedux_org_stdlib/rake/version_bump_task.rb
128
+ - lib/fedux_org_stdlib/rake/webserver_task.rb
128
129
  - lib/fedux_org_stdlib/rake_tasks.rb
129
130
  - lib/fedux_org_stdlib/rake_tasks/console.rb
130
131
  - lib/fedux_org_stdlib/rake_tasks/documentation.rb
@@ -151,6 +152,7 @@ files:
151
152
  - lib/fedux_org_stdlib/rake_tasks/tests/rspec.rb
152
153
  - lib/fedux_org_stdlib/rake_tasks/tests/travis.rb
153
154
  - lib/fedux_org_stdlib/recursive_file_finder.rb
155
+ - lib/fedux_org_stdlib/remote_repository.rb
154
156
  - lib/fedux_org_stdlib/require_files.rb
155
157
  - lib/fedux_org_stdlib/roles/comparable_by_name.rb
156
158
  - lib/fedux_org_stdlib/roles/typable.rb
@@ -216,6 +218,7 @@ files:
216
218
  - spec/project/report_spec.rb
217
219
  - spec/project/taskjuggler_spec.rb
218
220
  - spec/recursive_file_finder_spec.rb
221
+ - spec/remote_repository_spec.rb
219
222
  - spec/roles/typable_spec.rb
220
223
  - spec/shell_language_detector_spec.rb
221
224
  - spec/spec_helper.rb
@@ -253,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
253
256
  version: '0'
254
257
  requirements: []
255
258
  rubyforge_project:
256
- rubygems_version: 2.2.2
259
+ rubygems_version: 2.4.1
257
260
  signing_key:
258
261
  specification_version: 4
259
262
  summary: Collection of useful libraries. It maybe depend on external libraries.
@@ -302,6 +305,7 @@ test_files:
302
305
  - spec/project/report_spec.rb
303
306
  - spec/project/taskjuggler_spec.rb
304
307
  - spec/recursive_file_finder_spec.rb
308
+ - spec/remote_repository_spec.rb
305
309
  - spec/roles/typable_spec.rb
306
310
  - spec/shell_language_detector_spec.rb
307
311
  - spec/spec_helper.rb