postit 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ec42cfc1fa83e620a1f9fbf41012b812eb9a7db0
4
+ data.tar.gz: fcdd82e24cd356a8c2460f3dfe43cd629275ff04
5
+ SHA512:
6
+ metadata.gz: 6f8bb7e27884344886c91c6f7eda49d85c3f216d2ff816cc02d97241dc40688dba8c4f2d4aa79cd231e30163df242d53c86357228b511078aed0691fc3ac5d09
7
+ data.tar.gz: 4144eea95201a5fe911ee23362bb505c27bb79e10eb22261e963a10ad06ae9a1712cc6629b5a7182528447ed7fa746ffab8ff45115b59a686335cc548847f6b8
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
@@ -0,0 +1,2 @@
1
+ inherit_from:
2
+ - .rubocop_cocoapods.yml
@@ -0,0 +1,116 @@
1
+ AllCops:
2
+ Include:
3
+ - ./Rakefile
4
+ - ./Gemfile
5
+ - ./*.gemspec
6
+ Exclude:
7
+ - ./spec/fixtures/**/*
8
+
9
+ # At the moment not ready to be used
10
+ # https://github.com/bbatsov/rubocop/issues/947
11
+ Documentation:
12
+ Enabled: false
13
+
14
+ #- CocoaPods -----------------------------------------------------------------#
15
+
16
+ # We adopted raise instead of fail.
17
+ SignalException:
18
+ EnforcedStyle: only_raise
19
+
20
+ # They are idiomatic
21
+ AssignmentInCondition:
22
+ Enabled: false
23
+
24
+ # Allow backticks
25
+ AsciiComments:
26
+ Enabled: false
27
+
28
+ # Indentation clarifies logic branches in implementations
29
+ IfUnlessModifier:
30
+ Enabled: false
31
+
32
+ # No enforced convention here.
33
+ SingleLineBlockParams:
34
+ Enabled: false
35
+
36
+ # We only add the comment when needed.
37
+ Encoding:
38
+ Enabled: false
39
+
40
+ # Having these make it easier to *not* forget to add one when adding a new
41
+ # value and you can simply copy the previous line.
42
+ TrailingComma:
43
+ EnforcedStyleForMultiline: comma
44
+
45
+ Style/MultilineOperationIndentation:
46
+ EnforcedStyle: indented
47
+
48
+ # Clashes with CLAide Command#validate!
49
+ GuardClause:
50
+ Enabled: false
51
+
52
+ # Not always desirable: lib/claide/command/plugins_helper.rb:12:15
53
+ Next:
54
+ Enabled: false
55
+
56
+ # Arbitrary max lengths for classes simply do not work and enabling this will
57
+ # lead to a never ending stream of annoyance and changes.
58
+ Metrics/ClassLength:
59
+ Enabled: false
60
+
61
+ # Arbitrary max lengths for methods simply do not work and enabling this will
62
+ # lead to a never ending stream of annoyance and changes.
63
+ Metrics/MethodLength:
64
+ Enabled: false
65
+
66
+ # No enforced convention here.
67
+ Metrics/BlockNesting:
68
+ Enabled: false
69
+
70
+ # It will be obvious which code is complex, Rubocop should only lint simple
71
+ # rules for us.
72
+ Metrics/AbcSize:
73
+ Enabled: false
74
+
75
+ # It will be obvious which code is complex, Rubocop should only lint simple
76
+ # rules for us.
77
+ Metrics/CyclomaticComplexity:
78
+ Enabled: false
79
+
80
+ #- CocoaPods support for Ruby 1.8.7 ------------------------------------------#
81
+
82
+ HashSyntax:
83
+ EnforcedStyle: hash_rockets
84
+
85
+ Lambda:
86
+ Enabled: false
87
+
88
+ DotPosition:
89
+ EnforcedStyle: trailing
90
+
91
+ EachWithObject:
92
+ Enabled: false
93
+
94
+ Style/SpecialGlobalVars:
95
+ Enabled: false
96
+
97
+ #- CocoaPods specs -----------------------------------------------------------#
98
+
99
+ # Allow for `should.match /regexp/`.
100
+ AmbiguousRegexpLiteral:
101
+ Exclude:
102
+ - spec/**/*
103
+
104
+ # Allow `object.should == object` syntax.
105
+ Void:
106
+ Exclude:
107
+ - spec/**/*
108
+
109
+ ClassAndModuleChildren:
110
+ Exclude:
111
+ - spec/**/*
112
+
113
+ UselessComparison:
114
+ Exclude:
115
+ - spec/**/*
116
+
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ before_install: ./bin/setup
5
+ script: rake ci
@@ -0,0 +1,2 @@
1
+ # PostIt
2
+ ## The Bundler Version Manager
@@ -0,0 +1,42 @@
1
+ require 'rubygems'
2
+ GEMSPEC = Gem::Specification.load('postit.gemspec')
3
+
4
+ desc "Installs all development dependencies"
5
+ task :bootstrap do
6
+ GEMSPEC.development_dependencies.each do |dep|
7
+ sh 'gem', 'install', dep.name, '-v', dep.requirement.to_s
8
+ end
9
+ end
10
+
11
+ begin
12
+ GEMSPEC.development_dependencies.each do |dep|
13
+ gem dep.name, dep.requirement.to_s
14
+ end
15
+
16
+ require 'bundler/gem_tasks'
17
+ require 'tmpdir'
18
+
19
+ desc 'Run the specs'
20
+ task :spec do
21
+ puts 'Running specs...'
22
+ files = FileList['spec/**/*_spec.sh'].shuffle.map { |s| File.expand_path(s) }
23
+ files.each do |spec|
24
+ Dir.mktmpdir do |dir|
25
+ Dir.chdir(dir) do
26
+ rubyopt = "RUBYOPT='-I#{File.expand_path('../lib', __FILE__)}'"
27
+ path = %(PATH="#{File.expand_path('../exe', __FILE__)}:$PATH")
28
+ sh "#{rubyopt} #{path} sh '#{spec}'", verbose: false
29
+ end
30
+ end
31
+ end
32
+ puts "\n\n"
33
+ end
34
+
35
+ require 'rubocop/rake_task'
36
+ RuboCop::RakeTask.new
37
+
38
+ task :ci => [:spec, :rubocop]
39
+
40
+ rescue LoadError, NameError
41
+ warn "Please run rake bootstrap"
42
+ end
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'postit'
4
+
5
+ require 'irb'
6
+ IRB.start
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env sh
2
+
3
+ gem install bundler -v '< 1.10'
4
+ gem install bundler -v 1.10.2
5
+ gem install bundler -v 1.10.3
6
+
7
+ rake bootstrap
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'postit'
4
+ PostIt.setup
5
+ load Gem.bin_path('bundler', 'bundle', PostIt.bundler_version)
@@ -0,0 +1,14 @@
1
+ require 'postit/version'
2
+ require 'postit/environment'
3
+ require 'postit/parser'
4
+ require 'rubygems'
5
+
6
+ module PostIt
7
+ def self.setup
8
+ load File.expand_path('../postit/setup.rb', __FILE__)
9
+ end
10
+
11
+ def self.bundler_version
12
+ defined?(Bundler::VERSION) && Bundler::VERSION
13
+ end
14
+ end
@@ -0,0 +1,44 @@
1
+ require 'postit/parser'
2
+
3
+ module PostIt
4
+ class Environment
5
+ def initialize(argv)
6
+ @argv = argv
7
+ end
8
+
9
+ def env_var_version
10
+ ENV['BUNDLER_VERSION']
11
+ end
12
+
13
+ def cli_arg_version
14
+ return unless str = @argv.first
15
+ str = str.dup.force_encoding('BINARY') if str.respond_to?(:force_encoding)
16
+ if Gem::Version.correct?(str)
17
+ @argv.shift
18
+ str
19
+ end
20
+ end
21
+
22
+ def gemfile
23
+ ENV['BUNDLE_GEMFILE'] || 'Gemfile'
24
+ end
25
+
26
+ def lockfile
27
+ File.expand_path case File.basename(gemfile)
28
+ when 'gems.rb' then gemfile.sub(/\.rb$/, gemfile)
29
+ else "#{gemfile}.lock"
30
+ end
31
+ end
32
+
33
+ def lockfile_version
34
+ PostIt::Parser.new(lockfile).parse
35
+ end
36
+
37
+ def bundler_version
38
+ @bundler_version ||= begin
39
+ env_var_version || cli_arg_version ||
40
+ lockfile_version || Gem::Requirement.default
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,20 @@
1
+ module PostIt
2
+ class Parser
3
+ def initialize(file)
4
+ @file = file
5
+ end
6
+
7
+ BUNDLED_WITH =
8
+ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
9
+
10
+ def parse
11
+ lockfile = File.read(@file) if File.file?(@file)
12
+ return unless lockfile
13
+ if lockfile =~ BUNDLED_WITH
14
+ Regexp.last_match(1)
15
+ else
16
+ '< 1.10'
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,16 @@
1
+ require 'postit/environment'
2
+
3
+ environment = PostIt::Environment.new(ARGV)
4
+ version = environment.bundler_version
5
+
6
+ loop do
7
+ begin
8
+ gem 'bundler', version
9
+ break
10
+ rescue Gem::LoadError
11
+ nil
12
+ end
13
+ Gem.install('bundler', version)
14
+ end
15
+
16
+ require 'bundler/version'
@@ -0,0 +1,3 @@
1
+ module PostIt
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'postit/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'postit'
8
+ spec.version = PostIt::VERSION
9
+ spec.authors = ['Samuel Giddins']
10
+ spec.email = ['segiddins@segiddins.me']
11
+
12
+ spec.summary = 'The Bundler version manager'
13
+ spec.homepage = 'https://github.com/segiddins/postit'
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ .reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = 'exe'
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.10'
22
+ spec.add_development_dependency 'rake', '~> 10.0'
23
+ spec.add_development_dependency 'rubocop', '0.31'
24
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: postit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Samuel Giddins
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-06-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: '0.31'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: '0.31'
55
+ description:
56
+ email:
57
+ - segiddins@segiddins.me
58
+ executables:
59
+ - postit
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - ".rubocop.yml"
65
+ - ".rubocop_cocoapods.yml"
66
+ - ".travis.yml"
67
+ - README.md
68
+ - Rakefile
69
+ - bin/console
70
+ - bin/setup
71
+ - exe/postit
72
+ - lib/postit.rb
73
+ - lib/postit/environment.rb
74
+ - lib/postit/parser.rb
75
+ - lib/postit/setup.rb
76
+ - lib/postit/version.rb
77
+ - postit.gemspec
78
+ homepage: https://github.com/segiddins/postit
79
+ licenses: []
80
+ metadata: {}
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubyforge_project:
97
+ rubygems_version: 2.4.7
98
+ signing_key:
99
+ specification_version: 4
100
+ summary: The Bundler version manager
101
+ test_files: []
102
+ has_rdoc: